From b9878c184bb342bc30cbd2f2805756bcc282459c Mon Sep 17 00:00:00 2001 From: nonameShijian <2954700422@qq.com> Date: Sat, 6 Apr 2024 16:13:46 +0800 Subject: [PATCH] =?UTF-8?q?setBackgroundImage=E6=94=AF=E6=8C=81=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E4=BC=A0=E5=85=A5=EF=BC=8C=E4=BF=AE=E5=A4=8D=E9=83=A8?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=9E=8B=E6=8F=90=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node_modules/@types/codemirror/LICENSE | 21 + node_modules/@types/codemirror/README.md | 15 + .../codemirror/addon/comment/comment.d.ts | 37 + .../addon/comment/continuecomment.d.ts | 12 + .../codemirror/addon/dialog/dialog.d.ts | 43 + .../codemirror/addon/display/autorefresh.d.ts | 9 + .../codemirror/addon/display/fullscreen.d.ts | 13 + .../codemirror/addon/display/panel.d.ts | 41 + .../codemirror/addon/display/placeholder.d.ts | 11 + .../codemirror/addon/display/rulers.d.ts | 16 + .../codemirror/addon/edit/closebrackets.d.ts | 40 + .../codemirror/addon/edit/closetag.d.ts | 44 + .../codemirror/addon/edit/continuelist.d.ts | 7 + .../codemirror/addon/edit/matchbrackets.d.ts | 35 + .../codemirror/addon/edit/matchtags.d.ts | 25 + .../codemirror/addon/edit/trailingspace.d.ts | 8 + .../codemirror/addon/fold/brace-fold.d.ts | 9 + .../codemirror/addon/fold/comment-fold.d.ts | 7 + .../codemirror/addon/fold/foldcode.d.ts | 77 + .../codemirror/addon/fold/foldgutter.d.ts | 40 + .../codemirror/addon/fold/indent-fold.d.ts | 7 + .../codemirror/addon/fold/markdown-fold.d.ts | 7 + .../codemirror/addon/fold/xml-fold.d.ts | 31 + .../codemirror/addon/hint/anyword-hint.d.ts | 12 + .../codemirror/addon/hint/css-hint.d.ts | 7 + .../codemirror/addon/hint/html-hint.d.ts | 9 + .../addon/hint/javascript-hint.d.ts | 8 + .../codemirror/addon/hint/show-hint.d.ts | 121 + .../codemirror/addon/hint/sql-hint.d.ts | 20 + .../codemirror/addon/hint/xml-hint.d.ts | 13 + .../addon/lint/coffeescript-lint.d.ts | 7 + .../codemirror/addon/lint/css-lint.d.ts | 7 + .../codemirror/addon/lint/html-lint.d.ts | 7 + .../addon/lint/javascript-lint.d.ts | 7 + .../codemirror/addon/lint/json-lint.d.ts | 7 + .../@types/codemirror/addon/lint/lint.d.ts | 96 + .../codemirror/addon/lint/yaml-lint.d.ts | 7 + .../@types/codemirror/addon/merge/merge.d.ts | 137 + .../codemirror/addon/mode/loadMode.d.ts | 14 + .../codemirror/addon/mode/multiplex.d.ts | 29 + .../@types/codemirror/addon/mode/overlay.d.ts | 9 + .../@types/codemirror/addon/mode/simple.d.ts | 27 + .../codemirror/addon/runmode/colorize.d.ts | 12 + .../codemirror/addon/runmode/runmode.d.ts | 23 + .../addon/scroll/annotatescrollbar.d.ts | 26 + .../addon/scroll/scrollpastend.d.ts | 10 + .../addon/scroll/simplescrollbars.d.ts | 8 + .../codemirror/addon/search/jump-to-line.d.ts | 14 + .../addon/search/match-highlighter.d.ts | 50 + .../addon/search/matchesonscrollbar.d.ts | 12 + .../codemirror/addon/search/search.d.ts | 23 + .../codemirror/addon/search/searchcursor.d.ts | 53 + .../addon/selection/active-line.d.ts | 18 + .../addon/selection/mark-selection.d.ts | 11 + .../addon/selection/selection-pointer.d.ts | 11 + .../@types/codemirror/addon/tern/tern.d.ts | 105 + .../codemirror/addon/wrap/hardwrap.d.ts | 25 + node_modules/@types/codemirror/index.d.ts | 2062 ++ node_modules/@types/codemirror/mode/meta.d.ts | 19 + node_modules/@types/codemirror/package.json | 77 + node_modules/@types/estree/LICENSE | 21 + node_modules/@types/estree/README.md | 15 + node_modules/@types/estree/flow.d.ts | 167 + node_modules/@types/estree/index.d.ts | 683 + node_modules/@types/estree/package.json | 26 + node_modules/@types/jszip/LICENSE | 21 + node_modules/@types/jszip/README.md | 16 + node_modules/@types/jszip/index.d.ts | 232 + node_modules/@types/jszip/package.json | 22 + .../.github/workflows/release-package.yml | 20 + .../@types/noname-typings/ArrayEx.d.ts | 112 + node_modules/@types/noname-typings/Card.d.ts | 23 + .../@types/noname-typings/DateEx.d.ts | 5 + .../noname-typings/HTMLDivElementEx.d.ts | 85 + .../noname-typings/HTMLTableElementEx.d.ts | 8 + node_modules/@types/noname-typings/LICENSE | 674 + node_modules/@types/noname-typings/MapEx.d.ts | 27 + .../@types/noname-typings/Result.d.ts | 43 + node_modules/@types/noname-typings/Skill.d.ts | 1928 ++ .../cordova-plugin-dialogs.d.ts | 69 + .../cordova-plugin-file-transfer.d.ts | 136 + .../noname-typings/cordova-plugin-file.d.ts | 374 + .../cordova-plugin-local-notifications.d.ts | 390 + .../@types/noname-typings/electron.d.ts | 18368 ++++++++++++++++ node_modules/@types/noname-typings/index.d.ts | 20 + .../nonameModules/game/codemirror.d.ts | 2 + .../nonameModules/game/jszip.d.ts | 2 + .../noname-typings/nonameModules/noname.d.ts | 8 + .../nonameModules/noname/ai/basic.d.ts | 25 + .../nonameModules/noname/ai/index.d.ts | 9 + .../noname/game/dynamic-style/index.d.ts | 117 + .../nonameModules/noname/game/index.d.ts | 1409 ++ .../nonameModules/noname/game/promises.d.ts | 46 + .../nonameModules/noname/get/index.d.ts | 492 + .../nonameModules/noname/get/is.d.ts | 194 + .../nonameModules/noname/gnc/index.d.ts | 12 + .../nonameModules/noname/gnc/is.d.ts | 18 + .../nonameModules/noname/init/cordova.d.ts | 1 + .../nonameModules/noname/init/import.d.ts | 4 + .../nonameModules/noname/init/index.d.ts | 7 + .../nonameModules/noname/init/node.d.ts | 1 + .../nonameModules/noname/init/onload.d.ts | 1 + .../nonameModules/noname/init/polyfill.d.ts | 1 + .../noname/library/announce/index.d.ts | 53 + .../noname/library/announce/interface.d.ts | 54 + .../noname/library/assembly/buildin.d.ts | 40 + .../noname/library/assembly/index.d.ts | 60 + .../noname/library/cache/cacheContext.d.ts | 64 + .../library/cache/childNodesWatcher.d.ts | 10 + .../noname/library/channel/index.d.ts | 26 + .../noname/library/crypt/md5.d.ts | 1 + .../noname/library/element/button.d.ts | 13 + .../noname/library/element/card.d.ts | 110 + .../noname/library/element/client.d.ts | 14 + .../noname/library/element/content.d.ts | 118 + .../noname/library/element/contents.d.ts | 4 + .../noname/library/element/control.d.ts | 8 + .../noname/library/element/dialog.d.ts | 41 + .../noname/library/element/gameEvent.d.ts | 286 + .../library/element/gameEventPromise.d.ts | 108 + .../noname/library/element/index.d.ts | 12 + .../noname/library/element/nodeWS.d.ts | 10 + .../noname/library/element/player.d.ts | 1110 + .../noname/library/element/vcard.d.ts | 49 + .../noname/library/experimental/index.d.ts | 6 + .../noname/library/experimental/symbol.d.ts | 4 + .../noname/library/hooks/buildin.d.ts | 8 + .../noname/library/hooks/hook.d.ts | 14 + .../noname/library/hooks/index.d.ts | 16 + .../nonameModules/noname/library/index.d.ts | 4424 ++++ .../noname/library/init/index.d.ts | 53 + .../noname/library/init/promises.d.ts | 42 + .../nonameModules/noname/library/path.d.ts | 4 + .../noname/library/update-urls.d.ts | 4 + .../nonameModules/noname/library/update.d.ts | 145 + .../nonameModules/noname/status/index.d.ts | 30 + .../nonameModules/noname/ui/click/index.d.ts | 93 + .../nonameModules/noname/ui/create/index.d.ts | 110 + .../noname/ui/create/menu/index.d.ts | 60 + .../ui/create/menu/pages/cardPackMenu.d.ts | 1 + .../create/menu/pages/characterPackMenu.d.ts | 1 + .../ui/create/menu/pages/exetensionMenu.d.ts | 1 + .../ui/create/menu/pages/optionsMenu.d.ts | 1 + .../ui/create/menu/pages/otherMenu.d.ts | 1 + .../ui/create/menu/pages/startMenu.d.ts | 1 + .../nonameModules/noname/ui/index.d.ts | 136 + .../nonameModules/noname/util/browser.d.ts | 10 + .../nonameModules/noname/util/config.d.ts | 16 + .../nonameModules/noname/util/index.d.ts | 27 + .../nonameModules/noname/util/mutex.d.ts | 24 + .../noname/util/struct/index.d.ts | 1 + .../struct/promise-error-handler/chrome.d.ts | 54 + .../struct/promise-error-handler/firefox.d.ts | 20 + .../struct/promise-error-handler/index.d.ts | 3 + .../struct/promise-error-handler/unknown.d.ts | 22 + .../@types/noname-typings/package.json | 29 + node_modules/@types/noname-typings/readme.txt | 3 + node_modules/@types/noname-typings/type.d.ts | 702 + .../@types/noname-typings/windowEx.d.ts | 73 + node_modules/@types/tern/LICENSE | 21 + node_modules/@types/tern/README.md | 15 + node_modules/@types/tern/index.d.ts | 2 + node_modules/@types/tern/lib/infer/index.d.ts | 341 + node_modules/@types/tern/lib/tern/index.d.ts | 507 + node_modules/@types/tern/package.json | 27 + 165 files changed, 38735 insertions(+) create mode 100644 node_modules/@types/codemirror/LICENSE create mode 100644 node_modules/@types/codemirror/README.md create mode 100644 node_modules/@types/codemirror/addon/comment/comment.d.ts create mode 100644 node_modules/@types/codemirror/addon/comment/continuecomment.d.ts create mode 100644 node_modules/@types/codemirror/addon/dialog/dialog.d.ts create mode 100644 node_modules/@types/codemirror/addon/display/autorefresh.d.ts create mode 100644 node_modules/@types/codemirror/addon/display/fullscreen.d.ts create mode 100644 node_modules/@types/codemirror/addon/display/panel.d.ts create mode 100644 node_modules/@types/codemirror/addon/display/placeholder.d.ts create mode 100644 node_modules/@types/codemirror/addon/display/rulers.d.ts create mode 100644 node_modules/@types/codemirror/addon/edit/closebrackets.d.ts create mode 100644 node_modules/@types/codemirror/addon/edit/closetag.d.ts create mode 100644 node_modules/@types/codemirror/addon/edit/continuelist.d.ts create mode 100644 node_modules/@types/codemirror/addon/edit/matchbrackets.d.ts create mode 100644 node_modules/@types/codemirror/addon/edit/matchtags.d.ts create mode 100644 node_modules/@types/codemirror/addon/edit/trailingspace.d.ts create mode 100644 node_modules/@types/codemirror/addon/fold/brace-fold.d.ts create mode 100644 node_modules/@types/codemirror/addon/fold/comment-fold.d.ts create mode 100644 node_modules/@types/codemirror/addon/fold/foldcode.d.ts create mode 100644 node_modules/@types/codemirror/addon/fold/foldgutter.d.ts create mode 100644 node_modules/@types/codemirror/addon/fold/indent-fold.d.ts create mode 100644 node_modules/@types/codemirror/addon/fold/markdown-fold.d.ts create mode 100644 node_modules/@types/codemirror/addon/fold/xml-fold.d.ts create mode 100644 node_modules/@types/codemirror/addon/hint/anyword-hint.d.ts create mode 100644 node_modules/@types/codemirror/addon/hint/css-hint.d.ts create mode 100644 node_modules/@types/codemirror/addon/hint/html-hint.d.ts create mode 100644 node_modules/@types/codemirror/addon/hint/javascript-hint.d.ts create mode 100644 node_modules/@types/codemirror/addon/hint/show-hint.d.ts create mode 100644 node_modules/@types/codemirror/addon/hint/sql-hint.d.ts create mode 100644 node_modules/@types/codemirror/addon/hint/xml-hint.d.ts create mode 100644 node_modules/@types/codemirror/addon/lint/coffeescript-lint.d.ts create mode 100644 node_modules/@types/codemirror/addon/lint/css-lint.d.ts create mode 100644 node_modules/@types/codemirror/addon/lint/html-lint.d.ts create mode 100644 node_modules/@types/codemirror/addon/lint/javascript-lint.d.ts create mode 100644 node_modules/@types/codemirror/addon/lint/json-lint.d.ts create mode 100644 node_modules/@types/codemirror/addon/lint/lint.d.ts create mode 100644 node_modules/@types/codemirror/addon/lint/yaml-lint.d.ts create mode 100644 node_modules/@types/codemirror/addon/merge/merge.d.ts create mode 100644 node_modules/@types/codemirror/addon/mode/loadMode.d.ts create mode 100644 node_modules/@types/codemirror/addon/mode/multiplex.d.ts create mode 100644 node_modules/@types/codemirror/addon/mode/overlay.d.ts create mode 100644 node_modules/@types/codemirror/addon/mode/simple.d.ts create mode 100644 node_modules/@types/codemirror/addon/runmode/colorize.d.ts create mode 100644 node_modules/@types/codemirror/addon/runmode/runmode.d.ts create mode 100644 node_modules/@types/codemirror/addon/scroll/annotatescrollbar.d.ts create mode 100644 node_modules/@types/codemirror/addon/scroll/scrollpastend.d.ts create mode 100644 node_modules/@types/codemirror/addon/scroll/simplescrollbars.d.ts create mode 100644 node_modules/@types/codemirror/addon/search/jump-to-line.d.ts create mode 100644 node_modules/@types/codemirror/addon/search/match-highlighter.d.ts create mode 100644 node_modules/@types/codemirror/addon/search/matchesonscrollbar.d.ts create mode 100644 node_modules/@types/codemirror/addon/search/search.d.ts create mode 100644 node_modules/@types/codemirror/addon/search/searchcursor.d.ts create mode 100644 node_modules/@types/codemirror/addon/selection/active-line.d.ts create mode 100644 node_modules/@types/codemirror/addon/selection/mark-selection.d.ts create mode 100644 node_modules/@types/codemirror/addon/selection/selection-pointer.d.ts create mode 100644 node_modules/@types/codemirror/addon/tern/tern.d.ts create mode 100644 node_modules/@types/codemirror/addon/wrap/hardwrap.d.ts create mode 100644 node_modules/@types/codemirror/index.d.ts create mode 100644 node_modules/@types/codemirror/mode/meta.d.ts create mode 100644 node_modules/@types/codemirror/package.json create mode 100644 node_modules/@types/estree/LICENSE create mode 100644 node_modules/@types/estree/README.md create mode 100644 node_modules/@types/estree/flow.d.ts create mode 100644 node_modules/@types/estree/index.d.ts create mode 100644 node_modules/@types/estree/package.json create mode 100644 node_modules/@types/jszip/LICENSE create mode 100644 node_modules/@types/jszip/README.md create mode 100644 node_modules/@types/jszip/index.d.ts create mode 100644 node_modules/@types/jszip/package.json create mode 100644 node_modules/@types/noname-typings/.github/workflows/release-package.yml create mode 100644 node_modules/@types/noname-typings/ArrayEx.d.ts create mode 100644 node_modules/@types/noname-typings/Card.d.ts create mode 100644 node_modules/@types/noname-typings/DateEx.d.ts create mode 100644 node_modules/@types/noname-typings/HTMLDivElementEx.d.ts create mode 100644 node_modules/@types/noname-typings/HTMLTableElementEx.d.ts create mode 100644 node_modules/@types/noname-typings/LICENSE create mode 100644 node_modules/@types/noname-typings/MapEx.d.ts create mode 100644 node_modules/@types/noname-typings/Result.d.ts create mode 100644 node_modules/@types/noname-typings/Skill.d.ts create mode 100644 node_modules/@types/noname-typings/cordova-plugin-dialogs.d.ts create mode 100644 node_modules/@types/noname-typings/cordova-plugin-file-transfer.d.ts create mode 100644 node_modules/@types/noname-typings/cordova-plugin-file.d.ts create mode 100644 node_modules/@types/noname-typings/cordova-plugin-local-notifications.d.ts create mode 100644 node_modules/@types/noname-typings/electron.d.ts create mode 100644 node_modules/@types/noname-typings/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/game/jszip.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/init/cordova.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/init/import.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/init/node.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/init/onload.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/init/polyfill.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/announce/interface.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/assembly/buildin.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/assembly/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/cache/childNodesWatcher.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/crypt/md5.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/client.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/content.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/control.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/experimental/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/experimental/symbol.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/hooks/buildin.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/hooks/hook.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/hooks/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/path.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/update-urls.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/cardPackMenu.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/characterPackMenu.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/exetensionMenu.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/optionsMenu.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/startMenu.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/browser.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/config.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/mutex.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/struct/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/struct/promise-error-handler/chrome.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/struct/promise-error-handler/firefox.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/struct/promise-error-handler/index.d.ts create mode 100644 node_modules/@types/noname-typings/nonameModules/noname/util/struct/promise-error-handler/unknown.d.ts create mode 100644 node_modules/@types/noname-typings/package.json create mode 100644 node_modules/@types/noname-typings/readme.txt create mode 100644 node_modules/@types/noname-typings/type.d.ts create mode 100644 node_modules/@types/noname-typings/windowEx.d.ts create mode 100644 node_modules/@types/tern/LICENSE create mode 100644 node_modules/@types/tern/README.md create mode 100644 node_modules/@types/tern/index.d.ts create mode 100644 node_modules/@types/tern/lib/infer/index.d.ts create mode 100644 node_modules/@types/tern/lib/tern/index.d.ts create mode 100644 node_modules/@types/tern/package.json diff --git a/node_modules/@types/codemirror/LICENSE b/node_modules/@types/codemirror/LICENSE new file mode 100644 index 000000000..9e841e7a2 --- /dev/null +++ b/node_modules/@types/codemirror/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/codemirror/README.md b/node_modules/@types/codemirror/README.md new file mode 100644 index 000000000..61f269ae4 --- /dev/null +++ b/node_modules/@types/codemirror/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/codemirror` + +# Summary +This package contains type definitions for codemirror (https://github.com/codemirror/CodeMirror). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/codemirror. + +### Additional Details + * Last updated: Wed, 22 Nov 2023 00:24:48 GMT + * Dependencies: [@types/tern](https://npmjs.com/package/@types/tern) + +# Credits +These definitions were written by [mihailik](https://github.com/mihailik), [nrbernard](https://github.com/nrbernard), [Pr1st0n](https://github.com/Pr1st0n), [rileymiller](https://github.com/rileymiller), [toddself](https://github.com/toddself), [ysulyma](https://github.com/ysulyma), [azoson](https://github.com/azoson), [kylesferrazza](https://github.com/kylesferrazza), [fityocsaba96](https://github.com/fityocsaba96), [koddsson](https://github.com/koddsson), and [ficristo](https://github.com/ficristo). diff --git a/node_modules/@types/codemirror/addon/comment/comment.d.ts b/node_modules/@types/codemirror/addon/comment/comment.d.ts new file mode 100644 index 000000000..7c7be499f --- /dev/null +++ b/node_modules/@types/codemirror/addon/comment/comment.d.ts @@ -0,0 +1,37 @@ +import "../../"; + +declare module "../../" { + interface Editor { + /** Tries to uncomment the current selection, and if that fails, line-comments it. */ + toggleComment(options?: CommentOptions): void; + /** Set the lines in the given range to be line comments. Will fall back to `blockComment` when no line comment style is defined for the mode. */ + lineComment(from: Position, to: Position, options?: CommentOptions): void; + /** Wrap the code in the given range in a block comment. Will fall back to `lineComment` when no block comment style is defined for the mode. */ + blockComment(from: Position, to: Position, options?: CommentOptions): void; + /** Try to uncomment the given range. Returns `true` if a comment range was found and removed, `false` otherwise. */ + uncomment(from: Position, to: Position, options?: CommentOptions): boolean; + } + + interface CommentOptions { + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentStart?: string | undefined; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentEnd?: string | undefined; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentLead?: string | undefined; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + lineComment?: string | undefined; + /** A string that will be inserted after opening and leading markers, and before closing comment markers. Defaults to a single space. */ + padding?: string | null | undefined; + /** Whether, when adding line comments, to also comment lines that contain only whitespace. */ + commentBlankLines?: boolean | undefined; + /** When adding line comments and this is turned on, it will align the comment block to the current indentation of the first line of the block. */ + indent?: boolean | undefined; + /** When block commenting, this controls whether the whole lines are indented, or only the precise range that is given. Defaults to `true`. */ + fullLines?: boolean | undefined; + } + + interface CommandActions { + toggleComment(cm: Editor): void; + } +} diff --git a/node_modules/@types/codemirror/addon/comment/continuecomment.d.ts b/node_modules/@types/codemirror/addon/comment/continuecomment.d.ts new file mode 100644 index 000000000..92e7f0b54 --- /dev/null +++ b/node_modules/@types/codemirror/addon/comment/continuecomment.d.ts @@ -0,0 +1,12 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** + * if true, the editor will make the next line continue a comment when + * pressing the Enter key. If set to a string, it will continue comments + * using a custom shortcut. + */ + continueComments?: boolean | string | { key: string; continueLineComment?: boolean | undefined } | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/dialog/dialog.d.ts b/node_modules/@types/codemirror/addon/dialog/dialog.d.ts new file mode 100644 index 000000000..128d307d7 --- /dev/null +++ b/node_modules/@types/codemirror/addon/dialog/dialog.d.ts @@ -0,0 +1,43 @@ +import "../../"; + +export type DialogCloseFunction = () => void; + +export interface DialogOptions { + bottom?: boolean | undefined; +} + +export interface OpenDialogOptions extends DialogOptions { + /** If true, the dialog will be closed when the user presses enter in the input. Defaults to true. */ + closeOnEnter?: boolean | undefined; + /** Determines whether the dialog is closed when it loses focus. Defaults to true. */ + closeOnBlur?: boolean | undefined; + /** An event handler that will be called whenever keydown fires in the dialog's input. If the callback returns true, the dialog will not do any further processing of the event. */ + onKeyDown?(event: KeyboardEvent, value: string, close: DialogCloseFunction): boolean | undefined; + /** An event handler that will be called whenever keyup fires in the dialog's input. If the callback returns true, the dialog will not do any further processing of the event. */ + onKeyUp?(event: KeyboardEvent, value: string, close: DialogCloseFunction): boolean | undefined; + /** An event handler that will be called whenever input fires in the dialog's input. If the callback returns true, the dialog will not do any further processing of the event. */ + onInput?(event: KeyboardEvent, value: string, close: DialogCloseFunction): boolean | undefined; + /** A callback that will be called after the dialog has been closed and removed from the DOM. */ + onClose?(instance: HTMLElement): void; +} + +export interface OpenNotificationOptions extends DialogOptions { + duration?: number | undefined; +} + +declare module "../../" { + interface Editor { + /** Provides a very simple way to query users for text input. */ + openDialog( + template: string | Node, + callback: (value: string, e: Event) => void, + options?: OpenDialogOptions, + ): DialogCloseFunction; + openNotification(template: string | Node, options?: OpenNotificationOptions): DialogCloseFunction; + openConfirm( + template: string | Node, + callbacks: ReadonlyArray<(editor: Editor) => void>, + options?: DialogOptions, + ): DialogCloseFunction; + } +} diff --git a/node_modules/@types/codemirror/addon/display/autorefresh.d.ts b/node_modules/@types/codemirror/addon/display/autorefresh.d.ts new file mode 100644 index 000000000..90ccde236 --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/autorefresh.d.ts @@ -0,0 +1,9 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + // if true, it will be refreshed the first time the editor becomes visible. + // you can pass delay (msec) time as polling duration + autoRefresh?: boolean | { delay: number } | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/display/fullscreen.d.ts b/node_modules/@types/codemirror/addon/display/fullscreen.d.ts new file mode 100644 index 000000000..6bd13b526 --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/fullscreen.d.ts @@ -0,0 +1,13 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** + * When set to true, will make the editor full-screen (as in, taking up the whole browser window). + * Depends on fullscreen.css + * @see {@link https://codemirror.net/doc/manual.html#addon_fullscreen} + * @default false + */ + fullScreen?: boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/display/panel.d.ts b/node_modules/@types/codemirror/addon/display/panel.d.ts new file mode 100644 index 000000000..d07154647 --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/panel.d.ts @@ -0,0 +1,41 @@ +import "../../"; + +declare module "../../" { + interface Panel { + /** Removes the panel from the editor */ + clear(): void; + /** Notifies panel that height of DOM node has changed */ + changed(height?: number): void; + } + + interface ShowPanelOptions { + /** + * Controls the position of the newly added panel. The following values are recognized: + * `top` (default): Adds the panel at the very top. + * `after-top`: Adds the panel at the bottom of the top panels. + * `bottom`: Adds the panel at the very bottom. + * `before-bottom`: Adds the panel at the top of the bottom panels. + */ + position?: "top" | "after-top" | "bottom" | "before-bottom" | undefined; + /** The new panel will be added before the given panel. */ + before?: Panel | undefined; + /** The new panel will be added after the given panel. */ + after?: Panel | undefined; + /** The new panel will replace the given panel. */ + replace?: Panel | undefined; + /** Whether to scroll the editor to keep the text's vertical position stable, when adding a panel above it. Defaults to false. */ + stable?: boolean | undefined; + /** The initial height of the panel. Defaults to the offsetHeight of the node. */ + height?: number | undefined; + } + + interface Editor { + /** + * Places a DOM node above or below an editor and shrinks the editor to make room for the node. + * When using the `after`, `before` or `replace` options, if the panel doesn't exists or has been removed, the value of the `position` option will be used as a fallback. + * @param node the DOM node + * @param options optional options object + */ + addPanel(node: HTMLElement, options?: ShowPanelOptions): Panel; + } +} diff --git a/node_modules/@types/codemirror/addon/display/placeholder.d.ts b/node_modules/@types/codemirror/addon/display/placeholder.d.ts new file mode 100644 index 000000000..5ad8eff76 --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/placeholder.d.ts @@ -0,0 +1,11 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** + * Adds a placeholder option that can be used to make content appear in the editor when it is empty and not focused. + * It can hold either a string or a DOM node. Also gives the editor a CodeMirror-empty CSS class whenever it doesn't contain any text. + */ + placeholder?: string | Node | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/display/rulers.d.ts b/node_modules/@types/codemirror/addon/display/rulers.d.ts new file mode 100644 index 000000000..2b9784282 --- /dev/null +++ b/node_modules/@types/codemirror/addon/display/rulers.d.ts @@ -0,0 +1,16 @@ +import "../../"; + +export interface Ruler { + column: number; + className?: string | undefined; + color?: string | undefined; + lineStyle?: string | undefined; + width?: string | undefined; +} + +declare module "../../" { + interface EditorConfiguration { + /** show one or more vertical rulers in the editor. */ + rulers?: false | ReadonlyArray | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/closebrackets.d.ts b/node_modules/@types/codemirror/addon/edit/closebrackets.d.ts new file mode 100644 index 000000000..74e8194fe --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/closebrackets.d.ts @@ -0,0 +1,40 @@ +import "../../"; + +declare module "../../" { + interface AutoCloseBrackets { + /** + * String containing pairs of matching characters. + */ + pairs?: string | undefined; + + /** + * If the next character is in the string, opening a bracket should be auto-closed. + */ + closeBefore?: string | undefined; + + /** + * String containing chars that could do a triple quote. + */ + triples?: string | undefined; + + /** + * explode should be a similar string that gives the pairs of characters that, when enter is pressed between them, should have the second character also moved to its own line. + */ + explode?: string | undefined; + + /** + * By default, if the active mode has a closeBrackets property, that overrides the configuration given in the option. + * But you can add an override property with a truthy value to override mode-specific configuration. + */ + override?: boolean | undefined; + } + + interface EditorConfiguration { + /** + * Will auto-close brackets and quotes when typed. + * By default, it'll auto-close ()[]{}''"", but you can pass it a string similar to that (containing pairs of matching characters), + * or an object with pairs and optionally explode properties to customize it. + */ + autoCloseBrackets?: AutoCloseBrackets | boolean | string | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/closetag.d.ts b/node_modules/@types/codemirror/addon/edit/closetag.d.ts new file mode 100644 index 000000000..65f021932 --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/closetag.d.ts @@ -0,0 +1,44 @@ +import "../../"; + +declare module "../../" { + interface CommandActions { + closeTag(cm: Editor): void; + } + + interface AutoCloseTags { + /** + * Whether to autoclose when the '/' of a closing tag is typed. (default true) + */ + whenClosing?: boolean | undefined; + + /** + * Whether to autoclose the tag when the final '>' of an opening tag is typed. (default true) + */ + whenOpening?: boolean | undefined; + + /** + * An array of tag names that should not be autoclosed. (default is empty tags for HTML, none for XML) + */ + dontCloseTags?: readonly string[] | undefined; + + /** + * An array of tag names that should, when opened, cause a + * blank line to be added inside the tag, and the blank line and + * closing line to be indented. (default is block tags for HTML, none for XML) + */ + indentTags?: readonly string[] | undefined; + + /** + * An array of XML tag names that should be autoclosed with '/>'. (default is none) + */ + emptyTags: readonly string[]; + } + + interface EditorConfiguration { + /** + * Will auto-close XML tags when '>' or '/' is typed. + * Depends on the fold/xml-fold.js addon. + */ + autoCloseTags?: AutoCloseTags | boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/continuelist.d.ts b/node_modules/@types/codemirror/addon/edit/continuelist.d.ts new file mode 100644 index 000000000..09b358cf5 --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/continuelist.d.ts @@ -0,0 +1,7 @@ +import "../../"; + +declare module "../../" { + interface CommandActions { + newlineAndIndentContinueMarkdownList(cm: Editor): void | typeof Pass; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/matchbrackets.d.ts b/node_modules/@types/codemirror/addon/edit/matchbrackets.d.ts new file mode 100644 index 000000000..3fba6e99e --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/matchbrackets.d.ts @@ -0,0 +1,35 @@ +import "../../"; + +declare module "../../" { + interface MatchBrackets { + /** + * Only use the character after the start position, never the one before it. + */ + afterCursor?: boolean | undefined; + + /** + * Causes only matches where both brackets are at the same side of the start position to be considered. + */ + strict?: boolean | undefined; + + /** + * Stop after scanning this amount of lines without a successful match. Defaults to 1000. + */ + maxScanLines?: number | undefined; + + /** + * Ignore lines longer than this. Defaults to 10000. + */ + maxScanLineLength?: number | undefined; + + /** + * Don't highlight a bracket in a line longer than this. Defaults to 1000. + */ + maxHighlightLineLength?: number | undefined; + } + + interface EditorConfiguration { + // When set to true or an options object, causes matching brackets to be highlighted whenever the cursor is next to them. + matchBrackets?: MatchBrackets | boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/matchtags.d.ts b/node_modules/@types/codemirror/addon/edit/matchtags.d.ts new file mode 100644 index 000000000..aaaa89ea9 --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/matchtags.d.ts @@ -0,0 +1,25 @@ +import "../../"; + +declare module "../../" { + interface CommandActions { + /** + * You can bind a key to in order to jump to the tag matching the one under the cursor. + */ + toMatchingTag(cm: Editor): void; + } + + interface MatchTags { + /** + * Highlight both matching tags. + */ + bothTags?: boolean | undefined; + } + + interface EditorConfiguration { + /** + * When enabled will cause the tags around the cursor to be highlighted (using the CodeMirror-matchingtag class). + * Depends on the addon/fold/xml-fold.js addon. + */ + matchTags?: MatchTags | boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/edit/trailingspace.d.ts b/node_modules/@types/codemirror/addon/edit/trailingspace.d.ts new file mode 100644 index 000000000..d52d40c0a --- /dev/null +++ b/node_modules/@types/codemirror/addon/edit/trailingspace.d.ts @@ -0,0 +1,8 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** when enabled, adds the CSS class cm-trailingspace to stretches of whitespace at the end of lines. */ + showTrailingSpace?: boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/fold/brace-fold.d.ts b/node_modules/@types/codemirror/addon/fold/brace-fold.d.ts new file mode 100644 index 000000000..18cc2ba4a --- /dev/null +++ b/node_modules/@types/codemirror/addon/fold/brace-fold.d.ts @@ -0,0 +1,9 @@ +import "./foldcode"; + +declare module "./foldcode" { + interface FoldHelpers { + brace: FoldRangeFinder; + import: FoldRangeFinder; + include: FoldRangeFinder; + } +} diff --git a/node_modules/@types/codemirror/addon/fold/comment-fold.d.ts b/node_modules/@types/codemirror/addon/fold/comment-fold.d.ts new file mode 100644 index 000000000..339dca01f --- /dev/null +++ b/node_modules/@types/codemirror/addon/fold/comment-fold.d.ts @@ -0,0 +1,7 @@ +import "./foldcode"; + +declare module "./foldcode" { + interface FoldHelpers { + comment: FoldRangeFinder; + } +} diff --git a/node_modules/@types/codemirror/addon/fold/foldcode.d.ts b/node_modules/@types/codemirror/addon/fold/foldcode.d.ts new file mode 100644 index 000000000..caba1facf --- /dev/null +++ b/node_modules/@types/codemirror/addon/fold/foldcode.d.ts @@ -0,0 +1,77 @@ +// See docs https://codemirror.net/doc/manual.html#addon_foldcode + +import * as CodeMirror from "../../"; + +export type FoldRangeFinder = (cm: CodeMirror.Editor, pos: CodeMirror.Position) => CodeMirror.FoldRange | undefined; + +export interface FoldHelpers { + combine: (...finders: FoldRangeFinder[]) => FoldRangeFinder; + auto: FoldRangeFinder; +} + +declare module "../../" { + interface Editor { + /** + * Helps with code folding. Adds a foldCode method to editor instances, which will try to do a code fold starting at the given line, + * or unfold the fold that is already present. + * The method takes as first argument the position that should be folded (may be a line number or a Pos), and as second optional argument either a + * range-finder function, or an options object. + */ + foldCode: ( + lineOrPos: number | Position, + rangeFindeOrFoldOptions?: FoldRangeFinder | FoldOptions, + force?: "fold" | "unfold", + ) => void; + isFolded(pos: Position): boolean | undefined; + foldOption(option: K): FoldOptions[K]; + } + + interface EditorConfiguration { + foldOptions?: FoldOptions | undefined; + } + + interface FoldOptions { + /** + * The function that is used to find foldable ranges. If this is not directly passed, it will default to CodeMirror.fold.auto, + * which uses getHelpers with a "fold" type to find folding functions appropriate for the local mode. + * There are files in the addon/fold/ directory providing CodeMirror.fold.brace, which finds blocks in brace languages (JavaScript, C, Java, etc), + * CodeMirror.fold.indent, for languages where indentation determines block structure (Python, Haskell), and CodeMirror.fold.xml, for XML-style languages, + * and CodeMirror.fold.comment, for folding comment blocks. + */ + rangeFinder?: FoldRangeFinder | undefined; + + /** + * The widget to show for folded ranges. Can be either a string, in which case it'll become a span with class CodeMirror-foldmarker, or a DOM node. + * To dynamically generate the widget, this can be a function that returns a string or DOM node, which will then render as described. + * The function will be invoked with parameters identifying the range to be folded. + */ + widget?: string | Element | ((from: Position, to: Position) => string | Element) | undefined; + + /** + * When true (default is false), the addon will try to find foldable ranges on the lines above the current one if there isn't an eligible one on the given line. + */ + scanUp?: boolean | undefined; + + /** + * The minimum amount of lines that a fold should span to be accepted. Defaults to 0, which also allows single-line folds. + */ + minFoldSize?: number | undefined; + + clearOnEnter?: boolean | undefined; + } + + interface FoldRange { + from: Position; + to: Position; + } + + interface CommandActions { + toggleFold(cm: Editor): void; + fold(cm: Editor): void; + unfold(cm: Editor): void; + foldAll(cm: Editor): void; + unfoldAll(cm: Editor): void; + } + + const fold: FoldHelpers; +} diff --git a/node_modules/@types/codemirror/addon/fold/foldgutter.d.ts b/node_modules/@types/codemirror/addon/fold/foldgutter.d.ts new file mode 100644 index 000000000..d0157feb1 --- /dev/null +++ b/node_modules/@types/codemirror/addon/fold/foldgutter.d.ts @@ -0,0 +1,40 @@ +// See docs https://codemirror.net/doc/manual.html#addon_foldgutter + +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** + * Provides an option foldGutter, which can be used to create a gutter with markers indicating the blocks that can be folded. + */ + foldGutter?: boolean | FoldGutterOptions | undefined; + } + + interface FoldRange { + from: Position; + to: Position; + } + + interface FoldGutterOptions { + /** + * The CSS class of the gutter. Defaults to "CodeMirror-foldgutter". You will have to style this yourself to give it a width (and possibly a background). + */ + gutter?: string | undefined; + + /** + * A CSS class or DOM element to be used as the marker for open, foldable blocks. Defaults to "CodeMirror-foldgutter-open". + */ + indicatorOpen?: string | Element | undefined; + + /** + * A CSS class or DOM element to be used as the marker for folded blocks. Defaults to "CodeMirror-foldgutter-folded". + */ + indicatorFolded?: string | Element | undefined; + + /* + * The range-finder function to use when determining whether something can be folded. + * When not given, CodeMirror.fold.auto will be used as default. + */ + rangeFinder?: (cm: Editor, pos: Position) => FoldRange | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/fold/indent-fold.d.ts b/node_modules/@types/codemirror/addon/fold/indent-fold.d.ts new file mode 100644 index 000000000..2cdcca073 --- /dev/null +++ b/node_modules/@types/codemirror/addon/fold/indent-fold.d.ts @@ -0,0 +1,7 @@ +import "./foldcode"; + +declare module "./foldcode" { + interface FoldHelpers { + indent: FoldRangeFinder; + } +} diff --git a/node_modules/@types/codemirror/addon/fold/markdown-fold.d.ts b/node_modules/@types/codemirror/addon/fold/markdown-fold.d.ts new file mode 100644 index 000000000..4572c9aba --- /dev/null +++ b/node_modules/@types/codemirror/addon/fold/markdown-fold.d.ts @@ -0,0 +1,7 @@ +import "./foldcode"; + +declare module "./foldcode" { + interface FoldHelpers { + markdown: FoldRangeFinder; + } +} diff --git a/node_modules/@types/codemirror/addon/fold/xml-fold.d.ts b/node_modules/@types/codemirror/addon/fold/xml-fold.d.ts new file mode 100644 index 000000000..4c2cbad75 --- /dev/null +++ b/node_modules/@types/codemirror/addon/fold/xml-fold.d.ts @@ -0,0 +1,31 @@ +import * as CodeMirror from "../../"; +import "./foldcode"; + +export interface XmlTag { + from: CodeMirror.Position; + to: CodeMirror.Position; + tag: string; +} + +declare module "./foldcode" { + interface FoldHelpers { + xml: FoldRangeFinder; + } +} + +declare module "../../" { + function findMatchingTag( + cm: Editor, + pos: Position, + range: Range, + ): { open: XmlTag; close: XmlTag | null | undefined; at: "open" | "close" } | undefined; + + function findEnclosingTag( + cm: Editor, + pos: Position, + range: Range, + tag: string, + ): { open: XmlTag; close: XmlTag } | undefined; + + function scanForClosingTag(cm: Editor, pos: Position, name: string, end?: Position): XmlTag | null | undefined; +} diff --git a/node_modules/@types/codemirror/addon/hint/anyword-hint.d.ts b/node_modules/@types/codemirror/addon/hint/anyword-hint.d.ts new file mode 100644 index 000000000..e60acd4a7 --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/anyword-hint.d.ts @@ -0,0 +1,12 @@ +import "./show-hint"; + +declare module "../../" { + interface HintHelpers { + anyword: HintFunction; + } + + interface ShowHintOptions { + word?: RegExp | undefined; + range?: number | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/hint/css-hint.d.ts b/node_modules/@types/codemirror/addon/hint/css-hint.d.ts new file mode 100644 index 000000000..213bee30e --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/css-hint.d.ts @@ -0,0 +1,7 @@ +import "./show-hint"; + +declare module "../../" { + interface HintHelpers { + css: HintFunction; + } +} diff --git a/node_modules/@types/codemirror/addon/hint/html-hint.d.ts b/node_modules/@types/codemirror/addon/hint/html-hint.d.ts new file mode 100644 index 000000000..d610cc8b8 --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/html-hint.d.ts @@ -0,0 +1,9 @@ +import "./xml-hint"; + +declare module "../../" { + interface HintHelpers { + html: HintFunction; + } + + const htmlSchema: any; +} diff --git a/node_modules/@types/codemirror/addon/hint/javascript-hint.d.ts b/node_modules/@types/codemirror/addon/hint/javascript-hint.d.ts new file mode 100644 index 000000000..83f70477e --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/javascript-hint.d.ts @@ -0,0 +1,8 @@ +import "./show-hint"; + +declare module "../../" { + interface HintHelpers { + javascript: HintFunction; + coffeescript: HintFunction; + } +} diff --git a/node_modules/@types/codemirror/addon/hint/show-hint.d.ts b/node_modules/@types/codemirror/addon/hint/show-hint.d.ts new file mode 100644 index 000000000..cfde12c4d --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/show-hint.d.ts @@ -0,0 +1,121 @@ +import "../../"; + +declare module "../../" { + /** + * Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional + * options object, and pops up a widget that allows the user to select a completion. Finding hints is done with + * a hinting functions (the hint option), which is a function that take an editor instance and options object, + * and return a {list, from, to} object, where list is an array of strings or objects (the completions), and + * from and to give the start and end of the token that is being completed as {line, ch} objects. An optional + * selectedHint property (an integer) can be added to the completion object to control the initially selected hint. + */ + function showHint(cm: Editor, hinter?: HintFunction, options?: ShowHintOptions): void; + + function on(hints: Hints, eventName: T, handler: CompletionEventMap[T]): void; + function off(hints: Hints, eventName: T, handler: CompletionEventMap[T]): void; + function signal( + hints: Hints, + eventName: T, + ...args: Parameters + ): void; + + interface CompletionEventMap { + shown: () => void; + select: (completion: Hint | string, element: Element) => void; + pick: (completion: Hint | string) => void; + close: () => void; + } + + interface Hints { + from: Position; + to: Position; + list: Array; + } + + /** + * Interface used by showHint.js Codemirror add-on + * When completions aren't simple strings, they should be objects with the following properties: + */ + interface Hint { + text: string; + className?: string | undefined; + displayText?: string | undefined; + from?: Position | undefined; + /** Called if a completion is picked. If provided *you* are responsible for applying the completion */ + hint?: ((cm: Editor, data: Hints, cur: Hint) => void) | undefined; + render?: ((element: HTMLLIElement, data: Hints, cur: Hint) => void) | undefined; + to?: Position | undefined; + } + + interface EditorEventMap { + startCompletion: (instance: Editor) => void; + endCompletion: (instance: Editor) => void; + } + + interface Editor { + showHint(options?: ShowHintOptions): void; + closeHint(): void; + } + + interface CommandActions { + /* An extension of the existing CodeMirror typings for the autocomplete command */ + autocomplete: typeof showHint; + } + + interface HintFunction { + (cm: Editor, options: ShowHintOptions): Hints | null | undefined | PromiseLike; + } + + interface AsyncHintFunction { + (cm: Editor, callback: (hints: Hints | null | undefined) => void, options: ShowHintOptions): void; + async: true; + } + + interface HintFunctionResolver { + resolve(cm: Editor, post: Position): HintFunction | AsyncHintFunction; + } + + interface ShowHintOptions { + completeSingle?: boolean | undefined; + hint?: HintFunction | AsyncHintFunction | HintFunctionResolver | undefined; + alignWithWord?: boolean | undefined; + closeCharacters?: RegExp | undefined; + closeOnPick?: boolean | undefined; + closeOnUnfocus?: boolean | undefined; + updateOnCursorActivity?: boolean | undefined; + completeOnSingleClick?: boolean | undefined; + container?: HTMLElement | null | undefined; + customKeys?: + | { [key: string]: ((editor: Editor, handle: CompletionHandle) => void) | string } + | null + | undefined; + extraKeys?: { [key: string]: ((editor: Editor, handle: CompletionHandle) => void) | string } | null | undefined; + scrollMargin?: number | undefined; + paddingForScrollbar?: boolean | undefined; + moveOnOverlap?: boolean | undefined; + words?: readonly string[] | undefined; // used by fromList + } + + /** The Handle used to interact with the autocomplete dialog box. */ + interface CompletionHandle { + moveFocus(n: number, avoidWrap: boolean): void; + setFocus(n: number): void; + menuSize(): number; + length: number; + close(): void; + pick(): void; + data: any; + } + + interface EditorConfiguration { + showHint?: boolean | undefined; + hintOptions?: ShowHintOptions | undefined; + } + + interface HintHelpers { + auto: HintFunctionResolver; + fromList: HintFunction; + } + + const hint: HintHelpers; +} diff --git a/node_modules/@types/codemirror/addon/hint/sql-hint.d.ts b/node_modules/@types/codemirror/addon/hint/sql-hint.d.ts new file mode 100644 index 000000000..7458f373c --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/sql-hint.d.ts @@ -0,0 +1,20 @@ +import "./show-hint"; + +declare module "../../" { + interface HintHelpers { + sql: HintFunction; + } + + interface SqlHintTable { + columns: string[]; + } + + interface ShowHintOptions { + tables?: + | ReadonlyArray + | Record + | undefined; + defaultTable?: string | undefined; + disableKeywords?: boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/hint/xml-hint.d.ts b/node_modules/@types/codemirror/addon/hint/xml-hint.d.ts new file mode 100644 index 000000000..b3fc9407c --- /dev/null +++ b/node_modules/@types/codemirror/addon/hint/xml-hint.d.ts @@ -0,0 +1,13 @@ +import "./show-hint"; + +declare module "../../" { + interface HintHelpers { + xml: HintFunction; + } + + interface ShowHintOptions { + schemaInfo?: any; + quoteChar?: string | undefined; + matchInMiddle?: boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/lint/coffeescript-lint.d.ts b/node_modules/@types/codemirror/addon/lint/coffeescript-lint.d.ts new file mode 100644 index 000000000..d229b3df5 --- /dev/null +++ b/node_modules/@types/codemirror/addon/lint/coffeescript-lint.d.ts @@ -0,0 +1,7 @@ +import { Linter } from "./lint"; + +declare module "../../" { + namespace lint { + const coffeescript: Linter<{}>; + } +} diff --git a/node_modules/@types/codemirror/addon/lint/css-lint.d.ts b/node_modules/@types/codemirror/addon/lint/css-lint.d.ts new file mode 100644 index 000000000..ae85d516b --- /dev/null +++ b/node_modules/@types/codemirror/addon/lint/css-lint.d.ts @@ -0,0 +1,7 @@ +import { Linter } from "./lint"; + +declare module "../../" { + namespace lint { + const css: Linter; + } +} diff --git a/node_modules/@types/codemirror/addon/lint/html-lint.d.ts b/node_modules/@types/codemirror/addon/lint/html-lint.d.ts new file mode 100644 index 000000000..e02b8539d --- /dev/null +++ b/node_modules/@types/codemirror/addon/lint/html-lint.d.ts @@ -0,0 +1,7 @@ +import { Linter } from "./lint"; + +declare module "../../" { + namespace lint { + const html: Linter; + } +} diff --git a/node_modules/@types/codemirror/addon/lint/javascript-lint.d.ts b/node_modules/@types/codemirror/addon/lint/javascript-lint.d.ts new file mode 100644 index 000000000..bf45f2008 --- /dev/null +++ b/node_modules/@types/codemirror/addon/lint/javascript-lint.d.ts @@ -0,0 +1,7 @@ +import { Linter } from "./lint"; + +declare module "../../" { + namespace lint { + const javascript: Linter; + } +} diff --git a/node_modules/@types/codemirror/addon/lint/json-lint.d.ts b/node_modules/@types/codemirror/addon/lint/json-lint.d.ts new file mode 100644 index 000000000..28ffdb297 --- /dev/null +++ b/node_modules/@types/codemirror/addon/lint/json-lint.d.ts @@ -0,0 +1,7 @@ +import { Linter } from "./lint"; + +declare module "../../" { + namespace lint { + const json: Linter<{}>; + } +} diff --git a/node_modules/@types/codemirror/addon/lint/lint.d.ts b/node_modules/@types/codemirror/addon/lint/lint.d.ts new file mode 100644 index 000000000..1da24753a --- /dev/null +++ b/node_modules/@types/codemirror/addon/lint/lint.d.ts @@ -0,0 +1,96 @@ +import * as CodeMirror from "../../"; + +export interface BaseLintStateOptions { + /** debounce delay before linting onChange */ + delay?: number | undefined; + + /** callback to modify an annotation before display */ + formatAnnotation?: ((annotation: Annotation) => Annotation) | undefined; + + /** whether to lint onChange event */ + lintOnChange?: boolean | undefined; + + selfContain?: boolean | undefined; + + /** callback after linter completes */ + onUpdateLinting?( + annotationsNotSorted: Annotation[], + annotations: Annotation[], + codeMirror: CodeMirror.Editor, + ): void; + + /** + * Passing rules in `options` property prevents JSHint (and other linters) from complaining + * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc. + */ + options?: T | undefined; + + /** controls display of lint tooltips */ + tooltips?: boolean | "gutter" | undefined; +} + +export interface SyncLintStateOptions extends BaseLintStateOptions { + async?: false | undefined; + getAnnotations?: Linter | undefined; +} + +export interface AsyncLintStateOptions extends BaseLintStateOptions { + /** specifies that the lint process runs asynchronously */ + async: true; + getAnnotations?: AsyncLinter | undefined; +} + +export type LintStateOptions = SyncLintStateOptions | AsyncLintStateOptions; + +/** + * A function that return errors found during the linting process. + */ +export interface Linter { + (content: string, options: T, codeMirror: CodeMirror.Editor): + | Annotation[] + | PromiseLike; +} + +/** + * A function that calls the updateLintingCallback with any errors found during the linting process. + */ +export interface AsyncLinter { + ( + content: string, + updateLintingCallback: UpdateLintingCallback, + options: T, + codeMirror: CodeMirror.Editor, + ): void; +} + +/** + * A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations + */ +export interface UpdateLintingCallback { + (annotations: Annotation[]): void; + (codeMirror: CodeMirror.Editor, annotations: Annotation[]): void; +} + +/** + * An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error, + * and an explaination as to why the error was thrown. + */ +export interface Annotation { + from: CodeMirror.Position; + message?: string | undefined; + severity?: string | undefined; + to?: CodeMirror.Position | undefined; +} + +declare module "../../" { + interface Editor { + performLint: () => void; + } + + interface EditorConfiguration { + /** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */ + lint?: boolean | LintStateOptions | Linter | undefined; + } + + namespace lint {} +} diff --git a/node_modules/@types/codemirror/addon/lint/yaml-lint.d.ts b/node_modules/@types/codemirror/addon/lint/yaml-lint.d.ts new file mode 100644 index 000000000..42e2d31da --- /dev/null +++ b/node_modules/@types/codemirror/addon/lint/yaml-lint.d.ts @@ -0,0 +1,7 @@ +import { Linter } from "./lint"; + +declare module "../../" { + namespace lint { + const yaml: Linter<{}>; + } +} diff --git a/node_modules/@types/codemirror/addon/merge/merge.d.ts b/node_modules/@types/codemirror/addon/merge/merge.d.ts new file mode 100644 index 000000000..a6da73234 --- /dev/null +++ b/node_modules/@types/codemirror/addon/merge/merge.d.ts @@ -0,0 +1,137 @@ +import * as CodeMirror from "../../"; + +/** + * Tracks changes in chunks from original to new. + */ +export interface MergeViewDiffChunk { + editFrom: number; + editTo: number; + origFrom: number; + origTo: number; +} + +export interface DiffView { + /** + * Forces the view to reload. + */ + forceUpdate(): (mode: string) => void; + + /** + * Sets whether or not the merge view should show the differences between the editor views. + */ + setShowDifferences(showDifferences: boolean): void; +} + +export interface MergeView { + /** + * Returns the editor instance. + */ + editor(): CodeMirror.Editor; + + /** + * Left side of the merge view. + */ + left?: DiffView | undefined; + leftChunks(): MergeViewDiffChunk[] | undefined; + leftOriginal(): CodeMirror.Editor | undefined; + + /** + * Right side of the merge view. + */ + right?: DiffView | undefined; + rightChunks(): MergeViewDiffChunk[] | undefined; + rightOriginal(): CodeMirror.Editor | undefined; + + /** + * Sets whether or not the merge view should show the differences between the editor views. + */ + setShowDifferences(showDifferences: boolean): void; +} + +export interface MergeViewConstructor { + new(element: HTMLElement, options?: MergeViewConfiguration): MergeView; + (element: HTMLElement, options?: MergeViewConfiguration): MergeView; +} + +/** + * Options available to MergeView. + */ +export interface MergeViewConfiguration extends CodeMirror.EditorConfiguration { + /** + * Determines whether the original editor allows editing. Defaults to false. + */ + allowEditingOriginals?: boolean | undefined; + + /** + * When true stretches of unchanged text will be collapsed. When a number is given, this indicates the amount + * of lines to leave visible around such stretches (which defaults to 2). Defaults to false. + */ + collapseIdentical?: boolean | number | undefined; + + /** + * Sets the style used to connect changed chunks of code. By default, connectors are drawn. When this is set to "align", + * the smaller chunk is padded to align with the bigger chunk instead. + */ + connect?: string | undefined; + + /** + * Callback for when stretches of unchanged text are collapsed. + */ + onCollapse?( + mergeView: MergeView, + line: number, + size: number, + mark: CodeMirror.TextMarker, + ): void; + + /** + * Provides original version of the document to be shown on the right of the editor. + */ + orig?: string | undefined; + + /** + * Provides original version of the document to be shown on the left of the editor. + * To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight. + */ + origLeft?: string | undefined; + + /** + * Provides original version of document to be shown on the right of the editor. + * To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight. + */ + origRight?: string | undefined; + + /** + * Determines whether buttons that allow the user to revert changes are shown. Defaults to true. + */ + revertButtons?: boolean | undefined; + + revertChunk?: + | (( + mv: MergeView, + from: CodeMirror.Editor, + fromStart: CodeMirror.Position, + fromEnd: CodeMirror.Position, + to: CodeMirror.Editor, + toStart: CodeMirror.Position, + toEnd: CodeMirror.Position, + ) => void) + | undefined; + + /** + * When true, changed pieces of text are highlighted. Defaults to true. + */ + showDifferences?: boolean | undefined; +} + +declare module "../../" { + const MergeView: MergeViewConstructor; + + interface CommandActions { + /** Move cursor to the next diff */ + goNextDiff(cm: Editor): void; + + /** Move cursor to the previous diff */ + goPrevDiff(cm: Editor): void; + } +} diff --git a/node_modules/@types/codemirror/addon/mode/loadMode.d.ts b/node_modules/@types/codemirror/addon/mode/loadMode.d.ts new file mode 100644 index 000000000..10b916fe0 --- /dev/null +++ b/node_modules/@types/codemirror/addon/mode/loadMode.d.ts @@ -0,0 +1,14 @@ +import "../../"; + +export interface RequireModeOptions { + path?(mode: string): string; + loadMode?(file: string, callback: () => void): void; +} + +declare module "../../" { + let modeURL: string; + + function requireMode(mode: string | { name: string }, callback: () => void, options?: RequireModeOptions): void; + + function autoLoadMode(instance: Editor, mode: string, options?: RequireModeOptions): void; +} diff --git a/node_modules/@types/codemirror/addon/mode/multiplex.d.ts b/node_modules/@types/codemirror/addon/mode/multiplex.d.ts new file mode 100644 index 000000000..5f0702cdc --- /dev/null +++ b/node_modules/@types/codemirror/addon/mode/multiplex.d.ts @@ -0,0 +1,29 @@ +import * as CodeMirror from "../../"; + +export interface MultiplexedInnerMode { + open: string; + close: string; + mode: CodeMirror.Mode; + parseDelimiters?: boolean | undefined; + delimStyle?: string | undefined; + innerStyle?: string | undefined; +} + +declare module "../../" { + /** + * Mode combinator that can be used to easily 'multiplex' between several modes. + * When given as first argument a mode object, and as other arguments any number of + * {open, close, mode [, delimStyle, innerStyle, parseDelimiters]} objects, it will return a mode object that starts parsing + * using the mode passed as first argument, but will switch to another mode as soon as it encounters a string that occurs in + * one of the open fields of the passed objects. When in a sub-mode, it will go back to the top mode again when the close + * string is encountered. Pass "\n" for open or close if you want to switch on a blank line. + * + * When delimStyle is specified, it will be the token style returned for the delimiter tokens (as well as [delimStyle]-open on + * the opening token and [delimStyle]-close on the closing token). + * When innerStyle is specified, it will be the token style added for each inner mode token. + * When parseDelimiters is true, the content of the delimiters will also be passed to the inner mode. (And delimStyle is ignored.) + * + * The outer mode will not see the content between the delimiters. + */ + function multiplexingMode(outer: Mode, ...others: MultiplexedInnerMode[]): Mode; +} diff --git a/node_modules/@types/codemirror/addon/mode/overlay.d.ts b/node_modules/@types/codemirror/addon/mode/overlay.d.ts new file mode 100644 index 000000000..8b057b455 --- /dev/null +++ b/node_modules/@types/codemirror/addon/mode/overlay.d.ts @@ -0,0 +1,9 @@ +import "../../"; + +declare module "../../" { + /** + * Mode combinator that can be used to extend a mode with an 'overlay' — a secondary mode is run over the stream, + * along with the base mode, and can color specific pieces of text without interfering with the base mode. + */ + function overlayMode(base: Mode, overlay: Mode, combine?: boolean): Mode; +} diff --git a/node_modules/@types/codemirror/addon/mode/simple.d.ts b/node_modules/@types/codemirror/addon/mode/simple.d.ts new file mode 100644 index 000000000..a9945f32c --- /dev/null +++ b/node_modules/@types/codemirror/addon/mode/simple.d.ts @@ -0,0 +1,27 @@ +import "../../"; + +declare module "../../" { + // Based on https://codemirror.net/demo/simplemode.html + interface Rule { + regex?: string | RegExp | undefined; + token?: string | string[] | null | undefined; + sol?: boolean | undefined; + next?: string | undefined; + push?: string | undefined; + pop?: boolean | undefined; + mode?: { + spec: string | ModeSpec; + end?: RegExp | undefined; + persistent?: boolean | undefined; + } | undefined; + indent?: boolean | undefined; + dedent?: boolean | undefined; + dedentIfLineStart?: boolean | undefined; + } + + function defineSimpleMode( + name: string, + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics + mode: { [P in K]: P extends "meta" ? Record : Rule[] } & { start: Rule[] }, + ): void; +} diff --git a/node_modules/@types/codemirror/addon/runmode/colorize.d.ts b/node_modules/@types/codemirror/addon/runmode/colorize.d.ts new file mode 100644 index 000000000..c6b87a6e9 --- /dev/null +++ b/node_modules/@types/codemirror/addon/runmode/colorize.d.ts @@ -0,0 +1,12 @@ +import "../../"; + +declare module "../../" { + /** + * Provides a convenient way to syntax-highlight code snippets in a webpage. Depends on the runmode addon (or its standalone variant). + * Can be called with an array (or other array-ish collection) of DOM nodes that represent the code snippets. By default, it'll get all pre tags. + * Will read the data-lang attribute of these nodes to figure out their language, and syntax-color their content using the relevant CodeMirror + * mode (you'll have to load the scripts for the relevant modes yourself). + * A second argument may be provided to give a default mode, used when no language attribute is found for a node. + */ + function colorize(collection?: ArrayLike, defaultMode?: string): void; +} diff --git a/node_modules/@types/codemirror/addon/runmode/runmode.d.ts b/node_modules/@types/codemirror/addon/runmode/runmode.d.ts new file mode 100644 index 000000000..a55e975b6 --- /dev/null +++ b/node_modules/@types/codemirror/addon/runmode/runmode.d.ts @@ -0,0 +1,23 @@ +import "../../"; + +declare module "../../" { + /** + * Runs a CodeMirror mode over text without opening an editor instance. + * + * @param text The document to run through the highlighter. + * @param mode The mode to use (must be loaded as normal). + * @param callback If this is a function, it will be called for each token with + * five arguments, the token's text, the token's style class (may be null for unstyled tokens), + * the number of row of the token, the column position of token and the state of mode. + * If it is a DOM node, the tokens will be converted to span elements as in an editor, + * and inserted into the node (through innerHTML). + */ + function runMode( + text: string, + mode: string | ModeSpec, + callback: + | HTMLElement + | ((text: string, style?: string | null, row?: number, column?: number, state?: any) => void), + options?: { tabSize?: number | undefined; state?: any }, + ): void; +} diff --git a/node_modules/@types/codemirror/addon/scroll/annotatescrollbar.d.ts b/node_modules/@types/codemirror/addon/scroll/annotatescrollbar.d.ts new file mode 100644 index 000000000..078830c41 --- /dev/null +++ b/node_modules/@types/codemirror/addon/scroll/annotatescrollbar.d.ts @@ -0,0 +1,26 @@ +import * as CodeMirror from "../.."; +import "./searchcursor"; + +export interface Annotation { + clear(): void; + /** + * Updates the ranges to be highlighted. The array must be sorted. + */ + update(annotations: Array<{ from: CodeMirror.Position; to: CodeMirror.Position }>): void; +} + +export interface AnnotateScrollbarOptions { + className: string; + scrollButtonHeight?: number | undefined; + listenForChanges?: boolean | undefined; +} + +declare module "../../" { + interface Editor { + annotateScrollbar(options: string | AnnotateScrollbarOptions): Annotation; + } + + interface EditorConfiguration { + scrollButtonHeight?: number | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/scroll/scrollpastend.d.ts b/node_modules/@types/codemirror/addon/scroll/scrollpastend.d.ts new file mode 100644 index 000000000..ef189611b --- /dev/null +++ b/node_modules/@types/codemirror/addon/scroll/scrollpastend.d.ts @@ -0,0 +1,10 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** + * When the end of the file is reached it allows you to keep scrolling so that your last few lines of code are not stuck at the bottom of the editor. + */ + scrollPastEnd?: boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/scroll/simplescrollbars.d.ts b/node_modules/@types/codemirror/addon/scroll/simplescrollbars.d.ts new file mode 100644 index 000000000..aa3e02bb1 --- /dev/null +++ b/node_modules/@types/codemirror/addon/scroll/simplescrollbars.d.ts @@ -0,0 +1,8 @@ +import "../../"; + +declare module "../../" { + interface ScrollbarModels { + simple: ScrollbarModelConstructor; + overlay: ScrollbarModelConstructor; + } +} diff --git a/node_modules/@types/codemirror/addon/search/jump-to-line.d.ts b/node_modules/@types/codemirror/addon/search/jump-to-line.d.ts new file mode 100644 index 000000000..dfdda172f --- /dev/null +++ b/node_modules/@types/codemirror/addon/search/jump-to-line.d.ts @@ -0,0 +1,14 @@ +import "../.."; +import "../dialog/dialog"; + +declare module "../../" { + interface CommandActions { + jumpToLine(cm: Editor): void; + } + + interface EditorConfiguration { + search?: { + bottom: boolean; + } | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/search/match-highlighter.d.ts b/node_modules/@types/codemirror/addon/search/match-highlighter.d.ts new file mode 100644 index 000000000..f17eb7437 --- /dev/null +++ b/node_modules/@types/codemirror/addon/search/match-highlighter.d.ts @@ -0,0 +1,50 @@ +// See docs https://codemirror.net/doc/manual.html#addon_match-highlighter + +import "../../"; + +declare module "../../" { + interface HighlightSelectionMatches { + /** + * Minimum amount of selected characters that triggers a highlight (default 2). + */ + minChars?: number | undefined; + + /** + * The style to be used to highlight the matches (default "matchhighlight", which will correspond to CSS class cm-matchhighlight). + */ + style?: string | undefined; + + /** + * Controls whether whitespace is trimmed from the selection. + */ + trim?: boolean | undefined; + + /** + * Can be set to true or to a regexp matching the characters that make up a word. + */ + showToken?: boolean | RegExp | undefined; + + /** + * Used to specify how much time to wait, in milliseconds, before highlighting the matches (default is 100). + */ + delay?: number | undefined; + + /** + * If wordsOnly is enabled, the matches will be highlighted only if the selected text is a word. + */ + wordsOnly?: boolean | undefined; + + /** + * If annotateScrollbar is enabled, the occurences will be highlighted on the scrollbar via the matchesonscrollbar addon. + */ + annotateScrollbar?: boolean | undefined; + } + + interface EditorConfiguration { + /** + * Adds a highlightSelectionMatches option that can be enabled to highlight all instances of a currently selected word. + * When enabled, it causes the current word to be highlighted when nothing is selected (defaults to off). + */ + highlightSelectionMatches?: HighlightSelectionMatches | boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/search/matchesonscrollbar.d.ts b/node_modules/@types/codemirror/addon/search/matchesonscrollbar.d.ts new file mode 100644 index 000000000..7acd393ae --- /dev/null +++ b/node_modules/@types/codemirror/addon/search/matchesonscrollbar.d.ts @@ -0,0 +1,12 @@ +import "../.."; +import "./searchcursor"; + +export interface SearchAnnotation { + clear(): void; +} + +declare module "../../" { + interface Editor { + showMatchesOnScrollbar(query: string | RegExp, caseFold?: boolean, className?: string): SearchAnnotation; + } +} diff --git a/node_modules/@types/codemirror/addon/search/search.d.ts b/node_modules/@types/codemirror/addon/search/search.d.ts new file mode 100644 index 000000000..1fb0fab34 --- /dev/null +++ b/node_modules/@types/codemirror/addon/search/search.d.ts @@ -0,0 +1,23 @@ +import "../../"; +import "./searchcursor"; +import "../dialog/dialog"; + +declare module "../../" { + interface CommandActions { + find(cm: Editor): void; + findPersistent(cm: Editor): void; + findPersistentNext(cm: Editor): void; + findPersistentPrev(cm: Editor): void; + findNext(cm: Editor): void; + findPrev(cm: Editor): void; + clearSearch(cm: Editor): void; + replace(cm: Editor): void; + replaceAll(cm: Editor): void; + } + + interface EditorConfiguration { + search?: { + bottom: boolean; + } | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/search/searchcursor.d.ts b/node_modules/@types/codemirror/addon/search/searchcursor.d.ts new file mode 100644 index 000000000..2f0909b09 --- /dev/null +++ b/node_modules/@types/codemirror/addon/search/searchcursor.d.ts @@ -0,0 +1,53 @@ +import "../../"; + +declare module "../../" { + interface DocOrEditor { + /** + * This method can be used to implement search/replace functionality. + * `query`: This can be a regular * expression or a string (only strings will match across lines - + * if they contain newlines). + * `start`: This provides the starting position of the search. It can be a `{line, ch} object, + * or can be left off to default to the start of the document + * `caseFold`: This is only relevant when matching a string. IT will cause the search to be case-insenstive + */ + getSearchCursor(query: string | RegExp, start?: Position, caseFold?: boolean): SearchCursor; + } + + interface SearchCursor { + /** + * Searches forward or backward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups + */ + find(reverse: boolean): boolean | RegExpMatchArray; + + /** + * Searches forward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups + */ + findNext(): boolean | RegExpMatchArray; + + /** + * Searches backward from the current position. The return value indicates whether a match was + * found. If matching a regular expression, the return value will be the array returned by the match method, in case + * you want to extract matched groups + */ + findPrevious(): boolean | RegExpMatchArray; + + /** + * Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch} + * objects pointing the start of the match. + */ + from(): Position; + + /** + * Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch} + * objects pointing the end of the match. + */ + to(): Position; + + /** Replaces the currently found match with the given text and adjusts the cursor position to reflect the deplacement. */ + replace(text: string, origin?: string): void; + } +} diff --git a/node_modules/@types/codemirror/addon/selection/active-line.d.ts b/node_modules/@types/codemirror/addon/selection/active-line.d.ts new file mode 100644 index 000000000..890f6d5a7 --- /dev/null +++ b/node_modules/@types/codemirror/addon/selection/active-line.d.ts @@ -0,0 +1,18 @@ +import "../../"; + +declare module "../../" { + interface StyleActiveLine { + /** + * Controls whether single-line selections, or just cursor selections, are styled. Defaults to false (only cursor selections). + */ + nonEmpty: boolean; + } + + interface EditorConfiguration { + /** + * When enabled gives the wrapper of the line that contains the cursor the class CodeMirror-activeline, + * adds a background with the class CodeMirror-activeline-background, and adds the class CodeMirror-activeline-gutter to the line's gutter space is enabled. + */ + styleActiveLine?: StyleActiveLine | boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/selection/mark-selection.d.ts b/node_modules/@types/codemirror/addon/selection/mark-selection.d.ts new file mode 100644 index 000000000..09052f7f1 --- /dev/null +++ b/node_modules/@types/codemirror/addon/selection/mark-selection.d.ts @@ -0,0 +1,11 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** + * Causes the selected text to be marked with the CSS class CodeMirror-selectedtext or a custom class when the styleSelectedText option is enabled. + * Useful to change the colour of the selection (in addition to the background). + */ + styleSelectedText?: boolean | string | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/selection/selection-pointer.d.ts b/node_modules/@types/codemirror/addon/selection/selection-pointer.d.ts new file mode 100644 index 000000000..46e7da6ad --- /dev/null +++ b/node_modules/@types/codemirror/addon/selection/selection-pointer.d.ts @@ -0,0 +1,11 @@ +import "../../"; + +declare module "../../" { + interface EditorConfiguration { + /** + * Controls the mouse cursor appearance when hovering over the selection. It can be set to a string, like "pointer", or to true, + * in which case the "default" (arrow) cursor will be used. + */ + selectionPointer?: boolean | string | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/tern/tern.d.ts b/node_modules/@types/codemirror/addon/tern/tern.d.ts new file mode 100644 index 000000000..d94d36259 --- /dev/null +++ b/node_modules/@types/codemirror/addon/tern/tern.d.ts @@ -0,0 +1,105 @@ +// See docs https://codemirror.net/doc/manual.html#addon_tern and https://codemirror.net/addon/tern/tern.js (comments in the beginning of the file) +// Docs for tern itself might also be helpful: http://ternjs.net/doc/manual.html + +import * as Tern from "tern"; +import "../../"; + +declare module "../../" { + class TernServer { + constructor(options?: TernOptions); + + readonly options: TernOptions; + readonly docs: { + readonly [key: string]: { + doc: Doc; + name: string; + changed: { + from: number; + to: number; + } | null; + }; + }; + readonly server: Tern.Server; + addDoc( + name: string, + doc: Doc, + ): { doc: Doc; name: string; changed: { from: number; to: number } | null }; + delDoc(id: string | Editor | Doc): void; + hideDoc(id: string | Editor | Doc): void; + complete(cm: Editor): void; + showType(cm: Editor, pos?: Position, callback?: () => void): void; + showDocs(cm: Editor, pos?: Position, callback?: () => void): void; + updateArgHints(cm: Editor): void; + jumpToDef(cm: Editor): void; + jumpBack(cm: Editor): void; + rename(cm: Editor): void; + selectName(cm: Editor): void; + request( + cm: Doc, + query: Q, + callback: (error?: Error, data?: Tern.QueryResult) => void, + pos?: Position, + ): void; + request( + cm: Doc, + query: Q, + callback: (error?: Error, data?: Tern.QueryRegistry[Q]["result"]) => void, + pos?: Position, + ): void; + destroy(): void; + } + + interface TernOptions { + /** An object mapping plugin names to configuration options. */ + plugins?: Tern.ConstructorOptions["plugins"] | undefined; + /** An array of JSON definition data structures. */ + defs?: Tern.Def[] | undefined; + /** + * Can be used to access files in + * the project that haven't been loaded yet. Simply do callback(null) to + * indicate that a file is not available. + */ + getFile?(name: string, callback: (docValue: string | null) => any): any; + /** + * This function will be applied + * to documents before passing them on to Tern. + */ + fileFilter?(value: string, docName: string, doc: Doc): string; + /** This function should, when providing a multi-file view, switch the view or focus to the named file. */ + switchToDoc?(name: string, doc: Doc): void; + /** Can be used to override the way errors are displayed. */ + showError?(editor: Editor, message: Error | string): void; + /** + * Customize the content in tooltips for completions. + * Is passed a single argument — the completion's data as returned by + * Tern — and may return a string, DOM node, or null to indicate that + * no tip should be shown. By default the docstring is shown. + */ + completionTip?(data: Tern.CompletionsQueryResult): string | HTMLElement | null; + /** Like completionTip, but for the tooltips shown for type queries. */ + typeTip?(data: Tern.TypeQueryResult): string | HTMLElement | null; + /** This function will be applied to the Tern responses before treating them */ + responseFilter?( + doc: Doc, + query: Q, + request: Tern.Document, + error: Error | undefined, + data: Tern.QueryResult | undefined, + ): Tern.QueryResult | undefined; + /** + * Set to true to enable web worker mode. You'll probably + * want to feature detect the actual value you use here, for example + * !!window.Worker. + */ + useWorker?: boolean | undefined; + /** The main script of the worker. Point this to wherever you are hosting worker.js from this directory. */ + workerScript?: string | undefined; + /** + * An array of paths pointing (relative to workerScript) + * to the Acorn and Tern libraries and any Tern plugins you want to + * load. Or, if you minified those into a single script and included + * them in the workerScript, simply leave this undefined. + */ + workerDeps?: string[] | undefined; + } +} diff --git a/node_modules/@types/codemirror/addon/wrap/hardwrap.d.ts b/node_modules/@types/codemirror/addon/wrap/hardwrap.d.ts new file mode 100644 index 000000000..1602dd525 --- /dev/null +++ b/node_modules/@types/codemirror/addon/wrap/hardwrap.d.ts @@ -0,0 +1,25 @@ +import "../../"; + +export interface HardwrapOptions { + column?: number | undefined; + paragraphStart?: RegExp | undefined; + paragraphEnd?: RegExp | undefined; + wrapOn?: RegExp | undefined; + killTrailingSpace?: boolean | undefined; + forceBreak?: boolean | undefined; +} + +declare module "../../" { + interface CommandActions { + wrapLines(cm: Editor): void; + } + + interface Editor { + /** Wraps the paragraph at the given position. If pos is not given, it defaults to the cursor position. */ + wrapParagraph(pos?: Position, options?: HardwrapOptions): void; + /** Wraps the given range as one big paragraph. */ + wrapRange(from: Position, to: Position, options?: HardwrapOptions): void; + /** Wraps the paragraphs in (and overlapping with) the given range individually. */ + wrapParagraphsInRange(from: Position, to: Position, options?: HardwrapOptions): void; + } +} diff --git a/node_modules/@types/codemirror/index.d.ts b/node_modules/@types/codemirror/index.d.ts new file mode 100644 index 000000000..4d86424a6 --- /dev/null +++ b/node_modules/@types/codemirror/index.d.ts @@ -0,0 +1,2062 @@ +export = CodeMirror; +export as namespace CodeMirror; + +declare function CodeMirror( + place: ParentNode | ((host: HTMLElement) => void), + options?: CodeMirror.EditorConfiguration, +): CodeMirror.Editor; + +declare namespace CodeMirror { + const Doc: DocConstructor; + const Pos: PositionConstructor; + const Pass: { toString(): "CodeMirror.PASS" }; + + /** Find the column position at a given string index using a given tabsize. */ + function countColumn(line: string, index: number | null, tabSize: number): number; + function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): EditorFromTextArea; + + /** Split a string by new line. */ + function splitLines(text: string): string[]; + + /** Check if a char is part of an alphabet. */ + function isWordChar(ch: string): boolean; + + /** Call startState of the mode if available, otherwise return true */ + function startState(mode: Mode, a1?: any, a2?: any): T | boolean; + + /** Compare two positions, return 0 if they are the same, a negative number when a is less, and a positive number otherwise. */ + function cmpPos(a: Position, b: Position): number; + + /** + * Utility function that computes an end position from a change (an object with from, to, and text properties, as passed to various event handlers). + * The returned position will be the end of the changed range, after the change is applied. + */ + function changeEnd(change: EditorChange): Position; + + /** + * It contains a string that indicates the version of the library. This is a triple of integers "major.minor.patch", + * where patch is zero for releases, and something else (usually one) for dev snapshots. + */ + const version: string; + + /** + * An object containing default values for all options. + * You can assign to its properties to modify defaults (though this won't affect editors that have already been created). + */ + const defaults: { + [option: string]: any; + }; + + /** + * If you want to define extra methods in terms of the CodeMirror API, it is possible to use defineExtension. + * This will cause the given value(usually a method) to be added to all CodeMirror instances created from then on. + */ + function defineExtension(name: string, value: any): void; + + /** Like defineExtension, but the method will be added to the interface for Doc objects instead. */ + function defineDocExtension(name: string, value: any): void; + + /** + * Similarly, defineOption can be used to define new options for CodeMirror. + * The updateFunc will be called with the editor instance and the new value when an editor is initialized, + * and whenever the option is modified through setOption. + */ + function defineOption(name: string, default_: any, updateFunc: (editor: Editor, val: any, old: any) => void): void; + + /** + * If your extension just needs to run some code whenever a CodeMirror instance is initialized, use CodeMirror.defineInitHook. + * Give it a function as its only argument, and from then on, that function will be called (with the instance as argument) + * whenever a new CodeMirror instance is initialized. + */ + function defineInitHook(func: (editor: Editor) => void): void; + + /** + * Registers a helper value with the given name in the given namespace (type). This is used to define functionality + * that may be looked up by mode. Will create (if it doesn't already exist) a property on the CodeMirror object for + * the given type, pointing to an object that maps names to values. I.e. after doing + * CodeMirror.registerHelper("hint", "foo", myFoo), the value CodeMirror.hint.foo will point to myFoo. + */ + function registerHelper(namespace: string, name: string, helper: any): void; + + /** Given a state object, returns a {state, mode} object with the inner mode and its state for the current position. */ + function innerMode(mode: Mode, state: any): { state: any; mode: Mode }; + + /** + * Sometimes, it is useful to add or override mode object properties from external code. + * The CodeMirror.extendMode function can be used to add properties to mode objects produced for a specific mode. + * Its first argument is the name of the mode, its second an object that specifies the properties that should be added. + * This is mostly useful to add utilities that can later be looked up through getMode. + */ + function extendMode(name: string, properties: Partial>): void; + + interface EditorEventMap { + change: (instance: Editor, changeObj: EditorChange) => void; + changes: (instance: Editor, changes: EditorChange[]) => void; + beforeChange: (instance: Editor, changeObj: EditorChangeCancellable) => void; + cursorActivity: (instance: Editor) => void; + keyHandled: (instance: Editor, name: string, event: Event) => void; + inputRead: (instance: Editor, changeObj: EditorChange) => void; + electricInput: (instance: Editor, line: number) => void; + beforeSelectionChange: (instance: Editor, obj: EditorSelectionChange) => void; + viewportChange: (instance: Editor, from: number, to: number) => void; + swapDoc: (instance: Editor, oldDoc: Doc) => void; + gutterClick: (instance: Editor, line: number, gutter: string, clickEvent: Event) => void; + gutterContextMenu: (instance: Editor, line: number, gutter: string, contextMenuEvent: MouseEvent) => void; + focus: (instance: Editor, event: FocusEvent) => void; + blur: (instance: Editor, event: FocusEvent) => void; + scroll: (instance: Editor) => void; + refresh: (instance: Editor) => void; + optionChange: (instance: Editor, option: keyof EditorConfiguration) => void; + scrollCursorIntoView: (instance: Editor, event: Event) => void; + update: (instance: Editor) => void; + renderLine: (instance: Editor, lineHandle: LineHandle, element: HTMLElement) => void; + overwriteToggle: (instance: Editor, overwrite: boolean) => void; + } + + interface DocEventMap { + change: (instance: Doc, changeObj: EditorChange) => void; + beforeChange: (instance: Doc, changeObj: EditorChangeCancellable) => void; + cursorActivity: (instance: Doc) => void; + beforeSelectionChange: (instance: Doc, obj: EditorSelectionChange) => void; + } + + interface LineHandleEventMap { + delete: () => void; + change: (instance: LineHandle, changeObj: EditorChange) => void; + } + + interface TextMarkerEventMap { + beforeCursorEnter: () => void; + clear: (from: Position, to: Position) => void; + hide: () => void; + unhide: () => void; + } + + interface LineWidgetEventMap { + redraw: () => void; + } + + function on(doc: Doc, eventName: T, handler: DocEventMap[T]): void; + function on(cm: Editor, eventName: T, handler: EditorEventMap[T]): void; + function on( + lineHandle: LineHandle, + eventName: T, + handler: LineHandleEventMap[T], + ): void; + function on( + textMarker: TextMarker, + eventName: T, + handler: TextMarkerEventMap[T], + ): void; + function on( + LineWidget: LineWidget, + eventName: T, + handler: LineWidgetEventMap[T], + ): void; + function on(element: any, eventName: string, handler: () => void): void; + + function off(doc: Doc, eventName: T, handler: DocEventMap[T]): void; + function off(cm: Editor, eventName: T, handler: EditorEventMap[T]): void; + function off( + lineHandle: LineHandle, + eventName: T, + handler: LineHandleEventMap[T], + ): void; + function off( + textMarker: TextMarker, + eventName: T, + handler: TextMarkerEventMap[T], + ): void; + function off( + lineWidget: LineWidget, + eventName: T, + handler: LineWidgetEventMap[T], + ): void; + function off(element: any, eventName: string, handler: () => void): void; + + /** + * Various CodeMirror-related objects emit events, which allow client code to react to various situations. + * Handlers for such events can be registered with the on and off methods on the objects that the event fires on. + * To fire your own events, use CodeMirror.signal(target, name, args...), where target is a non-DOM-node object. + */ + function signal(doc: Doc, eventName: T, ...args: Parameters): void; + function signal( + cm: Editor, + eventName: T, + ...args: Parameters + ): void; + function signal( + lineHandle: LineHandle, + eventName: T, + ...args: Parameters + ): void; + function signal( + textMarker: TextMarker, + eventName: T, + ...args: Parameters + ): void; + function signal( + lineWidget: LineWidget, + eventName: T, + ...args: Parameters + ): void; + function signal(target: any, name: string, ...args: any[]): void; + + /** Modify a keymap to normalize modifier order and properly recognize multi-stroke bindings. */ + function normalizeKeyMap(km: KeyMap): KeyMap; + + type DOMEvent = + | "mousedown" + | "dblclick" + | "touchstart" + | "contextmenu" + | "keydown" + | "keypress" + | "keyup" + | "cut" + | "copy" + | "paste" + | "dragstart" + | "dragenter" + | "dragover" + | "dragleave" + | "drop"; + + type CoordsMode = "window" | "page" | "local" | "div"; + + interface Token { + /** The character(on the given line) at which the token starts. */ + start: number; + /** The character at which the token ends. */ + end: number; + /** The token's string. */ + string: string; + /** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */ + type: string | null; + /** The mode's state at the end of this token. */ + state: any; + } + + interface KeyMap { + // eslint-disable-next-line @typescript-eslint/no-invalid-void-type + [keyName: string]: false | string | ((instance: Editor) => void | typeof Pass); + } + + /** + * Methods prefixed with doc. can, unless otherwise specified, be called both on CodeMirror (editor) instances and + * CodeMirror.Doc instances. Thus, the Editor interface extends DocOrEditor defining the common API. + */ + interface Editor extends DocOrEditor { + /** Tells you whether the editor currently has focus. */ + hasFocus(): boolean; + + /** + * Used to find the target position for horizontal cursor motion.start is a { line , ch } object, + * an integer(may be negative), and unit one of the string "char", "column", or "word". + * Will return a position that is produced by moving amount times the distance specified by unit. + * When visually is true , motion in right - to - left text will be visual rather than logical. + * When the motion was clipped by hitting the end or start of the document, the returned value will have a hitSide property set to true. + */ + findPosH( + start: Position, + amount: number, + unit: string, + visually: boolean, + ): { line: number; ch: number; hitSide?: boolean | undefined }; + + /** + * Similar to findPosH , but used for vertical motion.unit may be "line" or "page". + * The other arguments and the returned value have the same interpretation as they have in findPosH. + */ + findPosV( + start: Position, + amount: number, + unit: string, + ): { line: number; ch: number; hitSide?: boolean | undefined }; + + /** Returns the start and end of the 'word' (the stretch of letters, whitespace, or punctuation) at the given position. */ + findWordAt(pos: Position): Range; + + /** Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option. */ + setOption(option: K, value: EditorConfiguration[K]): void; + + /** Retrieves the current value of the given option for this editor instance. */ + getOption(option: K): EditorConfiguration[K]; + + /** + * Attach an additional keymap to the editor. + * This is mostly useful for add - ons that need to register some key handlers without trampling on the extraKeys option. + * Maps added in this way have a higher precedence than the extraKeys and keyMap options, and between them, + * the maps added earlier have a lower precedence than those added later, unless the bottom argument was passed, + * in which case they end up below other keymaps added with this method. + */ + addKeyMap(map: string | KeyMap, bottom?: boolean): void; + + /** + * Disable a keymap added with addKeyMap.Either pass in the keymap object itself , or a string, + * which will be compared against the name property of the active keymaps. + */ + removeKeyMap(map: string | KeyMap): void; + + /** + * Enable a highlighting overlay.This is a stateless mini-mode that can be used to add extra highlighting. + * For example, the search add - on uses it to highlight the term that's currently being searched. + * mode can be a mode spec or a mode object (an object with a token method). The options parameter is optional. If given, it should be an object. + * Currently, only the opaque option is recognized. This defaults to off, but can be given to allow the overlay styling, when not null, + * to override the styling of the base mode entirely, instead of the two being applied together. + */ + addOverlay(mode: any, options?: { opaque?: boolean | undefined; priority?: number | undefined }): void; + + /** Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again. */ + removeOverlay(mode: any): void; + + /** Retrieve the currently active document from an editor. */ + getDoc(): Doc; + + /** Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor. */ + swapDoc(doc: Doc): Doc; + + /** Get the content of the current editor document. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ + getValue(seperator?: string): string; + + /** Set the content of the current editor document. */ + setValue(content: string): void; + + /** + * start is a an optional string indicating which end of the selection to return. + * It may be "from", "to", "head" (the side of the selection that moves when you press shift+arrow), + * or "anchor" (the fixed side of the selection).Omitting the argument is the same as passing "head". A {line, ch} object will be returned. + */ + getCursor(start?: string): Position; + + /** + * Set the cursor position. You can either pass a single {line, ch} object, or the line and the character as two separate parameters. + * Will replace all selections with a single, empty selection at the given position. + * The supported options are the same as for setSelection + */ + setCursor( + pos: Position | number, + ch?: number, + options?: { bias?: number | undefined; origin?: string | undefined; scroll?: boolean | undefined }, + ): void; + + /** + * Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) to the given value. + * Value can be either null, to clear the marker, or a DOM element, to set it. The DOM element will be shown in the specified gutter next to the specified line. + */ + setGutterMarker(line: any, gutterID: string, value: HTMLElement | null): LineHandle; + + /** Remove all gutter markers in the gutter with the given ID. */ + clearGutter(gutterID: string): void; + + /** + * Set a CSS class name for the given line.line can be a number or a line handle. + * where determines to which element this class should be applied, can can be one of "text" (the text element, which lies in front of the selection), + * "background"(a background element that will be behind the selection), + * or "wrap" (the wrapper node that wraps all of the line's elements, including gutter elements). + * class should be the name of the class to apply. + */ + addLineClass(line: any, where: string, _class_: string): LineHandle; + + /** + * Remove a CSS class from a line.line can be a line handle or number. + * where should be one of "text", "background", or "wrap"(see addLineClass). + * class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. + */ + removeLineClass(line: any, where: string, class_?: string): LineHandle; + + /** + * Compute the line at the given pixel height. mode is the relative element + * to use to compute this line, it may be "window", "page" (the default), or "local" + */ + lineAtHeight(height: number, mode?: CoordsMode): number; + + /** + * Computes the height of the top of a line, in the coordinate system specified by mode, it may be "window", + * "page" (the default), or "local". When a line below the bottom of the document is specified, the returned value + * is the bottom of the last line in the document. By default, the position of the actual text is returned. + * If includeWidgets is true and the line has line widgets, the position above the first line widget is returned. + */ + heightAtLine(line: any, mode?: CoordsMode, includeWidgets?: boolean): number; + + /** Returns the line number, text content, and marker status of the given line, which can be either a number or a line handle. */ + lineInfo( + line: any, + ): { + line: any; + handle: any; + text: string; + /** Object mapping gutter IDs to marker elements. */ + gutterMarkers: any; + textClass: string; + bgClass: string; + wrapClass: string; + /** Array of line widgets attached to this line. */ + widgets: any; + }; + + /** + * Puts node, which should be an absolutely positioned DOM node, into the editor, positioned right below the given { line , ch } position. + * When scrollIntoView is true, the editor will ensure that the entire node is visible (if possible). + * To remove the widget again, simply use DOM methods (move it somewhere else, or call removeChild on its parent). + */ + addWidget(pos: Position, node: HTMLElement, scrollIntoView: boolean): void; + + /** + * Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. + * line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line. + * options, when given, should be an object that configures the behavior of the widget. + * Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. + */ + addLineWidget(line: any, node: HTMLElement, options?: LineWidgetOptions): LineWidget; + + /** + * Programatically set the size of the editor (overriding the applicable CSS rules). + * width and height height can be either numbers(interpreted as pixels) or CSS units ("100%", for example). + * You can pass null for either of them to indicate that that dimension should not be changed. + */ + setSize(width: any, height: any): void; + + /** Scroll the editor to a given(pixel) position.Both arguments may be left as null or undefined to have no effect. */ + scrollTo(x?: number | null, y?: number | null): void; + + /** + * Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area, + * and the size of the visible area(minus scrollbars). + */ + getScrollInfo(): ScrollInfo; + + /** + * Scrolls the given element into view. + * pos can be: + * - a { line , ch } position, referring to a given character + * - null, to refer to the cursor + * - a { left , top , right , bottom } object, in editor-local coordinates + * - a { from, to } object, in editor-local coordinates + * The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. + */ + scrollIntoView( + pos: Position | null | { line: number; ch: number } | { + left: number; + top: number; + right: number; + bottom: number; + } | { from: Position; to: Position }, + margin?: number, + ): void; + + /** + * Returns an { left , top , bottom } object containing the coordinates of the cursor position. + * If mode is "local", they will be relative to the top-left corner of the editable document. + * If it is "page" or not given, they are relative to the top-left corner of the page. + * where specifies the position at which you want to measure. A boolean indicates either the start(true) or the end(false) of the selection. + */ + cursorCoords( + where?: boolean | Position | null, + mode?: CoordsMode, + ): { left: number; top: number; bottom: number }; + + /** + * Returns the position and dimensions of an arbitrary character. pos should be a { line , ch } object. + * If mode is "local", they will be relative to the top-left corner of the editable document. + * If it is "page" or not given, they are relative to the top-left corner of the page. + * This differs from cursorCoords in that it'll give the size of the whole character, + * rather than just the position that the cursor would have when it would sit at that position. + */ + charCoords( + pos: Position, + mode?: CoordsMode, + ): { left: number; right: number; top: number; bottom: number }; + + /** + * Given an { left , top } object , returns the { line , ch } position that corresponds to it. + * The optional mode parameter determines relative to what the coordinates are interpreted. + * It may be "window", "page" (the default), or "local". + */ + coordsChar(object: { left: number; top: number }, mode?: CoordsMode): Position; + + /** Returns the line height of the default font for the editor. */ + defaultTextHeight(): number; + + /** + * Returns the pixel width of an 'x' in the default font for the editor. + * (Note that for non-monospace fonts, this is mostly useless, and even for monospace fonts, non-ascii characters might have a different width). + */ + defaultCharWidth(): number; + + /** + * Returns a { from , to } object indicating the start (inclusive) and end (exclusive) of the currently rendered part of the document. + * In big documents, when most content is scrolled out of view, CodeMirror will only render the visible part, and a margin around it. + * See also the viewportChange event. + */ + getViewport(): { from: number; to: number }; + + /** + * If your code does something to change the size of the editor element (window resizes are already listened for), or unhides it, + * you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. + */ + refresh(): void; + + /** Gets the inner mode at a given position. This will return the same as getMode for simple modes, but will return an inner mode for nesting modes (such as htmlmixed). */ + getModeAt(pos: Position): Mode; + + /** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */ + getTokenAt(pos: Position, precise?: boolean): Token; + + /** + * This is a (much) cheaper version of getTokenAt useful for when you just need the type of the token at a given position, + * and no other information. Will return null for unstyled tokens, and a string, potentially containing multiple + * space-separated style names, otherwise. + */ + getTokenTypeAt(pos: Position): string; + + /** This is similar to getTokenAt, but collects all tokens for a given line into an array. */ + getLineTokens(line: number, precise?: boolean): Token[]; + + /** + * Returns the mode's parser state, if any, at the end of the given line number. + * If no line number is given, the state at the end of the document is returned. + * This can be useful for storing parsing errors in the state, or getting other kinds of contextual information for a line. + */ + getStateAfter(line?: number): any; + + /** + * CodeMirror internally buffers changes and only updates its DOM structure after it has finished performing some operation. + * If you need to perform a lot of operations on a CodeMirror instance, you can call this method with a function argument. + * It will call the function, buffering up all changes, and only doing the expensive update after the function returns. + * This can be a lot faster. The return value from this method will be the return value of your function. + */ + operation(fn: () => T): T; + + /** + * In normal circumstances, use the above operation method. But if you want to buffer operations happening asynchronously, or that can't all be wrapped in a callback + * function, you can call startOperation to tell CodeMirror to start buffering changes, and endOperation to actually render all the updates. Be careful: if you use this + * API and forget to call endOperation, the editor will just never update. + */ + startOperation(): void; + endOperation(): void; + + /** + * Adjust the indentation of the given line. + * The second argument (which defaults to "smart") may be one of: + * "prev" Base indentation on the indentation of the previous line. + * "smart" Use the mode's smart indentation if available, behave like "prev" otherwise. + * "add" Increase the indentation of the line by one indent unit. + * "subtract" Reduce the indentation of the line. + */ + indentLine(line: number, dir?: string): void; + + /** Indent a selection */ + indentSelection(how: string): void; + + /** Tells you whether the editor's content can be edited by the user. */ + isReadOnly(): boolean; + + /** + * Switches between overwrite and normal insert mode (when not given an argument), + * or sets the overwrite mode to a specific state (when given an argument). + */ + toggleOverwrite(value?: boolean): void; + + /** Runs the command with the given name on the editor. */ + execCommand(name: string): void; + + /** Give the editor focus. */ + focus(): void; + + /** + * Allow the given string to be translated with the phrases option. + */ + phrase(text: string): unknown; + + /** Returns the hidden textarea used to read input. */ + getInputField(): HTMLTextAreaElement; + + /** Returns the DOM node that represents the editor, and controls its size. Remove this from your tree to delete an editor instance. */ + getWrapperElement(): HTMLElement; + + /** Returns the DOM node that is responsible for the scrolling of the editor. */ + getScrollerElement(): HTMLElement; + + /** Fetches the DOM node that contains the editor gutters. */ + getGutterElement(): HTMLElement; + + on(eventName: T, handler: EditorEventMap[T]): void; + on( + eventName: K, + handler: (instance: Editor, event: GlobalEventHandlersEventMap[K]) => void, + ): void; + + off(eventName: T, handler: EditorEventMap[T]): void; + off( + eventName: K, + handler: (instance: Editor, event: GlobalEventHandlersEventMap[K]) => void, + ): void; + + /** Expose the state object, so that the Editor.state.completionActive property is reachable */ + state: any; + } + + interface EditorFromTextArea extends Editor { + /** Copy the content of the editor into the textarea. */ + save(): void; + + /** Remove the editor, and restore the original textarea (with the editor's current content). */ + toTextArea(): void; + + /** Returns the textarea that the instance was based on. */ + getTextArea(): HTMLTextAreaElement; + } + + interface ModeSpecOptions { + /** Below options are supported in CSS mode */ + + /** Whether to highlight non-standard CSS property keywords such as margin-inline or zoom (default: true). */ + highlightNonStandardPropertyKeywords?: boolean | undefined; + + /** Below options are supported in Cython/Python modes */ + + /** The version of Python to recognize. Default is 3. */ + version?: 2 | 3 | undefined; + /** + * If you have a single-line string that is not terminated at the end of the line, this will show subsequent + * lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false. + */ + singleLineStringErrors?: boolean | undefined; + /** + * If you want to write long arguments to a function starting on a new line, how much that line should be + * indented. Defaults to one normal indentation unit. + */ + hangingIndent?: number | undefined; + /** Regular Expression for single operator matching */ + singleOperators?: unknown | undefined; + /** Regular Expression for single delimiter matching default :^[\\(\\)\\[\\]\\{\\}@,:`=;\\.] */ + singleDelimiters?: unknown | undefined; + /** Regular Expression for double operators matching, default :^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*)) */ + doubleOperators?: unknown | undefined; + /** Regular Expression for double delimiters matching default :^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=)) */ + doubleDelimiters?: unknown | undefined; + /** Regular Expression for triple delimiters matching default :^((//=)|(>>=)|(<<=)|(\\*\\*=)) */ + tripleDelimiters?: unknown | undefined; + /** RegEx - Regular Expression for identifier, default :^[_A-Za-z][_A-Za-z0-9]* */ + identifiers?: unknown | undefined; + /** List of extra words ton consider as keywords */ + extra_keywords?: string[] | undefined; + /** List of extra words ton consider as builtins */ + extra_builtins?: string[] | undefined; + + /** useCPP, which determines whether C preprocessor directives are recognized. */ + useCPP?: boolean | undefined; + + /** Below options are supported in Handlebars/Haskell/YAML front matter mode */ + base?: string | undefined; + + /** Below options are supported in HTML mixed mode */ + tags?: { [key: string]: unknown } | undefined; + + /** Below options are supported in JavaScript mixed mode */ + + /** json which will set the mode to expect JSON data rather than a JavaScript program. */ + json?: boolean | undefined; + /** jsonld which will set the mode to expect JSON-LD linked data rather than a JavaScript program */ + jsonld?: boolean | undefined; + /** typescript which will activate additional syntax highlighting and some other things for TypeScript code */ + typescript?: boolean | undefined; + /** + * trackScope can be set to false to turn off tracking of local variables. This will prevent locals from getting + * the "variable-2" token type, and will break completion of locals with javascript-hint. + */ + trackScope?: boolean | undefined; + /** + * statementIndent which (given a number) will determine the amount of indentation to use for statements + * continued on a new line. + */ + statementIndent?: boolean | undefined; + /** + * wordCharacters, a regexp that indicates which characters should be considered part of an identifier. + * Defaults to /[\w$]/, which does not handle non-ASCII identifiers. Can be set to something more elaborate to + * improve Unicode support. + */ + wordCharacters?: unknown | undefined; + + /** Below options are supported in Markdown mixed mode */ + + /** Whether to separately highlight markdown meta characters (*[]()etc.) (default: false). */ + highlightFormatting?: boolean | undefined; + /** Maximum allowed blockquote nesting (default: 0 - infinite nesting). */ + maxBlockquoteDepth?: boolean | undefined; + /** Whether to highlight inline XML (default: true). */ + xml?: boolean | undefined; + /** + * Whether to syntax-highlight fenced code blocks, if given mode is included, or fencedCodeBlockDefaultMode + * is set (default: true). + */ + fencedCodeBlockHighlighting?: boolean | undefined; + /** Mode to use for fencedCodeBlockHighlighting, if given mode is not included. */ + fencedCodeBlockDefaultMode?: string | undefined; + /** When you want to override default token type names (e.g. {code: "code"}). */ + tokenTypeOverrides?: unknown | undefined; + /** Allow lazy headers without whitespace between hashtag and text (default: false). */ + allowAtxHeaderWithoutSpace?: boolean | undefined; + + /** Below options are supported in GFM mode mode */ + gitHubSpice?: boolean | undefined; + taskLists?: boolean | undefined; + strikethrough?: boolean | undefined; + emoji?: boolean | undefined; + + /** Below options are supported in Smarty mode */ + + /** leftDelimiter and rightDelimiter, which should be strings that determine where the Smarty syntax starts and ends. */ + leftDelimiter?: string | undefined; + rightDelimiter?: string | undefined; + baseMode?: string | undefined; + + /** Below options are supported in sTeX mode */ + + /** Whether to start parsing in math mode (default: false) */ + inMathMode?: boolean | undefined; + + /** Below options are supported in SystemVerilog mode */ + + /** List of keywords which should not cause indentation to increase. */ + noIndentKeywords?: unknown | undefined; + + /** Below options are supported in VHDL mode */ + + /** List of atom words. Default: "null" */ + atoms?: unknown | undefined; + /** List of meta hooks. Default: ["`", "$"] */ + hooks?: unknown | undefined; + /** Whether multi-line strings are accepted. Default: false */ + multiLineStrings?: boolean | undefined; + + /** Below options are supported in XML mode */ + + /** + * This switches the mode to parse HTML instead of XML. This means attributes do not have to be quoted, + * and some elements (such as br) do not require a closing tag. + */ + htmlMode?: boolean | undefined; + /** + * Controls whether the mode checks that close tags match the corresponding opening tag, + * and highlights mismatches as errors. Defaults to true. + */ + matchClosing?: boolean | undefined; + /** Setting this to true will force the opening tag of CDATA blocks to not be indented. */ + alignCDATA?: boolean | undefined; + } + + type ModeSpec = + & { + [P in keyof T]: T[P]; + } + & { name: string }; + + interface SelectionOptions { + /** + * Determines whether the selection head should be scrolled into view. Defaults to true. + */ + scroll?: boolean | undefined; + + /** + * Determines whether the selection history event may be merged with the previous one. + * When an origin starts with the character +, and the last recorded selection had the same origin + * and was similar (close in time, both collapsed or both non-collapsed), the new one will replace + * the old one. When it starts with *, it will always replace the previous event (if that had the same + * origin). Built-in motion uses the "+move" origin. User input uses the "+input" origin. + */ + origin?: string | undefined; + + /** + * Determine the direction into which the selection endpoints should be adjusted when they fall inside + * an atomic range. Can be either -1 (backward) or 1 (forward). When not given, the bias will be based + * on the relative position of the old selection—the editor will try to move further away from that, + * to prevent getting stuck. + */ + bias?: number | undefined; + } + + interface DocConstructor { + new(text: string, mode?: string | ModeSpec, firstLineNumber?: number, lineSep?: string): Doc; + (text: string, mode?: string | ModeSpec, firstLineNumber?: number, lineSep?: string): Doc; + } + + interface DocOrEditor { + /** Get the mode option */ + modeOption: string | ModeSpec; + + /** Get the current editor content. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */ + getValue(seperator?: string): string; + + /** Set the editor content. */ + setValue(content: string): void; + + /** + * Get the text between the given points in the editor, which should be {line, ch} objects. + * An optional third argument can be given to indicate the line separator string to use (defaults to "\n"). + */ + getRange(from: Position, to: Position, seperator?: string): string; + + /** + * Replace the part of the document between from and to with the given string. + * from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. + */ + replaceRange( + replacement: string | string[], + from: Position, + to?: Position, + origin?: string, + ): void; + + /** Get the content of line n. */ + getLine(n: number): string; + + /** Set the content of line n. */ + setLine(n: number, text: string): void; + + /** Remove the given line from the document. */ + removeLine(n: number): void; + + /** Get the number of lines in the editor. */ + lineCount(): number; + + /** + * Get the first line of the editor. This will usually be zero but for linked sub-views, + * or documents instantiated with a non-zero first line, it might return other values. + */ + firstLine(): number; + + /** Get the last line of the editor. This will usually be lineCount() - 1, but for linked sub-views, it might return other values. */ + lastLine(): number; + + /** Fetches the line handle for the given line number. */ + getLineHandle(num: number): LineHandle; + + /** Given a line handle, returns the current position of that line (or null when it is no longer in the document). */ + getLineNumber(handle: LineHandle): number | null; + + /** + * Iterate over the whole document, and call f for each line, passing the line handle. + * This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. + * Note that line handles have a text property containing the line's content (as a string). + */ + eachLine(f: (line: LineHandle) => void): void; + + /** + * Iterate over the range from start up to (not including) end, and call f for each line, passing the line handle. + * This is a faster way to visit a range of line handlers than calling getLineHandle for each of them. + * Note that line handles have a text property containing the line's content (as a string). + */ + eachLine(start: number, end: number, f: (line: LineHandle) => void): void; + + /** + * Set the editor content as 'clean', a flag that it will retain until it is edited, and which will be set again + * when such an edit is undone again. Useful to track whether the content needs to be saved. This function is deprecated + * in favor of changeGeneration, which allows multiple subsystems to track different notions of cleanness without interfering. + */ + markClean(): void; + + /** + * Returns a number that can later be passed to isClean to test whether any edits were made (and not undone) in the + * meantime. If closeEvent is true, the current history event will be ‘closed’, meaning it can't be combined with further + * changes (rapid typing or deleting events are typically combined). + */ + changeGeneration(closeEvent?: boolean): number; + + /** + * Returns whether the document is currently clean — not modified since initialization or the last call to markClean if + * no argument is passed, or since the matching call to changeGeneration if a generation value is given. + */ + isClean(generation?: number): boolean; + + /** Get the currently selected code. */ + getSelection(): string; + + /** Returns an array containing a string for each selection, representing the content of the selections. */ + getSelections(lineSep?: string): string[]; + + /** + * Replace the selection with the given string. By default, the new selection will span the inserted text. + * The optional collapse argument can be used to change this -- passing "start" or "end" will collapse the selection to the start or end of the inserted text. + */ + replaceSelection(replacement: string, collapse?: string): void; + + /** + * Replaces the content of the selections with the strings in the array. + * The length of the given array should be the same as the number of active selections. + * The collapse argument works the same as in replaceSelection. + */ + replaceSelections(replacements: string[], collapse?: string): void; + + /** + * start is a an optional string indicating which end of the selection to return. + * It may be "from", "to", "head" (the side of the selection that moves when you press shift+arrow), + * or "anchor" (the fixed side of the selection).Omitting the argument is the same as passing "head". A {line, ch} object will be returned. + */ + getCursor(start?: string): Position; + + /** + * Retrieves a list of all current selections. These will always be sorted, and never overlap (overlapping selections are merged). + * Each object in the array contains anchor and head properties referring to {line, ch} objects. + */ + listSelections(): Range[]; + + /** Return true if any text is selected. */ + somethingSelected(): boolean; + + /** + * Set the cursor position. You can either pass a single {line, ch} object, or the line and the character as two separate parameters. + * Will replace all selections with a single, empty selection at the given position. + * The supported options are the same as for setSelection + */ + setCursor( + pos: Position | number, + ch?: number, + options?: { bias?: number | undefined; origin?: string | undefined; scroll?: boolean | undefined }, + ): void; + + /** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */ + setSelection( + anchor: Position, + head?: Position, + options?: { bias?: number | undefined; origin?: string | undefined; scroll?: boolean | undefined }, + ): void; + + /** + * Sets a new set of selections. There must be at least one selection in the given array. When primary is a + * number, it determines which selection is the primary one. When it is not given, the primary index is taken from + * the previous selection, or set to the last range if the previous selection had less ranges than the new one. + * Supports the same options as setSelection. + */ + setSelections( + ranges: Array<{ anchor: Position; head: Position }>, + primary?: number, + options?: SelectionOptions, + ): void; + + /** + * Adds a new selection to the existing set of selections, and makes it the primary selection. + */ + addSelection(anchor: Position, head?: Position): void; + + /** + * Similar to setSelection, but will, if shift is held or the extending flag is set, + * move the head of the selection while leaving the anchor at its current place. + * to is optional, and can be passed to ensure a region (for example a word or paragraph) will end up selected + * (in addition to whatever lies between that region and the current anchor). When multiple selections + * are present, all but the primary selection will be dropped by this method. Supports the same options + * as setSelection. + */ + extendSelection(from: Position, to?: Position, options?: SelectionOptions): void; + + /** + * An equivalent of extendSelection that acts on all selections at once. + */ + extendSelections(heads: Position[], options?: SelectionOptions): void; + + /** + * Applies the given function to all existing selections, and calls extendSelections on the result. + */ + extendSelectionsBy(f: (range: Range) => Position): void; + + /** + * Sets or clears the 'extending' flag , which acts similar to the shift key, + * in that it will cause cursor movement and calls to extendSelection to leave the selection anchor in place. + */ + setExtending(value: boolean): void; + + /** + * Get the value of the 'extending' flag. + */ + getExtending(): boolean; + + /** Create a new document that's linked to the target document. Linked documents will stay in sync (changes to one are also applied to the other) until unlinked. */ + linkedDoc(options: { + /** + * When turned on, the linked copy will share an undo history with the original. + * Thus, something done in one of the two can be undone in the other, and vice versa. + */ + sharedHist?: boolean | undefined; + from?: number | undefined; + /** + * Can be given to make the new document a subview of the original. Subviews only show a given range of lines. + * Note that line coordinates inside the subview will be consistent with those of the parent, + * so that for example a subview starting at line 10 will refer to its first line as line 10, not 0. + */ + to?: number | undefined; + /** By default, the new document inherits the mode of the parent. This option can be set to a mode spec to give it a different mode. */ + mode?: string | ModeSpec | undefined; + }): Doc; + + /** + * Break the link between two documents. After calling this , changes will no longer propagate between the documents, + * and, if they had a shared history, the history will become separate. + */ + unlinkDoc(doc: Doc): void; + + /** + * Will call the given function for all documents linked to the target document. It will be passed two arguments, + * the linked document and a boolean indicating whether that document shares history with the target. + */ + iterLinkedDocs(fn: (doc: Doc, sharedHist: boolean) => void): void; + + /** Undo one edit (if any undo events are stored). */ + undo(): void; + + /** Redo one undone edit. */ + redo(): void; + + /** + * Undo one edit or selection change. + */ + undoSelection(): void; + + /** + * Redo one undone edit or selection change. + */ + redoSelection(): void; + + /** Returns an object with {undo, redo } properties , both of which hold integers , indicating the amount of stored undo and redo operations. */ + historySize(): { undo: number; redo: number }; + + /** Clears the editor's undo history. */ + clearHistory(): void; + + /** Get a (JSON - serializeable) representation of the undo history. */ + getHistory(): any; + + /** + * Replace the editor's undo history with the one provided, which must be a value as returned by getHistory. + * Note that this will have entirely undefined results if the editor content isn't also the same as it was when getHistory was called. + */ + setHistory(history: any): void; + + /** Can be used to mark a range of text with a specific CSS class name. from and to should be { line , ch } objects. */ + markText( + from: Position, + to: Position, + options?: TextMarkerOptions, + ): TextMarker; + + /** + * Inserts a bookmark, a handle that follows the text around it as it is being edited, at the given position. + * A bookmark has two methods find() and clear(). The first returns the current position of the bookmark, if it is still in the document, + * and the second explicitly removes the bookmark. + */ + setBookmark( + pos: Position, + options?: { + /** Can be used to display a DOM node at the current location of the bookmark (analogous to the replacedWith option to markText). */ + widget?: HTMLElement | undefined; + + /** + * By default, text typed when the cursor is on top of the bookmark will end up to the right of the bookmark. + * Set this option to true to make it go to the left instead. + */ + insertLeft?: boolean | undefined; + + /** + * When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents. + * By default, a marker appears only in its target document. + */ + shared?: boolean | undefined; + + /** As with markText, this determines whether mouse events on the widget inserted for this bookmark are handled by CodeMirror. The default is false. */ + handleMouseEvents?: boolean | undefined; + }, + ): TextMarker; + + /** Returns an array of all the bookmarks and marked ranges found between the given positions. */ + findMarks(from: Position, to: Position): TextMarker[]; + + /** Returns an array of all the bookmarks and marked ranges present at the given position. */ + findMarksAt(pos: Position): TextMarker[]; + + /** Returns an array containing all marked ranges in the document. */ + getAllMarks(): TextMarker[]; + + /** + * Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards. + * line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line. + * options, when given, should be an object that configures the behavior of the widget. + * Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. + */ + addLineWidget(line: any, node: HTMLElement, options?: LineWidgetOptions): LineWidget; + + /** Remove the line widget */ + removeLineWidget(widget: LineWidget): void; + + /** + * Gets the mode object for the editor. Note that this is distinct from getOption("mode"), which gives you the mode specification, + * rather than the resolved, instantiated mode object. + */ + getMode(): Mode; + + /** Returns the preferred line separator string for this document, as per the option by the same name. When that option is null, the string "\n" is returned. */ + lineSeparator(): string; + + /** + * Calculates and returns a { line , ch } object for a zero-based index whose value is relative to the start of the editor's text. + * If the index is out of range of the text then the returned object is clipped to start or end of the text respectively. + */ + posFromIndex(index: number): Position; + + /** The reverse of posFromIndex. */ + indexFromPos(object: Position): number; + + /** Expose the state object, so that the Doc.state.completionActive property is reachable */ + state: any; + } + + interface Doc extends DocOrEditor { + /** Retrieve the editor associated with a document. May return null. */ + getEditor(): Editor | null; + + /** Create an identical copy of the given doc. When copyHistory is true , the history will also be copied. */ + copy(copyHistory: boolean): Doc; + + on(eventName: T, handler: DocEventMap[T]): void; + off(eventName: T, handler: DocEventMap[T]): void; + } + + interface LineHandle { + text: string; + on(eventName: T, handler: LineHandleEventMap[T]): void; + off(leventName: T, handler: LineHandleEventMap[T]): void; + } + + interface ScrollInfo { + left: number; + top: number; + width: number; + height: number; + clientWidth: number; + clientHeight: number; + } + + interface MarkerRange { + from: Position; + to: Position; + } + + interface TextMarker extends Partial { + /** Remove the mark. */ + clear(): void; + + /** + * Returns a {from, to} object (both holding document positions), indicating the current position of the marked range, + * or undefined if the marker is no longer in the document. + */ + find(): T | undefined; + + /** Called when you've done something that might change the size of the marker and want to cheaply update the display */ + changed(): void; + + on(eventName: T, handler: TextMarkerEventMap[T]): void; + off(eventName: T, handler: TextMarkerEventMap[T]): void; + } + + interface LineWidget { + /** Removes the widget. */ + clear(): void; + + /** + * Call this if you made some change to the widget's DOM node that might affect its height. + * It'll force CodeMirror to update the height of the line that contains the widget. + */ + changed(): void; + + on(eventName: T, handler: LineWidgetEventMap[T]): void; + off(eventName: T, handler: LineWidgetEventMap[T]): void; + } + + interface LineWidgetOptions { + /** Whether the widget should cover the gutter. */ + coverGutter?: boolean | undefined; + /** Whether the widget should stay fixed in the face of horizontal scrolling. */ + noHScroll?: boolean | undefined; + /** Causes the widget to be placed above instead of below the text of the line. */ + above?: boolean | undefined; + /** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */ + showIfHidden?: boolean | undefined; + /** + * Determines whether the editor will capture mouse and drag events occurring in this widget. + * Default is false—the events will be left alone for the default browser handler, or specific handlers on the widget, to capture. + */ + handleMouseEvents?: boolean | undefined; + /** + * By default, the widget is added below other widgets for the line. + * This option can be used to place it at a different position (zero for the top, N to put it after the Nth other widget). + * Note that this only has effect once, when the widget is created. + */ + insertAt?: number | undefined; + /** Add an extra CSS class name to the wrapper element created for the widget. */ + className?: string | undefined; + } + + interface EditorChange { + /** Position (in the pre-change coordinate system) where the change started. */ + from: Position; + /** Position (in the pre-change coordinate system) where the change ended. */ + to: Position; + /** Array of strings representing the text that replaced the changed range (split by line). */ + text: string[]; + /** Text that used to be between from and to, which is overwritten by this change. */ + removed?: string[] | undefined; + /** String representing the origin of the change event and whether it can be merged with history */ + origin?: string | undefined; + } + + interface EditorChangeCancellable extends EditorChange { + /** + * may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. + * If the change came from undo/redo, `update` is undefined and the change cannot be modified. + */ + update?(from?: Position, to?: Position, text?: string[]): void; + + cancel(): void; + } + + interface PositionConstructor { + new(line: number, ch?: number, sticky?: string): Position; + (line: number, ch?: number, sticky?: string): Position; + } + + interface EditorSelectionChange { + ranges: Range[]; + update(ranges: Range[]): void; + origin?: string | undefined; + } + + interface Range { + anchor: Position; + head: Position; + from(): Position; + to(): Position; + empty(): boolean; + } + + interface Position { + ch: number; + line: number; + sticky?: string | undefined; + } + + interface ScrollbarMeasure { + clientHeight: number; + viewHeight: number; + scrollWidth: number; + viewWidth: number; + barLeft: number; + docHeight: number; + scrollHeight: number; + nativeBarWidth: number; + gutterWidth: number; + } + + interface ScrollbarModel { + update(measure: ScrollbarMeasure): { bottom: number; right: number }; + clear(): void; + setScrollLeft(pos: number): void; + setScrollTop(pos: number): void; + } + + interface ScrollbarModelConstructor { + new( + place: (node: Element) => void, + scroll: (pos: number, axis: "horizontal" | "vertical") => void, + ): ScrollbarModel; + } + + interface ScrollbarModels { + native: ScrollbarModelConstructor; + null: ScrollbarModelConstructor; + } + + const scrollbarModel: ScrollbarModels; + + type InputStyle = "textarea" | "contenteditable"; + + interface EditorConfiguration { + /** The starting value of the editor. Can be a string, or a document object. */ + value?: string | Doc | undefined; + + /** + * string|object. The mode to use. When not given, this will default to the first mode that was loaded. + * It may be a string, which either simply names the mode or is a MIME type associated with the mode. + * Alternatively, it may be an object containing configuration options for the mode, + * with a name property that names the mode (for example {name: "javascript", json: true}). + */ + mode?: string | ModeSpec | undefined; + + /** + * Explicitly set the line separator for the editor. By default (value null), the document will be split on CRLFs as well + * as lone CRs and LFs, and a single LF will be used as line separator in all output (such as getValue). When a specific + * string is given, lines will only be split on that string, and output will, by default, use that same separator. + */ + lineSeparator?: string | null | undefined; + + /** + * The theme to style the editor with. You must make sure the CSS file defining the corresponding .cm-s-[name] styles is loaded. + * The default is "default". + */ + theme?: string | undefined; + + /** How many spaces a block (whatever that means in the edited language) should be indented. The default is 2. */ + indentUnit?: number | undefined; + + /** Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before). Defaults to true. */ + smartIndent?: boolean | undefined; + + /** The width of a tab character. Defaults to 4. */ + tabSize?: number | undefined; + + /** Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. Default is false. */ + indentWithTabs?: boolean | undefined; + + /** + * Configures whether the editor should re-indent the current line when a character is typed + * that might change its proper indentation (only works if the mode supports indentation). Default is true. + */ + electricChars?: boolean | undefined; + + /** + * A regular expression used to determine which characters should be replaced by a special placeholder. Mostly useful for non-printing + * special characters. The default is /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/. + */ + specialChars?: RegExp | undefined; + + /** + * A function that, given a special character identified by the specialChars option, produces a DOM node that is used to + * represent the character. By default, a red dot (•) is shown, with a title tooltip to indicate the character code. + */ + specialCharPlaceholder?: ((char: string) => HTMLElement) | undefined; + + /** + * Flips overall layout and selects base paragraph direction to be left-to-right or right-to-left. Default is "ltr". CodeMirror + * applies the Unicode Bidirectional Algorithm to each line, but does not autodetect base direction — it's set to the editor + * direction for all lines. The resulting order is sometimes wrong when base direction doesn't match user intent (for example, + * leading and trailing punctuation jumps to the wrong side of the line). Therefore, it's helpful for multilingual input to let + * users toggle this option. + */ + direction?: "ltr" | "rtl" | undefined; + + /** + * Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text + * is visual (pressing the left arrow moves the cursor left) + * or logical (pressing the left arrow moves to the next lower index in the string, which is visually right in right-to-left text). + * The default is false on Windows, and true on other platforms. + */ + rtlMoveVisually?: boolean | undefined; + + /** + * Configures the keymap to use. The default is "default", which is the only keymap defined in codemirror.js itself. + * Extra keymaps are found in the keymap directory. See the section on keymaps for more information. + */ + keyMap?: string | undefined; + + /** Can be used to specify extra keybindings for the editor, alongside the ones defined by keyMap. Should be either null, or a valid keymap value. */ + extraKeys?: string | KeyMap | undefined; + + /** Allows you to configure the behavior of mouse selection and dragging. The function is called when the left mouse button is pressed. */ + configureMouse?: + | (( + cm: Editor, + repeat: "single" | "double" | "triple", + event: Event, + ) => MouseSelectionConfiguration) + | undefined; + + /** Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll). */ + lineWrapping?: boolean | undefined; + + /** Whether to show line numbers to the left of the editor. */ + lineNumbers?: boolean | undefined; + + /** At which number to start counting lines. Default is 1. */ + firstLineNumber?: number | undefined; + + /** A function used to format line numbers. The function is passed the line number, and should return a string that will be shown in the gutter. */ + lineNumberFormatter?: ((line: number) => string) | undefined; + + /** + * Can be used to add extra gutters (beyond or instead of the line number gutter). + * Should be an array of CSS class names, each of which defines a width (and optionally a background), + * and which will be used to draw the background of the gutters. + * May include the CodeMirror-linenumbers class, in order to explicitly set the position of the line number gutter + * (it will default to be to the right of all other gutters). These class names are the keys passed to setGutterMarker. + */ + gutters?: Array | undefined; + + /** + * Determines whether the gutter scrolls along with the content horizontally (false) + * or whether it stays fixed during horizontal scrolling (true, the default). + */ + fixedGutter?: boolean | undefined; + + /** + * Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also + * provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models. + */ + scrollbarStyle?: keyof ScrollbarModels | undefined; + + /** + * When fixedGutter is on, and there is a horizontal scrollbar, by default the gutter will be visible to the left of this scrollbar. + * If this option is set to true, it will be covered by an element with class CodeMirror-gutter-filler. + */ + coverGutterNextToScrollbar?: boolean | undefined; + + /** + * Selects the way CodeMirror handles input and focus. + * The core library defines the "textarea" and "contenteditable" input models. + * On mobile browsers, the default is "contenteditable". On desktop browsers, the default is "textarea". + * Support for IME and screen readers is better in the "contenteditable" model. + */ + inputStyle?: InputStyle | undefined; + + /** boolean|string. This disables editing of the editor content by the user. If the special value "nocursor" is given (instead of simply true), focusing of the editor is also disallowed. */ + readOnly?: boolean | "nocursor" | undefined; + + /** This label is read by the screenreaders when CodeMirror text area is focused. This is helpful for accessibility. */ + screenReaderLabel?: string | undefined; + + /** Whether the cursor should be drawn when a selection is active. Defaults to false. */ + showCursorWhenSelecting?: boolean | undefined; + + /** When enabled, which is the default, doing copy or cut when there is no selection will copy or cut the whole lines that have cursors on them. */ + lineWiseCopyCut?: boolean | undefined; + + /** + * When pasting something from an external source (not from the editor itself), if the number of lines matches the number of selection, + * CodeMirror will by default insert one line per selection. You can set this to false to disable that behavior. + */ + pasteLinesPerSelection?: boolean | undefined; + + /** Determines whether multiple selections are joined as soon as they touch (the default) or only when they overlap (true). */ + selectionsMayTouch?: boolean | undefined; + + /** The maximum number of undo levels that the editor stores. Defaults to 40. */ + undoDepth?: number | undefined; + + /** The period of inactivity (in milliseconds) that will cause a new history event to be started when typing or deleting. Defaults to 500. */ + historyEventDelay?: number | undefined; + + /** The tab index to assign to the editor. If not given, no tab index will be assigned. */ + tabindex?: number | undefined; + + /** + * Can be used to make CodeMirror focus itself on initialization. Defaults to off. + * When fromTextArea is used, and no explicit value is given for this option, it will be set to true when either the source textarea is focused, + * or it has an autofocus attribute and no other element is focused. + */ + autofocus?: boolean | undefined; + + /** + * Some addons run user-visible strings (such as labels in the interface) through the phrase method to allow for translation. + * This option determines the return value of that method. When it is null or an object that doesn't have a property named by + * the input string, that string is returned. Otherwise, the value of the property corresponding to that string is returned. + */ + phrases?: { [s: string]: unknown } | undefined; + + /** Controls whether drag-and - drop is enabled. On by default. */ + dragDrop?: boolean | undefined; + + /** + * When set (default is null) only files whose type is in the array can be dropped into the editor. + * The strings should be MIME types, and will be checked against the type of the File object as reported by the browser. + */ + allowDropFileTypes?: string[] | null | undefined; + + /** + * When given , this will be called when the editor is handling a dragenter , dragover , or drop event. + * It will be passed the editor instance and the event object as arguments. + * The callback can choose to handle the event itself , in which case it should return true to indicate that CodeMirror should not do anything further. + */ + onDragEvent?: ((instance: Editor, event: DragEvent) => boolean) | undefined; + + /** + * This provides a rather low-level hook into CodeMirror's key handling. + * If provided, this function will be called on every keydown, keyup, and keypress event that CodeMirror captures. + * It will be passed two arguments, the editor instance and the key event. + * This key event is pretty much the raw key event, except that a stop() method is always added to it. + * You could feed it to, for example, jQuery.Event to further normalize it. + * This function can inspect the key event, and handle it if it wants to. + * It may return true to tell CodeMirror to ignore the event. + * Be wary that, on some browsers, stopping a keydown does not stop the keypress from firing, whereas on others it does. + * If you respond to an event, you should probably inspect its type property and only do something when it is keydown + * (or keypress for actions that need character data). + */ + onKeyEvent?: ((instance: Editor, event: KeyboardEvent) => boolean) | undefined; + + /** Half - period in milliseconds used for cursor blinking. The default blink rate is 530ms. */ + cursorBlinkRate?: number | undefined; + + /** + * How much extra space to always keep above and below the cursor when + * approaching the top or bottom of the visible view in a scrollable document. Default is 0. + */ + cursorScrollMargin?: number | undefined; + + /** + * Determines the height of the cursor. Default is 1 , meaning it spans the whole height of the line. + * For some fonts (and by some tastes) a smaller height (for example 0.85), + * which causes the cursor to not reach all the way to the bottom of the line, looks better + */ + cursorHeight?: number | undefined; + + /** + * Controls whether, when the context menu is opened with a click outside of the current selection, + * the cursor is moved to the point of the click. Defaults to true. + */ + resetSelectionOnContextMenu?: boolean | undefined; + + /** + * Highlighting is done by a pseudo background thread that will work for workTime milliseconds, + * and then use timeout to sleep for workDelay milliseconds. + * The defaults are 200 and 300, you can change these options to make the highlighting more or less aggressive. + */ + workTime?: number | undefined; + + /** See workTime. */ + workDelay?: number | undefined; + + /** + * Indicates how quickly CodeMirror should poll its input textarea for changes(when focused). + * Most input is captured by events, but some things, like IME input on some browsers, don't generate events that allow CodeMirror to properly detect it. + * Thus, it polls. Default is 100 milliseconds. + */ + pollInterval?: number | undefined; + + /** + * By default, CodeMirror will combine adjacent tokens into a single span if they have the same class. + * This will result in a simpler DOM tree, and thus perform better. With some kinds of styling(such as rounded corners), + * this will change the way the document looks. You can set this option to false to disable this behavior. + */ + flattenSpans?: boolean | undefined; + + /** + * When enabled (off by default), an extra CSS class will be added to each token, indicating the (inner) mode that produced it, prefixed with "cm-m-". + * For example, tokens from the XML mode will get the cm-m-xml class. + */ + addModeClass?: boolean | undefined; + + /** + * When highlighting long lines, in order to stay responsive, the editor will give up and simply style + * the rest of the line as plain text when it reaches a certain position. The default is 10000. + * You can set this to Infinity to turn off this behavior. + */ + maxHighlightLength?: number | undefined; + + /** + * Specifies the amount of lines that are rendered above and below the part of the document that's currently scrolled into view. + * This affects the amount of updates needed when scrolling, and the amount of work that such an update does. + * You should usually leave it at its default, 10. Can be set to Infinity to make sure the whole document is always rendered, + * and thus the browser's text search works on it. This will have bad effects on performance of big documents. + */ + viewportMargin?: number | undefined; + + /** Specifies whether or not spellcheck will be enabled on the input. */ + spellcheck?: boolean | undefined; + + /** Specifies whether or not autocorrect will be enabled on the input. */ + autocorrect?: boolean | undefined; + + /** Specifies whether or not autocapitalization will be enabled on the input. */ + autocapitalize?: boolean | undefined; + } + + interface TextMarkerOptions { + /** Assigns a CSS class to the marked stretch of text. */ + className?: string | undefined; + + /** Determines whether text inserted on the left of the marker will end up inside or outside of it. */ + inclusiveLeft?: boolean | undefined; + + /** Like inclusiveLeft, but for the right side. */ + inclusiveRight?: boolean | undefined; + + /** For atomic ranges, determines whether the cursor is allowed to be placed directly to the left of the range. Has no effect on non-atomic ranges. */ + selectLeft?: boolean | undefined; + + /** Like selectLeft, but for the right side. */ + selectRight?: boolean | undefined; + + /** + * Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them. + * You can control whether the cursor is allowed to be placed directly before or after them using selectLeft or selectRight. + * If selectLeft (or right) is not provided, then inclusiveLeft (or right) will control this behavior. + */ + atomic?: boolean | undefined; + + /** Collapsed ranges do not show up in the display. Setting a range to be collapsed will automatically make it atomic. */ + collapsed?: boolean | undefined; + + /** + * When enabled, will cause the mark to clear itself whenever the cursor enters its range. + * This is mostly useful for text - replacement widgets that need to 'snap open' when the user tries to edit them. + * The "clear" event fired on the range handle can be used to be notified when this happens. + */ + clearOnEnter?: boolean | undefined; + + /** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */ + clearWhenEmpty?: boolean | undefined; + + /** + * Use a given node to display this range. Implies both collapsed and atomic. + * The given DOM node must be an inline element (as opposed to a block element). + */ + replacedWith?: HTMLElement | undefined; + + /** + * When replacedWith is given, this determines whether the editor will + * capture mouse and drag events occurring in this widget. Default is + * false—the events will be left alone for the default browser handler, + * or specific handlers on the widget, to capture. + */ + handleMouseEvents?: boolean | undefined; + + /** + * A read-only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document. + * Note: adding a read-only span currently clears the undo history of the editor, + * because existing undo events being partially nullified by read - only spans would corrupt the history (in the current implementation). + */ + readOnly?: boolean | undefined; + + /** When set to true (default is false), adding this marker will create an event in the undo history that can be individually undone (clearing the marker). */ + addToHistory?: boolean | undefined; + + /** Can be used to specify an extra CSS class to be applied to the leftmost span that is part of the marker. */ + startStyle?: string | undefined; + + /** Equivalent to startStyle, but for the rightmost span. */ + endStyle?: string | undefined; + + /** A string of CSS to be applied to the covered text. For example "color: #fe3". */ + css?: string | undefined; + + /** When given, will give the nodes created for this span a HTML title attribute with the given value. */ + title?: string | undefined; + + /** When given, add the attributes in the given object to the elements created for the marked text. Adding class or style attributes this way is not supported. */ + attributes?: { [name: string]: string } | undefined; + + /** + * When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents. + * By default, a marker appears only in its target document. + */ + shared?: boolean | undefined; + } + + class StringStream { + constructor(text: string); + lastColumnPos: number; + lastColumnValue: number; + lineStart: number; + + /** + * Current position in the string. + */ + pos: number; + + /** + * Where the stream's position was when it was first passed to the token function. + */ + start: number; + + /** + * The current line's content. + */ + string: string; + + /** + * Number of spaces per tab character. + */ + tabSize: number; + + /** + * Returns true only if the stream is at the end of the line. + */ + eol(): boolean; + + /** + * Returns true only if the stream is at the start of the line. + */ + sol(): boolean; + + /** + * Returns the next character in the stream without advancing it. Will return an null at the end of the line. + */ + peek(): string | null; + + /** + * Returns the next character in the stream and advances it. Also returns null when no more characters are available. + */ + next(): string | null; + + /** + * match can be a character, a regular expression, or a function that takes a character and returns a boolean. + * If the next character in the stream 'matches' the given argument, it is consumed and returned. + * Otherwise, undefined is returned. + */ + eat(match: string | RegExp | ((char: string) => boolean)): string; + + /** + * Repeatedly calls eat with the given argument, until it fails. Returns true if any characters were eaten. + */ + eatWhile(match: string | RegExp | ((char: string) => boolean)): boolean; + + /** + * Shortcut for eatWhile when matching white-space. + */ + eatSpace(): boolean; + + /** + * Moves the position to the end of the line. + */ + skipToEnd(): void; + + /** + * Skips to the next occurrence of the given character, if found on the current line (doesn't advance the stream if + * the character does not occur on the line). + * + * Returns true if the character was found. + */ + skipTo(ch: string): boolean; + + /** + * Act like a multi-character eat - if consume is true or not given - or a look-ahead that doesn't update the stream + * position - if it is false. pattern can be either a string or a regular expression starting with ^. When it is a + * string, caseFold can be set to true to make the match case-insensitive. When successfully matching a regular + * expression, the returned value will be the array returned by match, in case you need to extract matched groups. + */ + match(pattern: string, consume?: boolean, caseFold?: boolean): boolean; + match(pattern: RegExp, consume?: boolean): string[]; + + /** + * Backs up the stream n characters. Backing it up further than the start of the current token will cause things to + * break, so be careful. + */ + backUp(n: number): void; + + /** + * Returns the column (taking into account tabs) at which the current token starts. + */ + column(): number; + + /** + * Tells you how far the current line has been indented, in spaces. Corrects for tab characters. + */ + indentation(): number; + + /** + * Get the string between the start of the current token and the current stream position. + */ + current(): string; + + /** + * Returns the content of the line n lines ahead in the stream without + * advancing it. Will return undefined if not found. + */ + lookAhead(n: number): string | undefined; + } + + /** + * A Mode is, in the simplest case, a lexer (tokenizer) for your language — a function that takes a character stream as input, + * advances it past a token, and returns a style for that token. More advanced modes can also handle indentation for the language. + */ + interface Mode { + name?: string | undefined; + + /** + * This function should read one token from the stream it is given as an argument, optionally update its state, + * and return a style string, or null for tokens that do not have to be styled. Multiple styles can be returned, separated by spaces. + */ + token: (stream: StringStream, state: T) => string | null; + + /** + * A function that produces a state object to be used at the start of a document. + */ + startState?: (() => T) | undefined; + /** + * For languages that have significant blank lines, you can define a blankLine(state) method on your mode that will get called + * whenever a blank line is passed over, so that it can update the parser state. + */ + blankLine?: ((state: T) => void) | undefined; + /** + * Given a state returns a safe copy of that state. + */ + copyState?: ((state: T) => T) | undefined; + + /** + * Returns the number of spaces of indentation that should be used if a newline were added after the given state. Optionally + * this can use the textAfter string (which is the text after the current position) or the line string, which is the whole + * text of the line. + */ + indent?: ((state: T, textAfter: string, line: string) => number) | undefined; + + /** The four below strings are used for working with the commenting addon. */ + /** + * String that starts a line comment. + */ + lineComment?: string | undefined; + /** + * String that starts a block comment. + */ + blockCommentStart?: string | undefined; + /** + * String that ends a block comment. + */ + blockCommentEnd?: string | undefined; + /** + * String to put at the start of continued lines in a block comment. + */ + blockCommentLead?: string | undefined; + + /** + * Trigger a reindent whenever one of the characters in the string is typed. + */ + electricChars?: string | undefined; + /** + * Trigger a reindent whenever the regex matches the part of the line before the cursor. + */ + electricinput?: RegExp | undefined; + } + + /** + * A function that, given a CodeMirror configuration object and an optional mode configuration object, returns a mode object. + */ + interface ModeFactory { + (config: EditorConfiguration, modeOptions?: any): Mode; + } + + /** + * id will be the id for the defined mode. Typically, you should use this second argument to defineMode as your module scope function + * (modes should not leak anything into the global scope!), i.e. write your whole mode inside this function. + */ + function defineMode(id: string, modefactory: ModeFactory): void; + + /** + * The first argument is a configuration object as passed to the mode constructor function, and the second argument + * is a mode specification as in the EditorConfiguration mode option. + */ + function getMode(config: EditorConfiguration, mode: string | ModeSpec): Mode; + + /** + * Utility function from the overlay.js addon that allows modes to be combined. The mode given as the base argument takes care of + * most of the normal mode functionality, but a second (typically simple) mode is used, which can override the style of text. + * Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless + * the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined. + */ + function overlayMode(base: Mode, overlay: Mode, combine?: boolean): Mode; + + interface ModeMap { + [modeName: string]: ModeFactory; + } + + /** + * Maps mode names to their constructors + */ + const modes: ModeMap; + + function defineMIME(mime: string, modeSpec: string | ModeSpec): void; + + interface MimeModeMap { + [mimeName: string]: string | ModeSpec; + } + + /** + * Maps MIME types to mode specs. + */ + const mimeModes: MimeModeMap; + + interface CommandActions { + /** Select the whole content of the editor. */ + selectAll(cm: Editor): void; + + /** When multiple selections are present, this deselects all but the primary selection. */ + singleSelection(cm: Editor): void; + + /** Emacs-style line killing. Deletes the part of the line after the cursor. If that consists only of whitespace, the newline at the end of the line is also deleted. */ + killLine(cm: Editor): void; + + /** Deletes the whole line under the cursor, including newline at the end. */ + deleteLine(cm: Editor): void; + + /** Delete the part of the line before the cursor. */ + delLineLeft(cm: Editor): void; + + /** Delete the part of the line from the left side of the visual line the cursor is on to the cursor. */ + delWrappedLineLeft(cm: Editor): void; + + /** Delete the part of the line from the cursor to the right side of the visual line the cursor is on. */ + delWrappedLineRight(cm: Editor): void; + + /** + * Undo the last change. Note that, because browsers still don't make it possible for scripts to react to + * or customize the context menu, selecting undo (or redo) from the context menu in a CodeMirror instance does not work. + */ + undo(cm: Editor): void; + + /** Redo the last undone change. */ + redo(cm: Editor): void; + + /** Undo the last change to the selection, or if there are no selection-only changes at the top of the history, undo the last change. */ + undoSelection(cm: Editor): void; + + /** Redo the last change to the selection, or the last text change if no selection changes remain. */ + redoSelection(cm: Editor): void; + + /** Move the cursor to the start of the document. */ + goDocStart(cm: Editor): void; + + /** Move the cursor to the end of the document. */ + goDocEnd(cm: Editor): void; + + /** Move the cursor to the start of the line. */ + goLineStart(cm: Editor): void; + + /** Move to the start of the text on the line, or if we are already there, to the actual start of the line (including whitespace). */ + goLineStartSmart(cm: Editor): void; + + /** Move the cursor to the end of the line. */ + goLineEnd(cm: Editor): void; + + /** Move the cursor to the right side of the visual line it is on. */ + goLineRight(cm: Editor): void; + + /** Move the cursor to the left side of the visual line it is on. If this line is wrapped, that may not be the start of the line. */ + goLineLeft(cm: Editor): void; + + /** Move the cursor to the left side of the visual line it is on. If that takes it to the start of the line, behave like goLineStartSmart. */ + goLineLeftSmart(cm: Editor): void; + + /** Move the cursor up one line. */ + goLineUp(cm: Editor): void; + + /** Move down one line. */ + goLineDown(cm: Editor): void; + + /** Move the cursor up one screen, and scroll up by the same distance. */ + goPageUp(cm: Editor): void; + + /** Move the cursor down one screen, and scroll down by the same distance. */ + goPageDown(cm: Editor): void; + + /** Move the cursor one character left, going to the previous line when hitting the start of line. */ + goCharLeft(cm: Editor): void; + + /** Move the cursor one character right, going to the next line when hitting the end of line. */ + goCharRight(cm: Editor): void; + + /** Move the cursor one character left, but don't cross line boundaries. */ + goColumnLeft(cm: Editor): void; + + /** Move the cursor one character right, don't cross line boundaries. */ + goColumnRight(cm: Editor): void; + + /** Move the cursor to the start of the previous word. */ + goWordLeft(cm: Editor): void; + + /** Move the cursor to the end of the next word. */ + goWordRight(cm: Editor): void; + + /** + * Move to the left of the group before the cursor. A group is a stretch of word characters, a stretch of punctuation + * characters, a newline, or a stretch of more than one whitespace character. + */ + goGroupLeft(cm: Editor): void; + + /** Move to the right of the group after the cursor (see above). */ + goGroupRight(cm: Editor): void; + + /** Delete the character before the cursor. */ + delCharBefore(cm: Editor): void; + + /** Delete the character after the cursor. */ + delCharAfter(cm: Editor): void; + + /** Delete up to the start of the word before the cursor. */ + delWordBefore(cm: Editor): void; + + /** Delete up to the end of the word after the cursor. */ + delWordAfter(cm: Editor): void; + + /** Delete to the left of the group before the cursor. */ + delGroupBefore(cm: Editor): void; + + /** Delete to the start of the group after the cursor. */ + delGroupAfter(cm: Editor): void; + + /** Auto-indent the current line or selection. */ + indentAuto(cm: Editor): void; + + /** Indent the current line or selection by one indent unit. */ + indentMore(cm: Editor): void; + + /** Dedent the current line or selection by one indent unit. */ + indentLess(cm: Editor): void; + + /** Insert a tab character at the cursor. */ + insertTab(cm: Editor): void; + + /** Insert the amount of spaces that match the width a tab at the cursor position would have. */ + insertSoftTab(cm: Editor): void; + + /** If something is selected, indent it by one indent unit. If nothing is selected, insert a tab character. */ + defaultTabTab(cm: Editor): void; + + /** Swap the characters before and after the cursor. */ + transposeChars(cm: Editor): void; + + /** Insert a newline and auto-indent the new line. */ + newlineAndIndent(cm: Editor): void; + + /** Flip the overwrite flag. */ + toggleOverwrite(cm: Editor): void; + } + + /** + * Commands are parameter-less actions that can be performed on an editor. + * Their main use is for key bindings. + * Commands are defined by adding properties to the CodeMirror.commands object. + */ + const commands: CommandActions; + + interface MouseSelectionConfiguration { + /** + * The unit by which to select. May be one of the built-in units + * or a function that takes a position and returns a range around + * that, for a custom unit. The default is to return "word" for + * double clicks, "line" for triple clicks, "rectangle" for alt-clicks + * (or, on Chrome OS, meta-shift-clicks), and "single" otherwise. + */ + unit?: + | "char" + | "word" + | "line" + | "rectangle" + | ((cm: Editor, pos: Position) => { from: Position; to: Position }) + | undefined; + + /** + * Whether to extend the existing selection range or start + * a new one. By default, this is enabled when shift clicking. + */ + extend?: boolean | undefined; + + /** + * When enabled, this adds a new range to the existing selection, + * rather than replacing it. The default behavior is to enable this + * for command-click on Mac OS, and control-click on other platforms. + */ + addNew?: boolean | undefined; + + /** + * When the mouse even drags content around inside the editor, this + * controls whether it is copied (false) or moved (true). By default, this + * is enabled by alt-clicking on Mac OS, and ctrl-clicking elsewhere. + */ + moveOnDrag?: boolean | undefined; + } +} diff --git a/node_modules/@types/codemirror/mode/meta.d.ts b/node_modules/@types/codemirror/mode/meta.d.ts new file mode 100644 index 000000000..8029e5fbe --- /dev/null +++ b/node_modules/@types/codemirror/mode/meta.d.ts @@ -0,0 +1,19 @@ +import "../"; + +export interface ModeInfo { + name: string; + mime?: string | undefined; + mimes?: string[] | undefined; + mode: string; + file?: RegExp | undefined; + ext?: string[] | undefined; + alias?: string[] | undefined; +} + +declare module "../" { + const modeInfo: ModeInfo[]; + function findModeByMIME(mime: string): ModeInfo | undefined; + function findModeByExtension(ext: string): ModeInfo | undefined; + function findModeByFileName(filename: string): ModeInfo | undefined; + function findModeByName(name: string): ModeInfo | undefined; +} diff --git a/node_modules/@types/codemirror/package.json b/node_modules/@types/codemirror/package.json new file mode 100644 index 000000000..9a9abde1d --- /dev/null +++ b/node_modules/@types/codemirror/package.json @@ -0,0 +1,77 @@ +{ + "name": "@types/codemirror", + "version": "5.60.15", + "description": "TypeScript definitions for codemirror", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/codemirror", + "license": "MIT", + "contributors": [ + { + "name": "mihailik", + "githubUsername": "mihailik", + "url": "https://github.com/mihailik" + }, + { + "name": "nrbernard", + "githubUsername": "nrbernard", + "url": "https://github.com/nrbernard" + }, + { + "name": "Pr1st0n", + "githubUsername": "Pr1st0n", + "url": "https://github.com/Pr1st0n" + }, + { + "name": "rileymiller", + "githubUsername": "rileymiller", + "url": "https://github.com/rileymiller" + }, + { + "name": "toddself", + "githubUsername": "toddself", + "url": "https://github.com/toddself" + }, + { + "name": "ysulyma", + "githubUsername": "ysulyma", + "url": "https://github.com/ysulyma" + }, + { + "name": "azoson", + "githubUsername": "azoson", + "url": "https://github.com/azoson" + }, + { + "name": "kylesferrazza", + "githubUsername": "kylesferrazza", + "url": "https://github.com/kylesferrazza" + }, + { + "name": "fityocsaba96", + "githubUsername": "fityocsaba96", + "url": "https://github.com/fityocsaba96" + }, + { + "name": "koddsson", + "githubUsername": "koddsson", + "url": "https://github.com/koddsson" + }, + { + "name": "ficristo", + "githubUsername": "ficristo", + "url": "https://github.com/ficristo" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/codemirror" + }, + "scripts": {}, + "dependencies": { + "@types/tern": "*" + }, + "typesPublisherContentHash": "54e0c0ddc3a9697697700c91f38c2b02a1b34c09f84a5c7e8795d9f5b92618c2", + "typeScriptVersion": "5.0" +} \ No newline at end of file diff --git a/node_modules/@types/estree/LICENSE b/node_modules/@types/estree/LICENSE new file mode 100644 index 000000000..9e841e7a2 --- /dev/null +++ b/node_modules/@types/estree/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/estree/README.md b/node_modules/@types/estree/README.md new file mode 100644 index 000000000..c9bc4d5f4 --- /dev/null +++ b/node_modules/@types/estree/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/estree` + +# Summary +This package contains type definitions for estree (https://github.com/estree/estree). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. + +### Additional Details + * Last updated: Mon, 06 Nov 2023 22:41:05 GMT + * Dependencies: none + +# Credits +These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/estree/flow.d.ts b/node_modules/@types/estree/flow.d.ts new file mode 100644 index 000000000..9d001a92b --- /dev/null +++ b/node_modules/@types/estree/flow.d.ts @@ -0,0 +1,167 @@ +declare namespace ESTree { + interface FlowTypeAnnotation extends Node {} + + interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {} + + interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {} + + interface FlowDeclaration extends Declaration {} + + interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ArrayTypeAnnotation extends FlowTypeAnnotation { + elementType: FlowTypeAnnotation; + } + + interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ClassImplements extends Node { + id: Identifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface ClassProperty { + key: Expression; + value?: Expression | null; + typeAnnotation?: TypeAnnotation | null; + computed: boolean; + static: boolean; + } + + interface DeclareClass extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + body: ObjectTypeAnnotation; + extends: InterfaceExtends[]; + } + + interface DeclareFunction extends FlowDeclaration { + id: Identifier; + } + + interface DeclareModule extends FlowDeclaration { + id: Literal | Identifier; + body: BlockStatement; + } + + interface DeclareVariable extends FlowDeclaration { + id: Identifier; + } + + interface FunctionTypeAnnotation extends FlowTypeAnnotation { + params: FunctionTypeParam[]; + returnType: FlowTypeAnnotation; + rest?: FunctionTypeParam | null; + typeParameters?: TypeParameterDeclaration | null; + } + + interface FunctionTypeParam { + name: Identifier; + typeAnnotation: FlowTypeAnnotation; + optional: boolean; + } + + interface GenericTypeAnnotation extends FlowTypeAnnotation { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceExtends extends Node { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceDeclaration extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; + } + + interface IntersectionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface NullableTypeAnnotation extends FlowTypeAnnotation { + typeAnnotation: TypeAnnotation; + } + + interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface StringTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface TupleTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface TypeofTypeAnnotation extends FlowTypeAnnotation { + argument: FlowTypeAnnotation; + } + + interface TypeAlias extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + right: FlowTypeAnnotation; + } + + interface TypeAnnotation extends Node { + typeAnnotation: FlowTypeAnnotation; + } + + interface TypeCastExpression extends Expression { + expression: Expression; + typeAnnotation: TypeAnnotation; + } + + interface TypeParameterDeclaration extends Node { + params: Identifier[]; + } + + interface TypeParameterInstantiation extends Node { + params: FlowTypeAnnotation[]; + } + + interface ObjectTypeAnnotation extends FlowTypeAnnotation { + properties: ObjectTypeProperty[]; + indexers: ObjectTypeIndexer[]; + callProperties: ObjectTypeCallProperty[]; + } + + interface ObjectTypeCallProperty extends Node { + value: FunctionTypeAnnotation; + static: boolean; + } + + interface ObjectTypeIndexer extends Node { + id: Identifier; + key: FlowTypeAnnotation; + value: FlowTypeAnnotation; + static: boolean; + } + + interface ObjectTypeProperty extends Node { + key: Expression; + value: FlowTypeAnnotation; + optional: boolean; + static: boolean; + } + + interface QualifiedTypeIdentifier extends Node { + qualification: Identifier | QualifiedTypeIdentifier; + id: Identifier; + } + + interface UnionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {} +} diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts new file mode 100644 index 000000000..e933e20ef --- /dev/null +++ b/node_modules/@types/estree/index.d.ts @@ -0,0 +1,683 @@ +// This definition file follows a somewhat unusual format. ESTree allows +// runtime type checks based on the `type` parameter. In order to explain this +// to typescript we want to use discriminated union types: +// https://github.com/Microsoft/TypeScript/pull/9163 +// +// For ESTree this is a bit tricky because the high level interfaces like +// Node or Function are pulling double duty. We want to pass common fields down +// to the interfaces that extend them (like Identifier or +// ArrowFunctionExpression), but you can't extend a type union or enforce +// common fields on them. So we've split the high level interfaces into two +// types, a base type which passes down inherited fields, and a type union of +// all types which extend the base type. Only the type union is exported, and +// the union is how other types refer to the collection of inheriting types. +// +// This makes the definitions file here somewhat more difficult to maintain, +// but it has the notable advantage of making ESTree much easier to use as +// an end user. + +export interface BaseNodeWithoutComments { + // Every leaf interface that extends BaseNode must specify a type property. + // The type property should be a string literal. For example, Identifier + // has: `type: "Identifier"` + type: string; + loc?: SourceLocation | null | undefined; + range?: [number, number] | undefined; +} + +export interface BaseNode extends BaseNodeWithoutComments { + leadingComments?: Comment[] | undefined; + trailingComments?: Comment[] | undefined; +} + +export interface NodeMap { + AssignmentProperty: AssignmentProperty; + CatchClause: CatchClause; + Class: Class; + ClassBody: ClassBody; + Expression: Expression; + Function: Function; + Identifier: Identifier; + Literal: Literal; + MethodDefinition: MethodDefinition; + ModuleDeclaration: ModuleDeclaration; + ModuleSpecifier: ModuleSpecifier; + Pattern: Pattern; + PrivateIdentifier: PrivateIdentifier; + Program: Program; + Property: Property; + PropertyDefinition: PropertyDefinition; + SpreadElement: SpreadElement; + Statement: Statement; + Super: Super; + SwitchCase: SwitchCase; + TemplateElement: TemplateElement; + VariableDeclarator: VariableDeclarator; +} + +export type Node = NodeMap[keyof NodeMap]; + +export interface Comment extends BaseNodeWithoutComments { + type: "Line" | "Block"; + value: string; +} + +export interface SourceLocation { + source?: string | null | undefined; + start: Position; + end: Position; +} + +export interface Position { + /** >= 1 */ + line: number; + /** >= 0 */ + column: number; +} + +export interface Program extends BaseNode { + type: "Program"; + sourceType: "script" | "module"; + body: Array; + comments?: Comment[] | undefined; +} + +export interface Directive extends BaseNode { + type: "ExpressionStatement"; + expression: Literal; + directive: string; +} + +export interface BaseFunction extends BaseNode { + params: Pattern[]; + generator?: boolean | undefined; + async?: boolean | undefined; + // The body is either BlockStatement or Expression because arrow functions + // can have a body that's either. FunctionDeclarations and + // FunctionExpressions have only BlockStatement bodies. + body: BlockStatement | Expression; +} + +export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; + +export type Statement = + | ExpressionStatement + | BlockStatement + | StaticBlock + | EmptyStatement + | DebuggerStatement + | WithStatement + | ReturnStatement + | LabeledStatement + | BreakStatement + | ContinueStatement + | IfStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | DoWhileStatement + | ForStatement + | ForInStatement + | ForOfStatement + | Declaration; + +export interface BaseStatement extends BaseNode {} + +export interface EmptyStatement extends BaseStatement { + type: "EmptyStatement"; +} + +export interface BlockStatement extends BaseStatement { + type: "BlockStatement"; + body: Statement[]; + innerComments?: Comment[] | undefined; +} + +export interface StaticBlock extends Omit { + type: "StaticBlock"; +} + +export interface ExpressionStatement extends BaseStatement { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface IfStatement extends BaseStatement { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate?: Statement | null | undefined; +} + +export interface LabeledStatement extends BaseStatement { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface BreakStatement extends BaseStatement { + type: "BreakStatement"; + label?: Identifier | null | undefined; +} + +export interface ContinueStatement extends BaseStatement { + type: "ContinueStatement"; + label?: Identifier | null | undefined; +} + +export interface WithStatement extends BaseStatement { + type: "WithStatement"; + object: Expression; + body: Statement; +} + +export interface SwitchStatement extends BaseStatement { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface ReturnStatement extends BaseStatement { + type: "ReturnStatement"; + argument?: Expression | null | undefined; +} + +export interface ThrowStatement extends BaseStatement { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends BaseStatement { + type: "TryStatement"; + block: BlockStatement; + handler?: CatchClause | null | undefined; + finalizer?: BlockStatement | null | undefined; +} + +export interface WhileStatement extends BaseStatement { + type: "WhileStatement"; + test: Expression; + body: Statement; +} + +export interface DoWhileStatement extends BaseStatement { + type: "DoWhileStatement"; + body: Statement; + test: Expression; +} + +export interface ForStatement extends BaseStatement { + type: "ForStatement"; + init?: VariableDeclaration | Expression | null | undefined; + test?: Expression | null | undefined; + update?: Expression | null | undefined; + body: Statement; +} + +export interface BaseForXStatement extends BaseStatement { + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +export interface ForInStatement extends BaseForXStatement { + type: "ForInStatement"; +} + +export interface DebuggerStatement extends BaseStatement { + type: "DebuggerStatement"; +} + +export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; + +export interface BaseDeclaration extends BaseStatement {} + +export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { + type: "FunctionDeclaration"; + /** It is null when a function declaration is a part of the `export default function` statement */ + id: Identifier | null; + body: BlockStatement; +} + +export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { + id: Identifier; +} + +export interface VariableDeclaration extends BaseDeclaration { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const"; +} + +export interface VariableDeclarator extends BaseNode { + type: "VariableDeclarator"; + id: Pattern; + init?: Expression | null | undefined; +} + +export interface ExpressionMap { + ArrayExpression: ArrayExpression; + ArrowFunctionExpression: ArrowFunctionExpression; + AssignmentExpression: AssignmentExpression; + AwaitExpression: AwaitExpression; + BinaryExpression: BinaryExpression; + CallExpression: CallExpression; + ChainExpression: ChainExpression; + ClassExpression: ClassExpression; + ConditionalExpression: ConditionalExpression; + FunctionExpression: FunctionExpression; + Identifier: Identifier; + ImportExpression: ImportExpression; + Literal: Literal; + LogicalExpression: LogicalExpression; + MemberExpression: MemberExpression; + MetaProperty: MetaProperty; + NewExpression: NewExpression; + ObjectExpression: ObjectExpression; + SequenceExpression: SequenceExpression; + TaggedTemplateExpression: TaggedTemplateExpression; + TemplateLiteral: TemplateLiteral; + ThisExpression: ThisExpression; + UnaryExpression: UnaryExpression; + UpdateExpression: UpdateExpression; + YieldExpression: YieldExpression; +} + +export type Expression = ExpressionMap[keyof ExpressionMap]; + +export interface BaseExpression extends BaseNode {} + +export type ChainElement = SimpleCallExpression | MemberExpression; + +export interface ChainExpression extends BaseExpression { + type: "ChainExpression"; + expression: ChainElement; +} + +export interface ThisExpression extends BaseExpression { + type: "ThisExpression"; +} + +export interface ArrayExpression extends BaseExpression { + type: "ArrayExpression"; + elements: Array; +} + +export interface ObjectExpression extends BaseExpression { + type: "ObjectExpression"; + properties: Array; +} + +export interface PrivateIdentifier extends BaseNode { + type: "PrivateIdentifier"; + name: string; +} + +export interface Property extends BaseNode { + type: "Property"; + key: Expression | PrivateIdentifier; + value: Expression | Pattern; // Could be an AssignmentProperty + kind: "init" | "get" | "set"; + method: boolean; + shorthand: boolean; + computed: boolean; +} + +export interface PropertyDefinition extends BaseNode { + type: "PropertyDefinition"; + key: Expression | PrivateIdentifier; + value?: Expression | null | undefined; + computed: boolean; + static: boolean; +} + +export interface FunctionExpression extends BaseFunction, BaseExpression { + id?: Identifier | null | undefined; + type: "FunctionExpression"; + body: BlockStatement; +} + +export interface SequenceExpression extends BaseExpression { + type: "SequenceExpression"; + expressions: Expression[]; +} + +export interface UnaryExpression extends BaseExpression { + type: "UnaryExpression"; + operator: UnaryOperator; + prefix: true; + argument: Expression; +} + +export interface BinaryExpression extends BaseExpression { + type: "BinaryExpression"; + operator: BinaryOperator; + left: Expression; + right: Expression; +} + +export interface AssignmentExpression extends BaseExpression { + type: "AssignmentExpression"; + operator: AssignmentOperator; + left: Pattern | MemberExpression; + right: Expression; +} + +export interface UpdateExpression extends BaseExpression { + type: "UpdateExpression"; + operator: UpdateOperator; + argument: Expression; + prefix: boolean; +} + +export interface LogicalExpression extends BaseExpression { + type: "LogicalExpression"; + operator: LogicalOperator; + left: Expression; + right: Expression; +} + +export interface ConditionalExpression extends BaseExpression { + type: "ConditionalExpression"; + test: Expression; + alternate: Expression; + consequent: Expression; +} + +export interface BaseCallExpression extends BaseExpression { + callee: Expression | Super; + arguments: Array; +} +export type CallExpression = SimpleCallExpression | NewExpression; + +export interface SimpleCallExpression extends BaseCallExpression { + type: "CallExpression"; + optional: boolean; +} + +export interface NewExpression extends BaseCallExpression { + type: "NewExpression"; +} + +export interface MemberExpression extends BaseExpression, BasePattern { + type: "MemberExpression"; + object: Expression | Super; + property: Expression | PrivateIdentifier; + computed: boolean; + optional: boolean; +} + +export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; + +export interface BasePattern extends BaseNode {} + +export interface SwitchCase extends BaseNode { + type: "SwitchCase"; + test?: Expression | null | undefined; + consequent: Statement[]; +} + +export interface CatchClause extends BaseNode { + type: "CatchClause"; + param: Pattern | null; + body: BlockStatement; +} + +export interface Identifier extends BaseNode, BaseExpression, BasePattern { + type: "Identifier"; + name: string; +} + +export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; + +export interface SimpleLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value: string | boolean | number | null; + raw?: string | undefined; +} + +export interface RegExpLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: RegExp | null | undefined; + regex: { + pattern: string; + flags: string; + }; + raw?: string | undefined; +} + +export interface BigIntLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: bigint | null | undefined; + bigint: string; + raw?: string | undefined; +} + +export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "**" + | "|" + | "^" + | "&" + | "in" + | "instanceof"; + +export type LogicalOperator = "||" | "&&" | "??"; + +export type AssignmentOperator = + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "**=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&=" + | "||=" + | "&&=" + | "??="; + +export type UpdateOperator = "++" | "--"; + +export interface ForOfStatement extends BaseForXStatement { + type: "ForOfStatement"; + await: boolean; +} + +export interface Super extends BaseNode { + type: "Super"; +} + +export interface SpreadElement extends BaseNode { + type: "SpreadElement"; + argument: Expression; +} + +export interface ArrowFunctionExpression extends BaseExpression, BaseFunction { + type: "ArrowFunctionExpression"; + expression: boolean; + body: BlockStatement | Expression; +} + +export interface YieldExpression extends BaseExpression { + type: "YieldExpression"; + argument?: Expression | null | undefined; + delegate: boolean; +} + +export interface TemplateLiteral extends BaseExpression { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface TaggedTemplateExpression extends BaseExpression { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends BaseNode { + type: "TemplateElement"; + tail: boolean; + value: { + /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ + cooked?: string | null | undefined; + raw: string; + }; +} + +export interface AssignmentProperty extends Property { + value: Pattern; + kind: "init"; + method: boolean; // false +} + +export interface ObjectPattern extends BasePattern { + type: "ObjectPattern"; + properties: Array; +} + +export interface ArrayPattern extends BasePattern { + type: "ArrayPattern"; + elements: Array; +} + +export interface RestElement extends BasePattern { + type: "RestElement"; + argument: Pattern; +} + +export interface AssignmentPattern extends BasePattern { + type: "AssignmentPattern"; + left: Pattern; + right: Expression; +} + +export type Class = ClassDeclaration | ClassExpression; +export interface BaseClass extends BaseNode { + superClass?: Expression | null | undefined; + body: ClassBody; +} + +export interface ClassBody extends BaseNode { + type: "ClassBody"; + body: Array; +} + +export interface MethodDefinition extends BaseNode { + type: "MethodDefinition"; + key: Expression | PrivateIdentifier; + value: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; +} + +export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { + type: "ClassDeclaration"; + /** It is null when a class declaration is a part of the `export default class` statement */ + id: Identifier | null; +} + +export interface ClassDeclaration extends MaybeNamedClassDeclaration { + id: Identifier; +} + +export interface ClassExpression extends BaseClass, BaseExpression { + type: "ClassExpression"; + id?: Identifier | null | undefined; +} + +export interface MetaProperty extends BaseExpression { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportNamedDeclaration + | ExportDefaultDeclaration + | ExportAllDeclaration; +export interface BaseModuleDeclaration extends BaseNode {} + +export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; +export interface BaseModuleSpecifier extends BaseNode { + local: Identifier; +} + +export interface ImportDeclaration extends BaseModuleDeclaration { + type: "ImportDeclaration"; + specifiers: Array; + source: Literal; +} + +export interface ImportSpecifier extends BaseModuleSpecifier { + type: "ImportSpecifier"; + imported: Identifier; +} + +export interface ImportExpression extends BaseExpression { + type: "ImportExpression"; + source: Expression; +} + +export interface ImportDefaultSpecifier extends BaseModuleSpecifier { + type: "ImportDefaultSpecifier"; +} + +export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { + type: "ImportNamespaceSpecifier"; +} + +export interface ExportNamedDeclaration extends BaseModuleDeclaration { + type: "ExportNamedDeclaration"; + declaration?: Declaration | null | undefined; + specifiers: ExportSpecifier[]; + source?: Literal | null | undefined; +} + +export interface ExportSpecifier extends BaseModuleSpecifier { + type: "ExportSpecifier"; + exported: Identifier; +} + +export interface ExportDefaultDeclaration extends BaseModuleDeclaration { + type: "ExportDefaultDeclaration"; + declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; +} + +export interface ExportAllDeclaration extends BaseModuleDeclaration { + type: "ExportAllDeclaration"; + exported: Identifier | null; + source: Literal; +} + +export interface AwaitExpression extends BaseExpression { + type: "AwaitExpression"; + argument: Expression; +} diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json new file mode 100644 index 000000000..2d5a99837 --- /dev/null +++ b/node_modules/@types/estree/package.json @@ -0,0 +1,26 @@ +{ + "name": "@types/estree", + "version": "1.0.5", + "description": "TypeScript definitions for estree", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", + "license": "MIT", + "contributors": [ + { + "name": "RReverser", + "githubUsername": "RReverser", + "url": "https://github.com/RReverser" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/estree" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "6f0eeaffe488ce594e73f8df619c677d752a279b51edbc744e4aebb20db4b3a7", + "typeScriptVersion": "4.5", + "nonNpm": true +} \ No newline at end of file diff --git a/node_modules/@types/jszip/LICENSE b/node_modules/@types/jszip/LICENSE new file mode 100644 index 000000000..21071075c --- /dev/null +++ b/node_modules/@types/jszip/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/jszip/README.md b/node_modules/@types/jszip/README.md new file mode 100644 index 000000000..de178bb56 --- /dev/null +++ b/node_modules/@types/jszip/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/jszip` + +# Summary +This package contains type definitions for JSZip (http://stuk.github.com/jszip/). + +# Details +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jszip + +Additional Details + * Last updated: Wed, 31 May 2017 23:34:31 GMT + * Dependencies: none + * Global values: JSZip + +# Credits +These definitions were written by mzeiher . diff --git a/node_modules/@types/jszip/index.d.ts b/node_modules/@types/jszip/index.d.ts new file mode 100644 index 000000000..b44d2bc53 --- /dev/null +++ b/node_modules/@types/jszip/index.d.ts @@ -0,0 +1,232 @@ +// Type definitions for JSZip +// Project: http://stuk.github.com/jszip/ +// Definitions by: mzeiher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface JSZip { + files: {[key: string]: JSZipObject}; + + /** + * Get a file from the archive + * + * @param Path relative path to file + * @return File matching path, null if no file found + */ + file(path: string): JSZipObject; + + /** + * Get files matching a RegExp from archive + * + * @param path RegExp to match + * @return Return all matching files or an empty array + */ + file(path: RegExp): JSZipObject[]; + + /** + * Add a file to the archive + * + * @param path Relative path to file + * @param content Content of the file + * @param options Optional information about the file + * @return JSZip object + */ + file(path: string, data: any, options?: JSZipFileOptions): JSZip; + + /** + * Return an new JSZip instance with the given folder as root + * + * @param name Name of the folder + * @return New JSZip object with the given folder as root or null + */ + folder(name: string): JSZip; + + /** + * Returns new JSZip instances with the matching folders as root + * + * @param name RegExp to match + * @return New array of JSZipFile objects which match the RegExp + */ + folder(name: RegExp): JSZipObject[]; + + /** + * Call a callback function for each entry at this folder level. + * + * @param callback function + */ + forEach(callback: (relativePath: string, file: JSZipObject) => void): void; + + /** + * Get all files wchich match the given filter function + * + * @param predicate Filter function + * @return Array of matched elements + */ + filter(predicate: (relativePath: string, file: JSZipObject) => boolean): JSZipObject[]; + + /** + * Removes the file or folder from the archive + * + * @param path Relative path of file or folder + * @return Returns the JSZip instance + */ + remove(path: string): JSZip; + + /** + * @deprecated since version 3.0 + * @see {@link generateAsync} + * http://stuk.github.io/jszip/documentation/upgrade_guide.html + */ + generate(options?: JSZipGeneratorOptions): any; + + /** + * Generates a new archive asynchronously + * + * @param options Optional options for the generator + * @return The serialized archive + */ + generateAsync(options?: JSZipGeneratorOptions, onUpdate?: Function): Promise; + + /** + * @deprecated since version 3.0 + * @see {@link loadAsync} + * http://stuk.github.io/jszip/documentation/upgrade_guide.html + */ + load(): void; + + /** + * Deserialize zip file asynchronously + * + * @param data Serialized zip file + * @param options Options for deserializing + * @return Returns promise + */ + loadAsync(data: any, options?: JSZipLoadOptions): Promise; +} + +type Serialization = ("string" | "text" | "base64" | "binarystring" | "uint8array" | + "arraybuffer" | "blob" | "nodebuffer"); + +interface JSZipObject { + name: string; + dir: boolean; + date: Date; + comment: string; + options: JSZipObjectOptions; + + /** + * Prepare the content in the asked type. + * @param {String} type the type of the result. + * @param {Function} onUpdate a function to call on each internal update. + * @return Promise the promise of the result. + */ + async(type: Serialization, onUpdate?: Function): Promise; + + /** + * @deprecated since version 3.0 + */ + asText(): void; + /** + * @deprecated since version 3.0 + */ + asBinary(): void; + /** + * @deprecated since version 3.0 + */ + asArrayBuffer(): void; + /** + * @deprecated since version 3.0 + */ + asUint8Array(): void; + //asNodeBuffer(): void; +} + +interface JSZipFileOptions { + base64?: boolean; + binary?: boolean; + date?: Date; + compression?: string; + comment?: string; + optimizedBinaryString?: boolean; + createFolders?: boolean; + dir?: boolean; +} + +interface JSZipObjectOptions { + /** deprecated */ + base64: boolean; + /** deprecated */ + binary: boolean; + /** deprecated */ + dir: boolean; + /** deprecated */ + date: Date; + compression: string; +} + +interface JSZipGeneratorOptions { + /** deprecated */ + base64?: boolean; + /** DEFLATE or STORE */ + compression?: string; + /** base64 (default), string, uint8array, arraybuffer, blob */ + type?: string; + comment?: string; + /** + * mime-type for the generated file. + * Useful when you need to generate a file with a different extension, ie: “.ods”. + */ + mimeType?: string; + /** streaming uses less memory */ + streamFiles?: boolean; + /** DOS (default) or UNIX */ + platform?: string; +} + +interface JSZipLoadOptions { + base64?: boolean; + checkCRC32?: boolean; + optimizedBinaryString?: boolean; + createFolders?: boolean; +} + +interface JSZipSupport { + arraybuffer: boolean; + uint8array: boolean; + blob: boolean; + nodebuffer: boolean; +} + +declare var JSZip: { + /** + * Create JSZip instance + */ + (): JSZip; + /** + * Create JSZip instance + * If no parameters given an empty zip archive will be created + * + * @param data Serialized zip archive + * @param options Description of the serialized zip archive + */ + (data: any, options?: JSZipLoadOptions): JSZip; + + /** + * Create JSZip instance + */ + new (): JSZip; + /** + * Create JSZip instance + * If no parameters given an empty zip archive will be created + * + * @param data Serialized zip archive + * @param options Description of the serialized zip archive + */ + new (data: any, options?: JSZipLoadOptions): JSZip; + + prototype: JSZip; + support: JSZipSupport; +} + +declare module "jszip" { + export = JSZip; +} diff --git a/node_modules/@types/jszip/package.json b/node_modules/@types/jszip/package.json new file mode 100644 index 000000000..7ff794168 --- /dev/null +++ b/node_modules/@types/jszip/package.json @@ -0,0 +1,22 @@ +{ + "name": "@types/jszip", + "version": "0.0.33", + "description": "TypeScript definitions for JSZip", + "license": "MIT", + "contributors": [ + { + "name": "mzeiher", + "url": "https://github.com/mzeiher" + } + ], + "main": "", + "repository": { + "type": "git", + "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "1662aabea3b5b6b613519eb02c48d0886dac452a2d0ae1a8be95f18c326748fc", + "typeScriptVersion": "2.0" +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/.github/workflows/release-package.yml b/node_modules/@types/noname-typings/.github/workflows/release-package.yml new file mode 100644 index 000000000..e88ad5b3a --- /dev/null +++ b/node_modules/@types/noname-typings/.github/workflows/release-package.yml @@ -0,0 +1,20 @@ +name: Node.js Package +on: + push: + tags: + - "v*" +jobs: + Publish: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: latest + registry-url: https://registry.npmjs.org + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/node_modules/@types/noname-typings/ArrayEx.d.ts b/node_modules/@types/noname-typings/ArrayEx.d.ts new file mode 100644 index 000000000..414f5d0c6 --- /dev/null +++ b/node_modules/@types/noname-typings/ArrayEx.d.ts @@ -0,0 +1,112 @@ +// noname内扩展的一些array方法: +declare interface Array { + /** + * @deprecated 已废弃,请使用includes + */ + contains(item: T): boolean; + containsSome(...item: T): boolean; + containsAll(...item: T): boolean; + /** + * 添加任意元素进数组中 + * @param args + * @returns + * 1. 当添加成功时,返回此数组 + * 2. 添加失败(已有此元素)时返回false,若传入多个参数,且添加失败时,后面的元素不再进行添加操作 + */ + add(...args: T[]): this | false; + /** + * 添加一个数组的所有元素到该数组中(循环执行this.add),此时参数arr中若有一个数组元素可能会出现bug + * @param arr + */ + addArray(arr: T[]): this; + /** + * 移除一个元素出该数组(该元素不能是数组) + * @param item + * @returns + * 1. 当移除成功时,返回此数组 + * 2. 移除失败(没有此元素)时返回false + * 3. 传入参数为一个数组时,返回undefined + */ + remove(item: T): this | false; + + remove(item: T[]): void; + /** + * 将一个数组的所有元素移除出该数组(循环执行this.remove),此时参数arr中若有一个数组元素可能会出现bug + * @param arr + */ + removeArray(...arr: T[]): this; + /** + * 随机获得该数组的一个元素 + * @param args 设置需要排除掉的部分元素; + */ + randomGet(...args: T[]): T; + /** + * 随机移除数组的一个/多个元素 + * @param num 若num为数字的情况下,则移除num个元素,否则移除一个 + * @returns + * 1. 移除一个元素,只返回被移除的元素 + * 2. 移除多个元素,返回一个被移除元素组成的数组 + * 3. 数组无元素返回undefined + */ + randomRemove(num?: number): T | T[]; + randomRemove(num?: T): T | undefined; + /** + * 随机重新排序数组(数组乱序) + */ + randomSort(): this; + /** + * 随机获取数组的元素 + * + * 返回的是一个重新整合的数组 + * @param num 获取的数量, 不传参视为0 + */ + randomGets(num?: number): this; + /** + * 对所有玩家进行排序 + * + * 其排序,使用的是lib.sort.seat方法,按座位排序 + * @param target 目标玩家 + */ + sortBySeat(target?: Player): Player[]; + /** + * 将一个Array中所有位于处理区的卡牌过滤出来 + * + * 例:设一list为[c1,c2,c3,c4],其中c1和c3是位于处理区的卡牌 + * 那么list.filterInD()得到的结果即为[c1,c3] + * + * 在1.9.97.8.1或更高的版本中: + * 可通过直接在括号中填写一个区域 来判断处于特定区域的卡牌 + * 例:list.filterInD('h') 即判断数组中所有位于手牌区的卡牌 + * @param poiston 指定的区域,默认是 'o' + */ + filterInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): Card[]; + someInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean; + everyInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean; + + //关于处理区: + /* + 不知道处理区是什么的同学们 请自行查阅凌天翼规则集相关内容太长了我懒得贴 + 处理区在无名杀的代码为ui.ordering + 为方便兼容旧扩展 使用get.position(card)方法读取处理区的卡牌 默认得到的仍然是弃牌堆('d') + 使用get.position(card,true) 才会得到处理区('o')的结果 + + 处理区:(不清楚无名杀对其的实验是否满足这些要求) + 一个最常被用到,但是尚未命名的区域。 + 当你使用一张牌等待结算或处于结算中, + 当你和另一名角色拼点的两张牌失去时, + 当你和另一名角色交换的牌失去时, + 当你的牌被张辽或张郃搞的失去时…… + 总之,当一张牌不在任何角色的手牌、装备区或判定区里, + 也不在牌堆或弃牌堆里,也没有被移出游戏,那么它就是在这个尚未命名的区域里。 + 为了便于行文,在本规则与FAQ集中暂且称之为‘处理区’。 + */ + + /** + * 获取 item 在数组中出现的次数 + */ + numOf(item: T): number; + unique(): this; + toUniqued(): T[]; + maxBy(sortBy?: Function, filter?: typeof Array['prototype']['filter']): T; + minBy(sortBy?: Function, filter?: typeof Array['prototype']['filter']): T; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/Card.d.ts b/node_modules/@types/noname-typings/Card.d.ts new file mode 100644 index 000000000..d5c34474c --- /dev/null +++ b/node_modules/@types/noname-typings/Card.d.ts @@ -0,0 +1,23 @@ +declare type CardBaseUIData = { + name?: string; + suit?: string; + number?: number; + nature?: string | null; + + //用于某些方法,用于过滤卡牌的额外结构 + type?: string | string[]; + subtype?: string; + color?: string; + + /** + * 是否时视为牌 + * + * 是本来的卡牌,则为true,作为视为牌则为false/undefined + * 在useCard使用时,作为视为牌,会把next.cards,设置为card.cards; + * + */ + isCard?: boolean; + + /** 真实使用的卡牌 */ + cards?: Card[]; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/DateEx.d.ts b/node_modules/@types/noname-typings/DateEx.d.ts new file mode 100644 index 000000000..47bf74969 --- /dev/null +++ b/node_modules/@types/noname-typings/DateEx.d.ts @@ -0,0 +1,5 @@ +// 一些额外需要增加的一些小提示提示 +interface Date { + /** 格式化 */ + format(format: string): string; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/HTMLDivElementEx.d.ts b/node_modules/@types/noname-typings/HTMLDivElementEx.d.ts new file mode 100644 index 000000000..999acb098 --- /dev/null +++ b/node_modules/@types/noname-typings/HTMLDivElementEx.d.ts @@ -0,0 +1,85 @@ +//noname内扩展的一些HTMLDivElement方法: +interface HTMLDivElement { + _link: any; + timeout?: number; + destiny?: HTMLDivElement; + _listeningEnd?: boolean; + _transitionEnded?: boolean; + _onEndDelete?: boolean; + _selfDestroyed?: boolean; + /** + * 增加一个动画(增加className动画标记) + * + * @param name className + * @param time 该动画多长时间自动销毁 + */ + addTempClass(name: string, time?: number): this; + /** + * 隐藏 + */ + hide(): this; + unfocus(): this; + refocus(): this; + show(): this; + /** + * 删除该节点div + * @param time 调用后删除的时间(延时删除) + * @param callback 删除后的回调 + */ + delete(time?: number, callback?: () => void): this; + /** + * 将该节点div移除,并添加到目标处 + * + * 会为card设置将position到destiny,在get.position中,获得得位置为将要设置得position目标处; + * @param position 目标处 + * @param time 延迟执行的时间 + */ + goto(position: HTMLDivElement, time?: number): this; + /** + * 立即移除 + */ + fix(): this; + /** + * 设置背景(卡面)/设置图片 + * @param name 自定义格式名: xxx:xxxxxxxx:xx(应该有各种命名格式,到时详细探讨) + * @param type 设置的卡面的类型 + * @param ext 文件类型后缀名(例:.jpg),填noskin,或者不填,默认为".jpg" + * @param subfolder 子文件夹路径(基本都是按规定文件夹放置,命名),不填走默认路径 + */ + setBackground(name: string, type?: string, ext?: string, subfolder?: string): this; + /** + * 设置游戏背景,并且缓存该设置 + * @param img + */ + setBackgroundDB(img: string): Promise; + /** + * 设置背景 + * @param img + */ + setBackgroundImage(img: string | string[]): this; + /** + * 设置触摸/点击监听 + * @param func + */ + listen(func: (this: HTMLDivElement, event: Event) => void): this; + /** + * 设置转换结束(webkitTransitionEnd)监听 + * @param func + * @param time + */ + listenTransition(func: () => void, time: number): number; + /** + * 设置位置 + * @param args + */ + setPosition(...args: number[]): this; + /** + * 添加css样式 + * @param style + */ + css(style: { + [key in T]?: string; + } & { + innerHTML?: string; + }): this; +} diff --git a/node_modules/@types/noname-typings/HTMLTableElementEx.d.ts b/node_modules/@types/noname-typings/HTMLTableElementEx.d.ts new file mode 100644 index 000000000..b820a378f --- /dev/null +++ b/node_modules/@types/noname-typings/HTMLTableElementEx.d.ts @@ -0,0 +1,8 @@ +interface HTMLTableElement { + /** + * 获取该div下表结构row行,col列的元素 + * @param row + * @param col + */ + get(row: number, col: number): HTMLElement | void; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/LICENSE b/node_modules/@types/noname-typings/LICENSE new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/node_modules/@types/noname-typings/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/node_modules/@types/noname-typings/MapEx.d.ts b/node_modules/@types/noname-typings/MapEx.d.ts new file mode 100644 index 000000000..702e70ba6 --- /dev/null +++ b/node_modules/@types/noname-typings/MapEx.d.ts @@ -0,0 +1,27 @@ +declare interface Map { + /** + * @deprecated 为了兼容array改为map而创建的方法,请使用has + */ + contains(item: K): boolean; + + /** + * @deprecated 为了兼容array改为map而创建的方法,请使用has + */ + inculdes(item: K): boolean; + /** + * @deprecated 为了兼容array改为map而创建的方法,请使用set + */ + add(item: K): this; + /** + * @deprecated 为了兼容array改为map而创建的方法,请使用set + */ + push(item: K): this; + /** + * @deprecated 为了兼容array改为map而创建的方法 + */ + addArray(arr: Array): this; + /** + * @deprecated 为了兼容array改为map而创建的方法,请使用delete + */ + remove(item: K): this; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/Result.d.ts b/node_modules/@types/noname-typings/Result.d.ts new file mode 100644 index 000000000..24bfb85aa --- /dev/null +++ b/node_modules/@types/noname-typings/Result.d.ts @@ -0,0 +1,43 @@ +declare interface Result { + /** + * 最终结果 + * + * 大多代表该事件到达这一步骤过程中的结果; + * 一般用来标记当前事件是否按预定执行的,即执行成功 + * + * 大部分事件间接接触game.check,一般最终结果不变,大多数是这种 + * + * 其实主要是ok方法会有直接的bool,主要涉及game.check; + */ + bool?: boolean; + + //choose系 + /** 记录返回当前事件操作过程中的卡牌 */ + cards: Card[]; + /** 记录返回当前事件操作过程中的目标 */ + targets: Player[]; + /** 记录返回当前事件操作过程中的按钮 */ + buttons: Button[]; + /** 记录buttons内所有button.link(即该按钮的类型,link的类型很多,参考按钮的item) */ + links: any[]; + + //control系(直接control系列没有result.bool) + /** control操作面板的选中结果,即该按钮的link,即名字 */ + control: string; + /** 既control的下标 */ + index: number; + + //ok系 + /** 记录返回当前事件操作过程中,面板按钮的确定ok取消cancel */ + confirm: string; + /** 一般为触发的“视为”技能 */ + skill: string; + /** + * 当前事件操作的“视为”牌, + * 当前有“视为”操作,该card参数特供给视为牌,不需要cards[0]获取视为牌 ; + * 判断是否为视为牌:card.isCard,false为视为牌 + */ + card: Card; + + [key: string]: any; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/Skill.d.ts b/node_modules/@types/noname-typings/Skill.d.ts new file mode 100644 index 000000000..17e8884da --- /dev/null +++ b/node_modules/@types/noname-typings/Skill.d.ts @@ -0,0 +1,1928 @@ +/** 时机 */ +declare interface SkillTrigger { + /** + * 全场任意一名角色 + * + * 代表所有人 + */ + global?: string | string[]; + /** + * 玩家自己 + * + * 触发时件中,技能拥有者为事件的发起者; + * + * 注:需要是自己引发的事件; + */ + player?: string | string[]; + /** + * 你自己成为目标时 + */ + target?: string | string[]; + /** + * 来源是你自己时 + */ + source?: string | string[]; +} + +/** + * hookTrigger在不同方法中触发的方法接口 + * + * 注:似乎时用于模式,作为,游戏全局的一些每次都需要触发的方法(算是不实用的一个接口) + */ +declare interface SkillHookTrigger { + /** + * 【hookTrigger相关】 + * + * 之后处理方法 + * + * 在createTrigger中最终步骤中,需要当前没有hookTrigger配置才调用到 + * + * 若返回true时,会触发“triggerAfter” + * + * @param event + * @param player + * @param triggername + */ + after?(event: GameEventPromise, player: Player, triggername: string): boolean; + /** + * 【hookTrigger相关】 + * + * 在filterTrigger中执行,过滤发动条件,和filter有些类似,具体功能稍后分析 + */ + block?(event: GameEventPromise, player: Player, name: string, skill: string): boolean; + /** + * 【hookTrigger相关】 + * + * 在logSkill中执行,每次触发logSkill都会触发 + */ + log?: ThreeParmFun; +} + +/** mod的配置 */ +declare interface Mod { + /** + * 卡牌是否可弃置 + * @param card:Card 牌 + * @param player:Player 玩家 + */ + cardDiscardable?(card: Card, player: Player): boolean | void; + /** + * 卡牌是否可用(卡牌能否被选择) + * cardEnabled一起使用 + * + * 适用范围:player.canUse,lib.filter.cardEnabled,默认lib.filter.filterCard + * + * @param card:Card 牌 + * @param player:Player 玩家 + */ + cardEnabled?(card: Card, player: Player): boolean | void; + /** + * 卡牌是否可用(适用范围基本可以视为所有情况下) + * + * 适用范围:event.backup中技能信息触发(viewAS),cardEnabled(优先于该mod的触发),cardRespondable(优先于该mod的触发),_save(优先于cardSavable的mod触发)中均触发 + */ + cardEnabled2?(card: Card, player: Player): boolean | void; + /** + * 卡牌是否可用(改变卡牌的使用次数) + * + * 要与cardEnabled一起使用(目前看来两个效果一致) + * + * @param card Card 牌 + * @param player Player 玩家 + * @param num 使用次数 + */ + cardUsable?(card: Card, player: Player, num: number): boolean | number | void; + /** + * 卡牌是否可以响应 + * + * 要与cardEnabled一起使用(目前看来两个效果一致) + * + * @param card:Card 牌 + * @param player:Player 玩家 + */ + cardRespondable?(card: Card, player: Player): boolean | void; + /** + * 卡牌是否可以救人 + * + * 要与cardEnabled一起使用(目前看来两个效果一致) + * + * 注:还是和cardEnabled不同,设置了该mod检测,只要是在_save,濒死求救阶段,都可以触发; + * + * 不过前提,可能还是要通过该阶段的cardEnabled的检测,目前还没确定,日后再做分析 + * + * 适用范围:濒死阶段的filterCard + * + * @param card:Card 牌 + * @param player:Player 玩家 + * @param taregt:Target 当前处于濒死求救得玩家 + */ + cardSavable?(card: Card, player: Player, taregt: Player): boolean | void; + /** + * 在全局的防御范围 + * + * 注:防御距离就是要和别人的距离越远,所以,拉开距离需要增加; + */ + globalTo?(from: Player, to: Player, current): number | void; + /** + * 在全局的进攻距离 + * + * 注:进攻距离就是要和别人的距离越近,所以,增加距离需要减掉; + */ + globalFrom?(from: Player, to: Player, distance: number): number | void; + /** + * 角色的攻击范围 + * @param from + * @param to + * @param range + * + * 注:和globalFrom同理,拉近距离,减去; + */ + attackFrom?(from: Player, to: Player, range: number): number | void; + /** + * 攻击到角色的范围 + * @param from + * @param to + * @param range + * + * 注:和globalTo同理,拉开距离,增加; + */ + attackTo?(from: Player, to: Player, range: number): number | void; + /** 手牌上限 */ + maxHandcard?(player: Player, num: number): number | void; + /** + * 选择的目标 + * + * card:牌; + * + * player:玩家; + * + * range: + * range[1]:目标个数; + */ + selectTarget?(card: Card, player: Player, range: Select): void; + + /** + * 该卡牌的发动源玩家是否能使用该卡牌(该角色是否能使用该牌) + * + * @param card:Card + * + * @param player:Player 源玩家(使用牌的角色) + * + * @param target:Target 目标玩家 + */ + playerEnabled?(card: Card, player: Player, target: Player): boolean | void; + /** + * 是否能成为目标 + * + * card:牌; + * + * player:使用牌的角色; + * + * target:玩家 + */ + targetEnabled?(card: Card, player: Player, target: Player): boolean | void; + + /** + * 可以指定任意(范围内)目标 + * + * @param card:Card 牌 + * + * @param player:Player 玩家(使用牌的角色) + * + * @param target:Target 目标 + * + * @return 返回bool值可以不接受,范围检测,使用返回的结果;返回number,即计算距离是增加该距离;不返回,默认正常的范围检测 + */ + targetInRange?(card: Card, player: Player, target: Player): boolean | number | void; + /** + * 弃牌阶段时,忽略的手牌 + * + * @param card:Card + * + * @param player:Player + */ + ignoredHandcard?(card: Card, player: Player): boolean | void; + + /** 过滤可以被丢弃的牌 */ + canBeDiscarded?(card: Card, player: Player, target: Player, eventName: string): boolean | void; + /** 过滤可以获得的牌 */ + canBeGained?(card: Card, player: Player, target: Player, eventName: string): boolean | void; + canBeReplaced?(card: Card, source: Player, player: Player): boolean | void; + /** + * 改变花色 + */ + suit?(card: Card, suit: string): string | void; + /** + * 改变判断结果 + * + * 注:目前似乎没有用到该mod.改变结果不影响判定的牌结果,影响判定的最终结果,即之后判定牌的effect会受该结果影响 + * @param player + * @param result + */ + judge?(player: Player, result: Result); + + //2020-2-23版本: + /** + * 为技能配置一个自定义在事件中处理的回调事件,该事件的使用需要自己使用,实际是一个自定义事件,没什么实际意义; + * + * 其设置的位置在技能content期间设置,设置在期间引发的事件中; + * + * 用于以下场合:judge,chooseToCompareMultiple,chooseToCompare + * + * 新版本的judge事件中 可以通过设置callback事件 在judgeEnd和judgeAfter时机之前对判定牌进行操作 + * + * 在判断结果出来后,若事件event.callback存在,则发送“judgeCallback”事件 + * + * 同理拼点,在拼点结果出来后,发送“compareMultiple”事件(“compare”暂时没有) + * + * callback就是作为以上事件的content使用 + */ + callback?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll; + + //无懈相关:主要在_wuxie中,(此时应时无懈询问阶段),检测触发卡牌以下对应mod + /* + 主要参数解析: + card:trigger.card 触发该无懈阶段的卡牌; + + player:当前事件的玩家(应该也是触发该阶段的玩家) + + target:trigger.target 触发该无懈阶段的卡牌的玩家; + + current:当前game.filterPlayer,遍历过滤检测可以发动无懈的每一个玩家(即当前过滤检测中的玩家) + */ + //触发阶段为:phaseJudge(判定阶段) + /** 是否能在判定阶段使用无懈 */ + wuxieJudgeEnabled?(card: Card, player: Player, current: Player): boolean | void; + /** 是否能在判定阶段响应无懈 */ + wuxieJudgeRespondable?(card: Card, player: Player, current: Player): boolean | void; + //非判定阶段触发 + /** 是否能使用无懈 */ + wuxieEnabled?(card: Card, player: Player, target: Player, current: Player): boolean | void; + /** 是否能响应无懈 */ + wuxieRespondable?(card: Card, player: Player, target: Player, current: Player): boolean | void; + + //94版本 + /** 改变卡牌名字 用于get.name*/ + cardname?(card: Card, player: Player): string | void; + /** 改变卡牌伤害属性 用于get.nature*/ + cardnature?(card: Card, player: Player): string | void | boolean; + + /** 对特定角色使用牌的次数限制(用于优化【对特定角色使用牌无次数限制】的机制)【v1.9.105】 */ + cardUsableTarget?(card: Card, player: Player, target: Player): boolean | void; + + /** 用于get.value,对最后得返回value结果做处理 */ + aiValue?(player: Player, card: Card, num: number): number | void; + /** 用于get.order,对最后得返回order结果做处理 */ + aiOrder?(player: Player, card: Card, num: number): number | void; + + //player.inRange新增: + /** 在玩家范围内,即target是否在player的攻击范围内 */ + inRange?(from: Player, to: Player): boolean | void; + /** 在目标范围内,即player是否在source的攻击范围内 */ + inRangeOf?(from: Player, to: Player): boolean | void; + + maxHandcardBase?(player: Player, num: number): number | void; + + /** + * 强制判断卡牌能否重铸 + * 【v1.9.108.6~】 + */ + cardChongzhuable?(card: Card, player: Player): boolean | void; + + aiValue?(player: Player, card: Card, num: number): number | void; + aiUseful?(player: Player, card: Card, num: number): number | void; + + attackRange?(player: Player, num: number): number | void; + +} + +/** 技能 */ +declare interface Skill { + /** + * 技能按钮名字,不写则默认为此技能的翻译(可认为为该技能用于显示的翻译名) + * 注:用得挺少得,貌似主要是使用翻译得 + */ + name?: string; + /** + * 新版:用于记录自身名字key,希望能用于自身某些配置上直接使用......,需要测试过才肯定;【结果:失败,还是没用,屏蔽掉】 + * + * 旧版:用于解析用的key,不直接参与游戏逻辑,参与自己定义的解析流程,实质就是技能的名字,规范按技能名命名 + */ + // key?:string; + + /** + * 继承 + * + * 比较特殊的属性,继承当前技能没有的,而inherit继承技能中有的属性; + * 其中“audio”属性,尽可能直接继承赋值为inherit的名字; + * 同时,对应的翻译会覆盖成继承技能的翻译。 + */ + inherit?: string; + + //声音 + /** + * 配音: + * + * 主要分为:audioname(默认技能名),audioinfo(默认info.audio) + * + * 若为字符串时,带有“ext:”,则使用无名杀录目\extension\扩展名内的配音(扩展的配音) + * + * ,命名方法:技能名+这是第几个配音 + * + * + * 否则,该字符串指代的是另一个技能的名字,若该技能名存在,则audioinfo为该技能的audio; + * + * 若为数组,则是[audioname,audioinfo],分布覆盖原有的值。 + * + * audioinfo为数字时,数字为配音数量索引(同一技能有多个配音),从1开始,使用无名杀目录\audio\skill内的配音(audioname1~audioinfo序号); + * + * audioinfo为布尔值true或者字符串非空时,执行game.playSkillAudio(audioname),使用无名杀目录\audio\skill内的配音; + * + * 否则,若为false,空字符串,null结果,则不播音, + * + * 若info.audio:true,则使用game.playSkillAudio(audioname)。 + * + * 扩展(以game.trySkillAudio为准): + * + * 若info.audio是字符串: + * + * 1.则主要是播放扩展声音,格式:ext:扩展包的名字:额外参数; + * + * 2.直接就是技能名,即继承该技能的播放信息,audioinfo; + * + * 若info.audio是数组,则[扩展名,额外参数]; + * + * 额外参数:1."true",则直接播放该名字的声音;2.数字,则是随机选一个该"技能名+1-数字范围"的声音播放; + * + * 若info.audio是数字,则直接就是用解析出来的"audioname+1-数字范围"; + */ + audio?: number | string | boolean | [string, number]; + /** + * 指定武将名的音频。 + * + * 强制使用该audioname覆盖上面解析出来的audioname,其解析出来的audioname为“audioname_玩家武将名”, + * + * 最终路径为:无名杀目录\audio\“audioname_玩家武将名” + * + * 扩展: + * 若info.audioname存在,且是数组,且方法参数有player,则播放"audioname_玩家名"的声音(即可同一个技能,不同人播放不同声音) + */ + audioname?: string[]; + //【v1.9.102】 + /** + * 添加audioname2机制,用于重定向特定角色的语音到特定技能 + * + * 其key值为人物的name; + */ + audioname2?: SMap; + /** 强制播放音频 */ + forceaudio?: boolean; + + + //时机与触发相关 + /** + * 触发的时机 + * + * 一般用于触发技能(被动技能) + * + * 注1:主动触发enable,是没有event._trigger; + * + * 注2:有trigger,就表示这是一个触发技能,触发技能必须要有触发内容“content”,没有会引发报错; + */ + trigger?: SkillTrigger; + + /** + * 为true时,将该技能加入到_hookTrigger + * + * 根据代码理解: + * + * 通过addSkillTrigger,挂载在player._hookTrigger中; + * + * 作为一个单独触发的方式,每次createTrigger,logSkill,filterTriggers时执行所有挂载在_hookTrigger所有对应的hookTrigger; + * + * 目前可知,其相关使用方法:after,block,log【目前只有于国战方法中,应该是作为全局执行方法的一种简约写法,实用不大】 + */ + hookTrigger?: SkillHookTrigger; + + /** 同时机技能发动的优先度 */ + priority?: number; + + //基本都在核心createTrigger,addTrigger,trigger中逻辑触发相关,属于重要得属性 + /** + * 目前具体不知什么功能,当前所知,非常重要,和createTrigger,addTrigger,trigger相关 + * (推测,这属性是指明客户端是否显示该技能的操作按钮) + * + * 1.用于双将,若该设置不为true,该技能时在hiddenSkills隐藏技能列表中,且为“非明置”状态,结束当前“createTrigger”事件的触发; + * 即该设置,可以让隐藏技能触发; + * + * 2.用于event.addTrigger,event.trigger中,若该设置为true,默认为其priority+1,影响技能的触发顺序 + * (该顺序从代码看起来主要受priority影响,因为会*100,设置这个,会比其他同级优先一点) + * + * 3.当设置了该值为true, + * 若forced没设置到,则默认为true; + * 若popup没设置到,则默认为false; + * + * 故该设置核心功能:表明该技能是强行触发技能,并且不提示 + */ + silent?: boolean; + /** + * 目前具体不清楚什么功能,当前所知,也是个很重要得属性,估计是托管时是否触发得标记 + * + * 功能相当于forced+nopop ,会不会是被托管时的标记呢,正在验证 + * + * 用于双将,上面的silent为true,其非明置,该设置不为true,则触发“triggerHidden”; + * + * 功能好像是直接触发,在createTrigger中,直接event._result={bool:true}执行,否则可能需要(info.check进行ai检测); + */ + direct?: boolean; + /** + * 此技能是否可以被设置为自动发动(不询问) + * + * 设置了该属性的技能,可加入到配置选项中,自己设置是否自动发动(即该技能非必发技能) + * + * 若该属性值是“check”,则调用当前技能得check方法检测 + */ + frequent?: boolean | string | TwoParmFun; + /** + * 此技能是否可以被设置为自动发动2 + * + * 可以细分当前技能强制发动选项,(应该是为了细分子技能),保存到lib.config.autoskilllist, + * + * 在ui.click.autoskill2中执行, + * + * 取值为子技能的名字(注:目前,看来,只是在UI上作用,自动发动,更多是依赖frequent参数) + */ + subfrequent?: string[]; + /** + * 自动延迟的时间 + * + * 可以影响技能触发响应时间(主要影响loop之间的时间,即game.delayx的调用情况) + */ + autodelay?: boolean | number | TwoParmFun; + /** 第一时刻执行?(将发动顺序前置到列表前) */ + firstDo?: boolean; + /** 最后一刻做?(将发动顺序置于列表后方) */ + lastDo?: boolean; + + /** + * 此技能是否能固定触发(即自动发动)。 + * + * true为固定触发(可视为一种锁定技的,锁定技实质是mod里的技能) + * 国战可以触发亮将。 + * + * 【核心】作为game.check检测用的标准属性之一,在满足条件下强制执行。 + */ + forced?: boolean; + /** + * 死亡后是否可以发动技能 + */ + forceDie?: boolean; + /** + * 是否触发可以弹出选择技能的发动 + * + * 用于在arrangeTrigger过滤出多个同时机的触发技能时,在createTrigger中,询问玩家的技能发动, + * + * 若为false,不会加入询问触发的技能列表上(只有设置false才会); + * + * 若为字符串,则在createTrigger【step 3】触发技能时,使用player.popup弹出该提示文本; + */ + popup?: boolean | string; + /** + * player是否logSkill('此技能'). + * + * 设置true,则不弹出提示 + * + * 注:logSkill 则是在玩家确定要使用卡牌的情况下 弹出发动的技能(马里奥大佬的解释,到时看下) + * true为不 + */ + nopop?: boolean; + /** + * 取消触发后的处理 + * + * 在createTrigger中step 3处理 + * + * @param trigger + * @param player + */ + oncancel?(trigger: GameEventPromise, player: Player): void; + + //触发内容基本触发流程 + /** + * 在content之前执行 + * + * 在chooseToUse,step2中执行: + * 其执行时机和chooseButton一致,当chooseButton不存在时且game.online为false,则会执行这个 + * @param config + */ + precontent?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll; + /** + * 在content之前触发内容 + * + * 在useSkill中使用,主动触发技能content之前 + */ + contentBefore?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll; + /** + * 触发内容(技能内容) + * + * 作为被动触发技能: + * 在createTrigger,step3中创建当前技能的事件,设置该content为事件content作为触发内容; + * + * 作为主动触发技能: + * 在useSkill中创建当前技能的事件 + * 分步执行(通过step x分割开执行逻辑步骤) + * + * 注:此时的content,已经为触发该技能的效果而创建的,该技能执行中的事件,此时的event一般是不具备 + * 触发信息,触发的信息,主要在trigger触发事件中获取。 + */ + content?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll; + /** + * 在content之后触发内容 + * + * 在useSkill中使用,主动触发技能content之后 + */ + contentAfter?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll; + + //技能初始化与移除: + /** + * 获得技能时发动,初始化技能 + * + * 技能的话,则在addSkillTrigger,若第三个参数triggeronly取值为true,只设置触发,不初始化该技能; + * + * 正常在addSkill处理,this.addSkillTrigger(skill),使用此初始化; + */ + init?(player: Player, skill: string): void; + /** + * 添加技能时,初始化技能信息 + * + * 在addSkill中调用,每次添加都会执行 + */ + init2?(player: Player, skill: string): void; + /** 在执行player.disableSkill丧失技能时,若该属性为true,则执行技能的onremove */ + ondisable?: boolean; + /** + * 失去技能时发动 + * 当值为string时: + * + * 若为“storage”,删除player.storage中该技能的缓存(用于保存标记等信息); + * 注:失去这个技能时销毁标记。 + * + * 若为“discard”,若player.storage[skill]缓存的是卡牌时,执行game.cardsDiscard,并播放丢牌动画,然后移除player.storage[skill]; + * + * 若为“lose”,和“discard”差不多,不过不播丢牌动画; + * + * 当值为true时,直接移除player.storage[skill]; + * + * 当值为字符串集合时,则是删除集合中对应player.storage(即删除多个指定storage) + * + * 注:当前disableSkill中,若当前info.ondisable,调用onremove必须是方法,且不注入skill参数; + */ + onremove?: TwoParmFun | string | string[] | boolean; + /** 是否持续的附加技能,在removeSkill中使用 */ + keepSkill?: boolean; + + + //以下3个属性基本功能时一致:在某些模式下是否能使用,只使用一个就差不多 + /** + * 指定该技能在哪些模式下禁用 + * + * 注:在指定模式被禁用的技能,会被设置成空对象,并且“技能_info”的描述变成“此模式下不可用”。 + */ + forbid?: string[]; + /** 与forbid相反,只能在指定玩法模式下才能被使用,其他逻辑一致 */ + mode?: string[]; + /** 当前模式下是否能使用,返回false则不能使用,其实和forbid逻辑一致 */ + available?(mode: string): boolean; + + + //技能相关设置: + /** + * 技能组: + * + * 拥有这个技能时相当于拥有技能组内的技能 + * + * 注:一些特殊技能标签: + * + * “undist”:不计入距离的计算且不能使用牌且不是牌的合法目标 + * + * (被隔离玩家,目前确定的作用:player.getNext获取下一位玩家,player.getPrevious确定上一位玩家,player.distance计算玩家距离); + */ + group?: string | string[]; + /** + * 子技能: + * + * 你不会拥有写在这里面的技能,可以调用,可以用技能组联系起来; + * + * 子技能名字:“主技能_子技能”,翻译为主技能翻译 + * + * 注:子技能,会被视为“技能_子技能”独立保存起来。 + */ + subSkill?: SMap; + /** + * 全局技能?: + * + * 你拥有此技能时,所有角色拥有此技能(global的值为技能名) + * + * 注:无论是否拥有此技能,此技能都为全局技能写法:技能名前 + _ + */ + global?: string | string[]; + /** + * 在game.addGlobalSkill中使用: + * + * 强行设置global技能; + */ + globalSilent?: boolean; + + //技能相关设置=>功能设置 + /** + * 每回合限制使用次数 + * + * (若限制使用次数为变量时需写在filter内,即通过filter与变量动态判断) + * + * 主要在createTrigger,step3中触发计数。 + * + * 触发计数,会在玩家身上添加“counttrigger”技能,计数记录在:player.storage.counttrigger[当前技能名] + */ + usable?: number; + /** + * 每一轮的使用次数 + * + * 设置了该属性,会创建一个“技能名_roundcount”技能,将其加入group(技能组)中; + * + * 该技能的触发阶段“roundStart”(一轮的开始),用于记录当前技能的在一轮中使用的次数 + */ + round?: number; + /** 用于“技能名_roundcount”技能中,当前技能不可使用时,“n轮后”xxx,中xxx的部分显示(即后面部分) */ + roundtext?: string; + /** 增加显示的信息,这部分时增加,“n轮后”前面部分 */ + addintro?(storage: SMap, player: Player): string; + /** 延迟的时间 */ + delay?: number | boolean; + /** + * 锁定技 + * + * 若取值false,则get.is.locked,直接返回就false了; + * + * (锁定技的判定:1.info.trigger&&info.forced;2.info.mod;3.info.locked) + * + * 是否可以被“封印”(内置技能“fengyin”)的技能,取值为false时,get.is.locked返回为false;true则正常逻辑 + */ + locked?: boolean; + /** 是否是旧版技能,值为true,添加到lib.config.vintageSkills中,可以实现新/旧版技能切换,如果该为true,则“原翻译名_alter”即作为当前的翻译 */ + alter?: boolean; + + + //锁定技 + /** + * mod技能的设置 + * + * 如果有,技能视为锁定技 + * */ + mod?: Mod; + + //【重点】标记的key需要和技能名一致,游戏内都是通过对应skill取得对应的标记key,即player.storage[skill] + //限定技与觉醒技与技能标记 + /* + 关于限定技规范: + 一般情况下,需要在filter中,可加入!player.storage.xxx==true判定, + 在发动后,content内设置player.storage.xxx=true,代表已经触发了; + 目前,可以采用另一种简洁的方法,即觉醒技方法: + player.awakenSkill("xxx"); + 这样就会屏蔽发动过的技能,不会发动第二次; + */ + + /** + * 限定技(标记) + * + * 该标记为true时,若没有设置以下内容,则会自动设置: + * + * mark设置为true; + * + * intro.content设置为“limited”; + * + * skillAnimation设置为true; + * + * init设置为初始化玩家缓存的该技能名标记为false; + */ + limited?: boolean; + /** + * 是否开启觉醒动画 + * + * 准备来说,常用于觉醒动画,实际是指技能动画 + * + * 字符串时取值:epic,legend + */ + skillAnimation?: boolean | string; + /** 是否只显示文字特效 */ + textAnimation?: boolean; + /** 动画文字(可用于觉醒文字) */ + animationStr?: string; + /** 动画文字颜色(觉醒文字颜色) */ + animationColor?: string; + /** + * 觉醒技标记: + * + * (目前来看,这个目前单纯是技能标记,在主逻辑上并没使用,但貌似会被某些技能本身用到,或者类似左慈判断不能获得的技能的) + */ + juexingji?: boolean; + /** + * 获得技能时是否显示此标记, + * + * 若为false,可以用 markSkill 来显示此标记, + * + * 可以用 unmarkSkill 不显示标记 + * + * mark的常量值:"card","cards","image","character",表示,标记显示的特殊形式(UI上) + * + * 注:character,只能在表示一个角色时使用,标记以角色牌形式显示; + * + * 注:取值“auto”,在updateMark时,有计数时,执行unmarkSkill(?????) + */ + mark?: boolean | string; + /** 标记显示文本,一般为一个字 */ + marktext?: string; + /** 标记显示内容 */ + intro?: { + /** 自定义mark弹窗的显示内容 */ + mark?: ThreeParmFun; + /** 用于info.mark为“character”,添加,移除标记时,log显示的标记名(好像意义不大) */ + name?: string | TwoParmFun; + name2?: string | TwoParmFun; + /** + * 标记显示内容? + * 为cards时显示标记内的牌. + * + * 当标记显示内容是文本: + * + * "mark":有(数)个标记; + * + * "card":一张牌; + * + * "cards":多张牌; + * + * "limited":限定技,觉醒技专用;(若没设置,在info.limited为true下回默认设置这个) + * + * "time":剩余发动次数; + * + * "turn":剩余回合数; + * + * "cardCount":牌数; + * + * "info":技能描述; + * + * "character":武将牌; + * + * "player":一个玩家; + * + * "players":多个玩家; + * + * 可以只是一个描述文本; + * + * 在get.storageintro 中使用,以上,即为该方法的type,返回标记的描述内容 + * + * 若info.mark为“character”,则一般为一个描述文本; + * + * 注:info.mark为true时,也可以使用文本描述,比较自由(按道理都可以,不过默认搭配而已); + * + * 其中,文本可使用以下占位符: + * + * "#":(this.storage[skill])获取对应的计数, + * + * "&":get.cnNumber(this.storage[skill])获取对应的计数(需要使用到get.cnNumber来获取的数量), + * + * "$":get.translation(this.storage[skill])获取对应描述(一般是描述的角色名) + * + * 也可以是个自定义的方法 + */ + content?: string | ((storage: any, player: Player, skill: string) => string | void); + /** + * 标记数 + * + * 主要在player.updateMark时使用,实际顶替this.storage[i+'_markcount']获取标记数 + */ + markcount?: number | TwoParmFun | string; + /** 是否不启用技能标记计数 */ + nocount?: boolean; + /** + * 移除该标记时,在unmarkSkill执行 + * + * 若值为字符串“throw”,该玩家缓存中该技能标记的为牌时,播放丢牌动画; + * + * 若是方法,则直接使用该回调方法处理。 + * + * 注:该参数原本只在把整个标记移除时执行,后续可能自己扩展; + */ + onunmark?: TwoParmFun | string | boolean; + // id?:string; //id名字需带“subplayer”,用于特殊模式显示信息用 + }; + + //主公技 + /** + * 是否为主公技: + * + * true时,将这个技能设置为主公技 + * + * (目前来看,这个目前单纯是技能标记,在主逻辑上并没使用,但貌似会被某些技能本身用到) + */ + zhuSkill?: boolean; + + //主动技能(主动使用技能,包含技能使用的相关操作配置) + /** + * 可使用的阶段 + * + * 一般用于主动技能 + * + * 注:从这个info.enable==event.name看出,其实和trigger差不多,所有事件的发动都会阶段时点; + * + * 即,当前执行的事件,触发game.check,时,检测触发的技能的event.name,即是info.enable; + * + * 常用的阶段: + * + * phaseUse:出牌阶段使用; + * + * chooseToRespond:用以响应; + * + * chooseToUse:常用于“濒死使用”/打出使用 + */ + enable?: string | string[] | OneParmFun; + /** + * 是否显示弹出该技能使用卡牌的文字 + * + * useCard中使用, + * + * 若为true的话,则执行player.popup + * + * 例如:player.popup({使用卡牌名name,使用卡牌nature},'metal') + */ + popname?: boolean; + + //视为技(转换卡牌的技能) + /** + * (视为)目标卡牌 + * + * 一般用于视为技能 + * + * 【v1.9.102】扩展:可以使用函数式viewAs,目前核心支持使用地方:backup,ok; + */ + viewAs?: string | CardBaseUIData | ((cards: Card[], player: Player) => string | VCard | CardBaseUIData | null); + /** + * 视为技按钮出现条件(即发动条件) + * @param player + */ + viewAsFilter?(player: Player): boolean | void; + /** + * 使用视为牌时触发内容。 + * + * result.cards是视为前的牌 + * + * 注:实际是useResult,若当前处理的是技能,则先触发这个,后面再更具具体情况执行useCard,useSkill; + * + * 一般是用于视为技作为,效果处理,作为其他处理,会显得多余,算是视为技的扩展操作 + * + * @param result + * @param player + */ + onuse?(result: Result, player: Player): void; + /** + * 选择按钮(牌) + * + * 常用于视为技需要实现复杂的功能选项时使用; + * + * 当前使用范围: + * + * chooseToUse + * + * chooseToRespond + */ + chooseButton?: ChooseButtonConfigData; + /** + * 源技能 + * + * (该属性应该是动态生成的,用于记录执行backup的技能名,即执行backup的视为技能,实质是执行本技能) + * + * 在chooseToUse,step1中使用,若有,将器添加到event._aiexclude中; + * + * + * 目前来看,该字段不是配置进去的,而是chooseToUse,step3中,执行chooseButton的backup方法, + * + * 返回一个新的“视为”技能:“技能名_backup”,并设置到lib.skill中, + * + * 并且将技能名作为该技能的源技能设置到这个新技能的sourceSkill中。 + */ + sourceSkill?: string; + + + //具体功能的处理 + //弃牌,失去牌(默认不设置discard,lose,则直接player.discard弃置选择的牌) + //discard,lose其中一个false,都会为非视为技走lose事件失去卡牌,且提供丰富的参数设置; + /** + * 是否弃牌 + * + * 在useSkill中调用, + * + * 选择牌发动技能后,被选择的牌都要弃置 + * + * 取值false(因为undefined != false结果为true,故默认不填和true效果一致) + */ + discard?: boolean | ContentFuncByAll | OldContentFuncByAll; + /** + * 是否失去牌(是否调用player.lose) + * + * 与discard调用时机一致,都在useSkill中, + * 取值为false + */ + lose?: boolean; + /** + * 不弃牌,准备用这些牌来干什么(用于播放动画) + * + * 其字符串枚举有: + * + * give,give2,throw,throw2 + * + * 若不是字符串,则执行该方法 + */ + prepare?: string | ((cards: Card[], player: Player, targets: Player[]) => string | void); + /** 在lose事件中使用,触发执行“lose_卡牌名”事件的content */ + onLose?: OldContentFuncByAll | OldContentFuncByAll[]; + /** + * 在lose事件中使用,必须要失去的卡牌为“equips”(装备牌),有onLose才生效。 + * 若符合以上条件,则检测该牌是否需要后续触发执行“lose_卡牌名”事件,既上面配置的onLose + */ + filterLose?: TwoParmFun; + /** 在lose事件中使用,取值为true,作用貌似强制延迟弃牌动画处理 */ + loseDelay?: boolean; + + /** + * 是否触发lose失去牌阶段 + * + * 取值false; + * + * 若为false,则跳过该触发 + * + * 适合lose绑定一起使用,为false时,设置丢失牌事件_triggered为null + */ + //新版本出牌阶段主动技的新参数(均仅在discard为false且lose不为false时有效),且losetrigger不为false, + //是默认情况下:执行player.lose(cards,ui.special),以下为 + losetrigger?: boolean; + /** 让角色失去卡牌的过程中强制视为正面朝上失去(losetrigger不为false时,既默认情况下生效) */ + visible?: boolean; + /** + * 指定失去特殊区卡牌的去向 (即设置卡牌的position) + * + * 其值采用的是ui的成员,即通过ui[info.loseTo],获取实体对象设置; + * + * 默认为:"special", + * + * 取值:"special","discardPile","cardPile","ordering","control"(这一般都不会用上,好像没看见) + */ + loseTo?: string; + /** + * 需要失去的牌的区域ui.special(默认情况是这个,受loseTo影响), + * + * 设置lose事件的toStorage为true,失去的牌到牌记录到自己的storage中; + */ + toStorage?: boolean; + /** + * 用于将失去的牌置于某个区域的顶端(而非默认的顶端);【v1.9.108.6】 + */ + insert?: boolean; + + /** + * 技能响应前处理(非联机时,不在线时处理,估计时用于自动响应) + * + * 在chooseToRespond中使用 + */ + prerespond?(result, player: Player): void; + /** + * 技能响应(可直接使用技能来响应,在这里进行响应的处理) + * + * 在respond中使用 + */ + onrespond?(event: GameEventPromise, player: Player): void; + /** + * 过滤发动条件,返回true则可以发动此技能 + * + * 主要在filterTrigger,game.check中处理,返回false则不处理(可以不设置该配置,相当于默认true结果) + * + * 注: + * + * 1.主动触发:一般走的是game.check,其filter,传入的event指的是当前game.check处理的事件; + * + * 2.被动触发:一般走的是lib.filter.filterTrigger,其filter,传入的event指的是当前的触发事件,其中还会把触发事件名传入第三个参数; + * @param event 事件,即event._trigger,相当于trigger时机(此时的event为触发该技能时机时的事件) + * @param player + * @param name 触发名,为event.triggername,目前只有在lib.filter.filterTrigger中才传该值,即被动触发,主动触发不检测该值,目前暂未完善 + */ + filter?(event: GameEventPromise, player: Player, name?: string): boolean | void | null; + /** + * 选择的目标武将牌上出现什么字。 + * + * 使用地方:ui.click.target/player,.... + * + * 如果是数组第几元素对应第几个目标; + * + * 如果是方法,则直接根据入参target,判断返回的文本; + * + * 例子: + * targetprompt:['出杀','出闪'],依次就是你点击第一个角色后在其旁边显示出杀,第二个角色显示出闪 + */ + targetprompt?: string | string[] | OneParmFun; + /** + * 是否每个目标都结算一次(多个目标) + * + * true为可选择多名目标 + */ + multitarget?: boolean | number; + /** + * 指向线的颜色枚举: + * fire(橙红色FF9244),thunder(浅蓝色8DD8FF),green(青色8DFFD8), + */ + line?: string | { color: number[] } | boolean; + /** 是否显示多条指引线 */ + multiline?: boolean; + + /** + * 选中该技能使用时,进行处理 + * + * 在chooseToUse 的content中调用, + * + * 目前参考的例子中,大多数多是用于添加一些牌到待选择到event.set(key,收集的牌)中, + * + * 用于使用前先选牌的效果 + * + * 注:其调用时机应该远早于触发技能的,在选中牌时就开始处理。 + * @param event + */ + onChooseToUse?(event: GameEventPromise): void; + + /** + * 改变拼点用的牌 + * + * 在chooseToCompare和chooseToCompareMultiple,step2中使用,返回玩家用于的拼点的牌 + * @param player + */ + onCompare?(player: Player): Card[]; + + /** + * 在chooseToRespond时使用,会前置执行当前chooseToRespond事件player所有的技能该接口; + * + * 应该时用于chooseToRespond事件时,技能进行一些初始化处理(暂无使用实例) + * 【v1.9.106】 + * @param event + */ + onChooseToRespond?(event: GameEventPromise): void; + + //核心 + //event.bakcup设置的信息,game.check使用到的一些参数,其实就是把game.check需要的一些参数设置到技能中,作为check时的条件 + // 追加:这个主要用于game.check检测中,取代当前事件的条件;若没有主动申请检测,则其实用不上; + // 在表现上,主要用于:主动技,视为技 + /* 这些就是作为前提条件的主要属性 + filterButton + selectButton + filterTarget + selectTarget + filterCard + selectCard + position + forced + complexSelect?:boolean; + complexCard?:boolean; + complexTarget + ai1 + ai2 + */ + //目标 + /** + * 需要选择多少张牌才能发动 + * + * 选择的牌数 + * + * -1时,选择所有牌,否则就是指定数量的牌 + * + * 数组时,这个数组就是选择牌数的区间,其中任意(至少一张):[1,Infinity] + * + * 为变量时(具体情况具体分析),例:()=>number + */ + selectCard?: number | Select | NoneParmFum; + /** + * 需要选择多少个目标才能发动 + * + * 选择的目标数: + * + * 为-1时,选择全部人 + * + * 为数组时,这个数组就是选择目标数的区间 + */ + selectTarget?: number | Select | (() => number | Select); + /** + * 选择的牌需要满足的条件 + * + * 可以使用键值对的简便写法 + * + * 也可以使用函数返回值(推荐) + * + * 都是通过get.filter处理成事件的filterCard的方法; + * + * 直接填true,则有些地方,会优先触发过滤可使用的卡牌,例如ui.click.skill,ai.basic.chooseCard + * + * 注:game.check时,如果当前时viewAs“视为技”,则其过滤技能时filterCard,作为方法,多入参一个event参数,需要时可以使用; + * (一般没有) + */ + filterCard?: boolean | CardBaseUIData | TwoParmFun | boolean; + /** + * 是否使用mod检测 + * + * 取值true; + * + * 在event.backup使用, + * + * 当info.viewAs有值的时候(即该技能为视为技), + * + * 若没有设置filterCard,默认设置一个filterCard: + * 可以优先使用“cardEnabled2”的mod检测卡牌是否可使用; + * + * + * 已找不到,可能就是改成cardEnabled2 + * + * 则若当前事件为”chooseToUse“(选择卡牌使用),使用”cardEnabled“卡牌是否能使用mod检测; + * + * 则若当前事件为”chooseToRespond“(选择卡牌响应),使用”cardRespondable“卡牌是否能响应mod检测; + */ + ignoreMod?: boolean; + /** + * 选择的目标需要满足的条件 + */ + filterTarget?: ((card: Card, player: Player, target: Player) => boolean) | boolean; + /** + * 指定位置: + * 'h':手牌区, 'e':装备区, 'j':判定区 + */ + position?: string; + /** + * 选择时弹出的提示 + * + * 单参数的方法,主要用再技能点击使用时的提示; + * + * 注:即触发技能/主动发动技能的提示描述信息; + */ + prompt?: string | TwoParmFun; + //| TwoParmFun | TwoParmFun //好像没见到用 + /** + * 二次提示 + * + * 主要在createTrigger,step1中,设置event.prompt2 + * + * 若是boolean类型,则取值false,不显示prompt2,默认使用lib.translate[“技能名_info”]的描述 + * + * 注:即发动技能时,prompt提示下的提示(默认显示技能描述); + */ + prompt2?: string | TwoParmFun | boolean; + /** + * 在ui.click.skill中使用,若当前event.skillDialog不存在,可以用该方法生成的文本的dialog作为skillDialog; + * + * 若没有该方法,可以使用翻译中该技能的info信息代替。 + */ + promptfunc?: TwoParmFun; + /** 表示这次描述非常长(涉及用了h5文本),设置为true,重新执行ui.update(),设置skillDialog.forcebutton为true */ + longprompt?: boolean; + + //补充game.check相关参数的声明: + /** 过滤不可选择按钮 */ + filterButton?(button: Button, player: Player): boolean; + /** 按钮的可选数量,大多数情况下,默认1 */ + selectButton?: number | Select | NoneParmFum; + complexSelect?: boolean; + /** 复合选牌:即每选完一次牌后,都会重新下一次对所有牌的过滤 */ + complexCard?: boolean; + complexTarget?: boolean; + + /** 一般作为chooseCard相关ai */ + ai1?: Function; + /** 一般作为chooseTarget相关ai */ + ai2?: Function; + + /** + * 是否检测隐藏的卡牌 + * + * 使用范围:player.hasUsableCard,player.hasWuxie + * + * 常用:让系统知道玩家“有无懈”; + * + * 例子:可以参考“muniu”(木牛流马) + * @param player + * @param name + */ + hiddenCard?(player: Player, name: string): boolean | void; + + /** 录像相关,game.videoContent.skill中相关 */ + video?(player: Player, data: string | any[]): void; + + process?(player: Player): void; + + //在skillDisabled中,根据以下5个属性,检测技能是否是不能使用(若其中有一个时true都排除掉),在chooseSkill,选择获得技能时筛选列表 + //在getStockSkills中,有前3个标签属性的技能也是无法获取的 + /** + * 唯一 + * + * 在skillintro中使用(左慈不能化身) + * + * 注:该技能是否为特殊技能,即左慈化身能否获取等等,常与部分锁定技、主公技、觉醒技连用 + */ + unique?: boolean; + /** 临时技能,在die死亡时,会被移除 */ + temp?: boolean; + /** 子技能标签,在subSkill的技能中,会默认标记该属性为true */ + sub?: boolean; + /** 固有技,不能被removeSkill移除 */ + fixed?: boolean; + /** 一次性技能,在resetSkills时,直接移除该技能 */ + vanish?: boolean; + + /** + * 武将特有固有技能 + * + * 从逻辑上来看,比固定技优先级还高,不会受“fengyin”,“baiban”等技能移除; + * + * 在clearSkills时,如果不是“删除所有的all为true”的情况下,不会被移除; + * + * 不会被,“化身”之类的技能获得,删除; + */ + charlotte?: boolean; + /** 在clearSkills中使用,标记此标记,永远不会被该方法删除,该标记独立使用,一般其他方法没有对其进行处理 */ + superCharlotte?: boolean; + /** 作用不明,并没有什么用,与ui相关,在skillintro中使用,值为true */ + gainable?: boolean; + /** 在nodeintro中使用,添加classname:thundertext,值为true */ + thundertext?: boolean; + + //在nodeintro中使用的(这几个配置都没什么意义) + /** 设置nodeintro的点击事件 */ + clickable?(player: Player): void; + /** 过滤点击,应该是过滤弹出面板是否能点击,具体作用日后细究 */ + clickableFilter?(player: Player): boolean; + /** 技能名不带【】括号 */ + nobracket?: boolean; + + //日志相关: + /** 是否在历史日志中显示,取值未false不显示 */ + logv?: boolean; + /** + * 显示场上日志中显示 + * + * 在useSkill时,若值为“notarget”,则不显示出对所有“对...”目标相关描述的日志; + * + * 在useCard时,若该设置未false,则不执行player.logSkill; + */ + log?: boolean | string; + /** + * 目标日志 + * + * 若是字符串,则配置一个当前处理的trigger事件的一个玩家元素,例如"player","source","target"...; + * + * 若是方法,则配置一个方法直接返回文本,或者玩家 + * + * 若没有配置prompt,显示该配置的提示 + */ + logTarget?: string | TwoParmFun; + /** + * 是否通过logTarget显示触发者的目标日志; + * + * 目的:应该是为了细节化显示日志;在createTrigger,step3中使用,取值false,不使用logTarget,显示logSkill; + */ + logLine?: boolean; + + //技能的信息显示: + /** + * 内容描述 + * + * 在addCard时,设置“技能名_info”的翻译;(addCard很少使用) + * + * 若时subSkill子技能,则设置“技能名_子技能名_info”的翻译;(主要适用于子技能描述) + * + * 该技能的描述(自定义,非子技能时和game逻辑无关,用于自己的解析逻辑) + */ + description?: string; + /** 该技能的描述(自定义,和game逻辑无关,用于自己的解析逻辑) */ + // infoDescription?:string; + /** + * 来源: + * + * 若该来源技能不存在,则当前技能会被移除; + */ + derivation?: string[] | string; + + /** + * 强制加载该card配置, + * 例如,一些原本不用于contect模式得卡,设置该值可强制加载该card + */ + forceLoad?: boolean; + + //AI相关 + /** ai的详细配置 */ + ai?: SkillAI; + + /** + * ai用于检测的方法: + * + * 第一个参数好想有些不一样:event,card,子技能button; + * + * 基本ai.basic使用的check方法(既涉及choose系列时用的ai自动选择): + * + * 1)ai如何选牌: + * + * 在ai.basic.chooseCard中使用; + * + * 2)ai如何选按钮: + * + * 在ai.basic.chooseButton中使用; + * + * 3)ai如何选玩家: + * + * 在ai.basic.chooseTarget中使用; + * + * 注:其实这些应该都有两个参数的,既第二个参数其实当前所有选中的的数据; + * + * 有时甚至不传参,所以遇到保存,做好健壮性屏蔽; + * + * 特殊作用: + * + * 在触发createTrigger中使用,参数:trigger事件,player玩家; + * + * 1)在技能过滤触发时作为过滤条件(当前技能info.frequent=='check'): + * + * 2)告诉ai是否发动这个技能:返回true则发动此技能,即作为createTrigger过程中,设置ai如何chooseBool这个技能; + * + * 例: + * + * a.触发技判断敌友,大于0为选择队友发动,若<=0是对敌方发动:return get.attitude(player,event.player)>0; + * + * b.选取价值小于8的牌:return 8-get.value(card); 数字越大,会选用的牌范围越广,8以上甚至会选用桃发动技能,一般为6-ai.get.value(card); + * + * 注: + * + * 两个参数,用于事件触发技能:event:GameEvent,player:Player; + * + * 一个参数,用于主动使用触发技能:card:Card; + * + * 无参,简洁写法; + */ + check?: ((card: Card) => number | boolean | void) | ((event: GameEventPromise, player: Player) => number | boolean | void) | (() => number | boolean | void); + // check?(...any:any):number|boolean; + // /** ai用于检测的方法:用于主动使用触发技能 */ + // check?(card:Card):number|boolean; + // /** ai用于检测的方法:用于事件触发技能 */ + // check?(event:GameEventPromise,player:Player):number|boolean; + // check?():number|boolean; + // check?:OneParmFun | OneParmFun | OneParmFun | TwoParmFun; + + //event.addTrigger,默认对于技能优先度的标记:rule any); + + /** + * 手动设置技能的标签 + */ + categories?: (skill: string, player: Player) => string[]; + + //日后还有很多属性要添加的 + [key: string]: any; +} + +/** ai的配置信息 */ +declare interface SkillAI { + //****************************技能标签 start****************************** */ + //技能标签(告诉ai的细致的信息,用来自己处理时使用,甚至可以视为一般标记使用) + /* + player.hasSkillTag('xxxx') 检测是否有指定技能标签: + + 在流程中,优先检测 + info.ai.skillTagFilter + 若有这个,先用它过滤检测的技能标记,通过后, + 再检测ai[tag], + 若是字符串,则info.ai[tag]==arg; + 非字符串,则,只有true才可以成功(其实按代码,可以判定非0数字) + */ + + //无视防具系列: + /** + * 无防具(无视防具1) + * + * 在某些防具的filter中有所实现,拥有该技能标签,有些防具的效果不能发动 + */ + unequip?: boolean; + /** + * 无视防具2 + * + * 同样也是作为无视防具的效果的标签, + * 这个更直接,无需任何判定条件,直接无视 + */ + unequip2?: boolean; + /** 无视防具3 */ + unequip_ai?: boolean; + + /** + * 【响应闪】 + * 作用是告诉AI手里没『闪』也可能出『闪』,防止没『闪』直接掉血; + * 常用于视为技; + */ + respondShan?: boolean; + /** + * 【响应杀】 + * 作用是告诉AI手里没『杀』也可能出『杀』,防止没『杀』直接掉血; + * 常用于视为技; + */ + respondSha?: boolean; + /** + * 在createTrigger中使用,可以指示技能不强制发动,暂无用; + */ + nofrequent?: boolean; + /** + * 【卖血】 + * 用于其他AI检测是否是卖血流(if(target.hasSkillTag('maixie')))。并非加了这个AI就会卖血。 + */ + maixie?: boolean; + /** + * 【卖血2】 + * 用于chooseDrawRecover 选择抽牌还是回血,即表示该角色血量重要,告诉AI主动优先选择回血。 + */ + maixie_hp?: boolean; + /** + * 【卖血3】 + */ + maixie_defend?: boolean; + /** + * 【无护甲】 + * 视为无护甲,用于damage,作用是告诉AI,即使有护甲,也不不使用护甲抵扣伤害; + */ + nohujia?: boolean; + /** + * 【失去装备正收益】 + * 视为失去装备正收益,即失去装备可以发动某些效果,用于get.buttonValue中, + * 影响ui的选择项; + */ + noe?: boolean; + /** + * 【无手牌】 + * 视为无手牌,用于get.buttonValue中,目前只出现在“连营”和“伤逝”中,用于其它AI检测是否含有标签『无牌』,从而告诉其他AI不要拆迁(因为生生不息)。 + * 应该是影响ui的选择项 + */ + noh?: boolean; + /** + * 【不能发起拼点】 + * 用于player.canCompare 检测玩家是否能发起拼点(作为来源),可用于常规判定; + */ + noCompareSource?: boolean; + /** + * 【不能成为拼点目标】 + * 用于player.canCompare 检测目标是否能成为拼点的目标,可用于常规判定; + */ + noCompareTarget?: boolean; + /** + * 用于lib.filter.cardRespondable,检测是否可以响应卡牌(这个竟然参加逻辑中); + */ + norespond?: boolean; + /** + * 【不能自动无懈】 + * 影响lib.filter.wuxieSwap的检测; + */ + noautowuxie?: boolean; + /** + * 【可救助】 + * 在_save全局技能中检测,标记该技能是可用于濒死阶段救助;(即此技能可以用于自救) + * 现在参数3为寻求帮助的濒死角色【v1.9.108.2.1】。 + */ + save?: boolean; + /** + * 【响应桃】 + * 此技能可以用于救人, + * 一般用于视为技 + */ + respondTao?: boolean; + /** + * 【不明置】 + * 影响game.check的检测; + */ + nomingzhi?: boolean; + /** + * 反转装备的优先值,用于设置装备卡牌card.ai.basic.order的默认优先度; + */ + reverseEquip?: boolean; + /** 非身份,国战使用,濒死阶段,有该标记,可以强行进行复活求帮助 */ + revertsave?: boolean; + /** 改变判定 */ + rejudge?: boolean; + + //inRange方法相关标记,影响距离计算 + /** 逆时针计算距离 */ + left_hand?: boolean; + /** 顺时针计算距离 */ + right_hand?: boolean; + /** 计算距离时,无视本单位 */ + undist?: boolean; + + //其余一些有些少出场的: + /** 不会受到火焰伤害 */ + nofire?: boolean; + /** 不会受到雷电伤害 */ + nothunder?: boolean; + /** 不会受到伤害 */ + nodamage?: boolean; + /** 使用毒会有收益 */ + usedu?: boolean; + /** 不受毒影响 */ + nodu?: boolean; + notrick?: boolean; + notricksource?: boolean; + useShan?: boolean; + noShan?: boolean; + nolose?: boolean; + nodiscard?: boolean; + + /** 玩家不响应无懈 */ + playernowuxie?: boolean; + + /** 【响应酒】当你需要使用“酒”时,标记技能可响应 */ + jiuOther?: boolean; + + /** 【伤害减免】当你收到伤害时,伤害会减免 */ + filterDamage?: boolean; + + //个人额外扩展: + /** 不能被横置 */ + noLink?: boolean; + /** 不能被翻面 */ + noTurnover?: boolean; + + //【v1.9.102】 + /** + * 用于观看其他角色的手牌 + * + * 令其他角色的手牌对自己可见; + * 只需令自己拥有viewHandcard的技能标签即可,通过调整skillTagFilter即可实现对特定角色的手牌可见; + * 例: + * ai:{ + viewHandcard:true, + skillTagFilter:function(player,tag,arg){ //arg为目标,通过调整skillTagFilter即可实现对特定角色的手牌可见; + if(player==arg) return false; + }, //可看见除自己外所有人的手牌; + } + */ + viewHandcard?: boolean; + + /** + * 是否忽略技能检测 + * + * 用于get.effect,处理target时,检测是否处理target的result; + */ + ignoreSkill?: boolean; + //********************************技能标签 end********************************** */ + + + //ai基础属性值 + /** + * ai发动技能的优先度 【也用于卡牌的优先度】 + * 要具体比什么先发发动,可以使用函数返回结果 + */ + order?: number | ((item: SkillOrCard, player: Player) => number | void); + /** + * 发动技能是身份暴露度(0~1,相当于概率) + * 取值范围为0~1,用于帮助AI判断身份,AI中未写expose其他AI将会无法判断其身份 + */ + expose?: number; + /** + * 嘲讽值: + * 嘲讽值越大的角色越容易遭受到敌方的攻击,默认为1,一般在0~4中取值即可(缔盟threaten值为3) + */ + threaten?: number | ((player: Player, target: Player) => number | void); + /** + * 态度: + * 态度只由identity决定。不同身份对不同身份的att不同。 + * 例如:在身份局中,主对忠att值为6,忠对主att值为10; + * 注:配置不配该值; + */ + // attitude?: number; + + /** + * 效果: + * 影响ai出牌(例如什么时候不出杀)等 + * 效果值为正代表正效果,反之为负效果,AI会倾向于最大效果的目标/卡牌; + * + * 告诉ai有某技能时某牌的使用效果发生改变。 + * + * ai里面的effect是上帝视角,target不代表目标角色,player也不代表拥有此技能的玩家本身, + 因为effect是写给别的AI看的,所以target代表玩家本身,player代表其他人,可以是正在犹豫是否要杀你的任何一位玩家。 + + * 注:若不是个对象,可以直接是一个target(一种简写形式,不收录了) + * + * 应用: + * 〖主动技〗 + 如果技能发动无须指定目标: effect=result*ai.get.attitude(player,player); + 如果技能发动须指定目标 总效果=对使用者的收益值 * 使用者对自己的att+对目标的收益值 * 使用者对目标的att; 实际还会考虑嘲讽值,这里简化了; + 〖卖血技〗 + 总效果=对使用者的收益值 * 使用者对自己的att+对目标的收益值 * 使用者对目标的att; 实际还会考虑嘲讽值,这里简化了; + + 设对目标的原收益为n,对使用者的原收益为n',n>0代表正收益,n<0代表负收益; + 函数传入4个参数,分别为卡牌、使用者、目标以及n; + 返回值可有3种形式 + 1. 一个数a,对目标总的收益为a*n; + 2. 一个长度为2的数组[a,b],对目标的总收益为a*n+b; + 3. 一个长度为4的数组[a,b,c,d],对目标的总收益为a*n+b,对使用者的总收益为c*n'+d; + 假设n代表火杀对目标的效果 + 1. 技能为防止火焰伤害:return 0; + 2. 技能为防止火焰伤害并令目标摸一张牌:return [0,1]; + 3. 技能为防止火焰伤害并令使用者弃置一张牌:return [0,0,1,-1]; + + 〖倾向技〗 + 对确定的意向,反应准确的收益 + + 【收益论的检验】示例: + content:function(){ + game.log(player,'对',target,'的att是',ai.get.attitude(player,target)); + game.log(player,'对',player,'的att是',ai.get.attitude(player,player)); + game.log(player,'对',target,'发动【测试】的eff是',ai.get.effect(target,'测试',player,player)); + game.log(player,'对',target,'使用【杀】的eff是',ai.get.effect(target,{name:'sha'},player,player)); + }, + + 永远的萌新大佬的示例: + effect的返回值: + effect有3种可能的返回值,1个数字,长度为2的数组,长度为4的数组。 + 1个数字n:收益*n + 长度为2的数组[a,b]:a*收益+b + 长度为4的数组[a,b,c,d]:对目标为a*收益+b,对使用者为c*收益+d + *注意 zeroplayertarget 实际上是[0,0,0,0] zerotarget 实际上是[0,0 + "下面以target:function(){},别人对你使用杀为例,括号里为可能的技能描述" + return -1;//负影响(杀对你造成伤害时改为等量回复) + return 0;//无影响(杀对你无效) + return 2;//2倍影响(杀对你的伤害翻倍) + return 0.5;//一半影响(杀对你的伤害减半) + return [1,1];//正常影响+1(成为杀的目标摸一张牌) + return [1,-1];//正常影响-1(成为杀的目标弃一张牌) + return [0,1];//无影响+1(杀对你造成伤害时改为摸一张牌); + return [0,-1];//无影响-1(杀对你造成伤害时改为弃一张牌) + return [1,0,0,-1];//对你正常影响,对使用者无影响-1(刚烈) + return [1,1,1,1];//对双方正常影响+1(你成为杀的目标时你和使用者各摸一张牌) + */ + effect?: { + /** + * 牌对你的影响(你使用牌/技能对目标的影响) + * + * 返回结果的字符串:"zeroplayer","zerotarget","zeroplayertarget",指定最终结果的:对使用者的收益值,对目标的收益值为0 + * @param result1 即当前ai.result.player的结果 + */ + player?(card: Card, player: Player, target: Player, result1: number): string | number | number[] | void | boolean; + /** + * 一名角色以你为牌的目标时对你的影响(牌/技能对你的影响) + * + * 返回结果的字符串:"zeroplayer","zerotarget","zeroplayertarget",指定最终结果的:对使用者的收益值,对目标的收益值为0 + * @param result2 即当前ai.result.target的结果 + */ + target?(card: Card, player: Player, target: Player, result2: number): string | number | number[] | void | boolean; + }; + /** + * 收益: + * 收益值未在AI声明默认为0(对玩家对目标均是如此)。 + * 一般用于主动技; + * 关于收益的算法,待会再详细描述 + * + * 在get.result中使用; + * + */ + result?: { + /** + * ai如何选择目标(对目标的收益): + * 返回负,选敌人,返回正,选队友; + * 没有返回值则不选; + * 注:写了这个就不用写player(player){}了,因为player可以在这里进行判断......先继续研究好,再下定论; + */ + target?: number | ((player: Player, taregt: Player, card: Card) => number | void | boolean); + /** + * 主要用于get.effect_use中,优先于上面的target; + */ + target_use?: number | ((player: Player, taregt: Player, card: Card) => number | void) | boolean; + /** + * ai是否发动此技能(对玩家(自身)的收益): + * 返回正,发动,否则不发动; + * 注:最终 + */ + player?: number | ((player: Player, taregt: Player, card: Card) => number | void | boolean); + /** + * 主要用于get.effect_use中,优先于上面的player; + */ + player_use?: number | ((player: Player, taregt: Player, card: Card) => number | void | boolean); + + /** + * 取值为true时,不默认为“equip(装备)”卡牌,默认设置“card.ai.result.target”方法 + */ + keepAI?: boolean, + } + /** + * 技能标签的生效限制条件 + * + * 例:视为技中使用,ai什么时候可以发动视为技(决定某些技能标签的true/false) + * 在player.hasSkillTag,player.hasGlobalTag中使用 + */ + skillTagFilter?(player: Player, tag: string, arg: any): boolean | void; + + //------------------------------主要给卡牌使用的ai配置(也共享上面一些配置)-------------------------------- + //若武将使用以下配置,一般为该武将的“视为技”时使用,其配置对应“视为”的卡牌 + + //这些时在外的简写,一般详细处理,在basic内 + /** + * 回合外留牌的价值【一般用于卡牌的ai】 + * + * 大致的价值标准: + * tao [8,6.5,5,4]>shan [7,2]>wuxie [6,4]>sha,nanman [5,1]>wuzhong 4.5>shunshou,tiesuo 4 + * wugu,wanjian,juedou,guohe,jiedao,lebu,huogong,bingliang 1>shandian 0 + * 注:当value的结果为一个数组时,则标识当前card在手牌中位置,根据该牌所处位置,获得对应下标不同的value; + */ + useful?: number; + /** + * 牌的使用价值【一般用于卡牌的ai】 + * + * 数字越大,在一些ai会选用的牌范围越广,8以上甚至会选用桃发动技能,一般为6-ai.get.value(card); + * 大致的价值标准: + * wuzhong 9.2>shunshou 9>lebu 8>tao [8,6.5,5,4]>shan [7,2]>wuxie [6,4]>juedou 5.5>guohe,nanman,wanjian 5>sha [5,1] + * tiesuo,bingliang 4>huogong [3,1]>jiedao 2>taoyuan,shandian 0 + * 注:当value的结果为一个数组时,则标识当前card在手牌中位置,根据该牌所处位置,获得对应下标不同的value; + */ + value?: number | number[] | TwoParmFun; + /** 该装备的价值 */ + equipValue?: number | TwoParmFun; + /** 主要是使用在card的ai属性,武将技能可以无视 */ + basic?: { + /** 该装备的价值,同equipValue,优先使用equipValue,没有则ai.basic.equipValue */ + equipValue?: number | TwoParmFun; + /** 优先度 */ + order?: number | TwoParmFun; + /** 回合外留牌的价值(该牌可用价值),number为当前事件玩家的手牌的下标 */ + useful?: SAAType | TwoParmFun>; + /** 该牌的使用价值 */ + value?: SAAType | FourParmFun>; + + [key: string]: any; + }; + + //ai的tag【可用于标记卡牌的属性】 + //get.tag(卡牌,标签名) 检测是否有指定卡牌标签: + /** 主要是使用在card中,独立制定的一些标记来描述自身得一些特性,有则标记1,默认是没有(实质上用bool也行),可能有少许标记参与运算 */ + tag?: { + //比较常用:(以下为自己得理解) + /** 【响应杀】:即手上没有杀时,也有可能响应杀 */ + respondSha?: CardTagType; + /** 【响应闪】:即手上没有闪时,也有可能响应闪 */ + respondShan?: CardTagType; + /** 【不会受到伤害】 */ + damage?: CardTagType; + /** 【不受元素伤害】 */ + natureDamage?: CardTagType; + /** 【不受雷属性伤害】 */ + thunderDamage?: CardTagType; + /** 【不受冰属性伤害】【v1.9.107】 */ + iceDamage?: CardTagType; + /** 【不受火属性伤害】 */ + fireDamage?: CardTagType; + /** 【可以指定多个目标】 */ + multitarget?: CardTagType; + /** 【回复体力】 */ + recover?: CardTagType; + /** 【失去体力】 */ + loseHp?: CardTagType; + /** 【可获得牌】 */ + gain?: CardTagType; + /** 【可自救】 */ + save?: CardTagType; + /** 【可弃牌】,即弃牌可以有收益 */ + discard?: CardTagType; + /** 【失去牌】 */ + loseCard?: CardTagType; + /** 【多个目标结算时(?存疑)】 */ + multineg?: CardTagType; + /** 【可多次/再次判定/改变判定】 */ + rejudge?: CardTagType; + draw?: CardTagType; + norepeat?: CardTagType; + /** 【装备替换价值】 */ + valueswap?: CardTagType; + + [key: string]: CardTagType | void; + } + + /** + * 是否要对“连锁”状态下的目标处理; + * + * 新增,在get.effect中使用; + * @param player + * @param target + * @param card + */ + canLink?(player: Player, target: Player, card: Card): boolean; + + //日后还有很多属性要添加的 + [key: string]: any; +} + +/** 卡牌的tag的类型,注:作为方法的第二参数很少用上(一般用于二级类型判断) */ +type CardTagType = number | TwoParmFun | OneParmFun; + +/** + * 选择按钮配置 + * + * 时机:chooseToUse + * + * 当你在选择使用时,选择的是技能,若技能有chooseButton设置,则执行player.chooseButton方法: + * + * 以下则为调用该chooseButton的相关参数: + * + * 将操作返回的“视为”结果卡牌,通过event.backup通过视为卡牌的操作,重新操作该操作(一个绕的逻辑); + * + * 其实质:是一种视为技的操作,弥补一些视为使用某些xxx锦囊时的复杂操作; + * + * 在backup执行方法无法触发通信的原因: + 苏婆玛丽奥 11:50:33 + 主机不需要执行 + 这玩意是直接客机执行的 + 执行完了 把总的结果和生成的backup技能发过去; + 即chooseButton的所有方法都是交给客机执行的,主机只负责获取返回的backup信息; + + * 当前使用范围: + * + * chooseToUse + * + * chooseToRespond 【v1.9.106】 + */ +interface ChooseButtonConfigData { + //player.chooseButton的参数: + /** + * 选择内容的面板 + * + * 需要操作的内容,在这里创建; + * + * 返回传递给player.chooseButton的参数; + * + * 其中参数event,为当前chooseToUse事件 + */ + dialog?(event: GameEvent, player: Player): Dialog; + /** + * 卡牌选择条件 + * + * 既player.chooseButton的filterButton + * @param button + * @param player + */ + filter?(button: Button, player: Player): void; + /** + * ai如何选牌 + * + * 既player.chooseButton的ai + * @param button + */ + check?(button: Button): number; + /** + * 选择数目,默认为1 + * + * 既player.chooseButton的selectButton + */ + select?: number; + + //成功选择操作后的内容: + /** + * 返回“视为”部分(即当作该选择为视为的操作逻辑) + * + * 将该返回内容给event.backup,视为当前返回的信息条件作为使用; + * + * @param links result.links(由get.links获得,一般是指当前面板上的所有可选择按钮的link数据,一般为卡牌信息) + * @param player + */ + backup?(links: Result['links'], player: Player): Skill; + /** + * 选择时弹出的提示 + * @param links result.links(由get.links获得,一般是指当前面板上的所有可选择按钮的link数据,一般为卡牌信息) + * @param player + */ + prompt?(links: Result['links'], player: Player): string; + + /** + * 进行额外的选择时: + * 【v1.9.105】 + * + * 在chooseButton类出牌阶段技能中调用chooseControl函数而不是chooseButton函数进行第一段选择 + * + * 注1:使用参考 例:神户小鸟【花绽】 + * ; + * 注2:生成中所有选项,记得加上cancel2! + * + * 注3:其选择结果在:result.control + * + * 注4:返回的结果是提供给player.chooseControl方法的参数列表; + * + * 注5:默认是使用配置的dialog方法,返回的dialog,若设有该参数配置,则优先使用它返回的参数列表,从而构建的control; + * @param event + * @param player + */ + chooseControl?(event: GameEvent, player: Player): string[]; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/cordova-plugin-dialogs.d.ts b/node_modules/@types/noname-typings/cordova-plugin-dialogs.d.ts new file mode 100644 index 000000000..8d22f886e --- /dev/null +++ b/node_modules/@types/noname-typings/cordova-plugin-dialogs.d.ts @@ -0,0 +1,69 @@ +// Type definitions for Apache Cordova Dialogs plugin +// Project: https://github.com/apache/cordova-plugin-dialogs +// Definitions by: Microsoft Open Technologies Inc +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// +// Copyright (c) Microsoft Open Technologies Inc +// Licensed under the MIT license. + +interface Navigator { + /** This plugin provides access to some native dialog UI elements. */ + notification: Notification +} + +/** This plugin provides access to some native dialog UI elements. */ +interface Notification { + /** + * Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature, + * but some platforms use the browser's alert function, which is typically less customizable. + * @param message Dialog message. + * @param alertCallback Callback to invoke when alert dialog is dismissed. + * @param title Dialog title, defaults to 'Alert'. + * @param buttonName Button name, defaults to OK. + */ + alert(message: string, + alertCallback: () => void, + title?: string, + buttonName?: string): void; + /** + * The device plays a beep sound. + * @param times The number of times to repeat the beep. + */ + beep(times: number): void; + /** + * Displays a customizable confirmation dialog box. + * @param message Dialog message. + * @param confirmCallback Callback to invoke with index of button pressed (1, 2, or 3) + * or when the dialog is dismissed without a button press (0). + * @param title Dialog title, defaults to Confirm. + * @param buttonLabels Array of strings specifying button labels, defaults to [OK,Cancel]. + */ + confirm(message: string, + confirmCallback: (choice: number) => void, + title?: string, + buttonLabels?: string[]): void; + /** + * Displays a native dialog box that is more customizable than the browser's prompt function. + * @param message Dialog message. + * @param promptCallback Callback to invoke when a button is pressed. + * @param title Dialog title, defaults to "Prompt". + * @param buttonLabels Array of strings specifying button labels, defaults to ["OK","Cancel"]. + * @param defaultText Default textbox input value, default: "". + */ + prompt(message: string, + promptCallback: (result: NotificationPromptResult) => void, + title?: string, + buttonLabels?: string[], + defaultText?: string): void; +} + +/** Object, passed to promptCallback */ +interface NotificationPromptResult { + /** + * The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc. + * 0 is the result when the dialog is dismissed without a button press. + */ + buttonIndex: number; + /** The text entered in the prompt dialog box. */ + input1: string; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/cordova-plugin-file-transfer.d.ts b/node_modules/@types/noname-typings/cordova-plugin-file-transfer.d.ts new file mode 100644 index 000000000..ae758ea1f --- /dev/null +++ b/node_modules/@types/noname-typings/cordova-plugin-file-transfer.d.ts @@ -0,0 +1,136 @@ +// Type definitions for Apache Cordova FileTransfer plugin +// Project: https://github.com/apache/cordova-plugin-file-transfer +// Definitions by: Microsoft Open Technologies Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// +// Copyright (c) Microsoft Open Technologies Inc +// Licensed under the MIT license + +/// + +/** + * The FileTransfer object provides a way to upload files using an HTTP multi-part POST request, + * and to download files as well. + */ +interface FileTransfer { + /** Called with a ProgressEvent whenever a new chunk of data is transferred. */ + onprogress: (event: ProgressEvent) => void; + /** + * Sends a file to a server. + * @param fileURL Filesystem URL representing the file on the device. For backwards compatibility, + * this can also be the full path of the file on the device. + * @param server URL of the server to receive the file, as encoded by encodeURI(). + * @param successCallback A callback that is passed a FileUploadResult object. + * @param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult. + * Invoked with a FileTransferError object. + * @param options Optional parameters. + * @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. + * This is useful since Android rejects self-signed security certificates. + * Not recommended for production use. Supported on Android and iOS. + */ + upload( + fileURL: string, + server: string, + successCallback: (result: FileUploadResult) => void, + errorCallback: (error: FileTransferError) => void, + options?: FileUploadOptions, + trustAllHosts?: boolean): void; + /** + * downloads a file from server. + * @param source URL of the server to download the file, as encoded by encodeURI(). + * @param target Filesystem url representing the file on the device. For backwards compatibility, + * this can also be the full path of the file on the device. + * @param successCallback A callback that is passed a FileEntry object. (Function) + * @param errorCallback A callback that executes if an error occurs when retrieving the fileEntry. + * Invoked with a FileTransferError object. + * @param options Optional parameters. + * @param trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. + * This is useful since Android rejects self-signed security certificates. + * Not recommended for production use. Supported on Android and iOS. + */ + download( + source: string, + target: string, + successCallback: (fileEntry: FileEntry) => void, + errorCallback: (error: FileTransferError) => void, + trustAllHosts?: boolean, + options?: FileDownloadOptions): void; + /** + * Aborts an in-progress transfer. The onerror callback is passed a FileTransferError object + * which has an error code of FileTransferError.ABORT_ERR. + */ + abort(): void; +} + +declare var FileTransfer: { + new(): FileTransfer; +}; + +/** A FileUploadResult object is passed to the success callback of the FileTransfer object's upload() method. */ +interface FileUploadResult { + /** The number of bytes sent to the server as part of the upload. */ + bytesSent: number; + /** The HTTP response code returned by the server. */ + responseCode: number; + /** The HTTP response returned by the server. */ + response: string; + /** The HTTP response headers by the server. Currently supported on iOS only.*/ + headers: any; +} + +/** Optional parameters for upload method. */ +interface FileUploadOptions { + /** The name of the form element. Defaults to file. */ + fileKey?: string; + /** The file name to use when saving the file on the server. Defaults to image.jpg. */ + fileName?: string; + /** The HTTP method to use - either `PUT` or `POST`. Defaults to `POST`. */ + httpMethod?: string; + /** The mime type of the data to upload. Defaults to image/jpeg. */ + mimeType?: string; + /** A set of optional key/value pairs to pass in the HTTP request. */ + params?: Object; + /** Whether to upload the data in chunked streaming mode. Defaults to true. */ + chunkedMode?: boolean; + /** A map of header name/header values. Use an array to specify more than one value. */ + headers?: Object; +} + +/** Optional parameters for download method. */ +interface FileDownloadOptions { + /** A map of header name/header values. */ + headers?: {}; +} + +/** A FileTransferError object is passed to an error callback when an error occurs. */ +interface FileTransferError { + /** + * One of the predefined error codes listed below. + * FileTransferError.FILE_NOT_FOUND_ERR + * FileTransferError.INVALID_URL_ERR + * FileTransferError.CONNECTION_ERR + * FileTransferError.ABORT_ERR + * FileTransferError.NOT_MODIFIED_ERR + */ + code: number; + /** URL to the source. */ + source: string; + /** URL to the target. */ + target: string; + /** HTTP status code. This attribute is only available when a response code is received from the HTTP connection. */ + http_status: number; + /* Response body. This attribute is only available when a response is received from the HTTP connection. */ + body: string; + /* Exception that is thrown by native code */ + exception: any; +} + +declare var FileTransferError: { + /** Constructor for FileTransferError object */ + new(code?: number, source?: string, target?: string, status?: number, body?: any, exception?: any): FileTransferError; + FILE_NOT_FOUND_ERR: number; + INVALID_URL_ERR: number; + CONNECTION_ERR: number; + ABORT_ERR: number; + NOT_MODIFIED_ERR: number; +} \ No newline at end of file diff --git a/node_modules/@types/noname-typings/cordova-plugin-file.d.ts b/node_modules/@types/noname-typings/cordova-plugin-file.d.ts new file mode 100644 index 000000000..73cdac77b --- /dev/null +++ b/node_modules/@types/noname-typings/cordova-plugin-file.d.ts @@ -0,0 +1,374 @@ +// Type definitions for Apache Cordova File System plugin +// Project: https://github.com/apache/cordova-plugin-file +// Definitions by: Microsoft Open Technologies Inc +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// +// Copyright (c) Microsoft Open Technologies, Inc. +// Licensed under the MIT license. + +interface Window { + /** + * Requests a filesystem in which to store application data. + * @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT. + * @param size This is an indicator of how much storage space, in bytes, the application expects to need. + * @param successCallback The callback that is called when the user agent provides a filesystem. + * @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied. + */ + requestFileSystem( + type: LocalFileSystem, + size: number, + successCallback: (fileSystem: FileSystem) => void, + errorCallback?: (fileError: FileError) => void): void; + /** + * Look up file system Entry referred to by local URL. + * @param string url URL referring to a local file or directory + * @param successCallback invoked with Entry object corresponding to URL + * @param errorCallback invoked if error occurs retrieving file system entry + */ + resolveLocalFileSystemURL(url: string, + successCallback: (entry: Entry) => void, + errorCallback?: (error: FileError) => void): void; + + resolveLocalFileSystemURL(url: string, + successCallback: (entry: DirectoryEntry) => void, + errorCallback?: (error: FileError) => void): void; + /** + * Look up file system Entry referred to by local URI. + * @param string uri URI referring to a local file or directory + * @param successCallback invoked with Entry object corresponding to URI + * @param errorCallback invoked if error occurs retrieving file system entry + */ + resolveLocalFileSystemURI(uri: string, + successCallback: (entry: Entry) => void, + errorCallback?: (error: FileError) => void): void; + TEMPORARY: number; + PERSISTENT: number; +} + +/** + * An abstract interface representing entries in a file system, + * each of which may be a File or DirectoryEntry. + */ +interface Entry { + /** Entry is a file. */ + isFile: boolean; + /** Entry is a directory. */ + isDirectory: boolean; + /** The name of the entry, excluding the path leading to it. */ + name: string; + /** The full absolute path from the root to the entry. */ + fullPath: string; + /** The file system on which the entry resides. */ + filesystem: FileSystem; + nativeURL: string; + /** + * Look up metadata about this entry. + * @param successCallback A callback that is called with the time of the last modification. + * @param errorCallback A callback that is called when errors happen. + */ + getMetadata( + successCallback: (metadata: Metadata) => void, + errorCallback?: (error: FileError) => void): void; + /** + * Move an entry to a different location on the file system. It is an error to try to: + * move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided; + * move a file to a path occupied by a directory; + * move a directory to a path occupied by a file; + * move any element to a path occupied by a directory which is not empty. + * A move of a file on top of an existing file must attempt to delete and replace that file. + * A move of a directory on top of an existing empty directory must attempt to delete and replace that directory. + * @param parent The directory to which to move the entry. + * @param newName The new name of the entry. Defaults to the Entry's current name if unspecified. + * @param successCallback A callback that is called with the Entry for the new location. + * @param errorCallback A callback that is called when errors happen. + */ + moveTo(parent: DirectoryEntry, + newName?: string, + successCallback?: (entry: Entry) => void, + errorCallback?: (error: FileError) => void): void; + /** + * Copy an entry to a different location on the file system. It is an error to try to: + * copy a directory inside itself or to any child at any depth; + * copy an entry into its parent if a name different from its current one isn't provided; + * copy a file to a path occupied by a directory; + * copy a directory to a path occupied by a file; + * copy any element to a path occupied by a directory which is not empty. + * A copy of a file on top of an existing file must attempt to delete and replace that file. + * A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory. + * Directory copies are always recursive--that is, they copy all contents of the directory. + * @param parent The directory to which to move the entry. + * @param newName The new name of the entry. Defaults to the Entry's current name if unspecified. + * @param successCallback A callback that is called with the Entry for the new object. + * @param errorCallback A callback that is called when errors happen. + */ + copyTo(parent: DirectoryEntry, + newName?: string, + successCallback?: (entry: Entry) => void, + errorCallback?: (error: FileError) => void): void; + /** + * Returns a URL that can be used as the src attribute of a