diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f5f20b233d..df45a8a9e7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,6 +3,7 @@ # See https://github.com/DefinitelyTyped/DefinitelyTyped#edit-an-existing-package /types/a-big-triangle/ @MathiasPaumgarten +/types/a11y-dialog/ @Goyatuzo /types/abbrev/ @BendingBender /types/abs/ @AyaMorisawa /types/absolute/ @AyaMorisawa @@ -15,7 +16,7 @@ /types/ace-diff/ @innovation-team /types/acl/ @tkQubo /types/acorn/ @RReverser @e-cloud -/types/actioncable/ @zhu1230 +/types/actioncable/ @zhu1230 @szechyjs /types/actions-on-google/ @joelhegg /types/activedirectory2/ @pasthelod /types/activex-access/ @zspitz @@ -52,11 +53,14 @@ /types/aggregate-error/ @BendingBender /types/agora-rtc-sdk/ @menthays /types/ajv-errors/ @afshawnlotfi +/types/ale-url-parser/ @msn0 /types/alertify/ @jjeffery /types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce @rk-7 @alexmalcoci /types/alexa-voice-service/ @dolanmiu /types/algebra.js/ @CaselIT -/types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss +/types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss @keichinger +/types/ali-app/ @taoqf +/types/ali-oss/ @ptrdu /types/allure-js-commons/ @zaqqaz /types/almost-equal/ @cmaddalozzo /types/alt/ @Shearerbeard @@ -68,7 +72,7 @@ /types/amphtml-validator/ @kevincharm /types/amplify/ @joeriks /types/amplify-deferred/ @joeriks @laurentiustamate94 -/types/amplitude-js/ @Asido +/types/amplitude-js/ @Asido @danmana /types/amqp/ @seikho @jonnysparkplugs /types/amqp-connection-manager/ @rogierschouten /types/amqp-rpc/ @wokim @@ -149,6 +153,7 @@ /types/animation-frame/ @qinfchen /types/animejs/ @A-Babin /types/annyang/ @hisham @theluk +/types/ansi/ @Gustavo6046 /types/ansi-colors/ @rogierschouten /types/ansi-escape-sequences/ @aomarks /types/ansi-escapes/ @jacobbubu @@ -161,6 +166,7 @@ /types/any-db-transaction/ @rogierschouten /types/anybar/ @khoomeister /types/anymatch/ @BendingBender +/types/aos/ @shermendev /types/apex.js/ @y13i /types/aphrodite/ @asvetliakov /types/api-error-handler/ @tkrotoff @@ -168,6 +174,7 @@ /types/apigee-access/ @CasperSkydt /types/apollo-codegen/ @bradleyayers @kostspielig /types/apollo-upload-client/ @Slessi +/types/apostrophe/ @afholderman /types/app-root-dir/ @chenyang-biu /types/app-root-path/ @shantmarouti /types/appdmg/ @unindented @@ -195,18 +202,22 @@ /types/array-sort/ @DanielMSchmidt /types/array-uniq/ @DanielRosenwasser /types/array-unique/ @CSLTech +/types/array.prototype.flatmap/ @hallettj /types/arrify/ @wanganjun /types/artillery/ @kmccoan-allocadia /types/asana/ @tkqubo /types/asap/ @fpascutti +/types/ascii-art/ @lukaselmer /types/ascii2mathml/ @RagibHasin /types/asenv/ @remisery /types/asn1js/ @microshine /types/aspnet-identity-pw/ @jt000 +/types/assert/ @nicoabie /types/assert-equal-jsx/ @seryl /types/assert-plus/ @KostyaTretyak /types/assertsharp/ @brunolm /types/assets-webpack-plugin/ @kryops +/types/astring/ @nkappler /types/async/ @borisyankov @kern0 @Penryn @fenying @pascalmartin /types/async-cache/ @BendingBender /types/async-lock/ @elisee @afharo @rhymmor @@ -214,6 +225,7 @@ /types/async-retry/ @albertywu @MeLlamoPablo /types/async.nexttick/ @pyrho /types/asynciterator/ @rubensworks +/types/athenajs/ @warpdesign /types/atlaskit__button/ @dijimsta /types/atlaskit__calendar/ @lstanden /types/atlaskit__inline-edit/ @lstanden @@ -227,7 +239,8 @@ /types/atom-mocha-test-runner/ @GlenCFL /types/atpl/ @soywiz /types/audiosprite/ @Perlmint -/types/auth0/ @wbhob @westy92 @amiram +/types/auth-header/ @ForbesLindesay +/types/auth0/ @westy92 /types/auth0-angular/ @homesar /types/auth0-js/v7/ @advancedrei /types/auth0-js/ @adrianchia @mdurrant @peterblazejewicz @@ -238,12 +251,12 @@ /types/auto-sni/ @janwo /types/autobahn/ @darkl @valepu /types/autolinker/ @leonyu -/types/autoprefixer/ @odnamrataizem +/types/autoprefixer/ @odnamrataizem @murt /types/autosize/ @kingdango @keika299 @NeekSandhu /types/autosuggest-highlight/ @senukartur /types/awesomplete/ @webbiesdk @bmdixon @tbekolay @chrislopresto /types/aws-iot-device-sdk/ @niik @mlamp -/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins +/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory /types/aws-serverless-express/ @threesquared @jcaffey @mattmeye @albertovasquez /types/aws4/ @ajcrites /types/axe-webdriverjs/ @JoshuaKGoldberg @@ -301,10 +314,11 @@ /types/bases/ @harikv /types/bash-glob/ @mrmlnc /types/basic-auth/ @moonpyk @vesse +/types/basicauth-middleware/ @nchaulet /types/batch-stream/ @drudge /types/bazinga-translator/ @alexndlm /types/bcrypt/ @codeanimal @IOAyman @dstapleton92 -/types/bcryptjs/ @RafaelKr +/types/bcryptjs/ @RafaelKr @branoholy /types/bdfjs/ @jeremejevs /types/beats/ @urish /types/bech32/ @micksatana @@ -314,10 +328,10 @@ /types/bencode/ @tobenna /types/better-curry/ @pocesar /types/better-queue/ @maozedong -/types/better-scroll/ @stoneChen +/types/better-scroll/ @stoneChen @cnjack /types/better-sqlite3/ @Morfent @matrumz /types/bezier-easing/ @ptlis -/types/bezier-js/ @danmarshall +/types/bezier-js/ @danmarshall @Epskampie /types/bgiframe/ @sumegizoltan /types/bidirectional-map/ @helenanderson /types/big.js/ @nycdotnet @googol @@ -338,9 +352,8 @@ /types/bitcoinjs-lib/ @mhegazy @dlebrecht @rbuckton @micksatana @youssefgh @kento1218 /types/bitcore-lib/ @lautarodragan /types/bittorrent-protocol/ @feross @tlaziuk -/types/bitwise/ @danwbyrne /types/bitwise-xor/ @rogierschouten -/types/bl/ @Bartvds +/types/bl/ @Bartvds @reconbot /types/blacklist/ @mhegazy /types/blazy/ @julienpa /types/blessed/ @brynbellomy @skellock @@ -371,7 +384,7 @@ /types/boom/ @rogatty @AJamesPhillips @jineshshah36 @TimonVS @danielmachado /types/bootbox/ @vbortone @konpikwastaken @kanup @icereed @trodi @stannynuytkens @renjfk /types/bootpag/ @rdeneau -/types/bootstrap/v3/ @borisyankov +/types/bootstrap/v3/ @borisyankov @denisname /types/bootstrap/ @denisname /types/bootstrap-3-typeahead/ @AndersonFriaca /types/bootstrap-datepicker/ @borisyankov @@ -383,6 +396,7 @@ /types/bootstrap-slider/ @dbeckwith @leonard-thieu /types/bootstrap-switch/ @johnmbaughman /types/bootstrap-table/ @talatbaig +/types/bootstrap-toggle/ @gricey432 /types/bootstrap-touchspin/ @albinsunnanbo /types/bootstrap-treeview/ @jbtronics /types/bootstrap-validator/ @BradyLiles @@ -401,6 +415,7 @@ /types/breeze/ @borisyankov /types/bricks.js/ @kondi /types/bro-fs/ @ffflorian +/types/broccoli-plugin/ @dfreeman /types/brorand/ @chrootsu /types/browser-bunyan/ @PaulLockwood @kryops /types/browser-fingerprint/ @LKay @@ -409,7 +424,7 @@ /types/browser-report/ @JTOne123 /types/browser-resolve/ @marionebl /types/browser-sync/ @joeskeen @aznnomness -/types/browserify/ @AndrewGaspar @jvilk @leonard-thieu +/types/browserify/ @AndrewGaspar @jvilk @leonard-thieu @LinusU /types/bs58/ @chrootsu /types/bson/ @horiuchi @CaselIT /types/btoa/ @johngeorgewright @@ -423,7 +438,7 @@ /types/bufferstream/ @Bartvds /types/builtin-modules/ @ajafff /types/bull/v2/ @bgrieder @JProgrammer -/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 +/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana /types/bump-regex/ @silkentrance /types/bunnymq/ @cyrilschumacher /types/bunyan/ @amikhalev @@ -439,9 +454,11 @@ /types/byline/ @reppners /types/bytebuffer/ @cappellin /types/bytes/ @danny8002 @believer +/types/bytewise/ @danwbyrne /types/c3/ @mcliment @gerinjacob @denyo @dmitryshindin @timn /types/cache-manager/ @GausSim /types/cal-heatmap/ @RetroChrisB +/types/caller/ @ignocide /types/callsite/ @newclear /types/callsites/ @BendingBender /types/calq/ @eirikhm @@ -450,6 +467,7 @@ /types/camelcase-keys/ @mhegazy /types/camo/ @lucasmciruzzi /types/cancan/ @Vincent-Pang +/types/caniuse-api/ @davecardwell /types/cannon/ @clark-stevenson @Gelio /types/canvas-confetti/ @matracey /types/canvas-gauges/ @Mikhus @@ -475,6 +493,7 @@ /types/chai-datetime/ @cliffburger @mattbishop /types/chai-dom/ @mattlewis92 /types/chai-enzyme/ @asvetliakov +/types/chai-fs/ @dimitardanailov /types/chai-fuzzy/ @Bartvds /types/chai-http/ @Nemo157 @G1itcher @CaselIT @bas-l /types/chai-jest-snapshot/ @mattvperry @@ -493,7 +512,7 @@ /types/chardet/ @Gebatzens /types/charm/ @Xananax /types/charset/ @cspotcode -/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr @mernen @josefpaij @danmana @guillaume-ro-fr @archy-bold @braincore @gebeto @frabnt @alexdor @mahnuh +/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr @mernen @josefpaij @danmana @guillaume-ro-fr @archy-bold @braincore @frabnt @alexdor @mahnuh @Conrad777 /types/chartist/ @mtgibbs @psimonski @clottman @affilnost @sunnyrjuneja /types/chartmogul-node/ @chartmogul /types/chayns/ @HenningKuehl @@ -506,6 +525,7 @@ /types/chessboardjs/ @sliverb @davidmpaz /types/chmodr/ @BendingBender /types/chokidar/ @reppners @felixfbecker @bayssmekanique +/types/chordsheetjs/ @adamsbloom /types/chosen-js/ @borisyankov @denisname /types/chownr/ @BendingBender /types/chroma-js/v0/ @invliD @@ -533,6 +553,7 @@ /types/cleave.js/ @clentfort @jasongi-at-sportsbet @sashashakun /types/cli/ @kayahr /types/cli-color/ @ChaosinaCan +/types/cli-interact/ @ffflorian /types/cli-progress/ @mhegazy /types/cli-spinner/ @janslow /types/cli-table/ @arylo @@ -573,18 +594,20 @@ /types/color-namer/ @in19farkt /types/color-string/ @BendingBender @danmarshall /types/colorbrewer/ @mtraynham +/types/colresizable/ @gilleswaeber /types/com.darktalker.cordova.screenshot/ @akarienta /types/com.wikitude.phonegap.wikitudeplugin/ @zbarbuto /types/combine-source-map/ @TeamworkGuy2 /types/combined-stream/ @felixge @tlaziuk /types/combokeys/ @iclanton -/types/cometd/ @derekcicerone +/types/cometd/ @derekcicerone @unindented @alxHenry /types/command-line-args/v4/ @CzBuCHi @75lb /types/command-line-args/ @75lb /types/command-line-commands/ @CzBuCHi /types/command-line-usage/ @matrumz @Dvorsky /types/commangular/ @hiraash /types/comment-json/ @Jason3S +/types/commercetools__enzyme-extensions/ @screendriver /types/common-errors/ @icopp /types/common-prefix/ @seangenabe /types/common-tags/ @zuzusik @tzupengwang @@ -592,7 +615,7 @@ /types/commonmark/ @nicojs @leonard-thieu /types/compare-version/ @jpevarnek /types/compare-versions/ @LogvinovLeon -/types/complex/ @AyaMorisawa +/types/complex/ @AyaMorisawa @pavasich /types/component-emitter/ @psnider /types/compose-function/ @denis-sokolov /types/compressible/ @BendingBender @@ -612,6 +635,7 @@ /types/confit/ @ethanresnick /types/connect/ @SomaticIT @EvanHahn /types/connect-busboy/ @pinguet62 +/types/connect-datadog/ @moshegood /types/connect-ensure-login/ @0x6368656174 /types/connect-flash/ @AndreasGassmann /types/connect-history-api-fallback/ @douglasduteil @@ -623,8 +647,10 @@ /types/connect-redis/ @xstoudi @morcerf /types/connect-slashes/ @samherrmann /types/connect-timeout/ @cyrilschumacher +/types/consola/ @Jungwoo-An /types/console-log-level/ @ofrobots /types/console-stamp/ @ericbyers @guusdegraeve +/types/console-ui/ @dfreeman /types/consolidate/ @soywiz @theosherry @nicolashenry /types/consul/ @chrootsu /types/content-disposition/ @bomret @@ -651,6 +677,7 @@ /types/cordova-plugin-background-mode/ @Lordnoname /types/cordova-plugin-badge/ @timbru31 /types/cordova-plugin-ble-central/ @gjunge +/types/cordova-plugin-bluetoothclassic-serial/ @tuvokki /types/cordova-plugin-canvascamera/ @lordazzi /types/cordova-plugin-device-name/ @larrybahr /types/cordova-plugin-file-opener2/ @cyrilgandon @@ -669,17 +696,19 @@ /types/cordova_app_version_plugin/ @larrybahr /types/cordovarduino/ @hendrikmaus /types/core-js/ @rbuckton @mfdeveloper +/types/core-object/ @dfreeman /types/correlation-id/ @natemara /types/cors/ @pluma /types/cosmiconfig/v4/ @ozum /types/cosmiconfig/ @ozum @szeck87 @saadq @jinwoo -/types/cote/ @makepost +/types/cote/ @makepost @roblabat /types/couchbase/ @maouida @fluggo /types/countdown/ @gjuchault /types/counterpart/ @santiagodoldan /types/countries-and-timezones/ @zero51 /types/country-list/ @iRoachie /types/country-select-js/ @humrochagf +/types/countup.js/ @shermendev /types/coverup/ @bevalorous /types/cp-file/ @BendingBender /types/cpx/ @alan-agius4 @@ -694,12 +723,14 @@ /types/createjs-lib/ @evilangelist @gyohk /types/credential/ @phuvo /types/credit-card-type/ @LKay +/types/critters-webpack-plugin/ @JuanJoseGonGi /types/cron/ @horiuchi @winup /types/cropperjs/ @stepancar /types/croppie/ @connor4312 @dklmuc @sarunint @knuthelgesen /types/cross-spawn/ @Alorel /types/crossfilter/ @schmuli @iebaker @nordfjord /types/crossroads/ @diullei +/types/crpc/ @0xdeafcafe /types/cryptiles/ @awendland /types/crypto-js/ @misak113 /types/crypto-random-string/ @MrManny @@ -725,15 +756,16 @@ /types/cucumber/ @abraaoalves @jan-molak @isoung @BendingBender @ErikSchierboom /types/currency-formatter/ @mhegazy @davidmpaz /types/custom-error-generator/ @thmiceli +/types/custom-functions-runtime/ @OfficeDev @Zlatkovsky @mscharlock /types/cwise/ @taoqf /types/cwise-compiler/ @taoqf /types/cwise-parser/ @taoqf /types/cybozulabs-md5/ @pine613 /types/cytoscape/ @phreed @wy193777 @ypconstante @janniclas @cerberuser /types/d3/v3/ @gustavderdrache @borisyankov @MatthiasJobst -/types/d3/v4/ @tomwanzek @gustavderdrache @borisyankov -/types/d3/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-array/ @gustavderdrache @borisyankov @tomwanzek +/types/d3/v4/ @tomwanzek @gustavderdrache @borisyankov @denisname +/types/d3/ @tomwanzek @gustavderdrache @borisyankov @denisname +/types/d3-array/ @gustavderdrache @borisyankov @tomwanzek @denisname /types/d3-axis/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-box/ @lk-chen /types/d3-brush/ @tomwanzek @gustavderdrache @borisyankov @@ -751,10 +783,11 @@ /types/d3-force/ @tomwanzek @gustavderdrache @borisyankov /types/d3-format/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-geo/ @ledragon @tomwanzek @gustavderdrache @borisyankov +/types/d3-graphviz/ @DomParfitt /types/d3-hexbin/ @uncovertruth @tomwanzek @denisname /types/d3-hierarchy/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-hsv/ @arrayjam @denisname -/types/d3-interpolate/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-interpolate/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-path/ @tomwanzek @gustavderdrache @borisyankov /types/d3-polygon/ @tomwanzek @gustavderdrache @borisyankov /types/d3-quadtree/ @tomwanzek @gustavderdrache @borisyankov @denisname @@ -765,12 +798,12 @@ /types/d3-scale/v1/ @tomwanzek @gustavderdrache @borisyankov /types/d3-scale/ @tomwanzek @gustavderdrache @borisyankov /types/d3-scale-chromatic/ @Ledragon @gustavderdrache @borisyankov @henriquefm -/types/d3-selection/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-selection/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-selection-multi/ @gustavderdrache @borisyankov /types/d3-shape/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-time/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-time/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-time-format/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-timer/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-timer/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-tip/ @brspnnggrt /types/d3-transition/ @tomwanzek @gustavderdrache @borisyankov /types/d3-voronoi/ @tomwanzek @gustavderdrache @borisyankov @denisname @@ -802,6 +835,7 @@ /types/datejs/ @rupertavery /types/daterangepicker/ @SirMartin @smasala @nertzy /types/dav/ @ToastHawaii +/types/dayzed/ @samhh /types/db-migrate-base/ @nickiannone /types/db-migrate-pg/ @nickiannone /types/db.js/ @cgwrench @@ -809,8 +843,8 @@ /types/dd-trace/ @ColinBradley @alloy /types/deasync/ @Sicilica /types/debessmann/ @vkorehov -/types/debounce/ @denis-sokolov -/types/debug/ @swook @galtalmor @zamb3zi +/types/debounce/ @denis-sokolov @joshuakgoldberg +/types/debug/ @swook @galtalmor @zamb3zi @brasten /types/decamelize/ @samverschueren /types/decay/ @enaeseth /types/decompress/ @plantain-00 @jbethke @@ -824,7 +858,6 @@ /types/deep-freeze/ @Bartvds @aluanhaddad /types/deep-freeze-es6/ @mattbishop /types/deep-freeze-strict/ @mhegazy -/types/deepmerge/ @marvinscharle @syy1125 @AppLover69 /types/defaults/ @IbtihelCHNAB /types/defer-promise/ @niklasf /types/define-lazy-prop/ @BendingBender @@ -857,7 +890,9 @@ /types/detect-pointer/ @thomastilkema /types/detect-port/ @lith-light-g /types/detect-touch-events/ @thomastilkema -/types/detox/ @TareqElMasri +/types/detective/ @TeamworkGuy2 +/types/detox/ @TareqElMasri @stevechun +/types/dev-ip/ @mike-engel /types/devexpress-aspnetcore-bootstrap/ @devexpress @skubarenko /types/df-visible/ @Litee /types/dhtmlxgantt/ @mkozhukh @chriscamicas @@ -866,8 +901,9 @@ /types/di-lite/ @dcrusader /types/diacritics/ @otociulis /types/dialogflow/ @dyladan -/types/diff/ @vvakame @szdc +/types/diff/ @vvakame @szdc @moc-yuto /types/diff2html/ @rtfpessoa +/types/digibyte/ @lautarodragan @werewolfe /types/dir-resolve/ @andy-ms /types/discontinuous-range/ @OiCMudkips /types/discourse-sso/ @championswimmer @@ -886,10 +922,11 @@ /types/dojo/ @vansimke /types/dom-clipboard-api/ @43081j /types/dom-inputevent/ @diagramatics +/types/dom-loaded/ @ltetzlaff /types/dom-to-image/ @JipSterk /types/dom4/ @adidahiya @giladgray /types/domo/ @Steve-Fenton -/types/dompurify/ @bazuzi +/types/dompurify/ @bazuzi @FlowCrypt /types/domready/ @dotnetnerd /types/donna/ @vvakame /types/dookie/ @swanest @@ -916,6 +953,7 @@ /types/draggabilly/ @jaydubu /types/dragster/ @zskovacs /types/dragula/ @pwelter34 @abruzzihraig +/types/dropbox-chooser/ @quas94 /types/dropboxjs/ @Steve-Fenton @xperiments /types/dropkickjs/ @VorobeY1326 /types/dropzone/v4/ @nvivo @outring @renuo @Hikariii @@ -923,7 +961,7 @@ /types/dts-generator/ @mtraynham /types/duplexer2/ @Goldsmith42 /types/duplexer3/ @BendingBender -/types/duplexify/ @strax +/types/duplexify/ @strax @kinwa91 /types/duplicate-package-checker-webpack-plugin/ @mtraynham /types/durandal/ @BlueSpire /types/dustjs-linkedin/ @mdezem @@ -959,6 +997,7 @@ /types/ejs/ @benliddicott /types/ejs-locals/ @jt000 /types/ejson/ @shantanubhadoria +/types/elastic-apm-node/ @shahaed /types/elasticsearch/ @CasperSkydt @bfsmith @ddunkin @pushplay @mlamp @ahmadferdous @SimonSchick @brabster @deerawan /types/electron-config/ @mrfunkycold @unindented /types/electron-debug/ @unindented @@ -1024,6 +1063,7 @@ /types/emojione/ @dbrgn /types/empower/ @vvakame /types/emscripten/ @zakki @periklis +/types/encoding-down/ @MeirionHughes @danwbyrne /types/end-of-stream/ @strax /types/engine.io/ @KentarouTakeda /types/engine.io-client/ @KentarouTakeda @@ -1106,7 +1146,8 @@ /types/expo/v24/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger /types/expo/v25/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov /types/expo/v26/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @tinaroh -/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki +/types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo__status-bar-height/ @dawnmist /types/expo__vector-icons/ @incleaf /types/express/ @borisyankov @@ -1137,6 +1178,7 @@ /types/express-mung/ @cyrilschumacher /types/express-myconnection/ @Cellule /types/express-mysql-session/ @Akim95 +/types/express-ntlm/ @forivall /types/express-oauth-server/ @atd-schubert /types/express-openapi/ @mugeso /types/express-paginate/ @AmirTugi @@ -1149,12 +1191,14 @@ /types/express-sanitized/ @cjbarth /types/express-serve-static-core/ @borisyankov @19majkel94 @kacepe @micksatana @samijaber /types/express-session/ @horiuchi @jacobbogers @builtinnya @ry7n +/types/express-sitemap-xml/ @ffflorian /types/express-socket.io-session/ @AylaJK /types/express-to-koa/ @xiaohanzhang /types/express-unless/ @wokim /types/express-wechat-access/ @simmons8616 /types/express-winston/ @bricka /types/express-ws/ @ajliv +/types/express-ws-routes/ @gstamac /types/express-xml-bodyparser/ @noticeMaker @macedigital /types/extend/ @reppners /types/extjs/ @brian428 @@ -1168,8 +1212,9 @@ /types/f1/ @neolwc /types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods @bmartinson @RogerioTeixeira @BradleyHill /types/facebook-instant-games/ @menushka @oyvindjam -/types/facebook-js-sdk/ @amritk @mahmoudzohdi +/types/facebook-js-sdk/ @amritk @mahmoudzohdi @fluidsonic /types/facebook-pixel/ @noctishsu +/types/factory-girl/ @stackbuilders @sestrella @elcuy /types/faker/v3/ @Kuniwak /types/faker/ @bensw @basp @Kuniwak @mattbishop /types/falcor/ @Quramy @@ -1186,6 +1231,10 @@ /types/fast-list/ @BendingBender /types/fast-stats/ @rogierschouten /types/fastclick/ @shinnn +/types/fastify-cors/ @jannikkeye +/types/fastify-jwt/ @jannikkeye +/types/fastify-multipart/ @jannikkeye +/types/fastify-static/ @leomelzer /types/favico.js/ @drowse314-dev-ymat /types/favicons/ @mohsen1 /types/fb/ @JoshStrobl @@ -1212,7 +1261,7 @@ /types/feedme/ @codeanimal /types/feedparser/ @cortopy /types/fetch-jsonp/ @tkrotoff -/types/fetch-mock/ @asvetliakov @tamird @merrywhether @chrissinclair @matttennison @quentinbouygues +/types/fetch-mock/ @asvetliakov @tamird @merrywhether @chrissinclair @matttennison @quentinbouygues @mtsmfm /types/fetch.io/ @newraina /types/ffi/ @loyd @waitingsong /types/ffi-napi/ @keerthi16 @KiranNiranjan @@ -1247,7 +1296,7 @@ /types/firebase-token-generator/ @dotdotcommadot /types/firebird/ @karak /types/firefox/ @vvakame -/types/firefox-webext-browser/ @bomjacob +/types/firefox-webext-browser/ @jsmnbom /types/firmata/ @troywweber7 /types/first-mate/ @GlenCFL /types/fixed-data-table/ @pepaar @stephenjelfs @@ -1265,6 +1314,7 @@ /types/flush-write-stream/ @djcsdy /types/flux/ @stkb @GiedriusGrabauskas /types/fluxible/ @xbim +/types/fluxible-addons-react/ @xbim /types/fluxible-router/ @xbim /types/fluxxor/ @mrk21 /types/fm-websync/ @markusmauch @@ -1289,6 +1339,7 @@ /types/foundation/ @borisyankov /types/fpsmeter/ @alampros /types/framebus/ @kbukum +/types/franc/ @wlegate /types/frctl__fractal/ @pmccloghrylaing /types/freedom/ @jpevarnek /types/freeport/ @atd-schubert @@ -1328,6 +1379,7 @@ /types/fxn/ @charrondev /types/gae.channel.api/ @vvakame /types/gamedig/ @ivansieder +/types/gamepad/ @Lange /types/gamequery/ @Laubi /types/ganache-core/ @LogvinovLeon /types/gandi-livedns/ @xstoudi @@ -1490,9 +1542,11 @@ /types/get-stdin/ @DanielRosenwasser /types/get-stream/ @douglasduteil @BendingBender /types/get-value/ @DanielRosenwasser +/types/getenv/ @impankratov /types/getopts/ @azasypkin /types/getos/ @BendingBender /types/gettext.js/ @jucrouzet +/types/gh-pages/ @DanielRosenwasser /types/gifffer/ @gatimus /types/gijgo/ @atatanasov /types/giraffe/ @darthapo @@ -1500,6 +1554,7 @@ /types/git-branch/ @rynclark /types/git-config/ @stpettersens /types/git-remote-origin-url/ @janslow +/types/git-rev-sync/ @khoi-fish /types/git-url-parse/ @ajafff /types/github-url-to-object/ @ajafff /types/github-username-regex/ @BehindTheMath @@ -1509,7 +1564,8 @@ /types/gl-texture2d/ @MathiasPaumgarten /types/gldatepicker/ @qcz /types/glidejs/ @milanjaros -/types/glob/ @vvakame @voy +/types/glob/v5/ @vvakame @voy +/types/glob/ @vvakame @voy @ajafff /types/glob-base/ @alan-agius4 /types/glob-expand/ @vvakame /types/glob-parent/ @mrmlnc @@ -1520,8 +1576,9 @@ /types/globalize-compiler/ @iclanton /types/globby/ @douglasduteil @ikatyang /types/globule/ @durad +/types/glue/v4/ @gjednaszewski /types/glue/ @garfty -/types/gm/ @ChaosinaCan @maartenvanvliet +/types/gm/ @ChaosinaCan @maartenvanvliet @mlejva /types/go/ @NorthwoodsSoftware /types/google-adwords-scripts/ @jafaircl /types/google-apps-script/ @motemen @grant @@ -1542,17 +1599,20 @@ /types/google.geolocation/ @vbortone /types/google.picker/ @grapswiz /types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm +/types/google__maps/ @indrimuska /types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm /types/googlemaps.infobubble/ @Dashue -/types/googlepay/ @Fluccioni @Radu-Raicea -/types/got/ @BendingBender @LinusU @ikokostya +/types/googlepay/ @Fluccioni @Radu-Raicea @fstanis +/types/got/v8/ @BendingBender @LinusU @ikokostya +/types/got/ @BendingBender @LinusU @ikokostya @stijnvn /types/graceful-fs/v2/ @Bartvds /types/graceful-fs/ @Bartvds @BendingBender /types/gradient-string/ @Ailrun /types/graham_scan/ @hberntsen /types/gramps__rest-helpers/ @claude /types/graphite-udp/ @EricByers -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 +/types/graphlib-dot/ @DomParfitt +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais /types/graphql-date/ @enaeseth /types/graphql-deduplicator/ @lfades /types/graphql-depth-limit/ @eritikass @@ -1561,6 +1621,7 @@ /types/graphql-query-complexity/ @abhikmitra /types/graphql-relay/ @arvitaly @nitintutlani @Grelinfo /types/graphql-resolve-batch/ @nayni +/types/graphql-resolvers/ @mike-engel /types/graphql-type-json/ @schfkt /types/graphviz/ @mhfrantz /types/grasp/ @agnoster @@ -1570,12 +1631,11 @@ /types/grecaptcha/v0/ @brentj73 /types/grecaptcha/ @DethAriel @rafaeltavares /types/gregorian-calendar/ @cwalv -/types/grid-styled/ @antonvasin @vittorio @lhache /types/gridfs-stream/ @liorm /types/gridstack/ @PascalSenn @ZoolWay @Sl1MBoy /types/grpc-error/ @danwbyrne /types/grunt/ @jeffmay @basarat -/types/gsap/ @codebelt @ProbablePrime @philipbulley +/types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp /types/gtin/ @RafaelKr /types/guid/ @maroy1986 /types/gulp/ @GiedriusGrabauskas @@ -1721,6 +1781,8 @@ /types/holderjs/ @renjfk /types/hooker/ @misak113 /types/hopscotch/ @pimterry @Aurimas1 +/types/host-validation/ @dintopple +/types/hosted-git-info/ @OiyouYeahYou /types/howler/ @xperiments @tdukart @alien35 @nicholashza /types/hpp/ @kryops /types/html-entities/ @xstoudi @@ -1732,7 +1794,7 @@ /types/html-void-elements/ @rhysd /types/html-webpack-plugin/ @deevus @bumbleblym @tlaziuk /types/html-webpack-template/ @bumbleblym -/types/html2canvas/ @rwhepburn @tan9 @sschocke +/types/html2canvas/ @rwhepburn @tan9 @sschocke @Ristaaf /types/htmlbars-inline-precompile/ @chriskrycho /types/htmlparser2/ @staticfunction @LinusU /types/htmltojsx/ @basarat @@ -1744,7 +1806,7 @@ /types/http-graceful-shutdown/ @dlee-nvisia /types/http-link-header/ @screendriver /types/http-proxy/ @SomaticIT @Raigen @DanielMSchmidt -/types/http-proxy-agent/ @mrmlnc +/types/http-proxy-agent/ @mrmlnc @steprescott /types/http-proxy-middleware/ @zebMcCorkle @BendingBender /types/http-rx/ @L2jLiga /types/http-server/ @plantain-00 @@ -1763,9 +1825,11 @@ /types/hypertext-application-language/ @maks3w /types/hystrixjs/ @igorsechyn /types/i18n/ @SomaticIT @FindQ +/types/i18n-abide/ @smbell /types/i18n-js/ @ypresto /types/i18next/v2/ @mxl @deerawan @GiedriusGrabauskas -/types/i18next/ @mxl @deerawan @GiedriusGrabauskas +/types/i18next/v8/ @mxl @deerawan @GiedriusGrabauskas +/types/i18next/ @mxl @deerawan @GiedriusGrabauskas @lenovouser @qqilihq @butchyyyy /types/i18next-browser-languagedetector/v0/ @cyrilschumacher @GiedriusGrabauskas /types/i18next-browser-languagedetector/ @cyrilschumacher @GiedriusGrabauskas /types/i18next-express-middleware/ @cyrilschumacher @@ -1791,6 +1855,7 @@ /types/ignore-styles/ @tai2 /types/iltorb/ @Alorel @reconbot /types/image-size/ @elisee +/types/image-type/ @ffflorian /types/imagemagick/ @soywiz /types/imagemagick-native/ @horiuchi /types/imagemapster/ @delphinus35 @@ -1806,7 +1871,7 @@ /types/imgur-rest-api/ @lukewestby /types/imperium/ @gaetansenn /types/impress/ @borisyankov -/types/in-app-purchase/ @l-jonas +/types/in-app-purchase/ @l-jonas @IchordeDionysos /types/in-range/ @DanielRosenwasser /types/inboxsdk/ @rdoursenaud @amiram /types/incremental-dom/ @basarat @lanthaler @vvakame @@ -1818,9 +1883,11 @@ /types/inherits/ @chrootsu /types/ini/ @marcinporebski /types/iniparser/ @chrootsu +/types/init-package-json/ @kfarnung /types/inline-css/ @philipisapain -/types/inline-style-prefixer/ @ahz @dpetrezselyova +/types/inline-style-prefixer/ @ahz @dpetrezselyova @franklixuefei /types/inquirer/ @tkQubo @ppathan @jouderianjr @bang88 @bitjson @synarque @jrockwood @kwkelly @Ailrun +/types/inquirer-npm-name/ @manuth /types/insert-module-globals/ @leonard-thieu /types/insight/ @vvakame /types/integer/ @Morfent @@ -1841,7 +1908,7 @@ /types/ion-rangeslider/v1/ @dduugg @Karel-van-de-Plassche /types/ion-rangeslider/ @Karel-van-de-Plassche /types/ioredis/v3/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot -/types/ioredis/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot +/types/ioredis/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot @funthing @iamolegga /types/iota.lib.js/ @fogsh /types/ip/ @codeanimal /types/ip-address/ @icopp @danwbyrne @@ -1859,10 +1926,11 @@ /types/is-ci/ @atd-schubert /types/is-color/ @VitorLuizC /types/is-compressed/ @mhegazy +/types/is-docker/ @YashdalfTheGray /types/is-empty/ @termosa /types/is-finite/ @mhegazy /types/is-glob/ @mrmlnc -/types/is-hotkey/ @petester42 +/types/is-hotkey/ @petester42 @kalley /types/is-ip/ @coderslagoon /types/is-mobile/ @LogvinovLeon /types/is-my-json-valid/ @kruncher @@ -1885,6 +1953,7 @@ /types/is-url-superb/ @kryops /types/is-uuid/ @tedre191 /types/is-windows/ @mizunashi-mana +/types/isaac/ @mo /types/isbn-utils/ @elhaard /types/iscroll/ @csrakowski @devlato /types/ismobilejs/ @Ty3uK @@ -1908,6 +1977,7 @@ /types/japanese-holidays/ @syamatoo /types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B /types/jasmine-ajax/ @lgrignon +/types/jasmine-data-provider/ @tlaziuk /types/jasmine-data_driven_tests/ @AnthonyMacKinnon /types/jasmine-enzyme/ @bolatovumar /types/jasmine-es6-promise-matchers/ @stephenlautier @@ -1918,7 +1988,7 @@ /types/jasmine-node/ @svi3c /types/jasmine-promise-matchers/ @matthewjh /types/jasmine_dom_matchers/ @devoto13 -/types/jasminewd2/ @sjelin +/types/jasminewd2/ @sjelin @gkalpak /types/java/ @jimlloyd @hrl7 @darti /types/java-applet/ @cyrilschumacher /types/javascript-astar/ @ptlis @@ -1930,8 +2000,9 @@ /types/jdataview/ @RReverser /types/jdenticon/ @mtr /types/jest/v16/ @NoHomey @jwbay -/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald +/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald @andys8 /types/jest-axe/ @JoshuaKGoldberg +/types/jest-cli/ @lifeiscontent /types/jest-diff/ @myabc /types/jest-docblock/ @ikatyang /types/jest-each/ @theutz @nickmccurdy @@ -1956,6 +2027,7 @@ /types/johnny-five/ @nakakura @ujvzolee @workshop2 /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @aconanlai +/types/joi/v13/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick /types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick /types/joigoose/ @boothwhack /types/josa/ @vichyssoise @@ -1967,7 +2039,7 @@ /types/jqrangeslider/ @qcz /types/jquery/v1/ @choffmeister @Steve-Fenton @Diullei @tasoili @jasons-novaleaf @seanski @Guuz @ksummerlin @basarat @nwolverson @derekcicerone @AndrewGaspar @seikichi @benjaminjackman @s093294 @JoshStrobl @DickvdBrink @King2500 @leonard-thieu /types/jquery/v2/ @choffmeister @Steve-Fenton @Diullei @tasoili @jasons-novaleaf @seanski @Guuz @ksummerlin @basarat @nwolverson @derekcicerone @AndrewGaspar @seikichi @benjaminjackman @s093294 @JoshStrobl @DickvdBrink @King2500 @leonard-thieu -/types/jquery/ @leonard-thieu @borisyankov @choffmeister @Steve-Fenton @Diullei @tasoili @jasons-novaleaf @seanski @Guuz @ksummerlin @basarat @nwolverson @derekcicerone @AndrewGaspar @seikichi @benjaminjackman @s093294 @JoshStrobl @johnnyreilly @DickvdBrink @King2500 +/types/jquery/ @leonard-thieu @borisyankov @choffmeister @Steve-Fenton @Diullei @tasoili @jasons-novaleaf @seanski @Guuz @ksummerlin @basarat @nwolverson @derekcicerone @AndrewGaspar @seikichi @benjaminjackman @s093294 @JoshStrobl @johnnyreilly @DickvdBrink @King2500 @terrymun /types/jquery-ajax-chain/ @humana-fragilitas /types/jquery-alertable/ @stever /types/jquery-animate-scroll/ @AndersonFriaca @@ -1982,6 +2054,7 @@ /types/jquery-editable-select/ @baywet /types/jquery-focus-exit/ @AndersonFriaca /types/jquery-focusable/ @AndersonFriaca +/types/jquery-formatdatetime/ @AndersonFriaca /types/jquery-fullscreen/ @bgrieder /types/jquery-galleria/ @rimig /types/jquery-gray/ @AndersonFriaca @@ -2104,7 +2177,7 @@ /types/js-yaml/ @Bartvds @sclausen /types/js.spec/ @mattbishop /types/jsbn/ @Evgenus @al2xed -/types/jschannel/ @yitzchok +/types/jschannel/ @yitzchok @McFlat /types/jscrollpane/ @qcz /types/jsdeferred/ @minodisk /types/jsdom/ @leonard-thieu @palmfjord @@ -2112,7 +2185,7 @@ /types/jsend/ @CaselIT /types/jsesc/ @Bartvds /types/jsfl/ @soywiz -/types/jsforce/ @dolanmiu @netes @amphro @tnoonan-salesforce @whiteabelincoln +/types/jsforce/ @dolanmiu @netes @amphro @tnoonan-salesforce @whiteabelincoln @borys-kupar /types/jsftp/ @xyleen /types/jsgraph/ @rosinbum /types/jshamcrest/ @dharkness @@ -2125,6 +2198,7 @@ /types/json-patch-gen/ @RohdeK /types/json-pointer/ @Bartvds /types/json-query/ @mtraynham +/types/json-rpc-random-id/ @micahriggan /types/json-rpc-ws/ @npenin @mlamp /types/json-schema/ @bcherny @cyrilletuzi @lucianbuzzo @rolandjitsu /types/json-socket/ @svi3c @@ -2144,15 +2218,18 @@ /types/jsonnet/ @hookclaw /types/jsonp/ @surenkov /types/jsonpath/ @horiuchi @ikatyang +/types/jsonquery/ @JimmyBoh /types/jsonrpc-serializer/ @Akim95 @many20 /types/jsonstream/ @Bartvds /types/jsontoxml/ @benstevens48 -/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk +/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod /types/jsonwebtoken-promisified/ @SomaticIT @danielheim @brikou @aneilbaboo +/types/jspath/ @dex4er /types/jspdf/ @amberjs /types/jsqrcode/ @lordazzi /types/jsrender/ @zakki /types/jsreport-core/ @taoqf +/types/jsreport-html-embedded-in-docx/ @taoqf /types/jsreport-html-to-xlsx/v1/ @me /types/jsreport-html-to-xlsx/ @me /types/jsreport-jsrender/ @taoqf @@ -2174,6 +2251,7 @@ /types/jui/ @easylogic /types/jui-core/ @easylogic /types/jui-grid/ @easylogic +/types/just-debounce-it/ @azizhk /types/just-extend/ @pe8ter /types/jweixin/ @taoqf @gomydodo /types/jwplayer/ @martinduparc @kutomer @philippguertler @danielmcgraw @bpdsw @@ -2184,8 +2262,10 @@ /types/jwt-express/ @nickp10 /types/jwt-simple/ @kenfdev @GaelMagnan /types/jwt-then/ @phenomax +/types/k6/ @MajorBreakfast /types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram -/types/karma/ @tkrotoff @43081j +/types/karma/v1/ @tkrotoff @43081j +/types/karma/ @tkrotoff @43081j @devoto13 /types/karma-chai/ @JayAndCatchFire /types/karma-chai-sinon/ @vasek17 /types/karma-coverage/ @tkrotoff @@ -2195,11 +2275,12 @@ /types/karma-webpack/ @mtraynham /types/katex/ @mrand01 /types/kcors/ @Xstoudi @izayoiko -/types/kdbush/ @DenisCarriere +/types/kdbush/ @DenisCarriere @chrfrasco /types/keen-tracking/ @rui-ferreira /types/kefir/ @AyaMorisawa @HitoriSensei /types/kendo-ui/ @telerik -/types/keyboardjs/ @vbortone @piranha771 +/types/keyboardjs/ @vbortone @piranha771 @teoxoy +/types/keycloak-connect/ @gstamac /types/keygrip/ @jkeylu /types/keymaster/ @nitram509 /types/keymirror/ @jfahrenkrug @@ -2263,6 +2344,7 @@ /types/koa-pino-logger/ @khell /types/koa-pug/ @Xstoudi /types/koa-range/ @strax +/types/koa-ratelimit/ @OutdatedVersion /types/koa-redis/ @nsimmons /types/koa-redis-cache/ @dimamukhin /types/koa-requestid/ @sjmcdowall @@ -2275,15 +2357,17 @@ /types/koa-sslify/ @wingsbob /types/koa-static/ @hellopao @tlaziuk /types/koa-static-cache/ @JounQin +/types/koa-static-server/ @wulunyi /types/koa-views/ @brooklyndev /types/koa-webpack/ @malj @leebenson @miZyind @tlaziuk -/types/koa-websocket/ @moimael @jacogr @zdila +/types/koa-websocket/ @moimael @jacogr @zdila @Kroisse /types/koa-xml-body/ @uwinkelvos /types/koa2-cors/ @xialeistudio /types/koa2-session-redis/ @DimaMukhin /types/koa__cors/ @Xstoudi @izayoiko @stevehipwell @sjmcdowall /types/kolite/ @borisyankov /types/konami.js/ @mareek +/types/kos-core/ @ali-Kos /types/kraken-js/ @darkwebdev @micksatana /types/kramed/ @tonicblue /types/kss/ @giladgray @@ -2292,13 +2376,16 @@ /types/kuromoji/ @mzsm @kgtkr /types/lab/ @prashaantt /types/ladda/ @dflor003 @leemicw +/types/lambda-log/ @armonge +/types/lambda-tester/ @ivank @HajoAhoMantila /types/lasso/ @darkwebdev /types/later/ @jasond-s /types/latinize/ @GiedriusGrabauskas /types/latlon-geohash/ @rimig /types/launchpad/ @rictic +/types/layzr.js/ @shermendev /types/lazy-value/ @ikatyang -/types/lazy.js/ @Bartvds +/types/lazy.js/ @Bartvds @miso440 /types/lazypipe/ @tomc974 /types/ldapjs/ @cvillemure @peterkooijmans /types/leadfoot/ @theintern @@ -2314,7 +2401,7 @@ /types/leaflet-imageoverlay-rotated/ @tkleinke /types/leaflet-label/ @Nemo157 /types/leaflet-mouse-position/ @Hanyon -/types/leaflet-polylinedecorator/ @soucekv +/types/leaflet-polylinedecorator/ @soucekv @michaelfaisst /types/leaflet-providers/ @BendingBender /types/leaflet-rotatedmarker/ @robert-prib-polestar /types/leaflet-routing-machine/ @chanakadrathnayaka @@ -2329,21 +2416,28 @@ /types/leaflet.pancontrol/ @Brictarus /types/leaflet.pm/ @tkleinke /types/leaflet.polylinemeasure/ @RiON69 +/types/leakage/ @atd-schubert /types/leapmotionts/ @logotype +/types/ledgerhq__hw-transport/ @danwbyrne +/types/ledgerhq__hw-transport-node-hid/ @danwbyrne +/types/ledgerhq__hw-transport-u2f/ @danwbyrne /types/legal-eagle/ @j-f1 /types/lerna-get-packages/ @LogvinovLeon -/types/less/ @thasner @pranaygp @dwaxweiler +/types/less/ @thasner @pranaygp @dwaxweiler @chigix /types/less-middleware/ @federicobond /types/less2sass/ @gatimus /types/lestate/ @thelambdaparty /types/level-codec/ @danwbyrne /types/level-sublevel/ @basp -/types/leveldown/ @tarruda @LinusU -/types/levelup/ @blittle @tarruda +/types/leveldown/v1/ @tarruda @LinusU +/types/leveldown/ @MeirionHughes @danwbyrne +/types/levelup/v1/ @blittle @tarruda +/types/levelup/ @MeirionHughes @danwbyrne /types/leven/ @jmalonzo /types/levenshtein/ @geoffreak /types/libpq/ @Lodin /types/libsodium-wrappers/ @ffflorian +/types/libsodium-wrappers-sumo/ @ffflorian /types/libxmljs/ @fdecampredon @ComFreek /types/libxslt/ @alejo90 /types/license-checker/ @rogierschouten @unindented @@ -2353,6 +2447,7 @@ /types/line-reader/ @stpettersens /types/linear-gradient/ @Jack-Works /types/lingui__core/ @huan086 +/types/lingui__macro/ @huan086 /types/lingui__react/ @huan086 /types/linkify-it/ @praxxis /types/listr/ @durad @@ -2371,6 +2466,7 @@ /types/lockfile/v0/ @Bartvds /types/lockfile/ @Bartvds @BendingBender /types/lockr/ @droritos +/types/locks/ @flippynips /types/locutus/ @hookclaw /types/lodash/v3/ @bczengel @chrootsu /types/lodash/ @bczengel @chrootsu @stepancar @aj-r @ailrun @e-cloud @thorn0 @jtmthf @DomiR @@ -2690,6 +2786,7 @@ /types/luxon/ @colbydehart @FourwingsY @jsiebern /types/lwip/ @AyaMorisawa /types/lz-string/ @M0ns1gn0r +/types/lzma-native/ @leshow /types/magic-number/ @stpettersens /types/magicsuggest/ @leonardochaia /types/magnet-uri/ @tlaziuk @@ -2701,7 +2798,9 @@ /types/main-bower-files/ @k-kagurazaka /types/make-dir/ @ikatyang @BendingBender /types/maker.js/ @danmarshall -/types/mali/ @danwbyrne +/types/makeup-expander/ @darkwebdev +/types/makeup-floating-label/ @darkwebdev +/types/makeup-screenreader-trap/ @darkwebdev /types/mali-compose/ @danwbyrne /types/mali-onerror/ @danwbyrne /types/mandrill-api/ @pocesar @@ -2720,6 +2819,7 @@ /types/markdown-it/ @rapropos /types/markdown-it-anchor/ @seryl /types/markdown-it-container/ @hronex +/types/markdown-it-lazy-headers/ @knom /types/markdown-pdf/ @MonsieurMan /types/markdownlint/ @ark120202 /types/marked/ @worr @BendingBender @CrossR @@ -2730,7 +2830,8 @@ /types/maskedinput/ @lokeshpeta /types/masonry-layout/ @m-a-wilson @warriorrocker /types/massive/v3/ @swissspidy @clarenceh -/types/massive/ @swissspidy @clarenceh @AmazingTurtle +/types/massive/v4/ @swissspidy @clarenceh @AmazingTurtle +/types/massive/ @swissspidy @clarenceh @AmazingTurtle @mike-engel /types/match-media-mock/ @asvetliakov /types/match-sorter/ @claasahl /types/material-components-web/ @BrentDouglas @ckosti @@ -2772,6 +2873,7 @@ /types/maxmind/ @geoffreak /types/mcustomscrollbar/ @flurg /types/md5/ @arcdev1 @jprogrammer +/types/md5-file/ @BamButz /types/mdns/ @reppners /types/mdurl/ @rokt33r /types/media-typer/ @BendingBender @@ -2800,11 +2902,12 @@ /types/messenger/ @derekcicerone /types/meteor/ @barbatus @fullflavedave @orefalo @dagatsoin @birkskyum @ardatan @stefanholzapfel @andrei-markeev @lmachens /types/meteor-accounts-phone/ @DAB0mB +/types/meteor-astronomy/ @Deadly0 /types/meteor-collection-hooks/ @twastvedt /types/meteor-jboulhous-dev/ @vangorra /types/meteor-persistent-session/ @vangorra /types/meteor-prime8consulting-oauth2/ @vangorra -/types/meteor-publish-composite/ @vangorra +/types/meteor-publish-composite/ @vangorra @mrz5018 /types/meteor-roles/ @vangorra @mattmm3d /types/meteor-universe-i18n/ @mathewmeconry /types/method-override/ @santialbo @@ -2841,12 +2944,13 @@ /types/mitm/ @alejo90 /types/mixpanel/ @hjellek @Manduro /types/mixto/ @vvakame -/types/mjml/ @aahoughton +/types/mjml/ @aahoughton @marpstar /types/mkdirp/ @Bartvds @mrmlnc /types/mkdirp-promise/ @pluma /types/mkpath/ @optical /types/ml-levenberg-marquardt/ @m93a /types/mobx-apollo/ @pselden +/types/mobx-cookie/ @t49tran /types/mobx-devtools-mst/ @pluma /types/mocha/ @kazimanzurrashid @otiai10 @jt000 @enlight @cspotcode @1999 /types/mocha-each/ @magnostherobot @@ -2863,6 +2967,7 @@ /types/modernizr/ @borisyankov @theodorejb @leonyu @lucax88x @nhardy /types/modesl/ @neeschit /types/module-alias/ @KevinRamharak +/types/module-deps/ @TeamworkGuy2 /types/moji/ @yasupeke /types/moment-business/ @wonbyte /types/moment-business-time/ @swist @@ -2877,11 +2982,11 @@ /types/money-math/ @taoqf /types/mongo-sanitize/ @CedricCazin /types/mongodb/v2/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi -/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 +/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric /types/mongodb-memory-server/ @dmitryrogozhny /types/mongodb-uri/ @mernxl /types/mongoose/v4/ @simonxca @horiuchi @sindrenm @lukasz-zak -/types/mongoose/ @horiuchi @sindrenm @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 +/types/mongoose/ @horiuchi @sindrenm @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa /types/mongoose-geojson-schema/ @bondz @@ -2893,6 +2998,7 @@ /types/mongoose-simple-random/ @rsxdalv /types/mongoose-unique-validator/ @stevehipwell /types/mongorito/ @pinguet62 +/types/mongration/ @soulthreads /types/moo/ @deltaidea @MofX /types/moonjs/ @DanielRosenwasser /types/morgan/ @staticfunction @pscanf @@ -2902,6 +3008,7 @@ /types/motor-hat/ @muntyan /types/mousetrap/ @qcz /types/move-concurrently/ @mgroenhoff +/types/moveto/ @shermendev /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka /types/mozilla-readability/ @charlesvdv @@ -2918,6 +3025,7 @@ /types/muicss/ @samuelneff /types/multer/ @jt000 @DavidBR-SW @mxl @hyunseob /types/multer-gridfs-storage/v1/ @devconcept +/types/multer-gridfs-storage/v2/ @devconcept /types/multer-gridfs-storage/ @devconcept /types/multer-s3/ @tcaesvk @galtalmor @terski /types/multi-typeof/ @mhegazy @@ -2932,10 +3040,11 @@ /types/murmurhash3js/ @dlee-nvisia /types/musicmetadata/ @Xstoudi /types/mustache/ @markashleybell @manuth +/types/mutexify/ @maistho /types/mv/ @nenadalm /types/mysql/ @wjohnsto @kacepe @kpping @jdmunro /types/mz/ @ThomasHickman -/types/n3/ @phreed @rubensworks +/types/n3/ @phreed @rubensworks @LaurensRietveld /types/named-regexp-groups/ @jewbre /types/named-routes/ @qqilihq /types/nanoajax/ @nathancahill @@ -2973,11 +3082,13 @@ /types/network-interfaces/ @anderswestberg /types/new-relic-browser/ @renehamburger @piotrkubisa /types/newline-remove/ @OpenByteDev -/types/newman/ @LogvinovLeon -/types/newrelic/ @mastermatt +/types/newman/ @LogvinovLeon @Graham42 +/types/newrelic/ @mastermatt @brookspatton /types/nexpect/ @vvakame -/types/next/ @dru89 @brikou @jthegedus @resir014 @scottdj92 @joaovieira +/types/next/ @dru89 @brikou @jthegedus @resir014 @scottdj92 @joaovieira @ajliv +/types/next-redux-saga/ @leocavalcante /types/next-redux-wrapper/ @stevegeek @Jungwoo-An +/types/next-server/ @dru89 @brikou @jthegedus @resir014 @scottdj92 @joaovieira @ajliv /types/ng-command/ @stephenlautier /types/ng-cordova/ @ksachdeva /types/ng-dialog/ @stephenlautier @@ -3006,25 +3117,27 @@ /types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour @paambaati /types/nodal/ @charrondev -/types/node/v4/ @eps1lon @Archcry -/types/node/v6/ @WilcoBakker @inlined @eps1lon @Alorel @KSXGitHub @Archcry -/types/node/v7/ @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry -/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @brunoscheufler @KSXGitHub @islishude @r3nya -/types/node/v9/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @eyqs -/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @ZaneHannanAU @ThomasdenH @eyqs @matthieusieben +/types/node/v0/ @Microsoft @DefinitelyTyped +/types/node/v4/ @Microsoft @DefinitelyTyped @eps1lon @Archcry +/types/node/v6/ @Microsoft @DefinitelyTyped @WilcoBakker @inlined @eps1lon @Alorel @KSXGitHub @Archcry +/types/node/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry +/types/node/v8/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @brunoscheufler @KSXGitHub @islishude @r3nya +/types/node/v9/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @eyqs +/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @brunoscheufler @smac89 @tellnes @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz /types/node-7z/ @erkie /types/node-array-ext/ @Beng89 /types/node-cache/ @chrootsu @dthunell @useltmann /types/node-calendar/ @luzianz /types/node-cleanup/ @agadar -/types/node-cron/ @maximelkin +/types/node-crate/ @gjednaszewski +/types/node-cron/ @maximelkin @burtek /types/node-dijkstra/ @nokutu /types/node-dir/ @panuhorsmalahti /types/node-dogstatsd/ @chrisbobo /types/node-emoji/ @jonestristand @styu /types/node-fetch/ @torstenwerner @nikcorg /types/node-fibers/ @caryhaynie -/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung +/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau /types/node-gcm/ @horiuchi /types/node-geocoder/ @rosek86 /types/node-getopt/ @kcauchy @@ -3044,6 +3157,7 @@ /types/node-pushnotifications/ @menushka /types/node-ral/ @ssddi456 /types/node-red/ @andersea @tbowmo +/types/node-redis-pubsub/ @renekeijzer /types/node-resque/ @gordey4doronin /types/node-rsa/ @alitaheri @xm /types/node-schedule/ @cyrilschumacher @flowpl @@ -3078,9 +3192,10 @@ /types/nodeunit/ @jedigo /types/noisejs/ @izmhr /types/nomnom/ @panopticoncentral +/types/nookies/ @andreasbergqvist /types/nopt/ @jbondc /types/normalize-package-data/ @jdxcode -/types/normalize-url/ @odin3 @BendingBender +/types/normalize-url/ @odin3 @BendingBender @mathieumg /types/notie/ @mateusdemboski /types/notify/ @hellochar /types/notifyjs/ @soundTricker @NateScarlet @@ -3091,13 +3206,13 @@ /types/nouislider/ @bleuarg @lagaffe /types/novnc-core/ @smithkl42 @BendingBender /types/npm/ @SomaticIT -/types/npm-package-arg/ @mgroenhoff +/types/npm-package-arg/ @mgroenhoff @OiYouYeahYou /types/npm-packlist/ @ajafff /types/npmlog/ @DanielMSchmidt @littlepiggy03 /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk -/types/nuka-carousel/ @Romic +/types/nuka-carousel/ @Romic @altaudio /types/number-is-nan/ @mhegazy /types/number-to-words/ @frederickfogerty /types/numeral/ @vbortone @BehindTheMath @klujanrosas @@ -3108,13 +3223,15 @@ /types/nvd3/ @PjMitchell /types/nw.gui/ @xperiments /types/nw.js/ @alirdn +/types/nwmatcher/ @woutervh- /types/o.js/ @IceOnFire @bradzacher @janhommes @jcchalte -/types/oauth/ @nonAlgebraic +/types/oauth/ @nonAlgebraic @EduardoAC /types/oauth.js/ @nobuoka /types/oauth2-server/ @vangorra @cirick @d-fischer /types/oauth2orize/ @wokim @heycalmdown @stevehipwell /types/obelisk.js/ @bdrupieski /types/obj-file-parser/ @benc-uk +/types/obj-str/ @saenglert /types/object-assign/ @chbrown /types/object-diff/ @rogierschouten /types/object-hash/ @misak113 @@ -3133,6 +3250,7 @@ /types/odata/ @janhommes @jcchalte /types/ofe/ @Morfent /types/office-js/ @OfficeDev @LanceEA @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT +/types/office-runtime/ @Zlatkovsky @mscharlock /types/offline-js/ @cgwrench /types/oibackoff/ @geoffreak /types/oidc-token-manager/ @rosieks @@ -3142,11 +3260,12 @@ /types/omggif/ @ffflorian /types/on-finished/ @czechboy0 @BendingBender /types/on-headers/ @jjeffery @BendingBender +/types/on-wake-up/ @ajafff /types/once/ @denis-sokolov @BendingBender /types/onesignal-cordova-plugin/ @broder /types/onetime/ @BendingBender /types/oniguruma/ @smhxx -/types/onoff/ @marcel-ernst +/types/onoff/ @marcel-ernst @Kallu609 /types/ontime/ @Hirse /types/open/ @Bartvds /types/opener/ @tikurahul @@ -3157,16 +3276,18 @@ /types/openlayers/v2/ @bolhovsky /types/openlayers/v3/ @osechet @matthiasdailey-ccri /types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana @yairtawil @pierremarc @hauke96 @gberaudo -/types/openpgp/ @errietta +/types/openpgp/ @errietta @damonpam /types/openstack-wrapper/ @sanjaymadane /types/opentok/ @westy92 @CatGuardian /types/opentype.js/ @danmarshall @edzis /types/opn/ @shinnn @SomaticIT @tlent +/types/opossum/ @quinnlangille @lance /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem /types/ora/v0/ @basarat @screendriver /types/ora/ @basarat @screendriver @BendingBender @azasypkin +/types/oracle__oraclejet/ @nolakara @jingxwu /types/oracledb/ @Bigous /types/orchestrator/ @tkQubo @TeamworkGuy2 /types/orderedmap/ @bradleyayers @@ -3219,6 +3340,7 @@ /types/p-wait-for/ @BendingBender /types/p-whilst/ @BendingBender /types/p2/ @clark-stevenson +/types/p5/ @p5-types /types/package-json/ @jinwoo /types/packery/ @piraveen @hanssens /types/pad/ @mhegazy @@ -3226,10 +3348,11 @@ /types/paho-mqtt/ @amikhalev /types/pako/ @cappellin @calebegg /types/pangu/ @plantain-00 -/types/papaparse/ @torpedro @rainshen49 @jfloff @johnnyreilly @albertorestifo @BehindTheMath @3af +/types/papaparse/ @torpedro @rainshen49 @jfloff @johnnyreilly @albertorestifo @BehindTheMath @3af @jliuhtonen /types/paper/ @clark-stevenson @Xakaloz @sebaswebdev @rfried /types/parallel-transform/ @djcsdy /types/paralleljs/ @jbaldwin +/types/parcel-bundler/ @pinage404 /types/parcel-env/ @fathyb /types/parent-package-json/ @sgmccli /types/parity-pmd/ @leovujanic @jewbre @@ -3259,6 +3382,8 @@ /types/parsimmon/ @Bartvds @mizunashi-mana @bcherny @bvanreeven @leonard-thieu @MrJohz /types/passport/ @horiuchi @enaeseth @theigor @tlaziuk @danielpa9708 /types/passport-anonymous/ @0x6368656174 +/types/passport-auth0/ @johnbendi @iamvishnusankar +/types/passport-azure-ad/ @ShekharNain /types/passport-beam/ @AtlasDev /types/passport-cognito/ @mbutsykin /types/passport-discord/ @kzay @@ -3275,7 +3400,7 @@ /types/passport-local/ @SomaticIT /types/passport-local-mongoose/ @linusbrolin /types/passport-naver/ @Park9eon @zerocho -/types/passport-oauth2/ @pasieronen @WangZishi +/types/passport-oauth2/ @pasieronen @WangZishi @EduardoAC /types/passport-oauth2-client-password/ @akaNightmare /types/passport-remember-me-extended/ @AylaJK /types/passport-saml/ @cjbarth @dassennato @@ -3283,6 +3408,8 @@ /types/passport-strategy/ @liorm /types/passport-twitter/ @staticfunction /types/passport-unique-token/ @briman0094 @SomaticIT +/types/passport-vkontakte/ @soulthreads +/types/passport-windowsauth/ @forivall /types/password-hash/ @mugeso /types/password-hash-and-salt/ @alitaheri /types/path-exists/v1/ @shiwano @@ -3300,7 +3427,7 @@ /types/pbkdf2/ @timonegk /types/pdfjs-dist/ @jbaldwin /types/pdfkit/ @erichillah -/types/pdfmake/ @m1llen1um @radziksh +/types/pdfmake/ @m1llen1um @radziksh @evolkmann /types/pdfobject/ @nielsboogaard /types/pebblekitjs/ @makotokw /types/peer-dial/ @RealTYPICAL @@ -3308,6 +3435,7 @@ /types/pegjs/ @vvakame @SrTobi @siegebell /types/pem/ @tony19 @DethAriel /types/pem-jwk/ @alessiopcc +/types/permit/ @jannikkeye /types/persona/ @Nycto /types/pet-finder-api/ @me /types/pg/v6/ @pspeter3 @@ -3340,11 +3468,13 @@ /types/pidusage/ @cyrilschumacher @mx601595686 /types/pify/ @samverschueren @mad-mike @c7hm4r /types/pigpio/ @manerfan -/types/pikaday/ @MidnightDesign @wake42 +/types/pigpio-dht/ @erikma +/types/pikaday/ @MidnightDesign @wake42 @mezoistvan /types/pikaday-time/ @Sayan751 /types/pinkyswear/ @chances /types/pino/v3/ @psnider -/types/pino/ @psnider @BendingBender @screendriver @paambaati +/types/pino/ @psnider @BendingBender @screendriver @paambaati @alferpal +/types/pino-http/ @screendriver /types/pino-multi-stream/ @JakeGinnivan /types/pinterest-sdk/ @adamburmister /types/pinyin/ @wanganjun @@ -3359,6 +3489,7 @@ /types/playerframework/ @ricardosabino /types/playmusic/ @nickp10 /types/pleasejs/ @nakakura +/types/plist/ @higuri /types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart @szechyjs @MercifulCode @soorajpudiyadath @jonfreedman @meganrm /types/plugapi/ @BNedry /types/plugin-error/ @rogierschouten @@ -3380,6 +3511,9 @@ /types/popcorn/ @grapswiz /types/portscanner/ @douglasduteil /types/postal/ @lokeshpeta @myitcv +/types/postcss-calc/ @huan086 +/types/postcss-icss-values/ @huan086 +/types/postcss-modules-resolve-imports/ @huan086 /types/postman-collection/ @kbuzby /types/postmark/ @benbayard @jineshshah36 /types/pouch-redux-middleware/ @charrondev @@ -3393,7 +3527,7 @@ /types/pouchdb-adapter-node-websql/ @spaulg @geppy @fredgalvao /types/pouchdb-adapter-websql/ @spaulg @geppy @fredgalvao /types/pouchdb-browser/ @spaulg @geppy @fredgalvao -/types/pouchdb-core/ @spaulg @trubit @geppy @fredgalvao @TobiasBales @tiangolo +/types/pouchdb-core/ @spaulg @trubit @geppy @fredgalvao @TobiasBales @tiangolo @kmoe /types/pouchdb-find/ @trubit @tiangolo /types/pouchdb-http/ @spaulg @geppy @fredgalvao /types/pouchdb-mapreduce/ @spaulg @geppy @fredgalvao @@ -3443,6 +3577,7 @@ /types/prompt-sync/ @MugeSo /types/prompt-sync-history/ @MugeSo /types/promptly/ @danrspencer +/types/prompts/ @Berkays /types/prop-types/ @DovydasNavickas @ferdaber /types/proper-lockfile/ @qlonik /types/properties-reader/ @Goldsmith42 @@ -3462,7 +3597,7 @@ /types/prosemirror-tables/ @superchu @eshvedai @patsimm /types/prosemirror-transform/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-view/ @bradleyayers @davidka @timjb @patsimm -/types/proton-native/ @khanhas +/types/proton-native/ @khanhas @ltetzlaff /types/protractor-browser-logs/ @rokadias /types/protractor-helpers/ @johncant /types/protractor-http-mock/ @Crevil @@ -3483,7 +3618,8 @@ /types/pumpify/ @JustinBeckwith @aoberoi /types/pupa/ @nju33 /types/puppeteer/v0/ @marvinhagemeister @cdeutsch -/types/puppeteer/ @marvinhagemeister @cdeutsch @ksm2 +/types/puppeteer/ @marvinhagemeister @cdeutsch @ksm2 @SimonSchick +/types/puppeteer-core/ @mtsmfm /types/pure-render-decorator/ @seansfkelley /types/purl/ @danfma /types/pusher-js/ @tkqubo @cainlevy @@ -3496,7 +3632,7 @@ /types/qhistory/ @Kovensky /types/qiniu-js/ @taoqf /types/qlik/ @RubenSlabbert @AginicX -/types/qlik-engineapi/ @konne +/types/qlik-engineapi/ @konne @richardison /types/qlik-visualizationextensions/ @konne /types/qr-image/ @taoqf /types/qrcode/ @plantain-00 @@ -3517,7 +3653,7 @@ /types/rabbit.js/ @wokim /types/radium/ @alexgorbatchev @nupplaphil @asvetliakov /types/radius/ @codeanimal -/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm +/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt /types/random-js/ @pistacchio /types/random-number/ @OpenByteDev /types/random-seed/ @endel @@ -3541,23 +3677,26 @@ /types/raty/ @terrawheat /types/raven/ @scttcper @1999 @shreyjain1994 /types/raven-for-redux/ @chiubaka -/types/raygun4js/ @xt0rted @BenjaminHarding +/types/raygun/ @UberMouse +/types/raygun4js/ @xt0rted @BenjaminHarding @UberMouse /types/rbac-a/ @tlaziuk /types/rc/ @DanielRosenwasser /types/rc-select/ @DenisTirilis /types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 +/types/rc-time-picker/ @Hoff97 /types/rc-tree/ @johnnyreilly @Methuselah96 /types/rcloader/ @panuhorsmalahti /types/rdf-data-model/ @rubensworks -/types/rdf-js/ @rubensworks +/types/rdf-js/ @rubensworks @LaurensRietveld /types/rdflib/ @cenotelie /types/re-base/ @jordandrako /types/reach__router/ @kingdaro /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz /types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei /types/react-adal/ @dkorolev1 -/types/react-albus/ @sseppola -/types/react-alert/ @ssyrell +/types/react-albus/ @sseppola @conradreuter @kuirak +/types/react-alert/v2/ @ssyrell +/types/react-alert/ @g1eny0ung /types/react-alice-carousel/ @endigo /types/react-amplitude/ @rayzor65 /types/react-animate-on-scroll/ @ralbuque @@ -3568,6 +3707,7 @@ /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch @rosskevin /types/react-avatar-editor/ @diogocorrea @gabsprates /types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen +/types/react-better-password/ @mhuynh1 /types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall @jrakotoharisoa @r3nya @t49tran @@ -3576,7 +3716,7 @@ /types/react-bootstrap-table/v2/ @flaub @alelode @UJosue10 /types/react-bootstrap-table/ @flaub @alelode @UJosue10 @dawnmist @Ogglas /types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson -/types/react-breadcrumbs/ @KostyaEsmukov +/types/react-breadcrumbs/ @guoyunhe /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros /types/react-burger-menu/ @radziksh @@ -3585,6 +3725,7 @@ /types/react-cartographer/ @trevonmckay /types/react-circular-progressbar/ @lstanden /types/react-click-outside/ @screendriver +/types/react-close-on-escape/ @JamesAlias /types/react-codemirror/ @velveret @rudi-c /types/react-coinhive/ @sktbcbbs /types/react-collapse/ @Kimahriman @@ -3594,6 +3735,7 @@ /types/react-content-loader/ @alaatm @samwalshnz /types/react-copy-to-clipboard/ @mabels @BernabeFelix /types/react-copy-write/ @samhh @davej +/types/react-countup/ @danielbrodin /types/react-credit-cards/ @vstrimaitis @olefrank /types/react-cropper/ @stepancar /types/react-css-modules/ @KostyaEsmukov @skirsdeda @@ -3607,15 +3749,17 @@ /types/react-datagrid/ @stephenjelfs /types/react-date-range/ @Junbong /types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue @KoalaHuman @seansfkelley -/types/react-daterange-picker/ @uncovertruth @MartynasZilinskas @donaldtf +/types/react-daterange-picker/ @uncovertruth @MartynasZilinskas @donaldtf @vladflorescu94 /types/react-dates/ @ArturAmpilogov @NathanNZ /types/react-daum-postcode/ @Sa-ryong /types/react-dnd-multi-backend/ @dawnmist @beeequeue /types/react-dnd-touch-backend/ @mleko @dawnmist @beeequeue +/types/react-document-meta/ @ulrichb /types/react-document-title/ @cleverguy25 /types/react-dom/v15/ @MartynasZilinskas /types/react-dom/ @MartynasZilinskas @theruther4d /types/react-dom-factories/ @jgoz +/types/react-draft-wysiwyg/ @imechZhangLY /types/react-dragtastic/ @nscarcella /types/react-dropzone/v2/ @matdube @LynxEyes @goblindegook @benbayard /types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay @@ -3625,6 +3769,7 @@ /types/react-event-listener/ @asvetliakov /types/react-fa/ @flaub @patsissons @LKay /types/react-facebook-login/ @apare @jankarres +/types/react-facebook-login-component/ @koss-lebedev /types/react-faux-dom/ @alitaheri @cleverguy25 @deviousm @hanai /types/react-file-input/ @dmitryrogozhny /types/react-file-reader-input/ @dmitryrogozhny @alitaheri @@ -3640,6 +3785,7 @@ /types/react-gateway/ @jsonunger /types/react-geosuggest/ @brmenchl /types/react-global-configuration/ @ryokik +/types/react-google-login-component/ @koss-lebedev /types/react-google-maps-loader/ @vasilysn /types/react-google-places-suggest/ @vasilysn /types/react-google-recaptcha/ @KoalaHuman @@ -3652,38 +3798,43 @@ /types/react-helmet/ @evanbb @isman-usoh @lith-light-g @sammkj @yuit /types/react-helmet-async/ @forabi /types/react-highlight/ @joshuakgoldberg -/types/react-highlight-words/ @mhegazy @diogodca +/types/react-highlight-words/ @mhegazy @diogodca @kellyrmilligan /types/react-highlighter/ @oizie /types/react-holder/ @isman-usoh /types/react-hot-loader/ @jacekjagiello @MartynasZilinskas @DovydasNavickas /types/react-hyperscript/ @tock203 -/types/react-i18next/v1/ @KostyaEsmukov -/types/react-i18next/v4/ @GiedriusGrabauskas @netanelgilad -/types/react-i18next/ @GiedriusGrabauskas @chnoch @beheh @whtsky /types/react-icon-base/ @apare @LKay /types/react-icons/ @apare @johnnyreilly @LKay /types/react-image-crop/ @danielasy +/types/react-image-fallback/ @8enSmith /types/react-image-gallery/ @adamwpc /types/react-imageloader/ @stephenjelfs +/types/react-images/ @KonstantinLukaschenko +/types/react-imgpro/ @echoulen /types/react-infinite/ @rhysd /types/react-infinite-calendar/ @christianchown -/types/react-infinite-scroll-component/ @sroy3 @burtek @davidkevork -/types/react-infinite-scroller/ @Lapanti @psrebniak +/types/react-infinite-scroll-component/ @sroy3 @burtek @davidkevork @JoshuaScript +/types/react-infinite-scroller/ @Lapanti @psrebniak @WrathZA /types/react-input-autosize/ @jsonunger @franklixuefei /types/react-input-calendar/ @stepancar /types/react-input-mask/v1/ @apare /types/react-input-mask/ @apare @dima7a14 +/types/react-instantsearch/ @gburgett @jpowell +/types/react-instantsearch-core/ @gburgett @jpowell +/types/react-instantsearch-dom/ @gburgett @jpowell +/types/react-instantsearch-native/ @gburgett @jpowell /types/react-intl/v1/ @bgrieder /types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth /types/react-intl-redux/ @LKay -/types/react-is/ @AviVahl +/types/react-is/ @AviVahl @christianchown /types/react-is-deprecated/ @seansfkelley -/types/react-joyride/ @kdy1 +/types/react-joyride/ @kdy1 @kamranayub /types/react-js-pagination/ @netoisc /types/react-json/ @spielc /types/react-json-pretty/ @LKay /types/react-json-tree/ @gnestor -/types/react-jsonschema-form/ @iamdanfox @iplus26 @KurtPreston @phbou72 @LucianBuzzo +/types/react-jsonschema-form/ @iamdanfox @iplus26 @KurtPreston @phbou72 @LucianBuzzo @sthenault @sbusch +/types/react-jss/ @eps1lon /types/react-lazyload/ @m0a /types/react-lazylog/ @benjaminRomano /types/react-leaflet/ @danzel @davschne @yuit @@ -3691,24 +3842,26 @@ /types/react-list/ @buptyyf @tomshen /types/react-loadable/ @Kovensky @odensc @ianks @tlaziuk @iMobs /types/react-loader/ @artfuldev +/types/react-lottie/ @Kana00 @Ricki-BumbleDev /types/react-mailchimp-subscribe/ @osdiab /types/react-map-gl/ @rimig @fnberta /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti /types/react-mce/ @morphologue /types/react-mdl/ @bradzacher /types/react-measure/ @asvetliakov @marcfallows +/types/react-mentions/ @activescott /types/react-mixin/ @tkqubo -/types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz +/types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz @jpowell /types/react-motion/ @stepancar @asvetliakov @dimitarnestorov /types/react-motion-slider/ @asvetliakov /types/react-motion-ui-pack/ @jsonunger -/types/react-native/ @alloy @huhuanming @iRoachie @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam +/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel /types/react-native-android-taskdescription/ @christianchown /types/react-native-auth0/ @ascariandrea /types/react-native-autocomplete-input/ @ifiokjr /types/react-native-background-timer/ @chillkroeteTTS /types/react-native-bluetooth-serial/ @RodrigoAWeber -/types/react-native-calendars/ @Tyler-Zhang @DavidNorena +/types/react-native-calendars/ @Tyler-Zhang @DavidNorena @FabianMeul /types/react-native-communications/ @huhuanming @PaitoAnderson /types/react-native-custom-tabs/ @philnova /types/react-native-datepicker/ @jacobbaskin @@ -3723,8 +3876,9 @@ /types/react-native-fbsdk/ @ifiokjr /types/react-native-fetch-blob/ @MNBuyskih /types/react-native-fs/ @pocesar @josephroque -/types/react-native-google-signin/ @j-fro +/types/react-native-google-signin/ @j-fro @bm-software @christianchown @echentw /types/react-native-htmlview/ @ifiokjr +/types/react-native-huawei-protected-apps/ @christianchown /types/react-native-i18n/ @VincentLanglet /types/react-native-indicators/ @ifiokjr /types/react-native-keep-awake/ @huhuanming @@ -3746,7 +3900,10 @@ /types/react-native-popup-dialog/ @PaitoAnderson @connectdotz @bm-software /types/react-native-push-notification/ @PaitoAnderson @tomSawkins /types/react-native-qrcode/ @plantain-00 +/types/react-native-referrer/ @christianchown +/types/react-native-restart/ @christianchown /types/react-native-safari-view/ @mrand01 +/types/react-native-scaled-image/ @Jaeger25 /types/react-native-scrollable-tab-view/ @CaiHuan @egorshulga /types/react-native-sensor-manager/ @SahinVardar /types/react-native-settings-list/ @MrLuje @@ -3756,6 +3913,7 @@ /types/react-native-sortable-list/ @sivolobov @RookY2K /types/react-native-sqlite-storage/ @dryganets @cavarzan /types/react-native-star-rating/ @iRoachie +/types/react-native-status-bar-height/ @fiznool /types/react-native-svg-charts/ @krzysztof-miemiec /types/react-native-svg-uri/ @iRoachie /types/react-native-swiper/ @CaiHuan @huhuanming @mhcgrq @@ -3764,11 +3922,12 @@ /types/react-native-text-input-mask/ @RodrigoAWeber /types/react-native-toast-native/ @bm-software /types/react-native-touch-id/ @huhuanming @gazaret @jinshin1013 +/types/react-native-uuid-generator/ @burtek /types/react-native-vector-icons/ @iRoachie @timwangdev /types/react-native-version-number/ @VincentLanglet /types/react-native-video/ @huhuanming /types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @jkillian /types/react-navigation-material-bottom-tabs/ @iRoachie /types/react-no-ssr/ @rafalfilipek /types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar @@ -3776,8 +3935,9 @@ /types/react-notify-toast/ @klaascuvelier /types/react-numeric-input/ @heatherbooker @akx /types/react-onclickoutside/v5/ @LKay -/types/react-onclickoutside/ @LKay -/types/react-onsenui/ @salim7 @jemmyw +/types/react-onclickoutside/ @LKay @surgeboris +/types/react-onsenui/ @salim7 @jemmyw @lirbank +/types/react-outside-click-handler/ @zubivan /types/react-overlays/ @aaronbeall @vitosamson /types/react-owl-carousel/ @tbounsiar @igorissen @KennethanCeyer /types/react-paginate/v4/ @deevus @wouterhardeman @pegel03 @archy-bold @@ -3793,6 +3953,7 @@ /types/react-qr-reader/ @davidkevork /types/react-radio-group/ @jsonunger /types/react-recaptcha/ @mhegazy @zzanol +/types/react-reconciler/ @Methuselah96 /types/react-redux/v5/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva /types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski /types/react-redux-epic/ @forabi @@ -3806,8 +3967,8 @@ /types/react-responsive/ @asvetliakov @alechill @xaviergonz /types/react-rnd/ @Ragg- @fsubal @zyh825 /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov -/types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen @gillchristian -/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran +/types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen @gillchristian @nulladdict +/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall /types/react-router-config/ @lith-light-g @johnnyreilly /types/react-router-dom/ @tkrotoff @huy-nguyen @p-jackson @johnnyreilly @@ -3839,7 +4000,9 @@ /types/react-sparklines/ @henrinormak /types/react-spinkit/v1/ @tkqubo @mleko @pelotom /types/react-spinkit/ @tkqubo @mleko @pelotom @zzanol +/types/react-star-rating-component/ @marpstar /types/react-sticky/ @curtisw0 @ajhyndman +/types/react-sticky-box/ @koss-lebedev /types/react-sticky-el/ @jbraithwaite /types/react-stickynode/ @tstirrat /types/react-stripe-elements/ @dan-j @santiagodoldan @sonnysangha @9y5 @thchia @@ -3849,10 +4012,11 @@ /types/react-swipe/ @DeividasBakanas /types/react-swipeable/ @GiedriusGrabauskas @mctep @horiuchi /types/react-swipeable-views/ @mxl @DeividasBakanas -/types/react-syntax-highlighter/ @NoHomey -/types/react-table/ @royxue @psakalo @Havret +/types/react-syntax-highlighter/ @NoHomey @ajgamble-milner +/types/react-table/ @royxue @psakalo @Havret @andys8 /types/react-table-filter/ @gjsln -/types/react-tabs/ @danez +/types/react-tabs/ @danez @Equationist +/types/react-tag-autocomplete/ @jlismore /types/react-tag-input/ @Ogglas @jankarres @matthewberryman /types/react-tagcloud/ @wassname /types/react-tagsinput/ @mykter @@ -3862,6 +4026,7 @@ /types/react-tether/ @ryprice /types/react-text-mask/ @guilhermehubner @cavarzan @needpower /types/react-textarea-autosize/ @asvetliakov @zry656565 +/types/react-timeago/ @koss-lebedev /types/react-timeout/ @kerwynrg /types/react-toastify/ @icopp /types/react-toastr/ @shssoichiro @DanRegazzi @@ -3880,11 +4045,13 @@ /types/react-virtual-keyboard/ @bsurai /types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx @kraenhansen @Stevearzh @mgoszcz2 @brandonhall /types/react-virtualized-select/ @seansfkelley +/types/react-visibility-sensor/ @JRasmusBm /types/react-webcam/ @squat /types/react-weui/ @tairan -/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz +/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 /types/react-widgets-moment/ @dawnmist /types/react-window/ @martynaskadisa +/types/react-window-size/ @jakejrichards /types/react-youtube/ @kgtkr /types/react-youtube-embed/ @charles-salmon /types/reactable/ @spielc @@ -3901,16 +4068,20 @@ /types/readline-sync/ @jonestristand /types/readline-transform/ @dex4er /types/reapop/ @Barrokgl +/types/rebass/ @ryee-dev +/types/rebass__grid/ @antonvasin @vittorio @lhache @lavoaster /types/recaptcha2/ @l-jonas /types/recase/ @18steps /types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok +/types/recharts-scale/ @johnnyreilly /types/recluster/ @dex4er -/types/recompose/ @iskandersierra @mrapogee @clayne11 @Pajn @lucasterra +/types/recompose/ @iskandersierra @mrapogee @clayne11 @Pajn @lucasterra @brian-lives-outdoors /types/reconnect-core/ @thw0rted /types/reconnectingwebsocket/ @nguarracino +/types/recorder-js/ @higuri /types/recursive-readdir/v1/ @elisee /types/recursive-readdir/ @elisee @MicahZoltu -/types/redis/ @soywiz @CodeAnimal @MugeSo @UppaJung @Rokt33r @43081j @barnski +/types/redis/ @soywiz @CodeAnimal @MugeSo @UppaJung @Rokt33r @43081j @barnski @1pete /types/redis-errors/ @43081j /types/redis-mock/ @BendingBender /types/redis-rate-limiter/ @westy92 @@ -3921,7 +4092,7 @@ /types/reduce-reducers/ @huy-nguyen /types/redux-action/ @newraina /types/redux-action-utils/ @tkqubo -/types/redux-actions/ @jaysoo @alexgorbatchev @alechill @alexey-pelykh +/types/redux-actions/ @jaysoo @alexgorbatchev @alechill @alexey-pelykh @7hi4g0 /types/redux-async-queue/ @andreiho /types/redux-auth-wrapper/v1/ @LKay /types/redux-auth-wrapper/ @LKay @@ -3931,14 +4102,15 @@ /types/redux-devtools-dock-monitor/ @mc-petry /types/redux-devtools-log-monitor/ @mc-petry /types/redux-doghouse/ @BendingBender -/types/redux-first-router/ @Valbrand @viggyfresh @janb87 @corydeppen @jscinoz +/types/redux-first-router/ @Valbrand @viggyfresh @janb87 @corydeppen @jscinoz @surgeboris /types/redux-first-router-link/ @janb87 /types/redux-first-router-restore-scroll/ @icopp /types/redux-first-routing/ @tlaziuk /types/redux-form/v4/ @aikoven /types/redux-form/v6/ @carsonf @aikoven @LKay @bancek -/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce -/types/redux-immutable/ @oizie @sebald @gavingregory +/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun +/types/redux-immutable/v3/ @oizie @sebald @gavingregory +/types/redux-immutable/ @oizie @sebald @gavingregory @lukyth /types/redux-immutable-state-invariant/ @remojansen @highflying /types/redux-infinite-scroll/ @silkyfray /types/redux-injectable-store/ @unindented @@ -3980,13 +4152,15 @@ /types/relateurl/ @tkrotoff /types/relaxed-json/ @18steps /types/relay-runtime/ @voxmatt @alloy +/types/rellax/ @shermendev /types/remarkable/ @makepost /types/remote-redux-devtools/ @ColinEberhardt @unindented @mamodom @colindekker /types/remove-markdown/ @RagibHasin /types/rename/ @Aankhen /types/replace-ext/ @DeividasBakanas +/types/replacestream/ @dex4er /types/req-cwd/ @Alorel -/types/request/ @soywiz @bonnici @Bartvds @joeskeen @ccurrens @lookfirst @mastermatt @josecolella +/types/request/ @soywiz @bonnici @Bartvds @joeskeen @ccurrens @lookfirst @mastermatt @josecolella @murbanowicz /types/request-as-curl/ @atd-schubert /types/request-ip/ @mrhen /types/request-promise/ @cglantschnig @joeskeen @AyaMorisawa @mastermatt @@ -4005,7 +4179,7 @@ /types/resolve/ @marionebl @ajafff /types/resolve-from/ @unional /types/resourcejs/ @shaunluttin -/types/response-time/ @urossmolnik @TonyPythoneer +/types/response-time/ @urossmolnik @TonyPythoneer @danmana /types/rest/ @Nemo157 /types/restangular/ @borisyankov /types/restful.js/ @tkqubo @@ -4043,6 +4217,7 @@ /types/rmfr/ @pluma /types/roads/ @dancespiele /types/roads-server/ @dancespiele +/types/rocksdb/ @MeirionHughes @danwbyrne /types/roll/ @icopp /types/rolling-rate-limiter/ @l-jonas /types/rollup-plugin-json/ @asmockler @hotell @@ -4053,7 +4228,7 @@ /types/round-to/ @seangenabe /types/route-parser/ @ianks @bobbuehler /types/routie/ @Adilson -/types/royalslider/ @csrakowski +/types/royalslider/ @csrakowski @sKopheK /types/rpio/ @DominikPalo @Pencl /types/rrc/ @DeividasBakanas /types/rsmq/ @MugeSo @@ -4109,11 +4284,13 @@ /types/satnav/ @DotNetNerd /types/saywhen/ @SeanSobey /types/scalike/ @ryoppy +/types/schedule/ @Methuselah96 +/types/scheduler/ @Methuselah96 /types/schema-registry/ @bonzzy /types/schwifty/ @ozum /types/scoped-http-client/ @mattvperry @rianadon /types/screenfull/ @icholy @lionelb @joelshepherd -/types/screeps/ @MarkoSulamagi @NhanHo @bryanbecker @resir014 @Arcath @apemanzilla +/types/screeps/ @MarkoSulamagi @NhanHo @bryanbecker @resir014 @Arcath @dmarcuse /types/screeps-profiler/ @ramblurr /types/scriptjs/ @ssttevee /types/scroll-into-view/ @zivni @@ -4126,7 +4303,8 @@ /types/scryptsy/ @micksatana /types/sdp-transform/ @loc /types/seamless/ @danmana -/types/seamless-immutable/ @alex3165 @xsburg @geirsagberg +/types/seamless-immutable/ @alex3165 @xsburg @geirsagberg @RMHonor +/types/season/ @dex4er /types/secp256k1/ @anler /types/seed-random/ @l-jonas /types/seededshuffle/ @urish @@ -4169,33 +4347,36 @@ /types/send/ @MikeJerred /types/seneca/ @psnider @kevynb /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal -/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd @nrschultz @thomas-b +/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd @nrschultz @thomas-b @Antoine38660 /types/sequelize-cursor-pagination/ @pilagod /types/sequelize-fixtures/ @cschwarz /types/sequencify/ @npenin /types/sequester/ @Strate /types/serialize-error/ @thomasthiebaud -/types/serialize-javascript/ @lith-light-g +/types/serialize-javascript/ @lith-light-g @Pochodaydayup /types/serialport/v4/ @codefoster +/types/serialport/v6/ @codefoster @apearson /types/serialport/ @codefoster @apearson /types/serve-favicon/ @urossmolnik /types/serve-index/ @tkrotoff /types/serve-static/ @urossmolnik @LinusU /types/server/ @sant123 @iddan /types/server-destroy/ @gyszalai +/types/serverless/ @hassankhan /types/servicenow/ @bryceg /types/session-file-store/ @blendsdk @rokt33r /types/set-cookie-parser/ @nickp10 /types/set-value/ @DanielRosenwasser /types/settings/ @shreyjain1994 /types/sha1/ @arcdev1 +/types/sha256/ @nhardy /types/shallow-equals/ @rsolomon /types/shallowequal/ @seansfkelley /types/shapefile/ @DenisCarriere @Thw0rted /types/sharedb/ @soney /types/sharedworker/ @nakakura /types/sharepoint/ @gandjustas @andrei-markeev @baywet @teroarvola @dennispg -/types/sharp/ @lith-light-g @wooseopkim +/types/sharp/ @lith-light-g @wooseopkim @BTOdell /types/sheetify/ @toddself /types/shell-escape/ @nenadalm /types/shell-quote/ @jason0x43 @@ -4206,10 +4387,12 @@ /types/shipit-utils/ @cyrilschumacher /types/shopify-buy/ @openminder @straiforos @totemika /types/shortid/ @stpettersens @despairblue -/types/shot/ @AJamesPhillips +/types/shot/v3/ @AJamesPhillips @SimonSchick +/types/shot/ @AJamesPhillips @SimonSchick /types/should-sinon/ @Arylo /types/showdown/ @cbowdon @tan9 @arielsaldana /types/shrink-ray/ @forabi +/types/shuffle-seed/ @LeartS /types/siema/ @Irmiz @0x6368656174 @samnau /types/siesta/ @bquarmby /types/sigmajs/ @qinfchen @@ -4234,9 +4417,10 @@ /types/simplemde/ @Scalesoft /types/simplesmtp/ @rogierschouten /types/simplestorage.js/ @axelcostaspena @mxl +/types/sindresorhus__df/ @whatknight /types/single-line-log/ @ffflorian /types/single-spa-react/ @Garrett-Smith-iq -/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg +/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg @gjednaszewski /types/sinon-as-promised/ @igrayson /types/sinon-chai/v2/ @kazimanzurrashid @jedmao /types/sinon-chai/ @kazimanzurrashid @jedmao @elpdpt @@ -4259,12 +4443,12 @@ /types/slack-winston/ @BlueHatbRit /types/slackdown/ @nju33 /types/slackify-html/ @hypexr -/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti +/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav /types/slate-base64-serializer/ @YangusKhan /types/slate-html-serializer/ @YangusKhan /types/slate-irc/ @elisee -/types/slate-plain-serializer/ @YangusKhan -/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti +/types/slate-plain-serializer/ @YangusKhan @mkiefel +/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav /types/sleep/ @rajarz /types/slickgrid/ @jbaldwin /types/slideout/ @ToastHawaii @@ -4281,7 +4465,9 @@ /types/snazzy-info-window/ @milosd92 /types/snekfetch/ @ANekoIsFineToo @ShayBox @Dev-Yukine /types/snoowrap/ @vitosamson @TheAppleFreak +/types/snowball-stemmers/ @ryanvolum /types/snowboy/ @dolanmiu +/types/socket.io/v1/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io-client/ @progre @divillysausages @florentpoujol /types/socket.io-p2p/ @saenglert @@ -4297,8 +4483,9 @@ /types/solidity-parser-antlr/ @LogvinovLeon @albrow /types/solr-client/ @liul85 /types/solution-center-communicator/ @dami-gg +/types/sonic-boom/ @alferpal /types/sort-array/ @mrmlnc -/types/sortablejs/ @Maw-Fox +/types/sortablejs/ @Maw-Fox @maartenstaa /types/soundmanager2/ @elton2048 /types/soupbintcp/ @jewbre /types/source-list-map/ @e-cloud @@ -4325,7 +4512,7 @@ /types/spotify-api/ @skovmand /types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends /types/sprintf/ @soywiz @BendingBender -/types/sprintf-js/ @jasonswearingen @BendingBender +/types/sprintf-js/ @jasonswearingen @BendingBender @cdagli /types/sql-bricks/ @adn05 @paleo /types/sql.js/ @Hozuki /types/sqlanywhere/ @pkeuter @@ -4334,7 +4521,7 @@ /types/squirejs/ @bradleyayers /types/srp/ @Patman64 /types/ssh-key-decrypt/ @BendingBender -/types/ssh2/ @tkQubo @rbuckton +/types/ssh2/ @tkQubo @rbuckton @wrboyce /types/ssh2-sftp-client/ @igrayson @ascariandrea @kartik2406 /types/ssh2-streams/ @rbuckton /types/sshpk/ @mabels @@ -4346,6 +4533,8 @@ /types/stampit/v2/ @koresar /types/stampit/ @koresar @lummish /types/stamplay-js-sdk/ @ridermansb +/types/standard-error/ @roblabat +/types/standard-http-error/ @roblabat /types/starwars-names/ @claasahl /types/stat-mode/ @BendingBender /types/stats.js/ @gregolai @hberntsen @danvk @@ -4358,13 +4547,16 @@ /types/steam-totp/ @phenomax /types/steamid/ @Slessi /types/steed/ @Paul-Isache -/types/stellar-sdk/ @carl-foster @tristonj @pselden @maxbause +/types/stellar-sdk/ @carl-foster @tristonj @pselden @maxbause @charlie-wasp /types/stemmer/ @will-ockmore /types/sticky-cluster/ @paustint +/types/stompit/ @DanielRose /types/stompjs/ @jimic @Dr4k4n /types/stoppable/ @EricByers +/types/storage-helper/ @ajafff /types/store/ @vbortone @harry0000 @Ky6uk /types/storybook-addon-jsx/ @jameslnewell +/types/storybook-readme/ @lonyele /types/storybook__addon-a11y/ @hyunseob /types/storybook__addon-actions/ @joscha @jicjjang /types/storybook__addon-backgrounds/ @hyunseob @@ -4379,6 +4571,7 @@ /types/storybook__react/ @joscha @wapgear /types/storybook__react-native/ @joscha @wapgear @alechill @iRoachie /types/storybook__vue/ @pntgupta +/types/stream-array/ @Tyler-Murphy /types/stream-buffers/ @Jason3S /types/stream-chain/ @uhop /types/stream-csv-as-json/ @uhop @@ -4397,8 +4590,10 @@ /types/strftime/ @cyrilschumacher /types/strict-uri-encode/ @hoishin /types/string/ @basp +/types/string-argv/ @vladimir-tikhonov /types/string-format/ @lal12 /types/string-hash/ @ethanrubio +/types/string-replace-webpack-plugin/ @pd4d10 /types/string-similarity/ @ragtime /types/string-template/ @TonyPythoneer /types/string-width/ @jacobbubu @@ -4407,7 +4602,7 @@ /types/strip-ansi/ @mhegazy /types/strip-bom/ @mhegazy /types/strip-json-comments/ @dmoonfire -/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger +/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @@ -4416,16 +4611,22 @@ /types/strong-error-handler/ @blankstar85 /types/strong-log-transformer/ @azasypkin /types/strophe/ @DavidKDeutsch +/types/strophe.js/ @DavidKDeutsch /types/structured-source/ @azu -/types/styled-components/ @Igorbek @Igmat +/types/styled-components/v3/ @Igorbek @Igmat +/types/styled-components/ @Igorbek @Igmat @lavoaster /types/styled-jsx/ @R1ZZU -/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster +/types/styled-react-modal/ @Lavoaster +/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler +/types/styled-theming/ @ArjanJ /types/stylelint/v7/ @alan-agius4 -/types/stylelint/ @alan-agius4 +/types/stylelint/ @alan-agius4 @filipsalpe /types/stylelint-webpack-plugin/ @bahlo +/types/stylenames/ @bengry /types/stylus/ @SomaticIT /types/subscribe-ui-event/ @wangcheng678 /types/subsume/ @BendingBender +/types/subtitle/ @jenglamlow /types/succinct/ @EnableSoftware /types/sudo-block/ @BendingBender /types/suitescript/ @darrenhillconsulting @@ -4466,7 +4667,7 @@ /types/swagger-parser/ @Tobias4872 @EricHenry /types/swagger-restify-mw/ @micmro /types/swagger-sails-hook/ @micmro -/types/swagger-schema-official/ @mohsen1 @bsouthga @nimerritt +/types/swagger-schema-official/ @mohsen1 @bsouthga @nimerritt @mauriedo /types/swagger-tools/ @bricka /types/swagger-ui-dist/ @haowen737 /types/swagger-ui-express/ @dmitryrogozhny @@ -4478,7 +4679,7 @@ /types/swig-email-templates/ @mrhen @micksatana /types/swipe/ @kant2002 /types/swiper/v3/ @sgaliano @lucax88x -/types/swiper/ @sgaliano @lucax88x @ematseruk @odahcam +/types/swiper/ @sgaliano @lucax88x @ematseruk @odahcam @jmca /types/swipeview/ @borisyankov /types/switchery/ @bgrieder @claylaut /types/swiz/ @jedigo @@ -4486,6 +4687,7 @@ /types/synaptic/ @ToastHawaii @austincummings /types/systeminformation/ @PixelcrabAT /types/systemjs/ @ludohenin @NathanWalker @GiedriusGrabauskas @aluanhaddad +/types/tabbable/ @mokkan /types/table/ @evanshortiss @mrmlnc /types/tableau/ @protip /types/tabris-plugin-firebase/ @eclipsesource @@ -4500,6 +4702,7 @@ /types/tar-stream/ @glicht /types/task-graph-runner/ @mgroenhoff /types/tcp-ping/ @stegano +/types/tcp-port-used/ @gautejohan /types/teddy/ @lannonbr /types/tedious/ @rogierschouten @cjthompson @v-suhame /types/tedious-connection-pool/ @sandorfr @@ -4507,24 +4710,29 @@ /types/temp/ @DanielRosenwasser /types/temp-write/ @BendingBender /types/tempfile/ @SamVerschueren @BendingBender -/types/tempy/ @douglasduteil +/types/tempy/ @douglasduteil @maistho /types/terminal-menu/ @aravindarun +/types/tern/ @nkappler +/types/terser/ @JordiAnderl +/types/test-console/ @roberto @guidoux @gbmoretti /types/test-listen/ @stephenmathieson /types/testingbot-api/ @timbru31 /types/tether/ @adidahiya /types/tether-drop/ @adidahiya /types/tether-shepherd/ @mtgibbs /types/text-buffer/ @GlenCFL -/types/text-encoding/ @pine613 @mohsen1 +/types/text-encoding/ @pine613 @mohsen1 @nwmqpa /types/text-encoding-utf-8/ @trxcllnt /types/text-table/ @saadq /types/textarea-caret/ @shiftkey /types/textract/ @lal12 /types/textversionjs/ @aaronosher +/types/texzilla/ @m93a /types/tgfancy/ @Dabolus /types/theming/ @eps1lon +/types/theo/ @petekp /types/thepiratebay/ @jsorrell -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo +/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston /types/throttle/ @BendingBender @@ -4545,6 +4753,7 @@ /types/tinajs__tina-redux/ @Jimexist /types/tinder/ @pingec /types/tingle.js/ @ajafff +/types/tiny-async-pool/ @krlwlfrt /types/tiny-secp256k1/ @eduhenke /types/tiny-slider-react/ @screendriver /types/tinycolor2/ @M-Zuber @geertjansen @nvh @Ailrun @@ -4571,6 +4780,7 @@ /types/topojson-simplify/ @denisname @ricardo-mello /types/topojson-specification/ @denisname /types/toposort/ @danwbyrne +/types/torrent-search-api/ @ngirardin /types/torrent-stream/ @xstoudi /types/touch/ @mizunashi-mana @BendingBender /types/touch-events/ @kevinb7 @@ -4587,6 +4797,7 @@ /types/travis-fold/ @andy-ms /types/trayballoon/ @korve /types/tress/ @sindilevich +/types/trianglify/ @unindented /types/trim/ @skysteve /types/triple-beam/ @danwbyrne /types/triplesec/ @threesquared @@ -4657,9 +4868,9 @@ /types/unzip/ @coding2012 /types/unzipper/ @s73obrien @natemara @bartje321 /types/update-notifier/v1/ @vvakame @nchen63 -/types/update-notifier/ @vvakame @nchen63 @bitjson +/types/update-notifier/ @vvakame @nchen63 @bitjson @grinich /types/uploadcare/ @jineshshah36 -/types/upng-js/ @plantain-00 +/types/upng-js/ @plantain-00 @pineapplemachine /types/uppercamelcase/ @plantain-00 /types/urbanairship-cordova/ @Justin-Credible /types/uri-templates/ @Bartvds @barnski @@ -4693,6 +4904,7 @@ /types/uuid-parse/ @screendriver /types/uuid-validate/ @HiromiShikata /types/uws/ @plantain-00 @orblazer +/types/v-chart-plugin/ @natemara /types/valdr/ @ilbertz /types/valdr-message/ @ilbertz /types/valerie/ @conficient @@ -4760,6 +4972,7 @@ /types/w3c-web-usb/ @larsgk /types/waitme/ @totpero /types/wake_on_lan/ @SrTobi +/types/walk/ @poppa /types/wallabyjs/ @andrewconnell /types/wallpaper/ @BendingBender /types/wampy/ @KSDaemon @@ -4769,6 +4982,7 @@ /types/watchpack/ @e-cloud /types/waterline/ @arvitaly /types/watson-developer-cloud/ @waldo000000 @Naktibalda +/types/wavesurfer.js/ @higuri /types/waypoints/ @dominikbulaj @Koloto @evil-shrike /types/wcwidth/ @rokt33r /types/weak/ @int0h @@ -4776,7 +4990,7 @@ /types/web-animations-js/ @kritollm /types/web-bluetooth/ @urish /types/web-push/ @paullessing -/types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk +/types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk @sogasg @donamk @dkent600 @nerddan /types/web3-eth-abi/ @LogvinovLeon /types/web3-provider-engine/ @LogvinovLeon /types/webappsec-credential-management/ @iainmcgin @@ -4785,14 +4999,14 @@ /types/webcl/ @NCARalph /types/webcomponents.js/ @adidahiya /types/webcrypto/ @iislucas -/types/webdriverio/ @nmalaguti @timbru31 @fsmedberg-tc @tanvirislam06 @phil-lgr +/types/webdriverio/ @nmalaguti @timbru31 @fsmedberg-tc @tanvirislam06 @daveparslow @phil-lgr /types/webfontloader/ @doskallemaskin /types/webgl-ext/ @zenmumbler /types/webgl2/ @nkemnitz @karhu /types/webidl2/ @saschanaz /types/webmidi/ @lostfictions -/types/webpack/v3/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @alan-agius4 @elliottsj @jason0x43 @christophehurpeau -/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @alan-agius4 @elliottsj @jason0x43 @dennispg @christophehurpeau @ZSkycat @johnnyreilly +/types/webpack/v3/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @alan-agius4 @elliottsj @jason0x43 @christophehurpeau @rwaskiewicz @kuehlein +/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @alan-agius4 @elliottsj @jason0x43 @dennispg @christophehurpeau @ZSkycat @johnnyreilly @rwaskiewicz @kuehlein /types/webpack-assets-manifest/ @FranklinWhale /types/webpack-bundle-analyzer/ @kryops /types/webpack-chain/ @eirikurn @psachs21 @@ -4816,9 +5030,11 @@ /types/webpack-serve/ @rynclark @Jokcy @ZSkycat /types/webpack-sources/ @e-cloud @chriseppstein /types/webpack-stream/ @iclanton @bumbleblym +/types/webpack-subresource-integrity/ @huan086 /types/webpack-validator/ @deevus /types/webpackbar/ @rynclark /types/webpagetest/ @ksm2 +/types/webprogbase-console-view/ @veetaha /types/webrtc/ @nakakura /types/webscopeio__react-textarea-autocomplete/ @michauzo /types/websequencediagrams/ @ffflorian @@ -4864,6 +5080,7 @@ /types/wnumb/ @acoreyj /types/wonder.js/ @yyc-git /types/word-list-json/ @dovidm +/types/word2vector/ @renekeijzer /types/wordcloud/ @joeskeen /types/words-to-numbers/ @James-Frowen /types/workbox-sw/ @wessberg @@ -4905,18 +5122,20 @@ /types/xsockets/ @pushplay /types/xxhashjs/ @mDibyo /types/yallist/ @BendingBender +/types/yaml/ @ikatyang @ColinBradley /types/yandex-maps/ @Delagen /types/yandex-money-sdk/ @chrootsu /types/yar/ @SimonSchick /types/yargs/v8/ @poelstra @mizunashi-mana @pushplay @jeffkenney /types/yargs/v10/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC /types/yargs/v11/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC -/types/yargs/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC +/types/yargs/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC @tkazec /types/yargs-interactive/ @szeck87 +/types/yargs-parser/ @milesj /types/yauzl/ @ffflorian /types/yauzl-promise/ @dlee-nvisia /types/yayson/ @Codesleuth -/types/yazl/ @taoqf +/types/yazl/ @taoqf @seangenabe /types/ydn-db/ @yathit @gabrielmaldi /types/yeoman-generator/ @armorik83 @janslow @ikatyang /types/yeoman-test/ @ikatyang @@ -4930,7 +5149,7 @@ /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 @terrymun /types/youtube-dl/ @bsurai /types/yui/ @giabao -/types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola +/types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray /types/z-schema/ @pgonzal /types/zapier-platform-core/ @bradleyayers /types/zeit__next-typescript/ @icopp @@ -4943,6 +5162,7 @@ /types/zeromq/ @davemckeown @erikma @TitaneBoy /types/zip-webpack-plugin/ @blaise-io /types/zip.js/ @lgrignon +/types/zipcelx/ @aleburato /types/zipcodes/ @headdetect @dobesv /types/zipkin-context-cls/ @plantain-00 /types/zipkin-instrumentation-express/ @plantain-00 diff --git a/.gitignore b/.gitignore index ac63b6f6b5..079ad27699 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ npm-debug.log .settings/launch.json .vs .vscode +.history # yarn yarn.lock diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..9cf9495031 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/README.es.md b/README.es.md index c3cff967db..df675cbe41 100644 --- a/README.es.md +++ b/README.es.md @@ -22,15 +22,15 @@ Este es el método preferido. Solo está disponible para usuarios TypeScript 2.0 npm install --save-dev @types/node ``` -Los types deberían ser incluidos automaticamente por el compilador. +Los types deberían ser incluidos automáticamente por el compilador. Vea más en el [manual](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html). -Para un paquete NPM "foo", Estos `typings` estarán en "@types/foo". +Para un paquete NPM "foo", estos `typings` estarán en "@types/foo". Si no puedes encontrar tu paquete, búscalo en [TypeSearch](https://microsoft.github.io/TypeSearch/). Si aún no puedes encontrarlo, comprueba si el paquete ya [incluye](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) los typings. Esto es provisto usualmente en el campo `"types"` o `"typings"` en el `package.json`, -o solo busca por cualquier archivo ".d.ts" en el paquete e incluyelo manualmente con un `/// `. +o solo busca por cualquier archivo ".d.ts" en el paquete e inclúyelo manualmente con un `/// `. ### Otros métodos @@ -39,7 +39,7 @@ Estos pueden ser utilizados por TypeScript 1.0. * [Typings](https://github.com/typings/typings) * ~~[NuGet](http://nuget.org/packages?q=DefinitelyTyped)~~ (use las alternativas preferidas, la publicación DT type de nuget ha sido desactivada) -* Descarguelo manualmente desde la `master` branch de este repositorio +* Descárguelo manualmente desde la `master` branch de este repositorio Tal vez debas añadir manualmente las [referencias](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html). @@ -88,7 +88,7 @@ Primero, haz un [fork](https://guides.github.com/activities/forking/) en este re * `cd types/my-package-to-edit` * Haz cambios. Recuerda editar las pruebas. Si realiza cambios importantes, no olvide [actualizar una versión principal](#quiero-actualizar-un-paquete-a-una-nueva-versión-principal). -* También puede que quieras añadirte la sección "Definitions by" en el encabezado del paquete. +* También puede que quieras añadirle la sección "Definitions by" en el encabezado del paquete. - Esto hará que seas notificado (a través de tu nombre de usuario en GitHub) cada vez que alguien haga un pull request o issue sobre el paquete. - Haz esto añadiendo tu nombre al final de la línea, así como en `// Definitions by: Alice , Bob `. - O si hay más personas, puede ser multiline @@ -109,7 +109,7 @@ Si no lo hace, puedes hacerlo en el comentario asociado con el PR. Si eres el autor de la librería, o puedes hacer un pull request a la biblioteca, [bundle types](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) en vez de publicarlo en DefinitelyTyped. Si estás agregando typings para un paquete NPM, crea un directorio con el mismo nombre. -Si el paquete al que le estás agregando typings no es para NPM, asegurate de que el nombre que escojas no genere problemas con el nombre del paquete en NPM. +Si el paquete al que le estás agregando typings no es para NPM, asegúrate de que el nombre que escojas no genere problemas con el nombre del paquete en NPM. (Puedes usar `npm info foo` para verificar la existencia del paquete `foo`.) Tu paquete debería tener esta estructura: @@ -126,7 +126,7 @@ Ve todas las opciones en [dts-gen](https://github.com/Microsoft/dts-gen). También puedes configurar el `tsconfig.json` para añadir nuevos archivos, para agregar un `"target": "es6"` (necesitado por las funciones asíncronas), para agregar a la `"lib"`, o para agregar la opción de compilación `"jsx"`. -Los miembros de DefinitelyTyped frecuentemente monitorean nuevos PRs, pero ten en mente que la cantidad de PRs podrian ralentizar el proceso. +Los miembros de DefinitelyTyped frecuentemente monitorean nuevos PRs, pero ten en mente que la cantidad de PRs podrían ralentizar el proceso. Para un buen paquete de ejemplo, vea [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js). @@ -135,7 +135,7 @@ Para un buen paquete de ejemplo, vea [base64-js](https://github.com/DefinitelyTy * Primero, sigue el consejo del [manual](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). * Formatear: Ya sea utilizar todo en tabs, o siempre utiliza 4 espacios. -* `function sum(nums: number[]): number`: Utiliza `ReadonlyArray` si una funcion no escribe a sus parámetros. +* `function sum(nums: number[]): number`: Utiliza `ReadonlyArray` si una función no escribe a sus parámetros. * `interface Foo { new(): Foo; }`: Este define el tipo de objeto que esten nuevos. Probablemente quieras `declare class Foo { constructor(); }`. * `const Class: { new(): IClass; }`: @@ -146,7 +146,7 @@ Para un buen paquete de ejemplo, vea [base64-js](https://github.com/DefinitelyTy Un ejemplo donde un tipo de parámetro es aceptable: `function id(value: T): T;`. Un ejemplo donde no es aceptable: `function parseJson(json: string): T;`. Una excepción: `new Map()` está bien. -* Utilizando los tipos `Function` y `Object` casi nunca es una buena idea. En 99% de los casos es posible especificar un tipo más especifico. Los ejemplos son `(x: number) => number` para [funciones](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) y `{ x: number, y: number }` para objetos. Si no hay certeza en lo absoluto del tipo, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) es la opción correcta, no `Object`. Si el único hecho conocido sobre el tipo es que es un objecto, usa el tipo [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), no `Object` o `{ [key: string]: any }`. +* Utilizando los tipos `Function` y `Object` casi nunca es una buena idea. En 99% de los casos es posible especificar un tipo más específico. Los ejemplos son `(x: number) => number` para [funciones](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) y `{ x: number, y: number }` para objetos. Si no hay certeza en lo absoluto del tipo, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) es la opción correcta, no `Object`. Si el único hecho conocido sobre el tipo es que es un objecto, usa el tipo [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), no `Object` o `{ [key: string]: any }`. * `var foo: string | any`: Cuando es usado `any` en un tipo de unión, el tipo resultante todavía es `any`. Así que mientras la porción `string` de este tipo de anotación puede _verse_ útil, de hecho, no ofrece ningún typechecking adicional más que un simple `any`. Dependiendo de la intención, una alternativa aceptable puede ser `any`, `string`, o `string | object`. @@ -204,11 +204,11 @@ Este script utiliza [dtslint](https://github.com/Microsoft/dtslint). #### ¿Cuál es exactamente la relación entre este repositorio y los paquetes de `@types` en NPM? -La `master` branch es automaticamente publicada en el alcance de los `@types` en NPM gracias a los [types-publisher](https://github.com/Microsoft/types-publisher). +La `master` branch es automáticamente publicada en el alcance de los `@types` en NPM gracias a los [types-publisher](https://github.com/Microsoft/types-publisher). #### He enviado un pull request. ¿Cuánto tardará en ser merged? -Esto depende, pero la mayoría de los pull requests serán merged en alrededor de una semana. PRs que hayan sido aprovados por un autor listado en el encabezado de las definiciones usualmente son merged más rápidamente; PRs para nuevas definiciones tomarán más tiempo ya que requieren más revisiones de los mantenedores. Cada PR es revisado por un miembro de TypeScript o DefinitelyTyped antes de ser merged, por favor se paciente debido a que factores humanos pueden causar retrasos. Revisa el [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) para ver el progreso mientras los mantenedores trabajan on los PRs abiertos. +Esto depende, pero la mayoría de los pull requests serán merged en alrededor de una semana. PRs que hayan sido aprobados por un autor listado en el encabezado de las definiciones usualmente son merged más rápidamente; PRs para nuevas definiciones tomarán más tiempo ya que requieren más revisiones de los mantenedores. Cada PR es revisado por un miembro de TypeScript o DefinitelyTyped antes de ser merged, por favor sé paciente debido a que factores humanos pueden causar retrasos. Revisa el [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) para ver el progreso mientras los mantenedores trabajan en los PRs abiertos. #### Mi PR ha sido merged; ¿cuándo será actualizado el paquete de `@types` NPM? @@ -216,12 +216,12 @@ Los paquetes NPM deberán ser actualizados en unas cuantas horas. Si ha pasado m #### Estoy escribiendo una definición que depende de otra definición. Debería utilizar `` o una import? -Si el modulo al cual te estás refiriendo es un módulo externo (utiliza `export`), utilice una import. +Si el módulo al cual te estás refiriendo es un módulo externo (utiliza `export`), utilice una import. Si el módulo al cual te refieres es un módulo ambiente (utiliza `declare module`, o simplemente declara las globales), utilice ``. #### He notado que algunos paquetes aquí tienen `package.json`. -Normalmente no lo necesitaras. Cuando publicas un paquete normalmente nosotros automáticamente crearemos un `package.json` para eso. +Normalmente no lo necesitarás. Cuando publicas un paquete normalmente nosotros automáticamente crearemos un `package.json` para eso. Un `package.json` puede ser incluido por el bien de especificar dependencias. Aquí tienen un [ejemplo](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json). No aceptamos otros campos, tales como `"description"`, para que sean definidos manualmente. Además, si necesitas referencia a una versión anterior de typings, debes hacerlo añadiendo `"dependencies": { "@types/foo": "x.y.z" }` al package.json. @@ -260,7 +260,7 @@ Cuando ya no sea un borrador, lo podremos eliminar desde DefinitelyType y hacer Si planeas continuar actualizando la versión anterior del paquete, puedes crear una subcarpeta con la versión actual p.ej. `v2`, y copia los archivos existentes. Si es así, necesitarás: 1. Actualiza las rutas relativas en `tsconfig.json` al igual que `tslint.json`. -2. Añadir reglas de mapeo de rutas para asegurart de que la prueba se está ejecutando contra la versión prevista. +2. Añadir reglas de mapeo de rutas para asegurarte de que la prueba se está ejecutando contra la versión prevista. Por ejemplo [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) se ve así: @@ -280,24 +280,24 @@ Por ejemplo [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi } ``` -Si hay otros paquetes en DefinitelyTyped que son incompatibles con la nueva versión, necesitaras mapear las rutas a la versión anterior. También deberá hacer esto para los paquetes que dependen de paquetes que dependen de una version anterior. +Si hay otros paquetes en DefinitelyTyped que son incompatibles con la nueva versión, necesitarás mapear las rutas a la versión anterior. También deberá hacer esto para los paquetes que dependen de paquetes que dependen de una version anterior. Por ejemplo, `react-router` depende de `history@2`, así que [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) tiene una ruta mapeada a "history": `[ "history/v2" ]`; transitivo así mismo, `react-router-bootstrap` (que depende de `react-router`) también añade una ruta mapeada en su [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json). -Además, `/// ` no trabajara con rutas mapeadas, así que las dependencias deberán utilizar `import`. +Además, `/// ` no trabajará con rutas mapeadas, así que las dependencias deberán utilizar `import`. #### ¿Cómo escribo definitions para paquetes que pueden ser usados globalmente y como un módulo? -El manual de TypeScript contiene excelente [información general para escribir definiciones](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), ademas [este archivo de definiciones de ejemplo](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) el cual muestra como crear una definición utilizando la sintaxis de módulo en ES6, asi como también especificando objetos que son disponibles en el alcance global. Esta técnica es demostrada practicamente en la [definición para big.js](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/big.js/index.d.ts), el cual es una librería que puede ser cargada globalmente a travéz de una etiqueta script en una página web, o importada via require o imports estilo ES6. +El manual de TypeScript contiene excelente [información general para escribir definiciones](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), además [este archivo de definiciones de ejemplo](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) el cual muestra como crear una definición utilizando la sintaxis de módulo en ES6, asi como también especificando objetos que son disponibles en el alcance global. Esta técnica es demostrada prácticamente en la [definición para big.js](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/big.js/index.d.ts), el cual es una librería que puede ser cargada globalmente a través de una etiqueta script en una página web, o importada vía require o imports estilo ES6. -Para probar como puede ser usada tu definición cuando se refieren globalmente o como un módulo importado, crea una carpeta `test`, y coloca dos archivos de prueba en él. nombra uno `YourLibraryName-global.test.ts` y el otro `YourLibraryName-module.test.ts`. El archivo de prueba _global_ debe ejercer la definición de acuerdo como va a ser usado en un script cargado en una página web donde la librería estará disponible en el alcance global - en este escenario no debes de especificar la sentencia de import. El archivo _módulo_ de prueba debe de ejercer la definición de acuerdo a como va a ser utilizado cuando sea importado (incluyendo las sentencias `import`). Si especificas un propiedad `files` en tu archivo tsconfig.json, asegurate de incluir ambos archivos de prueba. Un [ejemplo práctico de esto](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test) es también disponible en la definición de big.js. +Para probar como puede ser usada tu definición cuando se refieren globalmente o como un módulo importado, crea una carpeta `test`, y coloca dos archivos de prueba en él. nombra uno `YourLibraryName-global.test.ts` y el otro `YourLibraryName-module.test.ts`. El archivo de prueba _global_ debe ejercer la definición de acuerdo como va a ser usado en un script cargado en una página web donde la librería estará disponible en el alcance global - en este escenario no debes de especificar la sentencia de import. El archivo _módulo_ de prueba debe de ejercer la definición de acuerdo a como va a ser utilizado cuando sea importado (incluyendo las sentencias `import`). Si especificas una propiedad `files` en tu archivo tsconfig.json, asegurate de incluir ambos archivos de prueba. Un [ejemplo práctico de esto](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test) es también disponible en la definición de big.js. Por favor tenga en cuenta que no es necesario para ejercer plenamente la definición en cada archivo de prueba - Es suficiente con probar solo los elementos globalmente accesibles en la prueba de archivos globales y ejercer la definición en el módulo del archivo de prueba, o viceversa. #### ¿Qué pasa con paquetes scoped? -Types para un paquete scoped `@foo/bar` deberán ir en `types/foo__bar`. tenga en cuenta el doble guion bajo. +Types para un paquete scoped `@foo/bar` deberán ir en `types/foo__bar`. tenga en cuenta el doble guión bajo. Cuando `dts-gen` es utilizado como scaffold en un paquete scoped, las propiedades `paths` deberán ser adaptadas manualmente en el paquete generado `tsconfig.json` para referenciar correctamente el paquete scoped: diff --git a/notNeededPackages.json b/notNeededPackages.json index 968192123b..cf5c9449d7 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -144,6 +144,12 @@ "sourceRepoURL": "https://github.com/Azure/azure-mobile-apps-node/", "asOfVersion": "3.0.0" }, + { + "libraryName": "@babel/parser", + "typingsPackageName": "babel__parser", + "sourceRepoURL": "https://github.com/babel/babel", + "asOfVersion": "7.1.0" + }, { "libraryName": "BabylonJS", "typingsPackageName": "babylonjs", @@ -396,6 +402,12 @@ "sourceRepoURL": "https://github.com/MikeMcl/decimal.js", "asOfVersion": "7.4.0" }, + { + "libraryName": "deepmerge", + "typingsPackageName": "deepmerge", + "sourceRepoURL": "git@github.com:KyleAMathews/deepmerge.git", + "asOfVersion": "2.2.0" + }, { "libraryName": "delay", "typingsPackageName": "delay", @@ -534,6 +546,12 @@ "sourceRepoURL": "https://github.com/code-chris/extended-listbox", "asOfVersion": "4.0.1" }, + { + "libraryName": "fast-diff", + "typingsPackageName": "fast-diff", + "sourceRepoURL": "https://github.com/jhchen/fast-diff", + "asOfVersion": "1.2.0" + }, { "libraryName": "JSON-Patch", "typingsPackageName": "fast-json-patch", @@ -618,6 +636,12 @@ "sourceRepoURL": "https://github.com/mikedeboer/node-github", "asOfVersion": "7.1.0" }, + { + "libraryName": "gitlab", + "typingsPackageName": "gitlab", + "sourceRepoURL": "https://github.com/jdalrymple/node-gitlab", + "asOfVersion": "2.0.0" + }, { "libraryName": "graphene-pk11", "typingsPackageName": "graphene-pk11", @@ -924,12 +948,24 @@ "sourceRepoURL": "https://github.com/blakeembrey/lower-case-first", "asOfVersion": "1.0.1" }, + { + "libraryName": "mali", + "typingsPackageName": "mali", + "sourceRepoURL": "https://github.com/malijs/mali", + "asOfVersion": "0.9.2" + }, { "libraryName": "maquette", "typingsPackageName": "maquette", "sourceRepoURL": "http://maquettejs.org/", "asOfVersion": "2.1.6" }, + { + "libraryName": "maxmind", + "typingsPackageName": "maxmind", + "sourceRepoURL": "https://github.com/runk/node-maxmind", + "asOfVersion": "2.0.5" + }, { "libraryName": "mendixmodelsdk", "typingsPackageName": "mendixmodelsdk", @@ -966,6 +1002,12 @@ "sourceRepoURL": "https://github.com/mweststrate/mobservable-react", "asOfVersion": "1.0.0" }, + { + "libraryName": "Mobx Cookie", + "typingsPackageName": "mobx-cookie", + "sourceRepoURL": "https://github.com/will-stone/mobx-cookie", + "asOfVersion": "1.1.1" + }, { "libraryName": "Moment", "typingsPackageName": "moment", @@ -1194,6 +1236,12 @@ "sourceRepoURL": "https://github.com/react-ga/react-ga", "asOfVersion": "2.3.0" }, + { + "libraryName": "react-i18next", + "typingsPackageName": "react-i18next", + "sourceRepoURL": "https://github.com/i18next/react-i18next", + "asOfVersion": "8.1.0" + }, { "libraryName": "react-monaco-editor", "typingsPackageName": "react-monaco-editor", diff --git a/types/a11y-dialog/a11y-dialog-tests.ts b/types/a11y-dialog/a11y-dialog-tests.ts new file mode 100644 index 0000000000..3df694fcdd --- /dev/null +++ b/types/a11y-dialog/a11y-dialog-tests.ts @@ -0,0 +1,30 @@ +import A11yDialog = require('a11y-dialog'); + +const dialogEl = new A11yDialog(document.getElementById("test")); +const dialogElTwo = new A11yDialog(document.getElementById("test"), document.getElementById("testContainer")); +const dialogElThree = new A11yDialog(document.getElementById("test"), "dummy-element"); + +dialogEl.show(); +dialogEl.hide(); +dialogElTwo.destroy(); +dialogElThree.create(); + +// Test out interfaces that extends Element. +dialogEl.on("show", (el: HTMLElement) => { + el.textContent; +}); + +// Test out element and event. +dialogEl.on("create", (el: HTMLElement, evt) => { + el.textContent; + + evt.target; +}); + +dialogEl.on('hide', () => { + const t = 5; +}); + +dialogEl.off("show", (el: HTMLElement) => { + el.textContent; +}); diff --git a/types/a11y-dialog/index.d.ts b/types/a11y-dialog/index.d.ts new file mode 100644 index 0000000000..105aaa70e7 --- /dev/null +++ b/types/a11y-dialog/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for a11y-dialog 5.2 +// Project: https://github.com/edenspiekermann/a11y-dialog +// Definitions by: Yuto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +type DialogEvents = "show" | "hide" | "destroy" | "create"; +declare class A11yDialog { + constructor(el: Element | null, containers?: NodeList | Element | string | null); + /** + * Shows the dialog. + */ + show(): void; + /** + * Hides the dialog. + */ + hide(): void; + /** + * Unbind click listeners from dialog openers and closers and remove all bound custom event listeners registered with `.on()` + */ + destroy(): void; + /** + * Bind click listeners to dialog openers and closers. + */ + create(el?: Element | null, containers?: NodeList | Element | string | null): void; + + on(evt: DialogEvents, callback: (dialogElement: any, event: Event) => void): void; + off(evt: DialogEvents, callback: (dialogElement: any, event: Event) => void): void; +} + +export = A11yDialog; diff --git a/types/a11y-dialog/tsconfig.json b/types/a11y-dialog/tsconfig.json new file mode 100644 index 0000000000..a27d99d6bf --- /dev/null +++ b/types/a11y-dialog/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "a11y-dialog-tests.ts" + ] +} \ No newline at end of file diff --git a/types/a11y-dialog/tslint.json b/types/a11y-dialog/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/a11y-dialog/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/ace/test/selection.ts b/types/ace/test/selection.ts index be7da64331..e698664b83 100644 --- a/types/ace/test/selection.ts +++ b/types/ace/test/selection.ts @@ -123,7 +123,7 @@ const aceSelectionTests = { }, "test: moveCursor word left with umlauts": function () { - var session = new AceAjax.EditSession(" Fu� F��e"); + var session = new AceAjax.EditSession(" Fu¢ F¢¢e"); var selection = session.getSelection(); selection.moveCursorTo(0, 9) diff --git a/types/actioncable/index.d.ts b/types/actioncable/index.d.ts index 9194e81d6f..b5bdbf429a 100644 --- a/types/actioncable/index.d.ts +++ b/types/actioncable/index.d.ts @@ -1,13 +1,15 @@ -// Type definitions for ActionCable -// Project: https://github.com/rails/rails/tree/master/actioncable +// Type definitions for ActionCable 5.2 +// Project: https://github.com/rails/rails/tree/master/actioncable/app/assets/javascripts // Definitions by: Vincent Zhu +// Jared Szechy // Definitions: https://github.com/zhu1230/DefinitelyTyped +// TypeScript Version: 2.3 declare module ActionCable { interface Channel { unsubscribe(): void; perform(action: string, data: {}): void; - send(data: Object): boolean; + send(data: any): boolean; } interface Subscriptions { @@ -16,12 +18,16 @@ declare module ActionCable { interface Cable { subscriptions: Subscriptions; + send(data: any): void; + connect(): void; + disconnect(): void; + ensureActiveConnection(): void; } interface CreateMixin { connected(): void; disconnected(): void; - received(obj: Object): void; + received(obj: any): void; [key: string]: Function; } diff --git a/types/adone/glosses/utils.d.ts b/types/adone/glosses/utils.d.ts index 5d2eb5f198..a08d4af4bd 100644 --- a/types/adone/glosses/utils.d.ts +++ b/types/adone/glosses/utils.d.ts @@ -451,7 +451,7 @@ declare namespace adone { | encoding.Multibyte; } - const defaultCharUnicode: "�"; + const defaultCharUnicode: string; const defaultCharSingleByte: "?"; diff --git a/types/aframe/test/aframe-io-tests.ts b/types/aframe/test/aframe-io-tests.ts index 77fe716390..1120b50be8 100644 --- a/types/aframe/test/aframe-io-tests.ts +++ b/types/aframe/test/aframe-io-tests.ts @@ -533,9 +533,10 @@ AFRAME.registerComponent('audioanalyser-waveform', { rings.forEach(function transformRing(ring: THREE.Line, index: number) { var normLevel; normLevel = levels[RINGCOUNT - index - 1] + 0.01; // Avoid scaling by 0. - (ring.material as THREE.LineBasicMaterial).color.setHSL(colors[index], 1, normLevel); - ring.material.linewidth = normLevel * 3; - ring.material.opacity = normLevel; + const lineMaterial = ring.material as THREE.LineBasicMaterial; + lineMaterial.color.setHSL(colors[index], 1, normLevel); + lineMaterial.linewidth = normLevel * 3; + lineMaterial.opacity = normLevel; ring.scale.z = normLevel; }); }, diff --git a/types/agenda/index.d.ts b/types/agenda/index.d.ts index 75246ecda3..37b9ce6b2c 100644 --- a/types/agenda/index.d.ts +++ b/types/agenda/index.d.ts @@ -64,7 +64,7 @@ declare class Agenda extends EventEmitter { defaultConcurrency(value: number): this; /** - * Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is + * Takes a number which specifies the max number jobs that can be locked at any given moment. By default it is * 0 for no max. * @param value The value to set. */ @@ -189,7 +189,7 @@ declare namespace Agenda { defaultLockLimit?: number; /** - * Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is + * Takes a number which specifies the max number jobs that can be locked at any given moment. By default it is * 0 for no max. */ lockLimit?: number; diff --git a/types/ajv-errors/index.d.ts b/types/ajv-errors/index.d.ts index fed9e4585f..3b5c2d2322 100644 --- a/types/ajv-errors/index.d.ts +++ b/types/ajv-errors/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/epoberezkin/ajv-errors // Definitions by: Afshawn Lotfi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Ajv } from "ajv"; diff --git a/types/ale-url-parser/ale-url-parser-tests.ts b/types/ale-url-parser/ale-url-parser-tests.ts new file mode 100644 index 0000000000..2a5d9fe632 --- /dev/null +++ b/types/ale-url-parser/ale-url-parser-tests.ts @@ -0,0 +1,22 @@ +import { parse, stringify } from 'ale-url-parser'; + +let url; +let urlObject; + +url = stringify({}); +console.log(url); + +url = stringify({ + protocol: 'protocol', + host: 'host', + path: ['foo', 'bar', 'baz'], + hash: 'hash', + query: { + foo: 1, + bar: [2, '3'] + } +}); +console.log(url); + +urlObject = parse('//any.dom.ain.co.m/foo/bar?test=1&test=2#hash'); +console.log(urlObject); diff --git a/types/ale-url-parser/index.d.ts b/types/ale-url-parser/index.d.ts new file mode 100644 index 0000000000..31b2d2fd03 --- /dev/null +++ b/types/ale-url-parser/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for ale-url-parser 0.10 +// Project: https://github.com/msn0/ale-url-parser#readme +// Definitions by: Michał Jezierski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export interface QueryParams { + [key: string]: any; +} + +export interface UrlObject { + protocol?: string; + host?: string; + path?: string[]; + query?: QueryParams; + hash?: string; +} + +/** + * Parse url string into url object. + * @return UrlObject + */ +export function parse(url: string): UrlObject; + +/** + * Stringify url object into url string. + * @return string + */ +export function stringify(urlObject: UrlObject): string; diff --git a/types/ale-url-parser/tsconfig.json b/types/ale-url-parser/tsconfig.json new file mode 100644 index 0000000000..2d18200901 --- /dev/null +++ b/types/ale-url-parser/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ale-url-parser-tests.ts" + ] +} diff --git a/types/babel__parser/tslint.json b/types/ale-url-parser/tslint.json similarity index 100% rename from types/babel__parser/tslint.json rename to types/ale-url-parser/tslint.json diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 87fdb95a01..cbd98d253a 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -21,6 +21,7 @@ let _algoliaResponse: Response = { processingTimeMS: 32, query: '', params: '', + index: '', }; let _clientOptions: ClientOptions = { @@ -103,7 +104,8 @@ let _algoliaQueryParameters: QueryParameters = { filters: '', attributesToRetrieve: [''], restrictSearchableAttributes: [''], - facets: '', + facets: [''], + facetingAfterDistinct: true, maxValuesPerFacet: 2, attributesToHighlight: [''], attributesToSnippet: [''], @@ -120,28 +122,29 @@ let _algoliaQueryParameters: QueryParameters = { typoTolerance: false, allowTyposOnNumericTokens: false, ignorePlurals: false, - disableTypoToleranceOnAttributes: '', + disableTypoToleranceOnAttributes: [''], aroundLatLng: '', aroundLatLngViaIP: '', aroundRadius: 0, aroundPrecision: 0, minimumAroundRadius: 0, insideBoundingBox: [[0]], - queryType: '', + queryType: 'prefixAll', insidePolygon: [[0]], - removeWordsIfNoResults: '', + removeWordsIfNoResults: 'firstWords', advancedSyntax: false, optionalWords: [''], removeStopWords: [''], disableExactOnAttributes: [''], - exactOnSingleWordQuery: '', - alternativesAsExact: true, + exactOnSingleWordQuery: 'attribute', + alternativesAsExact: ["ignorePlurals"], distinct: 0, getRankingInfo: false, numericAttributesToIndex: [''], + numericAttributesForFiltering: [''], numericFilters: [''], - tagFilters: '', - facetFilters: '', + tagFilters: [''], + facetFilters: [''], analytics: false, analyticsTags: [''], synonyms: true, @@ -171,8 +174,38 @@ index.partialUpdateObjects([{}], false).then(() => {}); let indexName : string = index.indexName; // complete copy -client.copyIndex('from', 'to').then(()=>{}) -client.copyIndex('from', 'to', ()=> {}) +client.copyIndex('from', 'to').then(()=>{}); +client.copyIndex('from', 'to', ()=> {}); // with scope -client.copyIndex('from', 'to', ['settings']).then(()=>{}) -client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {}) +client.copyIndex('from', 'to', ['settings']).then(()=>{}); +client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {}); + +// Browsing +const browser = index.browseAll(); +index.browseAll('query'); +index.browseAll('', { + filters: 'dog', +}); + +let hits: Object[] = []; + +browser.on('result', function onResult(content) { + hits = hits.concat(content.hits); +}); + +browser.on('end', function onEnd() { + const _message = `We got ${hits.length} hits` +}); + +browser.on('error', function onError(err) { + throw err; +}); + +browser.stop(); + +index.browse("", { + advancedSyntax: false, + attributesToRetrieve: ['dogs'] +}); +client.copyIndex('from', 'to', ['settings']).then(()=>{}); +client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {}); diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 71684995a4..04291996ba 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1,11 +1,14 @@ -// Type definitions for algoliasearch-client-js 3.27.0 +// Type definitions for algoliasearch-client-js 3.30.0 // Project: https://github.com/algolia/algoliasearch-client-js // Definitions by: Baptiste Coquelle // Haroen Viaene // Aurélien Hervé // Samuel Vaillant +// Kai Eichinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.8 + +type Omit = Pick> declare namespace algoliasearch { /** @@ -611,6 +614,11 @@ declare namespace algoliasearch { options: SearchForFacetValues.Parameters, cb: (err: Error, res: SearchForFacetValues.Response) => void ): void; + /** + * Browse an index + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + browse(query: string, parameters: BrowseParameters, cb: (err: Error, res: BrowseResponse) => void): void; /** * Browse an index * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse @@ -620,7 +628,7 @@ declare namespace algoliasearch { * Browse an index * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse */ - browse(query: string): Promise; + browse(query: string, parameters?: BrowseParameters): Promise; /** * Browse an index from a cursor * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse @@ -638,7 +646,7 @@ declare namespace algoliasearch { * Browse an entire index * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse */ - browseAll(): Promise; + browseAll(query?: string, parameters?: BrowseParameters): Browser; /** * Clear an index content * https://github.com/algolia/algoliasearch-client-js#clear-index---clearindex @@ -966,6 +974,22 @@ declare namespace algoliasearch { query: string; processingTimeMS: number; } + type BrowseParameters = Omit< + QueryParameters, + | "typoTolerance" + | "distinct" + | "facets" + | "getRankingInfo" + | "attributesToHighlight" + | "attributesToSnippet" + > + interface Browser { + on(type: "error", cb: (err: Error) => void): void + on(type: "end", cb: () => void): void + on(type: "stop", cb: () => void): void + on(type: "result", cb: (content: BrowseResponse) => void): void + stop(): void + } /** * Describes a synonym object */ @@ -1099,112 +1123,121 @@ declare namespace algoliasearch { userToken?: string; } interface QueryParameters { + /** + * Query string used to perform the search + * default: '' + * https://www.algolia.com/doc/api-reference/api-parameters/query/ + */ + query?: string; + /** + * Filter the query with numeric, facet or/and tag filters + * default: "" + * https://www.algolia.com/doc/api-reference/api-parameters/filters/ + */ + filters?: string; + /** + * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer. + * default: * + * https://www.algolia.com/doc/api-reference/api-parameters/attributesToRetrieve/ + */ + attributesToRetrieve?: string[]; + /** + * List of attributes you want to use for textual search + * default: attributeToIndex + * https://www.algolia.com/doc/api-reference/api-parameters/restrictSearchableAttributes/ + */ + restrictSearchableAttributes?: string[]; + /** + * You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes + * default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/facets/ + */ + facets?: string[]; /** - * Query string used to perform the search - * default: '' - * https://github.com/algolia/algoliasearch-client-js#query - */ - query?: string; - /** - * Filter the query with numeric, facet or/and tag filters - * default: "" - * https://github.com/algolia/algoliasearch-client-js#filters - */ - filters?: string; - /** - * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer. - * default: * - * https://github.com/algolia/algoliasearch-client-js#attributestoretrieve - */ - attributesToRetrieve?: string[]; - /** - * List of attributes you want to use for textual search - * default: attributeToIndex - * https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes - */ - restrictSearchableAttributes?: string[]; - /** - * You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes - * default: "" - * https://github.com/algolia/algoliasearch-client-js#facets - */ - facets?: string | string[]; + * Force faceting to be applied after de-duplication (via the Distinct setting). + * When using the distinct setting in combination with faceting, facet counts may be higher than expected. + * This is because the engine, by default, computes faceting before applying de-duplication (distinct). + * When facetingAfterDistinct is set to true, the engine calculates faceting after the de-duplication has been applied. + * default "" + * https://www.algolia.com/doc/api-reference/api-parameters/facetingAfterDistinct/ + */ + facetingAfterDistinct?: boolean; /** * Limit the number of facet values returned for each facet. - * default: "" - * https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet + * default: 100 + * https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/ */ maxValuesPerFacet?: number; /** * Default list of attributes to highlight. If set to null, all indexed attributes are highlighted. * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestohighlight + * https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/ */ attributesToHighlight?: string[]; /** * Default list of attributes to snippet alongside the number of words to return * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestosnippet + * https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/ */ attributesToSnippet?: string[]; /** * Specify the string that is inserted before the highlighted parts in the query result * default: - * https://github.com/algolia/algoliasearch-client-js#highlightpretag + * https://www.algolia.com/doc/api-reference/api-parameters/highlightPreTag/ */ highlightPreTag?: string; /** * Specify the string that is inserted after the highlighted parts in the query result * default: - * https://github.com/algolia/algoliasearch-client-js#highlightposttag + * https://www.algolia.com/doc/api-reference/api-parameters/highlightPostTag/ */ highlightPostTag?: string; /** * String used as an ellipsis indicator when a snippet is truncated. * default: … - * https://github.com/algolia/algoliasearch-client-js#snippetellipsistext + * https://www.algolia.com/doc/api-reference/api-parameters/snippetEllipsisText/ */ snippetEllipsisText?: string; /** * If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets * default: false - * https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays + * https://www.algolia.com/doc/api-reference/api-parameters/restrictHighlightAndSnippetArrays/ */ restrictHighlightAndSnippetArrays?: boolean; /** * Pagination parameter used to select the number of hits per page * default: 20 - * https://github.com/algolia/algoliasearch-client-js#hitsperpage + * https://www.algolia.com/doc/api-reference/api-parameters/hitsPerPage/ */ hitsPerPage?: number; /** * Pagination parameter used to select the page to retrieve. * default: 0 - * https://github.com/algolia/algoliasearch-client-js#page + * https://www.algolia.com/doc/api-reference/api-parameters/page/ */ page?: number; /** * Offset of the first hit to return * default: null - * https://github.com/algolia/algoliasearch-client-js#offset + * https://www.algolia.com/doc/api-reference/api-parameters/offset/ */ offset?: number; /** * Number of hits to return. * default: null - * https://github.com/algolia/algoliasearch-client-js#length + * https://www.algolia.com/doc/api-reference/api-parameters/length/ */ length?: number; /** * The minimum number of characters needed to accept one typo. * default: 4 - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo + * https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor1Typo/ */ minWordSizefor1Typo?: number; /** * The minimum number of characters needed to accept two typo. * fault: 8 - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos + * https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor2Typos/ */ minWordSizefor2Typos?: number; /** @@ -1214,62 +1247,62 @@ declare namespace algoliasearch { * 'false' The typo tolerance is disabled. All results with typos will be hidden. * 'min' Only keep results with the minimum number of typos * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos + * https://www.algolia.com/doc/api-reference/api-parameters/typoTolerance/ */ typoTolerance?: boolean; /** * If set to false, disables typo tolerance on numeric tokens (numbers). * default: - * https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens + * https://www.algolia.com/doc/api-reference/api-parameters/allowTyposOnNumericTokens/ */ allowTyposOnNumericTokens?: boolean; /** * If set to true, plural won't be considered as a typo * default: false - * https://github.com/algolia/algoliasearch-client-js#ignoreplurals + * https://www.algolia.com/doc/api-reference/api-parameters/ignorePlurals/ */ ignorePlurals?: boolean; /** * List of attributes on which you want to disable typo tolerance - * default: "" - * https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes + * default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/disableTypoToleranceOnAttributes/ */ - disableTypoToleranceOnAttributes?: string; + disableTypoToleranceOnAttributes?: string[]; /** * Search for entries around a given location * default: "" - * https://github.com/algolia/algoliasearch-client-js#aroundlatlng + * https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLng/ */ aroundLatLng?: string; /** * Search for entries around a given latitude/longitude automatically computed from user IP address. * default: "" - * https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip + * https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLngViaIP/ */ aroundLatLngViaIP?: string; /** * Control the radius associated with a geo search. Defined in meters. * default: null * You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area - * https://github.com/algolia/algoliasearch-client-js#aroundradius + * https://www.algolia.com/doc/api-reference/api-parameters/aroundRadius/ */ aroundRadius?: number | 'all'; /** * Control the precision of a geo search * default: null - * https://github.com/algolia/algoliasearch-client-js#aroundprecision + * https://www.algolia.com/doc/api-reference/api-parameters/aroundPrecision/ */ aroundPrecision?: number; /** * Define the minimum radius used for a geo search when aroundRadius is not set. * default: null - * https://github.com/algolia/algoliasearch-client-js#minimumaroundradius + * https://www.algolia.com/doc/api-reference/api-parameters/minimumAroundRadius/ */ minimumAroundRadius?: number; /** * Search entries inside a given area defined by the two extreme points of a rectangle * default: null - * https://github.com/algolia/algoliasearch-client-js#insideboundingbox + * https://www.algolia.com/doc/api-reference/api-parameters/insideBoundingBox/ */ insideBoundingBox?: number[][]; /** @@ -1278,13 +1311,13 @@ declare namespace algoliasearch { * 'prefixAll' All query words are interpreted as prefixes. This option is not recommended. * 'prefixLast' Only the last word is interpreted as a prefix (default behavior). * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. - * https://github.com/algolia/algoliasearch-client-js#querytype + * https://www.algolia.com/doc/api-reference/api-parameters/queryType/ */ - queryType?: any; + queryType?: "prefixAll"|"prefixLast"|"prefixNone"; /** * Search entries inside a given area defined by a set of points * defauly: '' - * https://github.com/algolia/algoliasearch-client-js#insidepolygon + * https://www.algolia.com/doc/api-reference/api-parameters/insidePolygon/ */ insidePolygon?: number[][]; /** @@ -1294,19 +1327,19 @@ declare namespace algoliasearch { * 'firstWords' When a query does not return any results, the first word will be added as optional * 'allOptional' When a query does not return any results, a second trial will be made with all words as optional * 'none' No specific processing is done when a query does not return any results - * https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults + * https://www.algolia.com/doc/api-reference/api-parameters/removeWordsIfNoResults/ */ - removeWordsIfNoResults?: string; + removeWordsIfNoResults?: "none"|"lastWords"|"firstWords"|"allOptional"; /** * Enables the advanced query syntax * default: false - * https://github.com/algolia/algoliasearch-client-js#advancedsyntax + * https://www.algolia.com/doc/api-reference/api-parameters/advancedSyntax/ */ advancedSyntax?: boolean; /** * A string that contains the comma separated list of words that should be considered as optional when found in the query * default: [] - * https://github.com/algolia/algoliasearch-client-js#optionalwords + * https://www.algolia.com/doc/api-reference/api-parameters/optionalWords/ */ optionalWords?: string[]; /** @@ -1314,13 +1347,13 @@ declare namespace algoliasearch { * default: false * true|false: enable or disable stop words for all 41 supported languages; or * a list of language ISO codes (as a comma-separated string) for which stop words should be enable - * https://github.com/algolia/algoliasearch-client-js#removestopwords + * https://www.algolia.com/doc/api-reference/api-parameters/removeStopWords/ */ - removeStopWords?: string[]; + removeStopWords?: boolean|string[]; /** * List of attributes on which you want to disable the computation of exact criteria * default: [] - * https://github.com/algolia/algoliasearch-client-js#disableexactonattributes + * https://www.algolia.com/doc/api-reference/api-parameters/disableExactOnAttributes/ */ disableExactOnAttributes?: string[]; /** @@ -1329,81 +1362,90 @@ declare namespace algoliasearch { * 'none': no exact on single word query * 'word': exact set to 1 if the query word is found in the record * 'attribute': exact set to 1 if there is an attribute containing a string equals to the query - * https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery + * https://www.algolia.com/doc/api-reference/api-parameters/exactOnSingleWordQuery/ */ - exactOnSingleWordQuery?: string; + exactOnSingleWordQuery?: "attribute"|"none"|"word"; /** * Specify the list of approximation that should be considered as an exact match in the ranking formula * default: ['ignorePlurals', 'singleWordSynonym'] * 'ignorePlurals': alternative words added by the ignorePlurals feature * 'singleWordSynonym': single-word synonym (For example "NY" = "NYC") * 'multiWordsSynonym': multiple-words synonym - * https://github.com/algolia/algoliasearch-client-js#alternativesasexact + * https://www.algolia.com/doc/api-reference/api-parameters/alternativesAsExact/ */ - alternativesAsExact?: any; + alternativesAsExact?: Array<"ignorePlurals"|"singleWordSynonym"|"multiWordsSynonym">; /** * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. - * https://github.com/algolia/algoliasearch-client-js#distinct + * https://www.algolia.com/doc/api-reference/api-parameters/distinct/ */ - distinct?: any; + distinct?: number|boolean; /** * If set to true, the result hits will contain ranking information in the _rankingInfo attribute. * default: false - * https://github.com/algolia/algoliasearch-client-js#getrankinginfo + * https://www.algolia.com/doc/api-reference/api-parameters/getRankingInfo/ */ getRankingInfo?: boolean; /** + * @deprecated Use `numericAttributesForFiltering` instead * All numerical attributes are automatically indexed as numerical filters * default: '' - * https://github.com/algolia/algoliasearch-client-js#numericattributestoindex + * https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/ */ numericAttributesToIndex?: string[]; + /** + * All numerical attributes are automatically indexed as numerical filters + * default: '' + * https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/ + */ + numericAttributesForFiltering?: string[]; /** * @deprecated please use filters instead * A string that contains the comma separated list of numeric filters you want to apply. - * https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated + * https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/ */ numericFilters?: string[]; /** * @deprecated + * * Filter the query by a set of tags. - * https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated + * Default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/tagFilters/ */ - tagFilters?: string; + tagFilters?: string[]; /** - * @deprecated * Filter the query by a set of facets. - * https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated + * Default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/ */ - facetFilters?: string | string[] + facetFilters?: string[]|string[][]; /** * If set to false, this query will not be taken into account in the analytics feature. * default true - * https://github.com/algolia/algoliasearch-client-js#analytics + * https://www.algolia.com/doc/api-reference/api-parameters/analytics/ */ analytics?: boolean; /** * If set, tag your query with the specified identifiers - * default: null - * https://github.com/algolia/algoliasearch-client-js#analyticstags + * default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/ */ analyticsTags?: string[]; /** * If set to false, the search will not use the synonyms defined for the targeted index. * default: true - * https://github.com/algolia/algoliasearch-client-js#synonyms + * https://www.algolia.com/doc/api-reference/api-parameters/synonyms/ */ synonyms?: boolean; /** * If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result. * default: true - * https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight + * https://www.algolia.com/doc/api-reference/api-parameters/replaceSynonymsInHighlight/ */ replaceSynonymsInHighlight?: boolean; /** * Configure the precision of the proximity ranking criterion * default: 1 - * https://github.com/algolia/algoliasearch-client-js#minproximity + * https://www.algolia.com/doc/api-reference/api-parameters/minProximity/ */ minProximity?: number; @@ -1456,7 +1498,7 @@ declare namespace algoliasearch { interface Task { taskID: number; createdAt: string; - objectID?: string; + objectID?: string; } interface TaskStatus { @@ -1739,42 +1781,42 @@ declare namespace algoliasearch { interface Response { /** * Contains all the hits matching the query - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ hits: any[]; /** * Current page - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ page: number; /** * Number of total hits matching the query - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ nbHits: number; /** * Number of pages - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ nbPages: number; /** * Number of hits per pages - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ hitsPerPage: number; /** * Engine processing time (excluding network transfer) - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ processingTimeMS: number; /** * Query used to perform the search - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ query: string; /** * GET parameters used to perform the search - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ params: string; facets?: { @@ -1788,6 +1830,16 @@ declare namespace algoliasearch { sum: number, }; }; + /** + * The index name is only set when searching multiple indices. + * https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?language=javascript#response + */ + index?: string; + /** + * The cursor is only set when browsing the index. + * https://www.algolia.com/doc/api-reference/api-methods/browse/ + */ + cursor?: string; } interface MultiResponse { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 4f068d5647..ce58d6a428 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -1,12 +1,15 @@ -// Type definitions for algoliasearch-client-js 3.27.0 +// Type definitions for algoliasearch-client-js 3.30.0 // Project: https://github.com/algolia/algoliasearch-client-js // Definitions by: Baptiste Coquelle // Haroen Viaene // Aurélien Hervé // Samuel Vaillant // Claas Brüggemann +// Kai Eichinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.8 + +type Omit = Pick> declare namespace algoliasearch { /** @@ -130,6 +133,11 @@ declare namespace algoliasearch { options: SearchForFacetValues.Parameters, cb: (err: Error, res: SearchForFacetValues.Response) => void ): void; + /** + * Browse an index + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + browse(query: string, parameters: BrowseParameters, cb: (err: Error, res: BrowseResponse) => void): void; /** * Browse an index * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse @@ -139,7 +147,7 @@ declare namespace algoliasearch { * Browse an index * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse */ - browse(query: string): Promise; + browse(query: string, parameters?: BrowseParameters): Promise; /** * Browse an index from a cursor * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse @@ -194,114 +202,122 @@ declare namespace algoliasearch { query: string; processingTimeMS: number; } - + type BrowseParameters = Omit< + QueryParameters, + | "typoTolerance" + | "distinct" + | "facets" + | "getRankingInfo" + | "attributesToHighlight" + | "attributesToSnippet" + > interface QueryParameters { /** * Query string used to perform the search * default: '' - * https://github.com/algolia/algoliasearch-client-js#query + * https://www.algolia.com/doc/api-reference/api-parameters/query/ */ query?: string; /** * Filter the query with numeric, facet or/and tag filters * default: "" - * https://github.com/algolia/algoliasearch-client-js#filters + * https://www.algolia.com/doc/api-reference/api-parameters/filters/ */ filters?: string; /** * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer. * default: * - * https://github.com/algolia/algoliasearch-client-js#attributestoretrieve + * https://www.algolia.com/doc/api-reference/api-parameters/attributesToRetrieve/ */ attributesToRetrieve?: string[]; /** * List of attributes you want to use for textual search * default: attributeToIndex - * https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes + * https://www.algolia.com/doc/api-reference/api-parameters/restrictSearchableAttributes/ */ restrictSearchableAttributes?: string[]; /** * You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes - * default: "" - * https://github.com/algolia/algoliasearch-client-js#facets + * default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/facets/ */ - facets?: string; + facets?: string[]; /** * Limit the number of facet values returned for each facet. - * default: "" - * https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet + * default: 100 + * https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/ */ maxValuesPerFacet?: number; /** * Default list of attributes to highlight. If set to null, all indexed attributes are highlighted. * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestohighlight + * https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/ */ attributesToHighlight?: string[]; /** * Default list of attributes to snippet alongside the number of words to return * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestosnippet + * https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/ */ attributesToSnippet?: string[]; /** * Specify the string that is inserted before the highlighted parts in the query result * default: - * https://github.com/algolia/algoliasearch-client-js#highlightpretag + * https://www.algolia.com/doc/api-reference/api-parameters/highlightPreTag/ */ highlightPreTag?: string; /** * Specify the string that is inserted after the highlighted parts in the query result * default: - * https://github.com/algolia/algoliasearch-client-js#highlightposttag + * https://www.algolia.com/doc/api-reference/api-parameters/highlightPostTag/ */ highlightPostTag?: string; /** * String used as an ellipsis indicator when a snippet is truncated. * default: … - * https://github.com/algolia/algoliasearch-client-js#snippetellipsistext + * https://www.algolia.com/doc/api-reference/api-parameters/snippetEllipsisText/ */ snippetEllipsisText?: string; /** * If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets * default: false - * https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays + * https://www.algolia.com/doc/api-reference/api-parameters/restrictHighlightAndSnippetArrays/ */ restrictHighlightAndSnippetArrays?: boolean; /** * Pagination parameter used to select the number of hits per page * default: 20 - * https://github.com/algolia/algoliasearch-client-js#hitsperpage + * https://www.algolia.com/doc/api-reference/api-parameters/hitsPerPage/ */ hitsPerPage?: number; /** * Pagination parameter used to select the page to retrieve. * default: 0 - * https://github.com/algolia/algoliasearch-client-js#page + * https://www.algolia.com/doc/api-reference/api-parameters/page/ */ page?: number; /** * Offset of the first hit to return * default: null - * https://github.com/algolia/algoliasearch-client-js#offset + * https://www.algolia.com/doc/api-reference/api-parameters/offset/ */ offset?: number; /** * Number of hits to return. * default: null - * https://github.com/algolia/algoliasearch-client-js#length + * https://www.algolia.com/doc/api-reference/api-parameters/length/ */ length?: number; /** * The minimum number of characters needed to accept one typo. * default: 4 - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo + * https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor1Typo/ */ minWordSizefor1Typo?: number; /** * The minimum number of characters needed to accept two typo. * fault: 8 - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos + * https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor2Typos/ */ minWordSizefor2Typos?: number; /** @@ -311,62 +327,62 @@ declare namespace algoliasearch { * 'false' The typo tolerance is disabled. All results with typos will be hidden. * 'min' Only keep results with the minimum number of typos * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos + * https://www.algolia.com/doc/api-reference/api-parameters/typoTolerance/ */ typoTolerance?: boolean; /** * If set to false, disables typo tolerance on numeric tokens (numbers). * default: - * https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens + * https://www.algolia.com/doc/api-reference/api-parameters/allowTyposOnNumericTokens/ */ allowTyposOnNumericTokens?: boolean; /** * If set to true, plural won't be considered as a typo * default: false - * https://github.com/algolia/algoliasearch-client-js#ignoreplurals + * https://www.algolia.com/doc/api-reference/api-parameters/ignorePlurals/ */ ignorePlurals?: boolean; /** * List of attributes on which you want to disable typo tolerance - * default: "" - * https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes + * default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/disableTypoToleranceOnAttributes/ */ - disableTypoToleranceOnAttributes?: string; + disableTypoToleranceOnAttributes?: string[]; /** * Search for entries around a given location * default: "" - * https://github.com/algolia/algoliasearch-client-js#aroundlatlng + * https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLng/ */ aroundLatLng?: string; /** * Search for entries around a given latitude/longitude automatically computed from user IP address. * default: "" - * https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip + * https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLngViaIP/ */ aroundLatLngViaIP?: string; /** * Control the radius associated with a geo search. Defined in meters. * default: null * You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area - * https://github.com/algolia/algoliasearch-client-js#aroundradius + * https://www.algolia.com/doc/api-reference/api-parameters/aroundRadius/ */ aroundRadius?: number | 'all'; /** * Control the precision of a geo search * default: null - * https://github.com/algolia/algoliasearch-client-js#aroundprecision + * https://www.algolia.com/doc/api-reference/api-parameters/aroundPrecision/ */ aroundPrecision?: number; /** * Define the minimum radius used for a geo search when aroundRadius is not set. * default: null - * https://github.com/algolia/algoliasearch-client-js#minimumaroundradius + * https://www.algolia.com/doc/api-reference/api-parameters/minimumAroundRadius/ */ minimumAroundRadius?: number; /** * Search entries inside a given area defined by the two extreme points of a rectangle * default: null - * https://github.com/algolia/algoliasearch-client-js#insideboundingbox + * https://www.algolia.com/doc/api-reference/api-parameters/insideBoundingBox/ */ insideBoundingBox?: number[][]; /** @@ -375,13 +391,13 @@ declare namespace algoliasearch { * 'prefixAll' All query words are interpreted as prefixes. This option is not recommended. * 'prefixLast' Only the last word is interpreted as a prefix (default behavior). * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. - * https://github.com/algolia/algoliasearch-client-js#querytype + * https://www.algolia.com/doc/api-reference/api-parameters/queryType/ */ - queryType?: any; + queryType?: "prefixAll"|"prefixLast"|"prefixNone"; /** * Search entries inside a given area defined by a set of points * defauly: '' - * https://github.com/algolia/algoliasearch-client-js#insidepolygon + * https://www.algolia.com/doc/api-reference/api-parameters/insidePolygon/ */ insidePolygon?: number[][]; /** @@ -391,19 +407,19 @@ declare namespace algoliasearch { * 'firstWords' When a query does not return any results, the first word will be added as optional * 'allOptional' When a query does not return any results, a second trial will be made with all words as optional * 'none' No specific processing is done when a query does not return any results - * https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults + * https://www.algolia.com/doc/api-reference/api-parameters/removeWordsIfNoResults/ */ - removeWordsIfNoResults?: string; + removeWordsIfNoResults?: "none"|"lastWords"|"firstWords"|"allOptional"; /** * Enables the advanced query syntax * default: false - * https://github.com/algolia/algoliasearch-client-js#advancedsyntax + * https://www.algolia.com/doc/api-reference/api-parameters/advancedSyntax/ */ advancedSyntax?: boolean; /** * A string that contains the comma separated list of words that should be considered as optional when found in the query * default: [] - * https://github.com/algolia/algoliasearch-client-js#optionalwords + * https://www.algolia.com/doc/api-reference/api-parameters/optionalWords/ */ optionalWords?: string[]; /** @@ -411,13 +427,13 @@ declare namespace algoliasearch { * default: false * true|false: enable or disable stop words for all 41 supported languages; or * a list of language ISO codes (as a comma-separated string) for which stop words should be enable - * https://github.com/algolia/algoliasearch-client-js#removestopwords + * https://www.algolia.com/doc/api-reference/api-parameters/removeStopWords/ */ - removeStopWords?: string[]; + removeStopWords?: boolean|string[]; /** * List of attributes on which you want to disable the computation of exact criteria * default: [] - * https://github.com/algolia/algoliasearch-client-js#disableexactonattributes + * https://www.algolia.com/doc/api-reference/api-parameters/disableExactOnAttributes/ */ disableExactOnAttributes?: string[]; /** @@ -426,81 +442,90 @@ declare namespace algoliasearch { * 'none': no exact on single word query * 'word': exact set to 1 if the query word is found in the record * 'attribute': exact set to 1 if there is an attribute containing a string equals to the query - * https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery + * https://www.algolia.com/doc/api-reference/api-parameters/exactOnSingleWordQuery/ */ - exactOnSingleWordQuery?: string; + exactOnSingleWordQuery?: "attribute"|"none"|"word"; /** * Specify the list of approximation that should be considered as an exact match in the ranking formula * default: ['ignorePlurals', 'singleWordSynonym'] * 'ignorePlurals': alternative words added by the ignorePlurals feature * 'singleWordSynonym': single-word synonym (For example "NY" = "NYC") * 'multiWordsSynonym': multiple-words synonym - * https://github.com/algolia/algoliasearch-client-js#alternativesasexact + * https://www.algolia.com/doc/api-reference/api-parameters/alternativesAsExact/ */ - alternativesAsExact?: any; + alternativesAsExact?: Array<"ignorePlurals"|"singleWordSynonym"|"multiWordsSynonym">; /** * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. - * https://github.com/algolia/algoliasearch-client-js#distinct + * https://www.algolia.com/doc/api-reference/api-parameters/distinct/ */ - distinct?: any; + distinct?: number|boolean; /** * If set to true, the result hits will contain ranking information in the _rankingInfo attribute. * default: false - * https://github.com/algolia/algoliasearch-client-js#getrankinginfo + * https://www.algolia.com/doc/api-reference/api-parameters/getRankingInfo/ */ getRankingInfo?: boolean; /** + * @deprecated Use `numericAttributesForFiltering` instead * All numerical attributes are automatically indexed as numerical filters * default: '' - * https://github.com/algolia/algoliasearch-client-js#numericattributestoindex + * https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/ */ numericAttributesToIndex?: string[]; + /** + * All numerical attributes are automatically indexed as numerical filters + * default: '' + * https://www.algolia.com/doc/api-reference/api-parameters/numericAttributesForFiltering/ + */ + numericAttributesForFiltering?: string[]; /** * @deprecated please use filters instead * A string that contains the comma separated list of numeric filters you want to apply. - * https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated + * https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/ */ numericFilters?: string[]; /** * @deprecated + * * Filter the query by a set of tags. - * https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated + * Default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/tagFilters/ */ - tagFilters?: string; + tagFilters?: string[]; /** - * @deprecated * Filter the query by a set of facets. - * https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated + * Default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/ */ - facetFilters?: string; + facetFilters?: string[]|string[][]; /** * If set to false, this query will not be taken into account in the analytics feature. * default true - * https://github.com/algolia/algoliasearch-client-js#analytics + * https://www.algolia.com/doc/api-reference/api-parameters/analytics/ */ analytics?: boolean; /** * If set, tag your query with the specified identifiers - * default: null - * https://github.com/algolia/algoliasearch-client-js#analyticstags + * default: [] + * https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/ */ analyticsTags?: string[]; /** * If set to false, the search will not use the synonyms defined for the targeted index. * default: true - * https://github.com/algolia/algoliasearch-client-js#synonyms + * https://www.algolia.com/doc/api-reference/api-parameters/synonyms/ */ synonyms?: boolean; /** * If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result. * default: true - * https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight + * https://www.algolia.com/doc/api-reference/api-parameters/replaceSynonymsInHighlight/ */ replaceSynonymsInHighlight?: boolean; /** * Configure the precision of the proximity ranking criterion * default: 1 - * https://github.com/algolia/algoliasearch-client-js#minproximity + * https://www.algolia.com/doc/api-reference/api-parameters/minProximity/ */ minProximity?: number; @@ -530,42 +555,42 @@ declare namespace algoliasearch { interface Response { /** * Contains all the hits matching the query - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ hits: any[]; /** * Current page - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ page: number; /** * Number of total hits matching the query - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ nbHits: number; /** * Number of pages - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ nbPages: number; /** * Number of hits per pages - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ hitsPerPage: number; /** * Engine processing time (excluding network transfer) - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ processingTimeMS: number; /** * Query used to perform the search - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ query: string; /** * GET parameters used to perform the search - * https://github.com/algolia/algoliasearch-client-js#response-format + * https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response */ params: string; facets?: { @@ -579,6 +604,16 @@ declare namespace algoliasearch { sum: number, }; }; + /** + * The index name is only set when searching multiple indices. + * https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?language=javascript#response + */ + index?: string; + /** + * The cursor is only set when browsing the index. + * https://www.algolia.com/doc/api-reference/api-methods/browse/ + */ + cursor?: string; } interface MultiResponse { diff --git a/types/ali-app/ali-app-tests.ts b/types/ali-app/ali-app-tests.ts new file mode 100644 index 0000000000..a42301aed1 --- /dev/null +++ b/types/ali-app/ali-app-tests.ts @@ -0,0 +1,2153 @@ +(() => { + // https://docs.alipay.com/mini/api/ui-navigate + my.navigateTo({ + url: 'new_page?count=100' + }); + // test.js + Page({ + onLoad(query: any) { + my.alert({ + content: JSON.stringify(query), + }); + } + }); + my.redirectTo({ + url: 'new_page?count=100' + }); + // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈, + // 而 redirectTo 方法则不会。见下方示例代码 + + // 此处是one页面 + my.navigateTo({ + url: 'two?pageId=10000' + }); + + // 此处是two页面 + my.navigateTo({ + url: 'one?pageId=99999' + }); + + // 在three页面内 navigateBack,将返回one页面 + my.navigateBack({ + delta: 2 + }); + my.reLaunch({ + url: '/page/index' + }); + my.setNavigationBar({ + title: '你好', + backgroundColor: '#108ee9', + success() { + my.alert({ + content: '设置成功', + }); + }, + fail() { + my.alert({ + content: '设置是失败', + }); + }, + }); + my.showNavigationBarLoading(); + my.hideNavigationBarLoading(); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-tabbar + my.switchTab({ + url: '/home' + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-feedback + my.alert({ + title: '亲', + content: '您本月的账单已出', + buttonText: '我知道了', + success: () => { + my.alert({ + title: '用户点击了「我知道了」', + }); + }, + }); + my.confirm({ + title: '温馨提示', + content: '您是否想查询快递单号:1234567890', + confirmButtonText: '马上查询', + cancelButtonText: '暂不需要', + success: (result) => { + my.alert({ + title: `${result.confirm}`, + }); + }, + }); + my.prompt({ + title: '标题单行', + message: '说明当前状态、提示用户解决方案,最好不要超过两行。', + placeholder: '给朋友留言', + okButtonText: '确定', + cancelButtonText: '取消', + success: (result) => { + my.alert({ + title: JSON.stringify(result), + }); + }, + }); + my.showToast({ + type: 'success', + content: '操作成功', + duration: 3000, + success: () => { + my.alert({ + title: 'toast 消失了', + }); + }, + }); + my.hideToast(); + my.showLoading({ + content: '加载中...', + delay: 1000, + }); + + my.hideLoading(); + + Page({ + onLoad() { + my.showLoading(); + const that = this; + setTimeout(() => { + my.hideLoading({ + page: that, // 防止执行时已经切换到其它页面,page指向不准确 + }); + }, 4000); + } + }); + my.showNavigationBarLoading(); + my.hideNavigationBarLoading(); + my.showActionSheet({ + title: '支付宝-ActionSheet', + items: ['菜单一', '菜单二', '菜单三', '菜单四', '菜单五'], + badges: [ + { index: 0, type: 'none' }, + { index: 1, type: 'point' }, + { index: 2, type: 'num', text: '99' }, + { index: 3, type: 'text', text: '推荐' }, + { index: 4, type: 'more' }], + cancelButtonText: '取消好了', + success: (res) => { + const btn = res.index === -1 ? '取消' : `第${res.index}个`; + my.alert({ + title: `你点了${btn}按钮` + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-pulldown + Page({ + onPullDownRefresh() { + my.stopPullDownRefresh(); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-contact + my.choosePhoneContact({ + success: (res) => { + my.alert({ + content: `姓名:${res.name}\n号码:${res.mobile}` + }); + } + }); + my.chooseAlipayContact({ + count: 2, + success: (res) => { + my.alert({ + content: 'chooseAlipayContact response: ' + JSON.stringify(res) + }); + }, + fail: (res) => { + my.alert({ + content: 'chooseAlipayContact response: ' + JSON.stringify(res) + }); + } + }); + my.chooseContact({ + chooseType: 'multi', // 多选模式 + includeMe: true, // 包含自己 + includeMobileContactMode: 'known', // 仅包含双向手机通讯录联系人,也即双方手机通讯录都存有对方号码的联系人 + multiChooseMax: 3, // 最多能选择三个联系人 + multiChooseMaxTips: '超过选择的最大人数了', + success: (res) => { + my.alert({ + content: 'chooseContact : ' + JSON.stringify(res) + }); + }, + fail: (res) => { + my.alert({ + content: 'chooseContact : ' + JSON.stringify(res) + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-city + my.chooseCity({ + cities: [ + { + city: '朝阳区', + adCode: '110105', + spell: 'chaoyang' + }, + { + city: '海淀区', + adCode: '110108', + spell: 'haidian' + }, + { + city: '丰台区', + adCode: '110106', + spell: 'fengtai' + }, + { + city: '东城区', + adCode: '110101', + spell: 'dongcheng' + }, + { + city: '西城区', + adCode: '110102', + spell: 'xicheng' + }, + { + city: '房山区', + adCode: '110111', + spell: 'fangshan' + } + ], + hotCities: [ + { + city: '朝阳区', + adCode: '110105' + }, + { + city: '海淀区', + adCode: '110108' + }, + { + city: '丰台区', + adCode: '110106' + } + ], + success: (res) => { + my.alert({ + content: `${res.city}:${res.adCode}` + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-date + my.datePicker({ + format: 'yyyy-MM-dd', + currentDate: '2012-12-12', + startDate: '2012-12-10', + endDate: '2012-12-15', + success: (res) => { + my.alert({ + content: res.date, + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-animation + const animation = my.createAnimation({ + transformOrigin: "top right", + duration: 3000, + timeFunction: "ease-in-out", + delay: 100, + }); + Page({ + data: { + animationInfo: {} + }, + onShow() { + const animation = my.createAnimation({ + duration: 1000, + timeFunction: 'ease-in-out', + }); + + this.animation = animation; + + animation.scale(3, 3).rotate(60).step(); + + this.setData({ + animationInfo: animation.export() + }); + + setTimeout(() => { + animation.translate(35).step(); + this.setData({ + animationInfo: animation.export(), + }); + }, 1500); + }, + rotateAndScale(this: my.Page) { + // 旋转同时放大 + this.animation.rotate(60).scale(3, 3).step(); + this.setData({ + animationInfo: this.animation.export(), + }); + }, + rotateThenScale(this: my.Page) { + // 先旋转后放大 + this.animation.rotate(60).step(); + this.animation.scale(3, 3).step(); + this.setData({ + animationInfo: this.animation.export(), + }); + }, + rotateAndScaleThenTranslate(this: my.Page) { + // 先旋转同时放大,然后平移 + this.animation.rotate(60).scale(3, 3).step(); + this.animation.translate(100, 100).step({ duration: 2000 }); + this.setData({ + animationInfo: this.animation.export() + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-canvas + const ctx = my.createCanvasContext('awesomeCanvas'); + ctx.toTempFilePath({ + success() { }, + }); + + ctx.setTextAlign("left"); + ctx.fillText("Hello world", 0, 100); + + ctx.setTextBaseline("top"); + ctx.fillText("Hello world", 0, 100); + + ctx.setFillStyle('blue'); + ctx.fillRect(50, 50, 100, 175); + ctx.draw(); + + ctx.setStrokeStyle('blue'); + ctx.strokeRect(50, 50, 100, 175); + ctx.draw(); + + ctx.setFillStyle('red'); + ctx.setShadow(15, 45, 45, 'yellow'); + ctx.fillRect(20, 20, 100, 175); + ctx.draw(); + + const grd = ctx.createLinearGradient(10, 10, 150, 10); + grd.addColorStop(0, 'yellow'); + grd.addColorStop(1, 'blue'); + + ctx.setFillStyle(grd); + ctx.fillRect(20, 20, 250, 180); + ctx.draw(); + + grd.addColorStop(0, 'blue'); + grd.addColorStop(1, 'red'); + + ctx.setFillStyle(grd); + ctx.fillRect(20, 20, 250, 180); + ctx.draw(); + + grd.addColorStop(0.36, 'orange'); + grd.addColorStop(0.56, 'cyan'); + grd.addColorStop(0.63, 'yellow'); + grd.addColorStop(0.76, 'blue'); + grd.addColorStop(0.54, 'green'); + grd.addColorStop(1, 'purple'); + grd.addColorStop(0.4, 'red'); + + ctx.setFillStyle(grd); + ctx.fillRect(20, 20, 250, 180); + ctx.draw(); + + ctx.beginPath(); + ctx.moveTo(20, 20); + ctx.lineTo(250, 10); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineWidth(10); + ctx.moveTo(20, 35); + ctx.lineTo(250, 30); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineWidth(20); + ctx.moveTo(20, 50); + ctx.lineTo(250, 55); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineWidth(25); + ctx.moveTo(20, 80); + ctx.lineTo(250, 85); + ctx.stroke(); + + ctx.draw(); + + ctx.beginPath(); + ctx.moveTo(10, 10); + ctx.lineTo(150, 10); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineCap('round'); + ctx.setLineWidth(20); + ctx.moveTo(20, 70); + ctx.lineTo(250, 80); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineCap('butt'); + ctx.setLineWidth(10); + ctx.moveTo(25, 80); + ctx.lineTo(250, 30); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineCap('square'); + ctx.setLineWidth(10); + ctx.moveTo(35, 47); + ctx.lineTo(230, 120); + ctx.stroke(); + + ctx.draw(); + + ctx.beginPath(); + ctx.moveTo(20, 30); + ctx.lineTo(150, 70); + ctx.lineTo(20, 100); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineJoin('round'); + ctx.setLineWidth(20); + ctx.moveTo(100, 20); + ctx.lineTo(280, 80); + ctx.lineTo(100, 100); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineJoin('bevel'); + ctx.setLineWidth(20); + ctx.moveTo(60, 25); + ctx.lineTo(180, 80); + ctx.lineTo(90, 100); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineJoin('miter'); + ctx.setLineWidth(15); + ctx.moveTo(130, 70); + ctx.lineTo(250, 50); + ctx.lineTo(230, 100); + ctx.stroke(); + + ctx.draw(); + + ctx.beginPath(); + ctx.setLineWidth(15); + ctx.setLineJoin('miter'); + ctx.setMiterLimit(1); + ctx.moveTo(10, 10); + ctx.lineTo(100, 50); + ctx.lineTo(10, 90); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineWidth(15); + ctx.setLineJoin('miter'); + ctx.setMiterLimit(2); + ctx.moveTo(50, 10); + ctx.lineTo(140, 50); + ctx.lineTo(50, 90); + ctx.stroke(); + + ctx.beginPath(); + ctx.setLineWidth(15); + ctx.setLineJoin('miter'); + ctx.setMiterLimit(3); + ctx.moveTo(90, 10); + ctx.lineTo(180, 50); + ctx.lineTo(90, 90); + ctx.stroke(); + + ctx.draw(); + + ctx.rect(20, 20, 250, 80); + ctx.setFillStyle('blue'); + ctx.fill(); + ctx.draw(); + + ctx.fillRect(20, 20, 250, 80); + ctx.setFillStyle('blue'); + ctx.draw(); + + ctx.setStrokeStyle('blue'); + ctx.strokeRect(20, 20, 250, 80); + ctx.draw(); + + ctx.setFillStyle('blue'); + ctx.fillRect(250, 10, 250, 200); + ctx.setFillStyle('yellow'); + ctx.fillRect(0, 0, 150, 200); + ctx.clearRect(10, 10, 150, 75); + ctx.draw(); + + ctx.moveTo(20, 20); + ctx.lineTo(200, 20); + ctx.lineTo(200, 200); + ctx.fill(); + ctx.draw(); + + ctx.rect(20, 20, 110, 40); + ctx.setFillStyle('blue'); + ctx.fill(); + + ctx.beginPath(); + ctx.rect(20, 30, 150, 40); + + ctx.setFillStyle('yellow'); + ctx.fillRect(20, 80, 150, 40); + + ctx.rect(20, 150, 150, 40); + + ctx.setFillStyle('red'); + ctx.fill(); + ctx.draw(); + + ctx.moveTo(20, 20); + ctx.lineTo(150, 10); + ctx.lineTo(150, 150); + ctx.stroke(); + ctx.draw(); + + ctx.rect(10, 10, 100, 30); + ctx.setStrokeStyle('blue'); + ctx.stroke(); + + ctx.beginPath(); + ctx.rect(20, 50, 150, 50); + + ctx.setStrokeStyle('yellow'); + ctx.strokeRect(15, 75, 200, 35); + + ctx.rect(20, 200, 150, 30); + + ctx.setStrokeStyle('red'); + ctx.stroke(); + ctx.draw(); + + ctx.rect(20, 20, 150, 50); + ctx.setFillStyle('blue'); + ctx.fill(); + + ctx.beginPath(); + ctx.rect(20, 50, 150, 40); + + ctx.setFillStyle('yellow'); + ctx.fillRect(20, 170, 150, 40); + + ctx.rect(10, 100, 100, 30); + + ctx.setFillStyle('red'); + ctx.fill(); + ctx.draw(); + + ctx.moveTo(20, 20); + ctx.lineTo(150, 20); + ctx.lineTo(150, 150); + ctx.closePath(); + ctx.stroke(); + ctx.draw(); + + ctx.rect(20, 20, 150, 50); + ctx.closePath(); + + ctx.beginPath(); + ctx.rect(20, 50, 150, 40); + + ctx.setFillStyle('red'); + ctx.fillRect(20, 80, 120, 30); + + ctx.rect(20, 150, 150, 40); + + ctx.setFillStyle('blue'); + ctx.fill(); + ctx.draw(); + + ctx.moveTo(20, 20); + ctx.lineTo(150, 15); + + ctx.moveTo(20, 55); + ctx.lineTo(120, 60); + ctx.stroke(); + ctx.draw(); + + ctx.moveTo(20, 20); + ctx.rect(20, 20, 80, 30); + ctx.lineTo(120, 80); + ctx.stroke(); + ctx.draw(); + + ctx.arc(200, 75, 50, 0, 2 * Math.PI); + ctx.setFillStyle('#CCCCCC'); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(50, 65); + ctx.lineTo(170, 80); + ctx.moveTo(200, 35); + ctx.lineTo(200, 235); + ctx.setStrokeStyle('#AAAAAA'); + ctx.stroke(); + + ctx.setFontSize(12); + ctx.setFillStyle('yellow'); + ctx.fillText('0', 165, 78); + ctx.fillText('0.6*PI', 96, 148); + ctx.fillText('1*PI', 15, 57); + ctx.fillText('1.7*PI', 94, 20); + + ctx.beginPath(); + ctx.arc(200, 85, 2, 0, 2 * Math.PI); + ctx.setFillStyle('blue'); + ctx.fill(); + + ctx.beginPath(); + ctx.arc(200, 35, 2, 0, 2 * Math.PI); + ctx.setFillStyle('green'); + ctx.fill(); + + ctx.beginPath(); + ctx.arc(450, 60, 2, 0, 2 * Math.PI); + ctx.setFillStyle('red'); + ctx.fill(); + + ctx.beginPath(); + ctx.arc(150, 35, 50, 0, 1.8 * Math.PI); + ctx.setStrokeStyle('#666666'); + ctx.stroke(); + + ctx.draw(); + + ctx.beginPath(); + ctx.arc(30, 30, 2, 0, 2 * Math.PI); + ctx.setFillStyle('red'); + ctx.fill(); + + ctx.beginPath(); + ctx.arc(250, 25, 2, 0, 2 * Math.PI); + ctx.setFillStyle('blue'); + ctx.fill(); + + ctx.beginPath(); + ctx.arc(20, 100, 2, 0, 2 * Math.PI); + ctx.arc(200, 100, 2, 0, 2 * Math.PI); + ctx.setFillStyle('green'); + ctx.fill(); + + ctx.setFillStyle('yellow'); + ctx.setFontSize(14); + + ctx.beginPath(); + ctx.moveTo(30, 30); + ctx.lineTo(30, 100); + ctx.lineTo(150, 75); + + ctx.moveTo(250, 30); + ctx.lineTo(250, 80); + ctx.lineTo(70, 75); + ctx.setStrokeStyle('#EEEEEE'); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(30, 30); + ctx.bezierCurveTo(30, 150, 250, 150, 180, 20); + ctx.setStrokeStyle('black'); + ctx.stroke(); + + ctx.draw(); + + ctx.beginPath(); + ctx.arc(30, 30, 2, 0, 2 * Math.PI); + ctx.setFillStyle('red'); + ctx.fill(); + + ctx.beginPath(); + ctx.arc(250, 20, 2, 0, 2 * Math.PI); + ctx.setFillStyle('blue'); + ctx.fill(); + + ctx.beginPath(); + ctx.arc(30, 200, 2, 0, 2 * Math.PI); + ctx.setFillStyle('green'); + ctx.fill(); + + ctx.setFillStyle('black'); + ctx.setFontSize(12); + + ctx.beginPath(); + ctx.moveTo(30, 30); + ctx.lineTo(30, 150); + ctx.lineTo(250, 30); + ctx.setStrokeStyle('#AAAAAA'); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(30, 30); + ctx.quadraticCurveTo(30, 150, 250, 25); + ctx.setStrokeStyle('black'); + ctx.stroke(); + + ctx.draw(); + + ctx.strokeRect(15, 15, 30, 25); + ctx.scale(3, 3); + ctx.strokeRect(15, 15, 30, 25); + ctx.scale(3, 3); + ctx.strokeRect(15, 15, 30, 25); + + ctx.draw(); + + ctx.strokeRect(200, 20, 180, 150); + ctx.rotate(30 * Math.PI / 180); + ctx.strokeRect(200, 20, 180, 150); + ctx.rotate(30 * Math.PI / 180); + ctx.strokeRect(200, 20, 180, 150); + + ctx.draw(); + + ctx.strokeRect(20, 20, 250, 80); + ctx.translate(30, 30); + ctx.strokeRect(20, 20, 250, 80); + ctx.translate(30, 30); + ctx.strokeRect(20, 20, 250, 80); + + ctx.draw(); + + ctx.setFontSize(14); + ctx.fillText('14', 20, 20); + ctx.setFontSize(22); + ctx.fillText('22', 40, 40); + ctx.setFontSize(30); + ctx.fillText('30', 60, 60); + ctx.setFontSize(38); + ctx.fillText('38', 90, 90); + + ctx.draw(); + + ctx.setFontSize(42); + ctx.fillText('Hello', 30, 30); + ctx.fillText('alipay', 200, 200); + + ctx.draw(); + + ctx.drawImage('https://img.alicdn.com/tfs/TB1GvVMj2BNTKJjy0FdXXcPpVXa-520-280.jpg', 2, 2, 250, 80); + ctx.draw(); + + ctx.setFillStyle('yellow'); + ctx.fillRect(10, 10, 150, 100); + ctx.setGlobalAlpha(0.2); + ctx.setFillStyle('blue'); + ctx.fillRect(50, 50, 150, 100); + ctx.setFillStyle('red'); + ctx.fillRect(100, 100, 150, 100); + + ctx.draw(); + + ctx.setLineDash([5, 15, 25]); + ctx.beginPath(); + ctx.moveTo(0, 100); + ctx.lineTo(400, 100); + ctx.stroke(); + + ctx.draw(); + + ctx.rotate(45 * Math.PI / 180); + ctx.setFillStyle('red'); + ctx.fillRect(70, 0, 100, 30); + + ctx.transform(1, 1, 0, 1, 0, 0); + ctx.setFillStyle('#000'); + ctx.fillRect(0, 0, 100, 100); + + ctx.draw(); + + ctx.rotate(45 * Math.PI / 180); + ctx.setFillStyle('red'); + ctx.fillRect(70, 0, 100, 30); + + ctx.setTransform(1, 1, 0, 1, 0, 0); + ctx.setFillStyle('#000'); + ctx.fillRect(0, 0, 100, 100); + + ctx.draw(); + + ctx.save(); + ctx.setFillStyle('red'); + ctx.fillRect(20, 20, 250, 80); + + ctx.restore(); + ctx.fillRect(60, 60, 155, 130); + + ctx.draw(); + + ctx.setFillStyle('blue'); + ctx.fillRect(20, 20, 180, 80); + ctx.draw(); + ctx.fillRect(60, 60, 250, 120); + ctx.draw(true); + + ctx.font = 'italic bold 50px cursive'; + const { width } = ctx.measureText('hello world'); + console.log(width); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-map + Page({ + onReady() { + // 使用 my.createMapContext 获取 map 上下文 + this.mapCtx = my.createMapContext('userMap'); + }, + getCenterLocation(this: my.Page) { + (this.mapCtx as my.MapContext).getCenterLocation({ + success(res) { + console.log(res.longitude); + console.log(res.latitude); + } + }); + }, + moveToLocation() { + this.mapCtx.moveToLocation(); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ui-hidekeyboard + my.hideKeyboard(); +})(); + +(() => { + // https://docs.alipay.com/mini/api/scroll + my.pageScrollTo({ + scrollTop: 100 + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/selector-query + Page({ + onReady() { + my.createSelectorQuery() + .select('#non-exists').boundingClientRect() + .select('#one').boundingClientRect() + .selectAll('.all').boundingClientRect() + .select('#scroll').scrollOffset() + .selectViewport().boundingClientRect() + .selectViewport().scrollOffset().exec((ret) => { + console.log(JSON.stringify(ret, null, 2)); + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/ewdxl3 + my.multiLevelSelect({ + title: 'nihao', // 级联选择标题 + list: [ + { + name: "杭州市", // 条目名称 + subList: [ + { + name: "西湖区", + subList: [ + { + name: "古翠街道" + }, + { + name: "文新街道" + } + ] + }, + { + name: "上城区", + subList: [ + { + name: "延安街道" + }, + { + name: "龙翔桥街道" + } + ] + } + ]// 级联子数据列表 + } + ]// 级联数据列表 + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/openapi-authorize + my.getAuthCode({ + scopes: 'auth_user', + success: (res) => { + my.alert({ + content: res.authCode, + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/userinfo + my.getAuthCode({ + scopes: 'auth_user', + success: (res) => { + my.getAuthUserInfo({ + success: (userInfo) => { + my.alert({ + content: userInfo.nickName + }); + my.alert({ + content: userInfo.avatar + }); + } + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/openapi-pay + my.tradePay({ + tradeNO: '201711152100110410533667792', // 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号trade_no + success: (res) => { + my.alert({ + content: JSON.stringify(res), + }); + }, + fail: (res) => { + my.alert({ + content: JSON.stringify(res), + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/pay-sign + my.paySignCenter({ + // tslint:disable-next-line:max-line-length + signStr: 'biz_content%3D%257B%2522access_params%2522%253A%257B%2522channel%2522%253A%2522ALIPAYAPP%2522%257D%252C%2522external_agreement_no%2522%253A%2522xidong___2317%2522%252C%2522external_logon_id%2522%253A%252213852852877%2522%252C%2522personal_product_code%2522%253A%2522GENERAL_WITHHOLDING_P%2522%252C%2522product_code%2522%253A%2522GENERAL_WITHHOLDING%2522%252C%2522sign_scene%2522%253A%2522INDUSTRY%257CCARRENTAL%2522%252C%2522third_party_type%2522%253A%2522PARTNER%2522%257D%26sign%3Df3pjBDTRftOwXWnCqAMAnkBfGTFlcMmZI8hEgmV6uREZRXVDuLsSjD8WO%252FeZ1fjDG8GqVO9t1AN7q6yCUHKX%252Bw%252FE7efXwpVDWldr4iVuXDtNd3UJDJUiRJhIm6b73czWacVzm1XIery%252F2DyKI2y08tBf5NNWuQCC3d%252FITxziTl8%253D%26timestamp%3D2017-06-27%2B14%253A44%253A00%26sign_type%3DRSA%26notify_url%3Dhttp%253A%252F%252Fapi.test.alipay.net%252Fatinterface%252Freceive_notify.htm%26charset%3DUTF-8%26app_id%3D2017060101317939%26method%3Dalipay.user.agreement.page.sign%26return_url%3Dhttp%253A%252F%252Fapi.test.alipay.net%252Fatinterface%252Freceive_notify.htm%26version%3D1.0', + success: (res) => { + my.alert({ + title: 'success', // alert框的标题 + content: JSON.stringify(res) + }); + }, + fail: (res) => { + my.alert({ + title: 'fail', // alert框的标题 + content: JSON.stringify(res) + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/card-voucher-ticket + my.openCardList(); + my.openMerchantCardList({ partnerId: '2088xxxxx' }); + // 传入passId来打开 + my.openCardDetail({ passId: "11xxxxx" }); + my.openVoucherList(); + my.openMerchantVoucherList({ partnerId: '2088xxxx' }); + // 传入passId来打开 + my.openVoucherDetail({ passId: "20170921" }); + + // 传入partnerId 和 serialNumber来打开 + my.openVoucherDetail({ + partnerId: "2018xxxx", + serialNumber: "20170921" + }); + // 传入passId来打开 + my.openKBVoucherDetail({ passId: "20170921" }); + + // 传入partnerId 和 serialNumber来打开 + my.openKBVoucherDetail({ + partnerId: "2088xxxx", + serialNumber: "20170921" + }); + my.openTicketList(); + my.openMerchantTicketList({ partnerId: '2088xxxx' }); + // 传入passId来打开 + my.openTicketDetail({ passId: "20170921" }); + + // 传入partnerId 和 serialNumber来打开 + my.openTicketDetail({ + partnerId: "2088xxxx", + serialNumber: "20170921" + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/add-card-auth + my.addCardAuth({ + url: '从 openapi 接口获取到的 url', + success: (res) => { + my.alert({ content: '授权成功' }); + }, + fail: (res) => { + my.alert({ content: '授权失败' }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/zm-service + my.startZMVerify({ + bizNo: 'your-biz-no', + success: (res) => { + my.alert({ title: 'success:' + JSON.stringify(res) }); + }, + fail: (res) => { + my.alert({ title: 'fail: ' + JSON.stringify(res) }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/zmcreditborrow + my.zmCreditBorrow({ + credit_biz: "", + out_order_no: "", + borrow_shop_name: "", + goods_name: "", + product_code: "w1010100000000002858", + rent_unit: "HOUR_YUAN", + rent_amount: "0.10", + deposit_amount: "0.50", + deposit_state: "Y", + invoke_return_url: "", + invoke_type: "TINYAPP", + borrow_time: "2017-04-27 10:01:01", + expiry_time: "2017-05-27 10:01:01", + rent_info: "2hour-free", + success: (res) => { + try { + const { resultStatus, result } = res; + switch (resultStatus) { + case '9000': + const callbackData = result.callbackData; + const decodedCallbackData = decodeURIComponent(callbackData); + const json = JSON.parse(decodedCallbackData.match(/{.*}/)!.toString()); + const jsonStr = JSON.stringify(json, null, 4); + if (json.success === true || json.success === 'true') { + // 创建订单成功, 此时可以跳转到订单详情页面 + my.alert({ content: '下单成功: ' + jsonStr }); + } else { + // 创建订单失败, 请提示用户创建失败 + my.alert({ content: '下单失败: ' + jsonStr }); + } + // (this as any as my.Page).setData({ + // callbackData, + // decodedCallbackData, + // parsedJSON: jsonStr, + // }); + break; + case '6001': + // 用户点击返回, 取消此次服务, 此时可以给提示 + my.alert({ content: '取消' }); + break; + default: + break; + } + } catch (error) { + // 异常, 请在这里提示用户稍后重试 + my.alert({ + content: '异常' + JSON.stringify(error, null, 4) + }); + } + }, + fail: (error) => { + // 调用接口失败, 请在这里提示用户稍后重试 + my.alert({ + content: '调用失败' + JSON.stringify(error, null, 4) + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/templatemessage +})(); + +(() => { + // https://docs.alipay.com/mini/api/text-identification + my.textRiskIdentification({ + content: '加我支付宝', + type: ['keyword', '0', '1', '2', '3'], + success: (res) => { + my.alert({ + title: 'ok', // alert 框的标题 + content: JSON.stringify(res), + }); + }, + fail: (res) => { + my.alert({ + title: 'fail', // alert 框的标题 + content: JSON.stringify(res), + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/open-miniprogram + my.navigateToMiniProgram({ + appId: 'xxxx', + extraData: { + data1: "test" + }, + success: (res) => { + console.log(JSON.stringify(res)); + }, + fail: (res) => { + console.log(JSON.stringify(res)); + } + }); + my.navigateBackMiniProgram({ + extraData: { + data1: "test" + }, + success: (res) => { + console.log(JSON.stringify(res)); + }, + fail: (res) => { + console.log(JSON.stringify(res)); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/webview-context + Page({ + onLoad() { + this.webViewContext = my.createWebViewContext('web-view-1'); + }, + // 接收来自H5的消息 + onMessage(e: any) { + console.log(e); // {'sendToMiniProgram': '0'} + // 向H5发送消息 + this.webViewContext.postMessage({ sendToWebView: '1' }); + } + }); + // H5的js代码中需要先定义my.onMessage 用于接收来自小程序的消息。 + my.onMessage = (e) => { + console.log(e); // {'sendToWebView': '1'} + }; + // H5想小程序发送消息 + my.postMessage({ sendToMiniProgram: '0' }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/media-image + const img = null as any as HTMLImageElement; + my.chooseImage({ + count: 2, + success: (res) => { + img.src = res.apFilePaths[0]; + }, + }); + my.previewImage({ + current: 2, + urls: [ + 'https://img.alicdn.com/tps/TB1sXGYIFXXXXc5XpXXXXXXXXXX.jpg', + 'https://img.alicdn.com/tps/TB1pfG4IFXXXXc6XXXXXXXXXXXX.jpg', + 'https://img.alicdn.com/tps/TB1h9xxIFXXXXbKXXXXXXXXXXXX.jpg' + ], + }); + my.saveImage({ + url: 'https://img.alicdn.com/tps/TB1sXGYIFXXXXc5XpXXXXXXXXXX.jpg' + }); + my.compressImage({ + apFilePaths: ['https://resource/apmlcc0ed184daffc5a0d8da86b2f518cf7b.image'], + // level: 1, + success: (res) => { + console.log(JSON.stringify(res)); + } + }); + // 网络图片路径 + my.getImageInfo({ + src: 'https://img.alicdn.com/tps/TB1sXGYIFXXXXc5XpXXXXXXXXXX.jpg', + success: (res) => { + console.log(JSON.stringify(res)); + } + }); + + // apFilePath + my.chooseImage({ + success: (res) => { + my.getImageInfo({ + src: res.apFilePaths[0], + success: (res) => { + console.log(JSON.stringify(res)); + } + }); + }, + }); + + // 相对路径 + my.getImageInfo({ + src: 'image/api.png', + success: (res) => { + console.log(JSON.stringify(res)); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/storage + my.setStorage({ + key: 'currentCity', + data: { + cityName: '杭州', + adCode: '330100', + spell: ' hangzhou', + }, + success() { + my.alert({ content: '写入成功' }); + } + }); + my.setStorageSync({ + key: 'currentCity', + data: { + cityName: '杭州', + adCode: '330100', + spell: ' hangzhou', + } + }); + my.getStorage({ + key: 'currentCity', + success(res) { + my.alert({ content: '获取成功:' + res.data.cityName }); + }, + fail(res) { + my.alert({ content: res.errorMessage }); + } + }); + const res = my.getStorageSync({ key: 'currentCity' }); + my.alert({ + content: JSON.stringify(res.data), + }); + my.removeStorage({ + key: 'currentCity', + success() { + my.alert({ content: '删除成功' }); + } + }); + my.removeStorageSync({ + key: 'currentCity', + }); + my.clearStorage(); + my.clearStorageSync(); + my.getStorageInfo({ + success(res) { + console.log(res.keys); + console.log(res.currentSize); + console.log(res.limitSize); + } + }); + const res1 = my.getStorageInfoSync(); + console.log(res1.keys); + console.log(res1.currentSize); + console.log(res1.limitSize); +})(); + +(() => { + // https://docs.alipay.com/mini/api/file + my.chooseImage({ + success: (res) => { + my.saveFile({ + apFilePath: res.apFilePaths[0], + success: (res) => { + console.log(JSON.stringify(res)); + }, + }); + }, + }); + my.getFileInfo({ + apFilePath: 'https://resource/apml953bb093ebd2834530196f50a4413a87.video', + digestAlgorithm: 'sha1', + success: (res) => { + console.log(JSON.stringify(res)); + } + }); + my.getSavedFileInfo({ + apFilePath: 'https://resource/apml953bb093ebd2834530196f50a4413a87.video', + success: (res) => { + console.log(JSON.stringify(res)); + } + }); + my.getSavedFileList({ + success: (res) => { + console.log(JSON.stringify(res)); + } + }); + my.getSavedFileList({ + success: (res) => { + my.removeSavedFile({ + apFilePath: res.fileList[0].apFilePath, + success: (res) => { + console.log('remove success'); + } + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/location + my.getLocation({ + success(res) { + my.hideLoading(); + console.log(res); + /* that对象为Page可以设置数据刷新界面 + that.setData({ + hasLocation: true, + location: formatLocation(res.longitude, res.latitude) + }) + */ + }, + fail() { + my.hideLoading(); + my.alert({ title: '定位失败' }); + }, + }); + my.openLocation({ + longitude: '121.549697', + latitude: '31.227250', + name: '支付宝', + address: '杨高路地铁站', + }); + my.chooseLocation({ + success: (res) => { + console.log(res); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/network + my.httpRequest({ + url: 'http://httpbin.org/post', + method: 'POST', + data: { + from: '支付宝', + production: 'AlipayJSAPI', + }, + dataType: 'json', + success(res) { + my.alert({ content: 'success' }); + }, + fail(res) { + my.alert({ content: 'fail' }); + }, + complete(res) { + my.hideLoading(); + my.alert({ content: 'complete' }); + } + }); + my.uploadFile({ + url: '请使用自己服务器地址', + fileType: 'image', + fileName: 'file', + filePath: '...', + success: (res) => { + my.alert({ + content: '上传成功' + }); + }, + }); + my.downloadFile({ + url: 'http://img.alicdn.com/tfs/TB1x669SXXXXXbdaFXXXXXXXXXX-520-280.jpg', + success({ apFilePath }) { + my.previewImage({ + urls: [apFilePath], + }); + }, + fail(res) { + my.alert({ + content: res.errorMessage || res.error, + }); + }, + }); + my.connectSocket({ + url: 'test.php', + data: {}, + header: { + 'content-type': 'application/json' + }, + method: 'GET' + }); + my.connectSocket({ + url: 'test.php', + }); + + my.onSocketOpen(() => { + console.log('WebSocket 连接已打开!'); + }); + Page({ + onLoad() { + this.callback = this.callback.bind(this); + my.onSocketOpen(this.callback); + }, + onUnload() { + my.offSocketOpen(this.callback); + }, + callback() { + }, + }); + my.connectSocket({ + url: '开发者的服务器地址' + }); + + my.onSocketOpen(() => { + console.log('WebSocket 连接已打开!'); + }); + + my.onSocketError(() => { + console.log('WebSocket 连接打开失败,请检查!'); + }); + Page({ + onLoad() { + this.callback = this.callback.bind(this); + my.onSocketError(this.callback); + }, + onUnload() { + my.offSocketError(this.callback); + }, + callback() { + my.sendSocketMessage({ + data: this.data.toSendMessage, // 需要发送的内容 + success: (res) => { + my.alert({ content: '数据发送!' + this.data.toSendMessage }); + }, + }); + }, + }); + my.connectSocket({ + url: '服务器地址' + }); + + my.onSocketMessage((res) => { + console.log('收到服务器内容:' + res.data); + }); + my.onSocketOpen(() => { + my.closeSocket(); + }); + + my.onSocketClose(() => { + console.log('WebSocket 已关闭!'); + }); + Page({ + // onLoad() { + onLaunch() { + // 注意: 回调方法的注册在整个小程序启动阶段只要做一次,调多次会有多次回调 + my.onSocketClose(() => { + my.alert({ content: '连接已关闭!' }); + this.setData({ + sendMessageAbility: false, + closeLinkAbility: false, + }); + }); + // 注意: 回调方法的注册在整个小程序启动阶段只要做一次,调多次会有多次回调 + my.onSocketOpen(() => { + my.alert({ content: '连接已打开!' }); + this.setData({ + sendMessageAbility: true, + closeLinkAbility: true, + }); + }); + + my.onSocketError((res) => { + my.alert({ content: 'WebSocket 连接打开失败,请检查!' + res }); + }); + + // 注意: 回调方法的注册在整个小程序启动阶段只要做一次,调多次会有多次回调 + my.onSocketMessage((res) => { + my.alert({ content: '收到数据!' + JSON.stringify(res) }); + }); + }, + connect_start() { + my.connectSocket({ + url: '服务器地址', // 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名 + success: (res) => { + my.showToast({ + content: 'success', // 文字内容 + }); + }, + fail: () => { + my.showToast({ + content: 'fail', // 文字内容 + }); + } + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/can-i-use + my.canIUse('getFileInfo'); + my.canIUse('closeSocket.object.code'); + my.canIUse('getLocation.object.type'); + my.canIUse('getSystemInfo.return.brand'); + my.canIUse('lifestyle'); + my.canIUse('button.open-type.share'); +})(); + +(() => { + // https://docs.alipay.com/mini/api/sdk-version + console.log(my.SDKVersion); +})(); + +(() => { + // https://docs.alipay.com/mini/api/system-info + Page({ + data: { + systemInfo: {} + }, + getSystemInfoPage(this: my.Page) { + my.getSystemInfo({ + success: (res) => { + this.setData({ + systemInfo: res + }); + } + }); + }, + }); + Page({ + data: { + systemInfo: {} + }, + getSystemInfoSyncPage(this: my.Page) { + this.setData({ + systemInfo: my.getSystemInfoSync() + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/network-status + Page({ + data: { + hasNetworkType: false + }, + getNetworkType(this: my.Page) { + my.getNetworkType({ + success: (res) => { + this.setData({ + hasNetworkType: true, + networkType: res.networkType + }); + } + }); + }, + clear(this: my.Page) { + this.setData({ + hasNetworkType: false, + networkType: '' + }); + }, + }); + my.onNetworkStatusChange((res) => { + console.log(JSON.stringify(res)); + }); + my.offNetworkStatusChange(); +})(); + +(() => { + // https://docs.alipay.com/mini/api/clipboard + Page({ + data: { + text: '3.1415926', + copy: '', + }, + + handlePaste(this: my.Page) { + my.getClipboard({ + success: ({ text }) => { + this.setData({ copy: text }); + }, + }); + }, + }); + Page({ + data: { + text: '3.1415926', + copy: '', + }, + + handleCopy() { + my.setClipboard({ + text: this.data.text, + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/shake + Page({ + watchShake() { + my.watchShake({ + success() { + console.log('动起来了'); + my.alert({ title: '动起来了 o.o' }); + } + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/vibrate + Page({ + vibrate() { + my.vibrate({ + success: () => { + my.alert({ title: '震动起来了' }); + } + }); + }, + }); + Page({ + vibrateLong() { + my.vibrateLong({ + success: () => { + my.alert({ title: '震动起来了' }); + } + }); + }, + }); + Page({ + vibrateShort() { + my.vibrateShort({ + success: () => { + my.alert({ title: '震动起来了' }); + } + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/macke-call + Page({ + makePhoneCall() { + my.makePhoneCall({ number: '95888' }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/get-server-time + // getServerTime(){ + // my.getServerTime({ + // success: (res) => { + // my.alert({ + // title: res.time, + // }); + // }, + // }); + // }; +})(); + +(() => { + // https://docs.alipay.com/mini/api/user-capture-screen + my.onUserCaptureScreen(() => { + my.alert({ + content: '收到用户截屏事件' + }); + }); + my.offUserCaptureScreen(); +})(); + +(() => { + // https://docs.alipay.com/mini/api/screen-brightness + my.setKeepScreenOn({ + keepScreenOn: true, + success: (res) => { + }, + fail: (res) => { + }, + }); + my.getScreenBrightness({ + success: (res) => { + console.log(JSON.stringify(res)); + }, + fail: (res) => { + }, + }); + my.setScreenBrightness({ + brightness: 0.5, + success: (res) => { + console.log(JSON.stringify(res)); + }, + fail: (res) => { + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/show-auth-guide + my.showAuthGuide({ + authType: 'LBSSERVICE' + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/scan + Page({ + scan() { + my.scan({ + type: 'qr', + success: (res) => { + my.alert({ title: res.code }); + }, + }); + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/bluetooth-intro + // 初始化 + my.openBluetoothAdapter({ + success: (res) => { + console.log(res); + } + }); + // 注册发现事件 + my.onBluetoothDeviceFound({ + success: (res) => { + const device = res.devices[0]; + // 连接发现的设备 + my.connectBLEDevice({ + deviceId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + // 停止搜索 + my.stopBluetoothDevicesDiscovery({ + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + } + }); + const deviceId = 'test'; + const serviceId = 'test'; + const characteristicId = 'test'; + // 注册连接事件 + my.onBLEConnectionStateChanged({ + success: (res) => { + console.log(res); + if (res.connected) { + // 开始读写notify等操作 + my.notifyBLECharacteristicValueChange({ + deviceId, + serviceId, + characteristicId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + } + } + }); + // 注册接收read或notify的数据 + my.onBLECharacteristicValueChange({ + success: (res) => { + console.log(res); + } + }); + // 开始搜索 + my.startBluetoothDevicesDiscovery({ + services: ['fff0'], + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + + // 断开连接 + my.disconnectBLEDevice({ + deviceId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + + // 注销事件 + my.offBluetoothDeviceFound(); + my.offBLEConnectionStateChanged(); + my.offBLECharacteristicValueChange(); + + // 退出蓝牙模块 + my.closeBluetoothAdapter({ + success: (res) => { + }, + fail: (res) => { + }, + complete: (res) => { + } + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/bluetooth-api + my.openBluetoothAdapter({ + success: (res) => { + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.closeBluetoothAdapter({ + success: (res) => { + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.getBluetoothAdapterState({ + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.startBluetoothDevicesDiscovery({ + services: ['fff0'], + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.stopBluetoothDevicesDiscovery({ + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.getBluetoothDevices({ + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.getConnectedBluetoothDevices({ + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + const deviceId = 'test'; + const serviceId = 'test'; + const characteristicId = 'test'; + my.connectBLEDevice({ + // 这里的 deviceId 需要在上面的 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取 + deviceId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.disconnectBLEDevice({ + deviceId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.writeBLECharacteristicValue({ + deviceId, + serviceId, + characteristicId, + value: 'fffe', + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.readBLECharacteristicValue({ + deviceId, + serviceId, + characteristicId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.notifyBLECharacteristicValueChange({ + deviceId, + serviceId, + characteristicId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.getBLEDeviceServices({ + deviceId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + my.getBLEDeviceCharacteristics({ + deviceId, + serviceId, + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + Page({ + onLoad() { + this.callback = this.callback.bind(this); + my.onBluetoothDeviceFound(this.callback); + }, + onUnload() { + my.offBluetoothDeviceFound(this.callback); + }, + callback(res: any) { + console.log(res); + }, + }); + my.offBluetoothDeviceFound(); + Page({ + onLoad() { + this.callback = this.callback.bind(this); + my.onBLECharacteristicValueChange(this.callback); + }, + onUnload() { + my.offBLECharacteristicValueChange(this.callback); + }, + callback(res: any) { + console.log(res); + }, + }); + my.offBLECharacteristicValueChange(); + my.offBLEConnectionStateChanged(); + my.offBluetoothAdapterStateChange(); +})(); + +(() => { + // https://docs.alipay.com/mini/api/yqleyc + my.startBeaconDiscovery({ + uuids: ['uuid1', 'uuid2'], + success: (res) => { + console.log(res); + }, + fail: () => { + }, + complete: () => { + } + }); + + my.stopBeaconDiscovery({ + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + + my.getBeacons({ + success: (res) => { + console.log(res); + }, + fail: (res) => { + }, + complete: (res) => { + } + }); + + my.onBeaconUpdate({ + success: (res) => { + }, + }); + + my.onBeaconServiceChange({ + success: (res) => { + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/data-safe + Page({ + data: { + inputValue: '', + outputValue: '', + }, + onInput(this: my.Page, e: any) { + this.setData({ inputValue: e.detail.value }); + }, + onEncrypt(this: my.Page) { + my.rsa({ + action: 'encrypt', + // 设置公钥 + // tslint:disable-next-line:max-line-length + key: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKmi0dUSVQ04hL6GZGPMFK8+d6\nGzulagP27qSUBYxIJfE04KT+OHVeFFb6K+8nWDea5mkmZrIgp022zZVDgdWPNM62\n3ouBwHlsfm2ekey8PpQxfXaj8lhM9t8rJlC4FEc0s8Qp7Q5/uYrowQbT9m6t7BFK\n3egOO2xOKzLpYSqfbQIDAQAB', + text: this.data.inputValue, + success: (result) => { + this.setData({ outputValue: result.text }); + }, + fail(e) { + my.alert({ + content: e.errorMessage || e.error, + }); + }, + }); + }, + onDecrypt(this: my.Page) { + my.rsa({ + action: 'decrypt', + text: this.data.inputValue, + // 设置私钥 + // tslint:disable-next-line:prefer-template + key: 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMqaLR1RJVDTiEvo\n' + + 'ZkY8wUrz53obO6VqA/bupJQFjEgl8TTgpP44dV4UVvor7ydYN5rmaSZmsiCnTbbN\n' + + 'lUOB1Y80zrbei4HAeWx+bZ6R7Lw+lDF9dqPyWEz23ysmULgURzSzxCntDn+5iujB\n' + + 'BtP2bq3sEUrd6A47bE4rMulhKp9tAgMBAAECgYBjsfRLPdfn6v9hou1Y2KKg+F5K\n' + + 'ZsY2AnIK+6l+sTAzfIAx7e0ir7OJZObb2eyn5rAOCB1r6RL0IH+MWaN+gZANNG9g\n' + + 'pXvRgcZzFY0oqdMZDuSJjpMTj7OEUlPyoGncBfvjAg0zdt9QGAG1at9Jr3i0Xr4X\n' + + '6WrFhtfVlmQUY1VsoQJBAPK2Qj/ClkZNtrSDfoD0j083LcNICqFIIGkNQ+XeuTwl\n' + + '+Gq4USTyaTOEe68MHluiciQ+QKvRAUd4E1zeZRZ02ikCQQDVscINBPTtTJt1JfAo\n' + + 'wRfTzA0Lvgig136xLLeQXREcgq1lzgkf+tGyUGYoy9BXsV0mOuYAT9ldja4jhJeq\n' + + 'cEulAkEAuSJ5KjV9dyb0RIFAz5C8d8o5KAodwaRIxJkPv5nCZbT45j6t9qbJxDg8\n' + + 'N+vghDlHI4owvl5wwVlAO8iQBy8e8QJBAJe9CVXFV0XJR/n/XnER66FxGzJjVi0f\n' + + '185nOlFARI5CHG5VxxT2PUCo5mHBl8ctIj+rQvalvGs515VQ6YEVDCECQE3S0AU2\n' + + 'BKyFVNtTpPiTyRUWqig4EbSXwjXdr8iBBJDLsMpdWsq7DCwv/ToBoLg+cQ4Crc5/\n5DChU8P30EjOiEo=', + success: (result) => { + this.setData({ outputValue: result.text }); + }, + fail(e) { + my.alert({ + content: e.errorMessage || e.error, + }); + }, + }); + }, + }); +})(); + +(() => { + // https://docs.alipay.com/mini/api/share_app + Page({ + onShareAppMessage() { + return { + title: '小程序示例', + desc: '小程序官方示例Demo,展示已支持的接口能力及组件。', + path: 'page/component/component-pages/view/view?param=123' + }; + }, + }); + + my.hideShareMenu(); +})(); + +(() => { + // https://docs.alipay.com/mini/api/report + my.reportAnalytics('purchase', { + status: 200, + reason: 'ok' + }); +})(); diff --git a/types/ali-app/index.d.ts b/types/ali-app/index.d.ts new file mode 100644 index 0000000000..82f7b2bf27 --- /dev/null +++ b/types/ali-app/index.d.ts @@ -0,0 +1,3265 @@ +// Type definitions for ali-app 1.0 +// Project: https://docs.alipay.com/mini/api/overview (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.) +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// 公共部分 +declare namespace my { + // #region 基本参数 + interface DataResponse { + /** 回调函数返回的内容 */ + data: any; + /** 开发者服务器返回的 HTTP 状态码 */ + status: number; + /** 开发者服务器返回的 HTTP Response Header */ + headers: object; + } + interface ErrMsgResponse { + /** 成功:ok,错误:详细信息 */ + errMsg: "ok" | string; + } + interface TempFileResponse { + /** 文件的临时路径 */ + apFilePath: string; + } + interface BaseOptions { + /** 接口调用成功的回调函数 */ + success?(res: R): void; + /** 接口调用失败的回调函数 */ + fail?(res: E): void; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?(res: any): void; + } + interface ErrCodeResponse { + errCode: number; + } + // #endregion +} + +// 界面 +declare namespace my { + //#region 导航栏 https://docs.alipay.com/mini/api/ui-navigate + interface NavigateToOptions extends BaseOptions { + /** 需要跳转的应用内页面的路径 */ + url: string; + } + /** + * 保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。 + * + * 注意:为了不让用户在使用小程序时造成困扰, + * 我们规定页面路径只能是五层,请尽量避免多层级的交互方式。 + */ + function navigateTo(options: NavigateToOptions): void; + + interface RedirectToOptions extends BaseOptions { + /** 需要跳转的应用内页面的路径 */ + url: string; + } + /** + * 关闭当前页面,跳转到应用内的某个页面。 + */ + function redirectTo(options: RedirectToOptions): void; + + interface NavigateBackOptions extends BaseOptions { + /** 返回的页面数,如果 delta 大于现有打开的页面数,则返回到首页 */ + delta: number; + } + /** + * 关闭当前页面,返回上一级或多级页面。可通过 getCurrentPages 获取当前的页面栈信息,决定需要返回几层。 + */ + function navigateBack(options?: NavigateBackOptions): void; + + interface ReLaunchOptions extends BaseOptions { + /** + * 需要跳转的应用内页面路径 , 路径后可以带参数。 + * 参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔 + * 如 'path?key=value&key2=value2',如果跳转的页面路径是 tabBar 页面则不能带参数 + */ + url: string; + } + /** + * 关闭所有页面,打开到应用内的某个页面。 + */ + function reLaunch(options?: ReLaunchOptions): void; + + interface SetNavigationBarOptions extends BaseOptions { + /** 页面标题 */ + title: string; + /** 图片连接地址,必须是https,请使用3x高清图片。若设置了image则title参数失效 */ + image: string; + /** 导航栏背景色,支持十六进制颜色值 */ + backgroundColor: string; + /** 导航栏底部边框颜色,支持十六进制颜色值。若设置了 backgroundColor,则borderBottomColor 不会生效,默认会和 backgroundColor 颜色一样 */ + borderBottomColor: string; + /** 是否重置导航栏为支付宝默认配色,默认 false */ + reset: boolean; + } + /** + * 动态设置当前页面的标题。 + */ + function setNavigationBar(options: Partial): void; + + /** + * 显示导航栏 loading + */ + function showNavigationBarLoading(): void; + + /** 隐藏导航栏 loading。 */ + function hideNavigationBarLoading(): void; + //#endregion + + //#region TabBar https://docs.alipay.com/mini/api/ui-tabbar + interface SwitchTabOptions extends BaseOptions { + /** + * 需要跳转的 tabBar 页面的路径 + * (需在 app.json 的 tabBar 字段定义的页面),路径后不能带参数 + */ + url: string; + } + /** + * 跳转到指定 tabBar 页面,并关闭其他所有非 tabBar 页面 + */ + function switchTab(options: SwitchTabOptions): void; + //#endregion + + //#region 交互反馈 https://docs.alipay.com/mini/api/ui-feedback + + interface AlertOptions extends BaseOptions { + /** alert框的标题 */ + title: string; + /** alert框的内容 */ + content: string; + /** 按钮文字,默认确定 */ + buttonText: string; + } + function alert(options: Partial): void; + + interface ConfirmOptions extends BaseOptions { + /** confirm框的标题 */ + title: string; + /** confirm框的内容 */ + content: string; + /** 确认按钮文字,默认‘确定’ */ + confirmButtonText: string; + /** 确认按钮文字,默认‘取消’ */ + cancelButtonText: string; + success(result: { confirm: boolean; }): void; + } + function confirm(options: Partial): void; + + interface PromptOptions extends BaseOptions { + /** prompt框标题 */ + title?: string; + /** prompt框文本,默认‘请输入内容’ */ + message?: string; + /** 输入框内的提示文案 */ + placeholder?: string; + /** message对齐方式,可用枚举left/center/right,iOS ‘center’, android ‘left’ */ + align?: 'left' | 'center' | 'right' | string; + /** 确认按钮文字,默认‘确定’ */ + okButtonText: string; + /** 确认按钮文字,默认‘取消’ */ + cancelButtonText: string; + success(result: { ok: boolean; inputValue: string; }): void; + } + function prompt(options: PromptOptions): void; + + interface ToastOptions extends BaseOptions { + /** + * 文字内容 + */ + content: string; + /** toast 类型,展示相应图标,默认 none,支持 success / fail / exception / none’。其中 exception 类型必须传文字信息 */ + type?: 'none' | 'success' | 'fail' | 'exception' | string; + /** + * 显示时长,单位为 ms,默认 2000 + */ + duration?: number; + } + /** + * 显示消息提示框 + */ + function showToast(options: Partial): void; + function hideToast(): void; + + interface LoadingOptions extends BaseOptions { + /** + * loading的文字内容 + */ + content?: string; + /** + * 延迟显示,单位 ms,默认 0。如果在此时间之前调用了 my.hideLoading 则不会显示 + */ + delay?: number; + } + /** + * 显示加载提示 + */ + function showLoading(options?: LoadingOptions): void; + interface HideLoadingOptions { + /** + * 体指当前page实例,某些场景下,需要指明在哪个page执行hideLoading。 + */ + page: any; + } + /** + * 隐藏消息提示框 + */ + function hideLoading(options?: HideLoadingOptions): void; + + interface Badge { + /** 需要飘红的选项的索引,从0开始 */ + index: number; + /** + * 飘红类型,支持 none(无红点)/ point(纯红点) / num(数字红点)/ text(文案红点)/ more(...) + * + */ + type: 'none' | 'point' | 'num' | 'text' | 'more' | string; + + /** + * 自定义飘红文案: + * + * 1、type为none/point/more时本文案可不填 + * 2、type为num时本文案为小数或<=0均不显示, >100 显示"..." + */ + text: string; + } + interface ActionSheetOptions extends BaseOptions { + /** 菜单标题 */ + title?: string; + /** + * 菜单按钮文字数组 + */ + items: string[]; + /** + * 取消按钮文案。默认为‘取消’。注:Android平台此字段无效,不会显示取消按钮。 + */ + cancelButtonText?: string; + /** + * (iOS特殊处理)指定按钮的索引号,从0开始,使用场景:需要删除或清除数据等类似场景,默认红色 + */ + destructiveBtnIndex?: number; + /** + * 需飘红选项的数组,数组内部对象字段见下表 + */ + badges?: Array>; + /** + * 接口调用成功的回调函数 + */ + success?(res: { + /** + * 用户点击的按钮,从上到下的顺序,从0开始 + */ + index: number; + }): void; + } + /** + * 显示操作菜单 + */ + function showActionSheet(options: ActionSheetOptions): void; + //#endregion + + //#region 下拉刷新 https://docs.alipay.com/mini/api/ui-pulldown + /** + * Page 实现的接口对象 + */ + interface PageOptions { + /** + * 下拉刷新 + * 在 Page 中定义 onPullDownRefresh 处理函数,监听该页面用户下拉刷新事件。 + * 需要在页面对应的 .json 配置文件中配置 "pullRefresh": true 选项,才能开启下拉刷新事件。 + * 当处理完数据刷新后,调用 my.stopPullDownRefresh 可以停止当前页面的下拉刷新。 + */ + onPullDownRefresh?(this: Page): void; + } + /** + * 停止当前页面的下拉刷新。 + */ + function stopPullDownRefresh(): void; + //#endregion + + //#region 联系人 https://docs.alipay.com/mini/api/ui-contact + interface ChoosePhoneContactOptions extends BaseOptions { + success(result: { + name: string; // 选中的联系人姓名 + mobile: string; // 选中的联系人手机号 + }): void; + /** + * 10 没有权限 + * 11 用户取消操作(或设备未授权使用通讯录) + */ + fail?(error: 10 | 11): void; + } + /** + * 选择本地系统通信录中某个联系人的电话。 + */ + function choosePhoneContact(options: ChoosePhoneContactOptions): void; + + interface ChooseAlipayContactOptions extends BaseOptions { + /** 单次最多选择联系人个数,默认 1,最大 10 */ + count: number; + success(result: { + realName: string; // 账号的真实姓名 + mobile: string; // 账号对应的手机号码 + email: string; // 账号的邮箱 + avatar: string; // 账号的头像链接 + userId: string; // 支付宝账号唯一 userId + }): void; + /** + * 10 没有权限 + * 11 用户取消操作(或设备未授权使用通讯录) + */ + fail?(error: 10 | 11): void; + } + /** + * 唤起支付宝通讯录,选择一个或者多个支付宝联系人。 + */ + function chooseAlipayContact(options: ChooseAlipayContactOptions): void; + + interface ContactsDic { + /** + * 支付宝账号唯一 userId + */ + userId: string; + /** + * 账号的头像链接 + */ + avatar: string; + /** + * 账号对应的手机号码 + */ + mobile: string; + /** + * 账号的真实姓名 + */ + realName: string; + /** + * 账号的显示名称:也即支付宝设置的备注名称,默认为朋友圈里面的昵称 + */ + displayName: string; // 账号的显示名称:也即支付宝设置的备注名称,默认为朋友圈里面的昵称 + } + interface ChooseContactOptions extends BaseOptions { + /** 选择类型,值为single(单选)或者 multi(多选) */ + chooseType: 'single' | 'multi' | string; + /** 包含手机通讯录联系人的模式:默认为不包含(none)、或者仅仅包含双向通讯录联系人(known)、或者包含手机通讯录联系人(all) */ + includeMobileContactMode?: 'none' | 'known' | 'all' | string; + /** 是否包含自己 */ + includeMe?: boolean; + /** 最大选择人数,仅 chooseType 为 multi 时才有效 */ + multiChooseMax?: number; + /** 多选达到上限的文案,仅 chooseType 为 multi 时才有效 */ + multiChooseMaxTips?: string; + + success(result: { + contactsDicArray: ContactsDic[]; + }): void; + } + /** + * 唤起选人组件,默认只包含支付宝联系人,可以通过修改参数包含手机通讯录联系人或者双向通讯录联系人。 + */ + function chooseContact(options: ChooseContactOptions): void; + //#endregion + + //#region 选择城市 https://docs.alipay.com/mini/api/ui-city + interface City { + city: string; // 城市名 + adCode: string; // 行政区划代码 + spell?: string; // 城市名对应拼音拼写,方便用户搜索 + } + interface ChooseCityOptions extends BaseOptions { + showLocatedCity: boolean; // 是否显示当前定位城市,默认 false + showHotCities: boolean; // 是否显示热门城市,默认 true + cities: City[]; // 自定义城市列表,列表内对象字段见下表 + hotCities: City[]; // 自定义热门城市列表,列表内对象字段见下表 + success(result: { city: string; adCode: string; }): void; + } + /** + * 打开城市选择列表 + * + * 如果用户没有选择任何城市直接点击了返回,将不会触发回调函数。 + */ + function chooseCity(options: Partial): void; + //#endregion + + //#region 选择日期 https://docs.alipay.com/mini/api/ui-date + interface DatePickerOptions extends BaseOptions { + /** + * 返回的日期格式, + * 1. yyyy-MM-dd(默认) + * 2. HH:mm + * 3. yyyy-MM-dd HH:mm + * 4. yyyy-MM (最低基础库:1.1.1, 可用 canIUse('datePicker.object.format.yyyy-MM') 判断) + * 5. yyyy (最低基础库:1.1.1,可用 canIUse('datePicker.object.format.yyyy') 判断) + */ + format: 'yyyy-MM-dd' | 'HH:mm' | 'yyyy-MM-dd HH:mm' | 'yyyy-MM' | 'yyyy'; + /** 初始选择的日期时间,默认当前时间 */ + currentDate: string; + /** 最小日期时间 */ + startDate: string; + /** 最大日期时间 */ + endDate: string; + success(result: { date: string; }): void; + /** 11 用户取消操作 */ + fail(error: 11): void; + } + /** + * 打开日期选择列表 + */ + function datePicker(optiosn: Partial): void; + //#endregion + + //#region 动画 https://docs.alipay.com/mini/api/ui-animation + type TimingFunction = + | "linear" + | "ease" + | "ease-in" + | "ease-in-out" + | "ease-out" + | "step-start" + | "step-end"; + interface CreateAnimationOptions { + /** 动画持续时间,单位ms,默认值 400 */ + duration: number; + /** 定义动画的效果,默认值"linear",有效值:"linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end" */ + timeFunction: TimingFunction; + /** 动画持续时间,单位 ms,默认值 0 */ + delay: number; + /** 设置transform-origin,默认为"50% 50% 0" */ + transformOrigin: string; + } + interface Animator { + actions: AnimationAction[]; + } + interface AnimationAction { + animates: Animate[]; + option: AnimationActionOption; + } + interface AnimationActionOption { + transformOrigin: string; + transition: AnimationTransition; + } + interface AnimationTransition { + delay: number; + duration: number; + timingFunction: TimingFunction; + } + interface Animate { + type: string; + args: any[]; + } + /** + * 创建动画实例 animation。调用实例的方法来描述动画,最后通过动画实例的export方法将动画数据导出并传递给组件的animation属性。 + * + * 注意: export 方法每次调用后会清掉之前的动画操作 + */ + function createAnimation(options: Partial): Animation; + /** 动画实例可以调用以下方法来描述动画,调用结束后会返回自身,支持链式调用的写法。 */ + interface Animation { + /** + * 调用动画操作方法后要调用 step() 来表示一组动画完成, + * 可以在一组动画中调用任意多个动画方法, + * 一组动画中的所有动画会同时开始, + * 一组动画完成后才会进行下一组动画。 + * @param options 指定当前组动画的配置 + */ + step(options?: CreateAnimationOptions): void; + /** + * 导出动画操作 + * + * 注意: export 方法每次调用后会清掉之前的动画操作 + */ + export(): Animator; + /** 透明度,参数范围 0~1 */ + opacity(value: number): Animation; + /** 颜色值 */ + backgroundColor(color: string): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + width(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + height(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + top(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + left(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + bottom(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + right(length: number): Animation; + /** deg的范围-180~180,从原点顺时针旋转一个deg角度 */ + rotate(deg: number): Animation; + /** deg的范围-180~180,在X轴旋转一个deg角度 */ + rotateX(deg: number): Animation; + /** deg的范围-180~180,在Y轴旋转一个deg角度 */ + rotateY(deg: number): Animation; + /** deg的范围-180~180,在Z轴旋转一个deg角度 */ + rotateZ(deg: number): Animation; + /** 同transform-function rotate3d */ + rotate3d(x: number, y: number, z: number, deg: number): Animation; + /** + * 一个参数时,表示在X轴、Y轴同时缩放sx倍数; + * 两个参数时表示在X轴缩放sx倍数,在Y轴缩放sy倍数 + */ + scale(sx: number, sy?: number): Animation; + /** 在X轴缩放sx倍数 */ + scaleX(sx: number): Animation; + /** 在Y轴缩放sy倍数 */ + scaleY(sy: number): Animation; + /** 在Z轴缩放sy倍数 */ + scaleZ(sz: number): Animation; + /** 在X轴缩放sx倍数,在Y轴缩放sy倍数,在Z轴缩放sz倍数 */ + scale3d(sx: number, sy: number, sz: number): Animation; + /** + * 一个参数时,表示在X轴偏移tx,单位px; + * 两个参数时,表示在X轴偏移tx,在Y轴偏移ty,单位px。 + */ + translate(tx: number, ty?: number): Animation; + /** + * 在X轴偏移tx,单位px + */ + translateX(tx: number): Animation; + /** + * 在Y轴偏移tx,单位px + */ + translateY(ty: number): Animation; + /** + * 在Z轴偏移tx,单位px + */ + translateZ(tz: number): Animation; + /** + * 在X轴偏移tx,在Y轴偏移ty,在Z轴偏移tz,单位px + */ + translate3d(tx: number, ty: number, tz: number): Animation; + /** + * 参数范围-180~180; + * 一个参数时,Y轴坐标不变,X轴坐标延顺时针倾斜ax度; + * 两个参数时,分别在X轴倾斜ax度,在Y轴倾斜ay度 + */ + skew(ax: number, ay?: number): Animation; + /** 参数范围-180~180;Y轴坐标不变,X轴坐标延顺时针倾斜ax度 */ + skewX(ax: number): Animation; + /** 参数范围-180~180;X轴坐标不变,Y轴坐标延顺时针倾斜ay度 */ + skewY(ay: number): Animation; + /** + * 同transform-function matrix + */ + matrix( + a: number, + b: number, + c: number, + d: number, + tx: number, + ty: number + ): Animation; + /** 同transform-function matrix3d */ + matrix3d( + a1: number, + b1: number, + c1: number, + d1: number, + a2: number, + b2: number, + c2: number, + d2: number, + a3: number, + b3: number, + c3: number, + d3: number, + a4: number, + b4: number, + c4: number, + d4: number + ): Animation; + } + //#endregion + + //#region 画布 https://docs.alipay.com/mini/api/ui-canvas + interface ToTempFilePathOptions extends BaseOptions { + x: number; // 画布 x 轴起点,默认为 0 + y: number; // 画布 y 轴起点,默认为 0 + width: number; // 画布宽度,默认为 canvas 宽度 - x + height: number; // 画布高度,默认为 canvas 高度 - y + destWidth: number; // 输出的图片宽度,默认为 width + destHeight: number; // 输出的图片高度,默认为 height + } + type Color = string | number[] | number | CanvasAction; + + interface CanvasAction { + /** + * 创建一个颜色的渐变点。 + * 小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染。 + * + * @param stop 渐变点位置,值必须在 [0,1] 范围内 + * @param color 颜色值 + */ + addColorStop(stop: number, color: Color): void; + } + + interface TextMetrics { + width: number; + } + + interface ConvasContext { + font: string; + /** + * 把当前画布的内容导出生成图片,并返回文件路径。 + */ + toTempFilePath(options?: Partial): void; + /** + * textAlign 是 Canvas 2D API 描述绘制文本时,文本的对齐方式的属性。注意,该对齐是基于 + * CanvasRenderingContext2D.fillText 方法的x的值。所以如果 textAlign="center",那么该文本将画在 x-50%*width + */ + setTextAlign(textAlign: 'left' | 'right' | 'center' | 'start' | 'end'): void; + /** + * textBaseline 是 Canvas 2D API 描述绘制文本时,当前文本基线的属性。 + */ + setTextBaseline(textBaseline: 'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom'): void; + /** + * 设置填充色。 + * + * 如果没有设置 fillStyle,则默认颜色为 black。 + */ + setFillStyle(color: Color): void; + /** + * 设置边框颜色。 + * + * 如果没有设置 strokeStyle,则默认颜色为 black。 + */ + setStrokeStyle(color: Color): void; + /** + * 设置阴影样式。 + * 如果没有设置,offsetX 的默认值为 0, offsetY 的默认值为 0, blur 的默认值为 0,color 的默认值为 black。 + * @param offsetX 阴影相对于形状水平方向的偏移 + * @param offsetY 阴影相对于形状竖直方向的偏移 + * @param blur 0~100 阴影的模糊级别,值越大越模糊 + * @param color 阴影颜色 + */ + setShadow(offsetX: number, offsetY: number, blur: number, color: Color): void; + + /** + * 创建一个线性的渐变色。 + * + * @param x0 起点 x 坐标 + * @param y0 起点 y 坐标 + * @param x1 终点 x 坐标 + * @param y1 终点 y 坐标 + */ + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasAction; + + /** + * 创建一个圆形的渐变色。 + * 起点在圆心,终点在圆环。 + * 需要使用 addColorStop() 来指定渐变点,至少需要两个。 + * @param x 圆心 x 坐标 + * @param y 圆心 y 坐标 + * @param r 圆半径 + * @returns + */ + createCircularGradient(x: number, y: number, r: number): CanvasAction; + + /** + * 设置线条的宽度。 + * @param lineWidth 线条宽度,单位为 px + */ + setLineWidth(lineWidth: number): void; + + /** + * 设置线条的端点样式。 + * + * @param lineCap 线条的结束端点样式 + */ + setLineCap(lineCap: 'round' | 'butt' | 'square'): void; + + /** + * 设置线条的交点样式。 + * + * @param lineJoin 线条的结束交点样式 + */ + setLineJoin(lineJoin: 'round' | 'bevel' | 'miter'): void; + + /** + * 设置最大斜接长度,斜接长度指的是在两条线交汇处内角和外角之间的距离。 当 setLineJoin() 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示 + * + * @param miterLimit 最大斜接长度 + */ + setMiterLimit(miterLimit: number): void; + + /** + * 创建一个矩形。 + * + * @param x 矩形左上角的 x 坐标 + * @param y 矩形左上角的 y 坐标 + * @param width 矩形路径宽度 + * @param height 矩形路径高度 + */ + rect(x: number, y: number, width: number, height: number): void; + + /** + * 填充矩形。 + * 用 setFillStyle() 设置矩形的填充色,如果没设置则默认是 black。 + * @param x 矩形左上角的 x 坐标 + * @param y 矩形左上角的 y 坐标 + * @param width 矩形路径宽度 + * @param height 矩形路径高度 + */ + fillRect(x: number, y: number, width: number, height: number): void; + + /** + * 画一个矩形(非填充)。 + * 用 setFillStroke() 设置矩形线条的颜色,如果没设置默认是 black。 + * @param x 矩形左上角的 x 坐标 + * @param y 矩形左上角的 y 坐标 + * @param width 矩形路径宽度 + * @param height 矩形路径高度 + */ + strokeRect(x: number, y: number, width: number, height: number): void; + + /** + * 清除画布上在该矩形区域内的内容。 + * clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,可以对 canvas 加了一层背景色。 + * @param x 矩形左上角的 x 坐标 + * @param y 矩形左上角的 y 坐标 + * @param width 矩形路径宽度 + * @param height 矩形路径高度 + */ + clearRect(x: number, y: number, width: number, height: number): void; + + /** + * 对当前路径中的内容进行填充。默认的填充色为黑色。 + * + */ + fill(): void; + + /** + * 画出当前路径的边框。默认 black。 + * stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去 + */ + stroke(): void; + + /** + * 关闭一个路径 + * 关闭路径会连接起点和终点。 + * 如果关闭路径后没有调用 fill() 或者 stroke() 并开启了新的路径,那之前的路径将不会被渲染。 + */ + beginPath(): void; + + /** + * 关闭一个路径 + * 关闭路径会连接起点和终点。 + * + */ + closePath(): void; + + /** + * 把路径移动到画布中的指定点,不创建线条。 + * 用 stroke() 方法来画线条 + * @param x 目标位置 x 坐标 + * @param y 目标位置 y 坐标 + */ + moveTo(x: number, y: number): void; + + /** + * lineTo 方法增加一个新点,然后创建一条从上次指定点到目标点的线。 + * 用 stroke() 方法来画线条 + * + * @param x 目标位置 x 坐标 + * @param y 目标位置 y 坐标 + */ + lineTo(x: number, y: number): void; + + /** + * 画一条弧线。 + * 创建一个圆可以用 arc() 方法指定其实弧度为0,终止弧度为 2 * Math.PI。 + * + * @param x + * @param y + * @param r + * @param sAngle + * @param eAngle + */ + arc(x: number, y: number, r: number, sAngle: number, eAngle: number): void; + + /** + * 创建三次方贝塞尔曲线路径。 + * 曲线的起始点为路径中前一个点。 + * @param cp1x + * @param cp1y + * @param cp2x + * @param cp2y + * @param x + * @param y + */ + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + + /** + * 将当前创建的路径设置为当前剪切路径。 + * + */ + clip(): void; + + /** + * 创建二次贝塞尔曲线路径。 + * 曲线的起始点为路径中前一个点。 + * @param cpx 贝塞尔控制点 x 坐标 + * @param cpy 贝塞尔控制点 y 坐标 + * @param x 结束点 x 坐标 + * @param y 结束点 y 坐标 + */ + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + + /** + * 在调用scale方法后,之后创建的路径其横纵坐标会被缩放。多次调用scale,倍数会相乘。 + * + * @param scaleWidth 横坐标缩放倍数 (1 = 100%,0.5 = 50%,2 = 200%) + * @param scaleHeight 纵坐标轴缩放倍数 (1 = 100%,0.5 = 50%,2 = 200%) + */ + scale(scaleWidth: number, scaleHeight: number): void; + + /** + * 以原点为中心,原点可以用 translate方法修改。顺时针旋转当前坐标轴。多次调用rotate,旋转的角度会叠加。 + * + * @param rotate 旋转角度,以弧度计(degrees * Math.PI/180;degrees 范围为0~360) + */ + rotate(rotate: number): void; + + /** + * 对当前坐标系的原点(0, 0)进行变换,默认的坐标系原点为页面左上角。 + * + * @param x 水平坐标平移量 + * @param y 竖直坐标平移量 + */ + translate(x: number, y: number): void; + + /** + * 设置字体大小。 + * + * @param fontSize 字号 + */ + setFontSize(fontSize: number): void; + + /** + * 在画布上绘制被填充的文本。 + * + * @param text 文本 + * @param x 绘制文本的左上角 x 坐标 + * @param y 绘制文本的左上角 y 坐标 + */ + fillText(text: string, x: number, y: number): void; + + /** + * 绘制图像,图像保持原始尺寸。 + * + * @param imageResource 图片资源, 只支持线上 cdn 地址或离线包地址,线上 cdn 需返回头 Access-Control-Allow-Origin: * + * @param x 图像左上角 x 坐标 + * @param y 图像左上角 y 坐标 + * @param width 图像宽度 + * @param height 图像高度 + */ + drawImage(imageResource: string, x: number, y: number, width: number, height: number): void; + + /** + * 设置全局画笔透明度。 + * + * @param alpha 透明度,0 表示完全透明,1 表示不透明 范围 [0, 1] + */ + setGlobalAlpha(alpha: number): void; + + /** + * 设置虚线的样式 + * + * @param segments 一组描述交替绘制线段和间距(坐标空间单位)长度的数字。 如果数组元素的数量是奇数, 数组的元素会被复制并重复。例如, [5, 15, 25] 会变成 [5, 15, 25, 5, 15, 25]。 + */ + setLineDash(segments: number[]): void; + + /** + * 使用矩阵多次叠加当前变换的方法,矩阵由方法的参数进行描述。你可以缩放、旋转、移动和倾斜上下文。 + * + * @param scaleX 水平缩放 + * @param skewX 水平倾斜 + * @param skewY 垂直倾斜 + * @param scaleY 垂直缩放 + * @param translateX 水平移动 + * @param translateY 垂直移动 + */ + transform(scaleX: number, skewX: number, skewY: number, scaleY: number, translateX: number, translateY: number): void; + + /** + * 使用单位矩阵重新设置(覆盖)当前的变换并调用变换的方法,此变换由方法的变量进行描述。 + * + * @param scaleX 水平缩放 + * @param skewX 水平倾斜 + * @param skewY 垂直倾斜 + * @param scaleY 垂直缩放 + * @param translateX 水平移动 + * @param translateY 垂直移动 + */ + setTransform(scaleX: number, skewX: number, skewY: number, scaleY: number, translateX: number, translateY: number): void; + + /** + * 保存当前的绘图上下文。 + * + */ + save(): void; + + /** + * 恢复之前保存的绘图上下文。 + */ + restore(): void; + + /** + * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。 + * 绘图上下文需要由 my.createCanvasContext(canvasId) 来创建。 + * @param [reserve] 本次绘制是否接着上一次绘制,即 reserve 参数为 false 时则在本次调用 drawCanvas绘制之前 native 层应先清空画布再继续绘制;若 reserver 参数为true 时,则保留当前画布上的内容,本次调用drawCanvas绘制的内容覆盖在上面,默认 false + */ + draw(reserve?: boolean): void; + + measureText(text: string): TextMetrics; + } + /** + * 创建 canvas 绘图上下文 + * + * 该绘图上下文只作用于对应 canvasId 的 + */ + function createCanvasContext(canvasId: string): ConvasContext; + //#endregion + + //#region 地图 https://docs.alipay.com/mini/api/ui-map + interface GetCenterLocationOptions extends BaseOptions { + success?(res: { longitude: string; latitude: string; }): void; + } + + interface MapContext extends BaseOptions { + /** + * 获取当前地图中心的经纬度,返回 gcj02 坐标系的值,可以用于 my.openLocation + * + * @param options + */ + getCenterLocation(options: GetCenterLocationOptions): void; + /** + * 将地图中心移动到当前定位点,需要配合 map 组件的 show-location 使用 + */ + moveToLocation(): void; + } + + /** + * 创建并返回一个 map 上下文对象 mapContext。 + * + * @param mapId + * @returns + */ + function createMapContext(mapId: string): MapContext; + + //#endregion + + //#region 键盘 https://docs.alipay.com/mini/api/ui-hidekeyboard + /** + * 隐藏键盘 + * + */ + function hideKeyboard(): void; + //#endregion + + //#region 滚动 https://docs.alipay.com/mini/api/scroll + interface PageScrollToOptions { + scrollTop: number; // 滚动到页面的目标位置,单位 px + } + + /** + * 滚动到页面的目标位置 + * + * @param options + */ + function pageScrollTo(options: PageScrollToOptions): void; + //#endregion + + //#region 节点查询 https://docs.alipay.com/mini/api/selector-query + interface RectArea { + /** 节点的左边界坐标 */ + left: number; + /** 节点的右边界坐标 */ + right: number; + /** 节点的上边界坐标 */ + top: number; + /** 节点的下边界坐标 */ + bottom: number; + /** 节点的宽度 */ + width: number; + /** 节点的高度 */ + height: number; + } + interface NodesRefRect extends RectArea { + /** 节点的ID */ + id: string; + /** 节点的dataset */ + dataset: any; + } + interface NodeRefOffset { + /** 节点的ID */ + id: string; + /** 节点的dataset */ + dataset: any; + /** 节点的水平滚动位置 */ + scrollLeft: number; + /** 节点的竖直滚动位置 */ + scrollTop: number; + } + interface NodesRef { + /** + * 添加节点的布局位置的查询请求,相对于显示区域,以像素为单位。 + * 其功能类似于DOM的getBoundingClientRect。 + * 返回值是nodesRef对应的selectorQuery。 + * 返回的节点信息中,每个节点的位置用 + * left、right、top、bottom、width、height字段描述。 + * 如果提供了callback回调函数,在执行selectQuery的exec方法后 + * 节点信息会在callback中返回。 + */ + boundingClientRect( + callback?: (rect: T) => void + ): SelectorQuery; + /** + * 添加节点的滚动位置查询请求,以像素为单位。 + * 节点必须是scroll-view或者viewport。 + * 返回值是nodesRef对应的selectorQuery。 + * 返回的节点信息中,每个节点的滚动位置用scrollLeft、scrollHeight字段描述。 + * 如果提供了callback回调函数,在执行selectQuery的exec方法后,节点信息会在callback中返回。 + */ + scrollOffset(callback?: (rect: NodeRefOffset) => void): SelectorQuery; + // /** + // * 获取节点的相关信息,需要获取的字段在fields中指定。 + // * 返回值是nodesRef对应的selectorQuery。 + // */ + // fields( + // fields: NodeRefFieldsOptions, + // callback?: (result: any) => void + // ): SelectorQuery; + } + /** + * SelectorQuery对象实例 + */ + interface SelectorQuery { + // /** + // * 将选择器的选取范围更改为自定义组件component内 + // * (初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点 + // * @version 1.6.0 + // */ + // in(component: Component): SelectorQuery; + /** + * 在当前页面下选择第一个匹配选择器selector的节点,返回一个NodesRef对象实例,可以用于获取节点信息。 + * selector类似于CSS的选择器,但仅支持下列语法。 + * + ID选择器:#the-id + * + class选择器(可以连续指定多个):.a-class.another-class + * + 子元素选择器:.the-parent > .the-child + * + 后代选择器:.the-ancestor .the-descendant + * + 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant + * + 多选择器的并集:#a-node, .some-other-nodes + */ + select(selector: string): NodesRef; + /** + * 在当前页面下选择匹配选择器selector的节点,返回一个NodesRef对象实例。 + * 与selectorQuery.selectNode(selector)不同的是,它选择所有匹配选择器的节点。 + */ + selectAll(selector: string): NodesRef; + /** + * 选择显示区域,可用于获取显示区域的尺寸、滚动位置等信息 + * 返回一个NodesRef对象实例。 + */ + selectViewport(): NodesRef; + /** + * 执行所有的请求 + * 请求结果按请求次序构成数组,在callback的第一个参数中返回。 + */ + exec(callback?: (result: any[]) => void): void; + } + /** + * 获取一个节点查询对象 SelectorQuery。 + * + * @param page 可以指定 page 属性,默认为当前页面 + * @returns + */ + function createSelectorQuery(page?: any): SelectorQuery; + //#endregion + + //#region 级联选择 https://docs.alipay.com/mini/api/ewdxl3 + interface MultiLevelSelectItem { + name: string; + subList?: MultiLevelSelectItem[]; + } + interface MultiLevelSelectOptions extends BaseOptions { + title?: string; // 标题 + list?: MultiLevelSelectItem[]; // 选择数据列表 + name?: string; // 条目名称 + subList?: MultiLevelSelectItem[]; // 子条目列表 + success?(res: { + success: boolean; // 是否选择完成,取消返回false + result: MultiLevelSelectItem[]; // 选择的结果,如[{“name”:”杭州市”},{“name”:”上城区”},{“name”:”古翠街道”}] + }): void; + } + + function multiLevelSelect(options?: MultiLevelSelectOptions): void; + //#endregion +} + +// 开放接口 +declare namespace my { + //#region 用户授权 https://docs.alipay.com/mini/api/openapi-authorize + interface GetAuthCodeOptions extends BaseOptions { + scopes?: string | string[]; // 授权类型,默认 auth_base。支持 auth_base(静默授权)/ auth_user(主动授权) / auth_zhima(芝麻信用) + success?(res: { + authCode: string; // 授权码 + authErrorScope: { + [scope: string]: number; + }; // 失败的授权类型,key是授权失败的 scope,value 是对应的错误码 + authSucessScope: string[]; // 成功的授权 scope + }): void; + } + /** + * 获取授权码。 + * 详细用户授权接入参考 [指引](https://docs.alipay.com/mini/introduce/auth)。 + */ + function getAuthCode(options: GetAuthCodeOptions): void; + //#endregion + + //#region 客户端获取会员信息 https://docs.alipay.com/mini/api/userinfo + interface GetAuthUserInfoOptions extends BaseOptions { + success?(res: { + nickName: string; // 用户昵称 + avatar: string; // 用户头像链接 + }): void; + } + /** + * 客户端获取会员信息 + * 获取会员信息首先需要获取用户授权,详细会员信息获取参考[指引](https://docs.alipay.com/mini/introduce/auth),采用 jsapi 调用的方式。 + */ + function getAuthUserInfo(options: GetAuthUserInfoOptions): void; + //#endregion + + //#region 小程序唤起支付 https://docs.alipay.com/mini/api/openapi-pay + interface TradePayOptions extends BaseOptions { + tradeNO?: string; // 接入小程序支付时传入此参数。此参数为支付宝交易号 + success?(res: { + // resultCode | 描述 + // -----------|------ + // 9000 | 订单支付成功 + // 8000 | 正在处理中 + // 4000 | 订单支付失败 + // 6001 | 用户中途取消 + // 6002 | 网络连接出错 + // 6004 | 支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态 + // 99 | 用户点击忘记密码导致快捷界面退出(only iOS) + resultCode: string; + }): void; + } + /** + * 发起支付。 + * 详细接入支付方式参考[指引](https://docs.alipay.com/mini/introduce/pay)。 + * @param options + */ + function tradePay(options: TradePayOptions): void; + //#endregion + + //#region 支付代扣签约 https://docs.alipay.com/mini/api/pay-sign + interface PaySignCenterOptions extends BaseOptions { + signStr: string; // 签约字符串 + } + + /** + * 签约中心 + * + * 返回码 | 含义 + * ------|------ + * 7000 | 协议签约成功 + * 7001 | 签约结果未知(有可能已经签约成功),请根据外部签约号查询签约状态 + * 7002 | 协议签约失败 + * 6001 | 用户中途取消 + * 6002 | 网络连接错误 * @param options + */ + function paySignCenter(options: PaySignCenterOptions): void; + //#endregion + + //#region 小程序二维码 https://docs.alipay.com/mini/api/openapi-qrcode + // @see https://docs.alipay.com/mini/api/openapi-qrcode + // @see https://docs.alipay.com/mini/introduce/qrcode + //#endregion + + //#region 跳转支付宝卡包 https://docs.alipay.com/mini/api/card-voucher-ticket + /** + * 打开支付宝卡列表。 + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + */ + function openCardList(): void; + interface OpenMerchantCardList extends BaseOptions { + partnerId: string; // 商户编号 + } + + /** + * 打开支付宝卡列表。 + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + * @param options + */ + function openMerchantCardList(options: OpenMerchantCardList): void; + + interface OpenCardDetailOptions extends BaseOptions { + passId: string; // 卡实例Id + } + /** + * 打开当前用户的某张卡的详情页 + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + * + * passId获取方式: + * 1)通过alipass创建的卡 + * 调用alipay.pass.instance.add(支付宝pass新建卡券实例接口)接口,在出参“result”中可获取 + * 2)通过会员卡创建的卡 + * 调用alipay.marketing.card.query(会员卡查询)接口,在schema_url中可获取,具体参数为“p=xxx”,xxx即为passId。 + */ + function openCardDetail(options: OpenCardDetailOptions): void; + + /** + * 打开支付宝券列表 + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + * + * @param options + */ + function openVoucherList(): void; + + interface OpenMerchantVoucherListOptions extends BaseOptions { + partnerId: string; // 商户编号 + } + /** + * 打开当前用户的某个商户的券列表 + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + */ + function openMerchantVoucherList(options: OpenMerchantVoucherListOptions): void; + + interface OpenVoucherDetailOptions1 extends BaseOptions { + passId: string; // 券实例Id,调用券发放接口可以获取该参数(如果传入了partnerId和serialNumber则不需传入) + } + interface OpenVoucherDetailOptions2 extends BaseOptions { + partnerId: string; // 商户编号,以 2088 为开头(如果传入了passId则不需传入) + serialNumber: string; // 序列号,调用新建卡券模板可以获取该参数(如果传入了passId则不需传入) + } + /** + * 打开当前用户的某张券的详情页(非口碑) + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + */ + function openVoucherDetail(options: OpenVoucherDetailOptions1 | OpenVoucherDetailOptions2): void; + + interface OpenKBVoucherDetailOptions1 extends BaseOptions { + passId: string; // 卡实例Id(如果传入了partnerId和serialNumber则不需传入) + } + interface OpenKBVoucherDetailOptions2 extends BaseOptions { + partnerId: string; // 商户编号(如果传入了passId则不需传入) + serialNumber: string; // 序列号(如果传入了passId则不需传入) + } + /** + * 打开当前用户的某张券的详情页(口碑) + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + */ + function openKBVoucherDetail(options: OpenKBVoucherDetailOptions1 | OpenKBVoucherDetailOptions2): void; + + /** + * 打开支付宝票列表。 + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + */ + function openTicketList(): void; + + interface OpenMerchantTicketListOptions extends BaseOptions { + partnerId: string; // 商户编号 + } + /** + * 打开某个商户的票列表 + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + */ + function openMerchantTicketList(options: OpenMerchantTicketListOptions): void; + + interface OpenTicketDetailOptions1 extends BaseOptions { + passId: string; // 卡实例Id(如果传入了partnerId和serialNumber则不需要传入passId) + } + interface OpenTicketDetailOptions2 extends BaseOptions { + partnerId: string; // 商户编号(如果传入了passId则不需要传入partnerId) + serialNumber: string; // 序列号(如果传入了passId则不需要传入serialNumber) + } + /** + * 打开当前用户的某张票的详情页 + * + * 有关支付宝卡包详细功能,见[支付宝卡包产品介绍](https://docs.alipay.com/mini/introduce/voucher) + */ + function openTicketDetail(options: OpenTicketDetailOptions1 | OpenTicketDetailOptions2): void; + //#endregion + + //#region 会员开卡授权 https://docs.alipay.com/mini/api/add-card-auth + interface AddCardAuthResult { + success: true | boolean; // true 表示领卡成功 + resultStatus: string; // 9000 表示成功 + result: { + app_id: string; // 应用id + auth_code: string; // 授权码,用于换取authtoken + state: string; // 授权的state + scope: string; // 授权scope + template_id: string; // 会员卡模板Id + request_id: string; // 会员卡表单信息请求Id + out_string: string; // 会员卡领卡链接透传参数 + }; + } + interface AddCardAuthResult { + success: false | boolean; // false 表示领卡失败 + /** + * 失败的错误码 + * 领卡失败 code 说明 + * 名称 | 类型 | 说明 + * -----|-----|----- + * JSAPI_SERVICE_TERMINATED | String | 用户取消 + * JSAPI_PARAM_INVALID | String | url 为空或非法参数 + * JSAPI_SYSTEM_ERROR | String | 系统错误 + */ + code: string; + } + interface AddCardAuthOptions extends BaseOptions { + /** + * 开卡授权的页面地址,从alipay.marketing.card.activateurl.apply接口获取 + */ + url: string; + success?(res: AddCardAuthResult): void; + } + /** + * 小程序唤起会员开卡授权页面,小程序接入会员卡[点此查看](https://docs.alipay.com/mini/introduce/card) + */ + function addCardAuth(options: AddCardAuthOptions): void; + //#endregion + + //#region 芝麻认证 https://docs.alipay.com/mini/api/zm-service + interface StartZMVerifyOptions extends BaseOptions { + bizNo: string; // 认证标识 + success?(res: { + token: string; // 认证标识 + passed: string; // 认证是否通过 + reason?: string; // 认证不通过原因 + }): void; + } + /** + * 芝麻认证接口,调用此接口可以唤起芝麻认证页面并进行人脸身份验证。 + * 有关芝麻认证的产品和接入介绍,详见 [芝麻认证](https://docs.alipay.com/mini/introduce/zm-verify)。 + * 需要通过蚂蚁开发平台,调用certification.initialize接口进行[认证初始化](https://docs.alipay.com/zmxy/271/105914)。获得biz_no 后,方能通过以下接口激活芝麻认证小程序。 + */ + function startZMVerify(options: StartZMVerifyOptions): void; + //#endregion + + //#region 信用借还 https://docs.alipay.com/mini/api/zmcreditborrow + interface ZMCreditBorrowOptions extends BaseOptions { + /** + * 外部订单号,需要唯一,由商户传入,芝麻内部会做幂等控制,格式为:yyyyMMddHHmmss+随机数 + * + */ + out_order_no: string; + /** + * 信用借还的产品码,传入固定值:w1010100000000002858 + */ + product_code: string; + /** + * 物品名称,最长不能超过14个汉字 + */ + goods_name: string; + /** + * 租金单位,租金+租金单位组合才具备实际的租金意义。 + * 取值定义如下: + * DAY_YUAN: 元 / 天 + * HOUR_YUAN: 元 / 小时 + * YUAN: 元 + * YUAN_ONCE: 元 / 次 + */ + rent_unit: string; + /** + * 租金,租金 + 租金单位组合才具备实际的租金意义。 + * > 0.00元,代表有租金 + * = 0.00元,代表无租金,免费借用 + * 注:参数传值必须 >= 0,传入其他值会报错参数非法 + */ + rent_amount: string; + /** + * 押金,金额单位:元。 + * 注:不允许免押金的用户按此金额支付押金;当物品丢失时,赔偿金额不得高于该金额。 + */ + deposit_amount: string; + /** + * 该字段目前默认传Y; + * 是否支持当借用用户信用不够(不准入)时,可让用户支付押金借用: + * Y: 支持 + * N: 不支持 + * 注:支付押金的金额等同于deposit_amount。 + */ + deposit_state?: string; // 该字段目前默认传Y; + /** + * 回调到商户的小程序schema地址。说明:商户的回调地址可以在商户后台里进行配置,服务端回调时,首先根据参数:invoke_type 查询是否有对应的配置地址,如果有,则使用已定义的地址,否则,使用该字段定义的地址执行回调; + * 参考表格下方的说明一; + * 小程序回调地址参考表格下方的说明三; + * 说明一: + * 支付宝商户账号登录我的商家服务打开入口链接; + * 商家服务中选择“您可能需要->信用借还”或者点击链接; + * 场景ID配置->配置新ID,选择对应的业务类型、服务类目和联盟,将生成的场景ID作为credit_biz的值传入即可; + * 回调地址配置->设置小程序回调地址,注意:若设置了该回调地址,则接口my.zmCreditBorrow中的入参invoke_return_url将会失效,以该处设置为准; + * 说明三: + * 小程序回调地址示例一:alipays://platformapi/startapp?appId=1999; + * 小程序回调地址示例二:alipays://platformapi/startapp?appId=1999&page=pages/map; + */ + invoke_return_url?: string; + /** + * 商户访问蚂蚁的对接模式,默认传TINYAPP: + * TINYAPP:回跳至小程序地址; + * WINDOWS:支付宝服务窗,默认值; + */ + invoke_type?: 'TINYAPP' | 'TINYAPP' | 'WINDOWS' | string; + /** + * 信用业务服务,注意:该字段不能为空,且必须根据说明的指引配置商户专属的场景ID,商户自助接入时,登录后台可配置场景ID,将后台配置的场景ID作为该字段的输入; + * 参考说明一自助进行配置; + */ + credit_biz: string; + /** + * 商户订单创建的起始借用时间,格式:YYYY - MM - DD HH: MM: SS。如果不传入或者为空,则认为订单创建起始时间为调用此接口时的时间。 + */ + borrow_time?: string; + /** + * 到期时间,不允许为空,请根据实际业务合理设置该值,格式:YYYY - MM - DD HH: MM: SS,是指最晚归还时间,表示借用用户如果超过此时间还未完结订单(未归还物品或者未支付租金)将会进入逾期状态,芝麻会给借用用户发送催收提醒;需要晚于borrow_time。 + */ + expiry_time: string; + /** + * 借用用户的手机号码,可选字段。推荐商户传入此值,会将此手机号码与用户身份信息进行匹配验证,防范欺诈风险。 + */ + mobile_no?: string; + /** + * 物品借用地点的描述,便于用户知道物品是在哪里借的。可为空 + * + */ + borrow_shop_name?: string; + /** + * 租金的结算方式,非必填字段,默认是支付宝租金结算支付 merchant:表示商户自行结算,信用借还不提供租金支付能力; alipay:表示使用支付宝支付功能,给用户提供租金代扣及赔偿金支付能力; + * + */ + rent_settle_type?: 'merchant' | 'alipay' | string; + /** + * 商户请求状态上下文。商户发起借用服务时,需要在借用结束后返回给商户的参数,格式:json; + * 如果json的某一项值包含中文,请使用encodeURIComponent对该值进行编码; + * @example + * var ext = { + * name: encodeURIComponent('名字') + * }; + * var obj = { + * invoke_state: JSON.stringify(ext) + * } + */ + invoke_state?: string; + /** + * 租金信息描述, 长度不超过14个汉字,只用于页面展示给C端用户,除此之外无其他意义。 + */ + rent_info?: string; + /** + * 借用用户的真实姓名,非必填字段。但name和cert_no必须同时非空,或者同时为空,一旦传入会对用户身份进行校验。 + */ + name?: string; + /** + * 借用用户的真实身份证号,非必填字段。但name和cert_no必须同时非空,或者同时为空,一旦传入会对用户身份进行校验。 + */ + cert_no?: string; + /** + * 借用用户的收货地址,可选字段,最大长度128。推荐商户传入此值,会将此手机号码与用户身份信息进行匹配验证,防范欺诈风险。 + */ + address?: string; + success?(res: { + /** + * 6001 用户取消了业务流程 + * 6002 网络异常 + * 9000 成功 + * 4000 系统异常 + */ + resultStatus: '6001' | '6002' | '9000' | '4000' | string; + result: { + /** + * 商户发起借用服务时传入的参数,需要在借用结束后返回给商户的参数 + * @example + * {"user_name":"john"} + */ + invoke_state: string; + /** + * 外部订单号,需要唯一,由商户传入,芝麻内部会做幂等控制,格式为:yyyyMMddHHmmss+4位随机数 + * @example + * 201610010000283627 + */ + out_order_no: string; + /** + * 芝麻信用借还订单号 + * @example + * 10020027631 + */ + order_no: string; + /** + * 是否准入:Y:准入;N:不准入(该字段目前无实际意义) + */ + admit_state: 'Y' | 'N' | string; + /** + * 物品借用/租赁者的用户id + * @example + * 2088202924240029 + */ + user_id: string; + callbackData: any; // todo only in example + } + }): void; + } + function zmCreditBorrow(options: ZMCreditBorrowOptions): void; + //#endregion + + //#region 文本风险识别 https://docs.alipay.com/mini/api/text-identification + type TextRiskIdentificationType = 'keyword' | '0' | '1' | '2' | '3' | string; + interface TextRiskIdentificationOptions extends BaseOptions { + /** + * 需要进行风险识别的文本内容 + */ + content: string; + /** + * 识别类型:keyword 表示关键词、0 表示广告、1表示涉政、2表示涉黄、3表示低俗辱骂 + */ + type: TextRiskIdentificationType[]; + success?(res: { + result: { + /** + * 目标内容文本识别到的类型,keyword 表示关键词、0 表示广告、1表示涉政、2表示涉黄、3表示低俗辱骂 + */ + type: TextRiskIdentificationType; + /** + * 仅当识别命中了 type 为 keyword 时,才会返回该字段 + */ + hitKeywords?: string[]; + /** + * 识别命中得分,最高分100分。仅当识别没有命中 keyword ,但入参中包含了广告或涉政或涉黄时,才会返回该字段 + */ + score?: string; + }; + fail?(res: { + /** + * 识别错误码 + */ + error: string; + /** + * 识别错误消息 + */ + errorMessage: string; + }): void; + }): void; + } + /** + * 文本风险识别, **支付宝客户端10.1.10及以上版本支持。**详细接入参考[指引](https://docs.alipay.com/mini/introduce/text-identification) + */ + function textRiskIdentification(options: TextRiskIdentificationOptions): void; + //#endregion + + //#region 小程序跳转 https://docs.alipay.com/mini/api/open-miniprogram + interface NavigateToMiniProgramOptions extends BaseOptions { + /** + * 要跳转的目标小程序appId + */ + appId: string; + /** + * 打开的页面路径,如果为空则打开首页 + */ + path?: string; + /** + * 需要传递给目标小程序的数据,目标小程序可在 App.onLaunch() ,App.onShow() 中获取到这份数据 + */ + extraData?: any; + /** + * 要打开的小程序版本,有效值 develop(开发版),trial(体验版),release(正式版) ,仅在当前小程序为开发版或体验版时此参数有效;如果当前小程序是正式版,则打开的小程序必定是正式版。默认值 release + */ + envVersion?: 'develop' | 'trial' | 'release' | string; + } + /** + * 跳转到其他小程序。详细接入参考[指引](https://docs.alipay.com/mini/introduce/open-miniprogram) + * @param options + */ + function navigateToMiniProgram(options: NavigateToMiniProgramOptions): void; + interface NavigateBackMiniProgramOptions extends BaseOptions { + /** + * 需要传递给目标小程序的数据,目标小程序可在 App.onLaunch(),App.onShow() 中获取到这份数据 + */ + extraData?: any; + } + /** + * 跳转回上一个小程序,只有当另一个小程序跳转到当前小程序时才会能调用成功 + */ + function navigateBackMiniProgram(options: NavigateBackMiniProgramOptions): void; + //#endregion + + //#region webview组件控制 https://docs.alipay.com/mini/api/webview-context + interface WebViewContext { + postMessage(param: any): void; + } + /** + * 创建并返回 web-view 上下文 webViewContext 对象。 + * + * @param webviewId 要创建的web-view所对应的id属性 + */ + function createWebViewContext(webviewId: string): WebViewContext; + //#endregion +} + +// 多媒体 +declare namespace my { + //#region 图片 https://docs.alipay.com/mini/api/media-image + type ImageSourceType = "album" | "camera"; + interface ChooseImageOptions extends BaseOptions { + /** 最大可选照片数,默认1张 */ + count: number; + /** 相册选取或者拍照,默认 [‘camera’,‘album’] */ + sourceType: ImageSourceType[]; + /** 成功则返回图片的本地文件路径列表 tempFilePaths */ + success(res: { + /** + * 图片文件描述 + */ + apFilePaths: string[]; + }): void; + } + /** + * 从本地相册选择图片或使用相机拍照。 + */ + function chooseImage(options: Partial): void; + + interface PreviewImageOptions extends BaseOptions { + /** 当当前显示图片索引,默认 0 */ + current?: number; + /** 要预览的图片链接列表 */ + urls: string[]; + } + /** + * 预览图片。 + */ + function previewImage(options: PreviewImageOptions): void; + + interface SaveImageOptions extends BaseOptions { + /** + * 要保存的图片链接 + */ + url: string; + success?(res: { errMsg: string }): void; + } + /** + * 保存在线图片到手机相册。 + */ + function saveImage(options: SaveImageOptions): void; + + interface CompressImageOptions extends BaseOptions { + /** + * 要压缩的图片地址数组 + */ + apFilePaths: string[]; + /** + * 压缩级别,支持 0 ~ 4 的整数,默认 4。详见「compressLevel表 说明表」 + * compressLevel表 + * compressLevel | 说明 + * --------------|----- + * 0 | 低质量 + * 1 | 中等质量 + * 2 | 高质量 + * 3 | 不压缩 + * 4 | 根据网络适应 + */ + compressLevel?: 0 | 1 | 2 | 3 | 4; + success?(res: { + /** + * 压缩后的路径数组 + */ + apFilePaths: string[]; + }): void; + } + /** + * 压缩图片。扫码体验: + */ + function compressImage(options: CompressImageOptions): void; + + interface GetImageInfoOptions extends BaseOptions { + /** + * 图片路径,目前支持: + * - 网络图片路径 + * - apFilePath路径 + * - 相对路径 + */ + src: string; + success?(res: { + width: number; // 图片宽度(单位px) + height: number; // 图片高度(单位px) + path: string; // 图片本地路径 + }): void; + } + /** + * 获取图片信息 + */ + function getImageInfo(options: GetImageInfoOptions): void; + //#endregion +} + +// 缓存 +declare namespace my { + //#region 缓存 https://docs.alipay.com/mini/api/storage + interface SetStorageOptions extends BaseOptions { + /** 本地缓存中的指定的 key */ + key: string; + /** 需要存储的内容 */ + data: any; + } + /** + * 将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的数据。 + * 这是异步接口。 + */ + function setStorage(options: SetStorageOptions): void; + + /** + * 同步将数据存储在本地缓存中指定的 key 中。 + * 这是同步接口。 + * + * @param key 本地缓存中的指定的 key + * @param data 需要存储的内容 + */ + function setStorageSync(options: { key: string; data: any; }): void; + + interface GetStorageOptions extends BaseOptions { + /** 本地缓存中的指定的 key */ + key: string; + /** 接口调用的回调函数,res = {data: key对应的内容} */ + success(res: DataResponse): void; + } + /** + * 获取缓存数据。 + * 这是异步接口。 + */ + function getStorage(options: GetStorageOptions): void; + + /** + * 同步获取缓存数据。 + * 这是同步接口 + */ + function getStorageSync(options: { key: string; }): any; + + interface RemoveStorageOptions extends BaseOptions { + key: string; + } + /** + * 删除缓存数据。 + * 这是异步接口。 + */ + function removeStorage(options: RemoveStorageOptions): void; + + /** + * 同步删除缓存数据。 + * 这是同步接口。 + * @param key 缓存数据的key + */ + function removeStorageSync(options: { key: string; }): void; + + /** + * 清除本地数据缓存。 + * 这是异步接口。 + */ + function clearStorage(): void; + + /** + * 同步清除本地数据缓存。 + * 这是同步接口。 + */ + function clearStorageSync(): void; + + interface StorageInfo { + /** + * 当前storage中所有的key + */ + keys: string[]; + /** + * 当前占用的空间大小, 单位kb + */ + currentSize: number; + /** + * 限制的空间大小,单位kb + */ + limitSize: number; + } + interface GetStorageInfoOptions extends BaseOptions { + success(res: StorageInfo): void; + } + /** + * 异步获取当前storage的相关信息 + */ + function getStorageInfo(options: GetStorageInfoOptions): void; + + function getStorageInfoSync(): StorageInfo; + //#endregion +} + +// 文件 +declare namespace my { + //#region 文件 https://docs.alipay.com/mini/api/file + interface SavedFileData { + /** 文件保存路径 */ + apFilePath: string; + } + interface SaveFileOptions extends BaseOptions { + /** 文件路径 */ + apFilePath: string; + success?(res: SavedFileData): void; + } + /** + * 保存文件到本地(本地文件大小总容量限制:10M) + */ + function saveFile(options: SaveFileOptions): void; + + interface GetFileInfoSuccess { + /** 文件大小,单位:B */ + size: number; + /** 摘要结果 */ + digest: string; + } + interface GetFileInfoOptions extends BaseOptions { + /** 文件路径 */ + apFilePath: string; + /** 摘要算法,支持md5和sha1,默认为md5 */ + digestAlgorithm?: 'md5' | 'sha1'; + success?(options: GetFileInfoSuccess): void; + } + /** + * 获取文件信息 + * 基础库版本 1.4.0 开始支持,低版本需做兼容处理 + */ + function getFileInfo(options: GetFileInfoOptions): void; + + interface SavedFileInfoData { + /** + * 文件大小,单位B + */ + size: number; + /** + * 创建时间 + */ + createTime: number; + } + interface GetSavedFileInfoOptions extends BaseOptions { + /** 文件路径 */ + apFilePath: string; + /** 接口调用成功的回调函数 */ + success?(res: SavedFileInfoData): void; + } + /** + * 获取保存的文件信息 + */ + function getSavedFileInfo(options: GetSavedFileInfoOptions): void; + + interface GetSavedFileListOptions extends BaseOptions { + success?(res: { + fileList: Array<{ + /** 文件大小 */ + size: number; + /** 创建时间 */ + createTime: number; + /** 文件路径 */ + apFilePath: string; + }> + }): void; + } + function getSavedFileList(options: GetSavedFileListOptions): void; + + type RemoveSavedFileOptions = GetSavedFileInfoOptions; + /** + * 删除某个保存的文件 + */ + function removeSavedFile(options: RemoveSavedFileOptions): void; + //#endregion +} + +// 位置 +declare namespace my { + //#region 位置 https://docs.alipay.com/mini/api/location + interface LocationData { + /** 经度 */ + longitude: string; + /** 纬度 */ + latitude: string; + /** 精确度,单位m */ + accuracy: string; + /** + * 水平精确度,单位m + */ + horizontalAccuracy: string; + /** + * 国家(type>0生效) + */ + country?: string; + /** + * 国家编号 (type>0生效) + */ + countryCode?: string; + /** + * 省份(type>0生效) + */ + province?: string; + /** + * 城市(type>0生效) + */ + city?: string; + /** + * 城市级别的地区代码(type>0生效) + */ + cityAdcode?: string; + /** + * 区县(type>0生效) + */ + district?: string; + /** + * 区县级别的地区代码(type>0生效) + */ + districtAdcode?: string; + /** + * 需要街道级别逆地理的才会有的字段,街道门牌信息,结构是:{ street, number } (type > 1生效) + */ + streetNumber?: { + street: string; + number: string; + }; + /** + * 需要POI级别逆地理的才会有的字段, 定位点附近的 POI 信息,结构是:{ name, address } (type > 2生效) + */ + pois?: Array<{ + name: string; + address: string; + }>; + } + interface GetLocationOptions extends BaseOptions { + /** + * 支付宝客户端经纬度定位缓存过期时间,单位秒。默认 30s。使用缓存会加快定位速度,缓存过期会重新定位 + */ + cacheTimeout: number; + /** + * 0:默认,获取经纬度 + * 1:获取经纬度和详细到区县级别的逆地理编码数据 + * 2:获取经纬度和详细到街道级别的逆地理编码数据,不推荐使用 + * 3:获取经纬度和详细到POI级别的逆地理编码数据,不推荐使用 + */ + type: 0 | 1 | 2 | 3; + /** 接口调用成功的回调函数,返回内容详见返回参数说明。 */ + success(res: LocationData): void; + } + /** + * 获取用户当前的地理位置信息 + */ + function getLocation(options: Partial): void; + + interface OpenLocationOptions extends BaseOptions { + /** 经度 */ + longitude: number | string; + /** 纬度 */ + latitude: number | string; + /** 位置名称 */ + name: string; + /** 地址的详细说明 */ + address: string; + /** 缩放比例,范围 3~19,默认为 15 */ + scale?: number; + } + /** + * 使用微信内置地图查看位置 + */ + function openLocation(options: OpenLocationOptions): void; + + interface ChooseLocationData { + /** + * 位置名称 + */ + name: string; + /** + * 详细地址 + */ + address: string; + /** + * 纬度,浮点数,范围为-90~90,负数表示南纬 + */ + latitude: number; + /** + * 经度,浮点数,范围为-180~180,负数表示西经 + */ + longitude: number; + } + interface ChooseLocationOptions extends BaseOptions { + success(res: ChooseLocationData): void; + } + /** + * 使用支付宝内置地图选择地理位置。 + */ + function chooseLocation(options: ChooseLocationOptions): void; + //#endregion +} + +// 网络 +declare namespace my { + //#region 网络 https://docs.alipay.com/mini/api/network + interface RequestHeader { + [key: string]: string; + } + interface RequestOptions extends BaseOptions { + /** 目标服务器url */ + url: string; + /** 设置请求的 HTTP 头,默认 {'Content-Type': 'application/x-www-form-urlencoded'} */ + header?: RequestHeader; + /** 默认GET,目前支持GET,POST */ + method?: "GET" | "POST"; + /** 请求的参数 */ + data?: any; + /** + * 超时时间,单位ms,默认30000 + */ + timeout?: number; + /** 期望返回的数据格式,默认json,支持json,text,base64 */ + dataType?: 'json' | 'text' | 'base64'; + /** 收到开发者服务成功返回的回调函数,res = {data: '开发者服务器返回的内容'} */ + success?(res: DataResponse): void; + } + function httpRequest(options: RequestOptions): void; + + interface UploadFileOptions extends BaseOptions { + /** 开发者服务器地址 */ + url: string; + /** 要上传文件资源的本地定位符 */ + filePath: string; + /** 文件名,即对应的 key, 开发者在服务器端通过这个 key 可以获取到文件二进制内容 */ + fileName: string; + /** + * 文件类型 + */ + fileType: 'image' | 'video' | 'audio'; + /** HTTP 请求 Header */ + header?: RequestHeader; + /** HTTP 请求中其他额外的 form 数据 */ + formData?: any; + success?(res: { + /** 服务器返回的数据 */ + data: string; + /** HTTP 状态码 */ + statusCode: string; + header: any; + }): void; + } + /** + * 上传本地资源到开发者服务器。 + */ + function uploadFile(options: UploadFileOptions): void; + + interface DownloadFileOptions extends BaseOptions { + /** 下载文件地址 */ + url: string; + /** HTTP 请求 Header */ + header?: RequestHeader; + /** 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} */ + success?(res: TempFileResponse): void; + } + /** + * 下载文件资源到本地。 + */ + function downloadFile(options: DownloadFileOptions): void; + + interface ConnectSocketOptions extends BaseOptions { + /** 目标服务器url */ + url: string; + /** 请求的参数 */ + data?: any; + /** 设置请求的头部 */ + header?: RequestHeader; + method?: 'GET' | 'POST'; // todo missing in api + } + /** + * 创建一个 WebSocket 的连接; + * 一个支付宝小程序同时只能保留一个 WebSocket 连接,如果当前已存在 WebSocket 连接,会自动关闭该连接,并重新创建一个新的 WebSocket 连接。 + */ + function connectSocket(options: ConnectSocketOptions): void; + + /** + * 监听WebSocket连接打开事件。 + */ + function onSocketOpen(callback: () => void): void; + + /** + * 监听WebSocket关闭。 + */ + function onSocketClose(callback: () => void): void; + + /** + * 取消监听WebSocket连接打开事件。 + */ + function offSocketOpen(callback: () => void): void; + + /** + * 监听WebSocket错误。 + */ + function onSocketError(callback: (error: any) => void): void; + + /** + * 取消监听WebSocket错误。 + */ + function offSocketError(callback: (error: any) => void): void; + + interface SendSocketMessageOptions extends BaseOptions { + /** + * 需要发送的内容:普通的文本内容 String 或者经 base64 编码后的 String + */ + data: string | ArrayBuffer; + /** + * 如果需要发送二进制数据,需要将入参数据经 base64 编码成 String 后赋值 data,同时将此字段设置为true,否则如果是普通的文本内容 String,不需要设置此字段 + */ + isBuffer?: boolean; + } + /** + * 通过 WebSocket 连接发送数据,需要先使用 my.connectSocket 发起建连,并在 my.onSocketOpen 回调之后再发送数据。 + */ + function sendSocketMessage(options: SendSocketMessageOptions): void; + + /** + * 监听WebSocket接受到服务器的消息事件。 + */ + function onSocketMessage(callback: (res: { + /** + * 需要发送的内容:普通的文本内容 String 或者经 base64 编码后的 String + */ + data: string | ArrayBuffer; + /** + * 如果需要发送二进制数据,需要将入参数据经 base64 编码成 String 后赋值 data,同时将此字段设置为true,否则如果是普通的文本内容 String,不需要设置此字段 + */ + isBuffer?: boolean; + }) => void): void; + function offSocketMessage(callback: (error: any) => void): void; + + interface CloseSocketOptions extends BaseOptions { + success?(res: any): void; + } + /** + * 监听WebSocket关闭。 + */ + function closeSocket(options?: CloseSocketOptions): void; + + /** + * 取消监听WebSocket关闭。 + */ + function offSocketClose(callback: (error: any) => void): void; + //#endregion +} + +// 设备 +declare namespace my { + //#region canIUse https://docs.alipay.com/mini/api/can-i-use + /** + * 判断当前小程序的 API、入参或返回值、组件、属性等在当前版本是否支持。 + * 参数使用 ${API}.${type}.${param}.${option} 或者 ${component}.${attribute}.${option} 方式来调用 + * - API 表示 api 名字 + * - type 取值 object/return/callback 表示 api 的判断类型 + * - param 表示参数的某一个属性名 + * - option 表示参数属性的具体属性值 + * - component 表示组件名称 + * - attribute 表示组件属性名 + * - option 表示组件属性值 + */ + function canIUse(api: string): boolean; + //#endregion + + //#region 获取基础库版本号 https://docs.alipay.com/mini/api/sdk-version + const SDKVersion: string; + //#endregion + //#region 系统信息 https://docs.alipay.com/mini/api/system-info + interface SystemInfo { + /** + * 手机型号 + */ + model: string; + /** + * 设备像素比 + */ + pixelRatio: number; + /** + * 窗口宽度 + */ + windowWidth: number; + /** + * 窗口高度 + */ + windowHeight: number; + /** + * 支付宝设置的语言 + */ + language: string; + /** + * 支付宝版本号 + */ + version: string; + /** + * 设备磁盘容量 + */ + storage: string; + /** + * 当前电量百分比 + */ + currentBattery: string; + /** + * 系统版本 + */ + system: string; + /** + * 系统名:Android,iOS + */ + platform: 'Android' | 'iOS' | string; + /** + * 屏幕宽度 + */ + screenWidth: number; + /** + * 屏幕高度 + */ + screenHeight: number; + /** + * 手机品牌 + */ + brand: string; + /** + * 用户设置字体大小 + */ + fontSizeSetting: number; + /** + * 当前运行的客户端,当前是支付宝则有效值是"alipay" + */ + app: 'alipay' | string; + } + interface GetSystemInfoOptions extends BaseOptions { + success?(res: SystemInfo): void; + } + function getSystemInfo(options: GetSystemInfoOptions): void; + function getSystemInfoSync(): SystemInfo; + //#endregion + + //#region 网络状态 https://docs.alipay.com/mini/api/network-status + interface GetNetworkTypeOptions extends BaseOptions { + success?(res: { + /** 网络是否可用 */ + networkAvailable: boolean; + /** 网络类型值 UNKNOWN / NOTREACHABLE / WIFI / 3G / 2G / 4G / WWAN */ + networkType: NetworkType; + }): void; + } + type NetworkType = 'UNKNOWN' | 'NOTREACHABLE' | 'WIFI' | '3G' | '2G' | '4G' | 'WWAN'; + function getNetworkType(options: GetNetworkTypeOptions): void; + + /** + * 开始网络状态变化的监听 + */ + function onNetworkStatusChange(callback: (res: { + /** 网络是否可用 */ + isConnected: boolean; + /** 网络类型值 UNKNOWN / NOTREACHABLE / WIFI / 3G / 2G / 4G / WWAN */ + networkType: NetworkType; + }) => void): void; + + /** + * 取消网络状态变化的监听 + */ + function offNetworkStatusChange(): void; + //#endregion + + //#region 剪贴板 https://docs.alipay.com/mini/api/clipboard + interface GetClipboardOptions extends BaseOptions { + success?(res: { + text: string; + }): void; + } + function getClipboard(options: GetClipboardOptions): void; + + interface SetClipboardOptions extends BaseOptions { + /** 剪贴板数据 */ + text: string; + } + function setClipboard(options: SetClipboardOptions): void; + //#endregion + + //#region 摇一摇 https://docs.alipay.com/mini/api/shake + function watchShake(options: BaseOptions): void; + //#endregion + + //#region 震动 https://docs.alipay.com/mini/api/vibrate + /** + * 调用震动功能。 + */ + function vibrate(options?: BaseOptions): void; + + /** + * 调用震动功能。 + */ + function vibrateLong(options?: BaseOptions): void; + + /** + * 调用震动功能。 + */ + function vibrateShort(options?: BaseOptions): void; + //#endregion + + //#region 拨打电话 https://docs.alipay.com/mini/api/macke-call + interface MakePhoneCallOptions extends BaseOptions { + /** + * 需要拨打的电话号码 + */ + number: string; + } + /** + * 拨打电话 + */ + function makePhoneCall(options: MakePhoneCallOptions): void; + //#endregion + + //#region 获取服务器时间 https://docs.alipay.com/mini/api/get-server-time + interface GetServerTimeOptions extends BaseOptions { + success?(res: { + /** 服务器时间的毫秒数 */ + time: number; + }): void; + } + function getServerTime(options: GetServerTimeOptions): void; + //#endregion + + //#region 用户截屏事件 https://docs.alipay.com/mini/api/user-capture-screen + /** + * 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件 + */ + function onUserCaptureScreen(callback?: (res: any) => void): void; + + /** + * 取消监听截屏事件。一般需要与 my.onUserCaptureScreen 成对出现。 + */ + function offUserCaptureScreen(): void; + //#endregion + + //#region 屏幕亮度 https://docs.alipay.com/mini/api/screen-brightness + interface SetKeepScreenOnOptions extends BaseOptions { + /** 是否保持屏幕常亮 */ + keepScreenOn: boolean; + success?(res: { errMsg: string }): void; + } + /** + * 设置是否保持常亮状态。 + * 仅在当前小程序生效,离开小程序后设置失效。 + */ + function setKeepScreenOn(options?: SetKeepScreenOnOptions): void; + + interface GetScreenBrightnessOptions extends BaseOptions { + /** 屏幕亮度值,范围 0~1,0 最暗,1 最亮 */ + success(value: number): void; + } + /** + * 获取屏幕亮度 + */ + function getScreenBrightness(options?: GetScreenBrightnessOptions): void; + + interface SetScreenBrightnessOptions extends BaseOptions { + /** 需要设置的屏幕亮度,取值范围0-1 */ + brightness: number; + } + /** + * 设置屏幕亮度 + */ + function setScreenBrightness(options: SetScreenBrightnessOptions): void; + //#endregion + + //#region 权限引导 https://docs.alipay.com/mini/api/show-auth-guide + interface showAuthGuideOptions extends BaseOptions { + /** + * 引导的权限标识,用于标识该权限类型(如 LBS) + * 支持的 authType 如下: + * + * 权限名称 权限码 支持平台 + * 后台保活权限 BACKGROUNDER Android + * 桌面快捷权限 SHORTCUT Android + * 麦克风权限 MICROPHONE iOS + * 通讯录权限 ADDRESSBOOK iOS + * 相机权限 CAMERA iOS + * 照片权限 PHOTO iOS + * push通知栏权限 NOTIFICATION iOS + * 自启动权限 SELFSTARTING Android + * lbs总开关 LBSSERVICE iOS + * lbs开关(app) LBS iOS + */ + authType: 'BACKGROUNDER' | 'SHORTCUT' | 'MICROPHONE' | 'ADDRESSBOOK' | 'CAMERA' | 'PHOTO' | 'NOTIFICATION' | 'SELFSTARTING' | 'LBSSERVICE' | 'LBS'; + } + function showAuthGuide(options: showAuthGuideOptions): void; + //#endregion +} + +// 扫码 +declare namespace my { + //#region 扫码 https://docs.alipay.com/mini/api/scan + type scanType = "qr" | "bar"; + interface ScanCodeData { + /** + * 扫描二维码时返回二维码数据 + */ + code: string; + /** + * 所扫码的类型 + */ + qrCode: string; + /** + * 扫描条形码时返回条形码数据 + */ + barCode: string; + } + interface ScanOptions extends BaseOptions { + /** + * 扫码样式(默认 qr): + * 1. qr,扫码框样式为二维码扫码框 + * 1. bar,扫码样式为条形码扫码框 + */ + type?: scanType; + /** + * 是否隐藏相册(不允许从相册选择图片),只能从相机扫码 + */ + hideAlbum?: boolean; + success?(res: ScanCodeData): void; + } + /** + * 调起客户端扫码界面,扫码成功后返回对应的结果 + */ + function scan(options: ScanOptions): void; + //#endregion +} + +// 蓝牙 +declare namespace my { + //#region 快速接入 https://docs.alipay.com/mini/api/bluetooth-intro + //#endregion + + //#region API https://docs.alipay.com/mini/api/bluetooth-api + interface OpenBluetoothAdapterOptions extends BaseOptions { + /** 不传的话默认是true,表示是否在离开当前页面时自动断开蓝牙(仅对android有效) */ + autoClose: boolean; + success(res: { + /** + * 是否支持 BLE + */ + isSupportBLE: boolean; + }): void; + } + /** + * 初始化小程序蓝牙模块,生效周期为调用 my.openBluetoothAdapter 至调用 my.closeBluetoothAdapter 或小程序被销毁为止。 在小程序蓝牙适配器模块生效期间,开发者可以正常调用下面的小程序API,并会收到蓝牙模块相关的 on 事件回调。 + */ + function openBluetoothAdapter(options: Partial): void; + + interface CloseBluetoothAdapterOptions extends BaseOptions { + success(res: any): void; + } + /** + * 关闭本机蓝牙模块 + */ + function closeBluetoothAdapter(options: CloseBluetoothAdapterOptions): void; + + interface BluetoothAdapterStateData extends ErrMsgResponse { + /** + * 是否正在搜索设备 + */ + discovering: boolean; + /** + * 蓝牙模块是否可用(需支持 BLE 并且蓝牙是打开状态) + */ + available: boolean; + } + interface GetBluetoothAdapterStateOptions extends BaseOptions { + success(res: BluetoothAdapterStateData): void; + } + /** + * 获取本机蓝牙适配器状态 + */ + function getBluetoothAdapterState(options: GetBluetoothAdapterStateOptions): void; + + interface StartBluetoothDevicesDiscoveryOptions extends BaseOptions { + /** + * 蓝牙设备主 service 的 uuid 列表 + * 某些蓝牙设备会广播自己的主 service 的 uuid。如果这里传入该数组,那么根据该 uuid 列表,只搜索有这个主服务的设备。 + */ + services?: string[]; + /** + * 否允许重复上报同一设备, 如果允许重复上报,则onDeviceFound 方法会多次上报同一设备,但是 RSSI 值会有不同 + */ + allowDuplicatesKey?: boolean; + /** + * 上报设备的间隔,默认为0,意思是找到新设备立即上报,否则根据传入的间隔上报 + */ + interval?: number; + } + /** + * 开始搜寻附近的蓝牙外围设备。搜索结果将在 my.onBluetoothDeviceFound 事件中返回。 + */ + function startBluetoothDevicesDiscovery(options: StartBluetoothDevicesDiscoveryOptions): void; + + interface StopBluetoothDevicesDiscoveryOptions extends BaseOptions { + success(res: ErrMsgResponse): void; + } + /** + * 停止搜寻附近的蓝牙外围设备。请在确保找到需要连接的设备后调用该方法停止搜索。 + */ + function stopBluetoothDevicesDiscovery(options: StopBluetoothDevicesDiscoveryOptions): void; + + /** + * 蓝牙设备信息 + */ + interface BluetoothDevice { + /** + * 蓝牙设备名称,某些设备可能没有 + */ + name: string; + /** + * (兼容旧版本) 值与 name 一致 + */ + deviceName: string; + /** + * 广播设备名称 + */ + localName: string; + /** + * 设备的 id + */ + deviceId: string; + /** + * 设备信号强度 + */ + RSSI: number; + /** + * 设备的广播内容 + */ + advertisData: ArrayBuffer; + /** + * 设备的manufacturerData + */ + manufacturerData: ArrayBuffer; + } + interface GetBluetoothDevicesOptions extends BaseOptions { + success( + res: { + devices: BluetoothDevice[]; + } & ErrMsgResponse + ): void; + } + /** + * 获取所有已发现的蓝牙设备,包括已经和本机处于连接状态的设备。 + */ + function getBluetoothDevices(options: GetBluetoothDevicesOptions): void; + + interface GetConnectedBluetoothDevicesOptions extends BaseOptions { + services?: string[]; + success( + res: { + devices: BluetoothDevice[]; + } & ErrMsgResponse + ): void; + } + /** + * 获取处于已连接状态的设备。 + */ + function getConnectedBluetoothDevices(options: GetConnectedBluetoothDevicesOptions): void; + + interface BLEDeviceOptions extends BaseOptions { + /** + * 蓝牙设备id + */ + deviceId: string; + } + /** + * 连接低功耗蓝牙设备。 + */ + function connectBLEDevice(options: BLEDeviceOptions): void; + + /** + * 断开与低功耗蓝牙设备的连接。 + */ + function disconnectBLEDevice(options: BLEDeviceOptions): void; + + interface WriteBLECharacteristicValueOptions extends BaseOptions { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 蓝牙特征值对应服务的 uuid + */ + serviceId: string; + /** + * 蓝牙特征值的 uuid + */ + characteristicId: string; + /** + * 蓝牙设备特征值对应的值,16进制字符串,限制在20字节内 + */ + value: string; + } + /** + * 向低功耗蓝牙设备特征值中写入数据。 + */ + function writeBLECharacteristicValue( + options: WriteBLECharacteristicValueOptions + ): void; + + interface ReadBLECharacteristicValueOptions extends BaseOptions { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 蓝牙特征值对应服务的 uuid + */ + serviceId: string; + /** + * 蓝牙特征值的 uuid + */ + characteristicId: string; + success( + res: { + characteristic: { + /** + * 蓝牙设备特征值的 uuid + */ + characteristicId: string; + /** + * 蓝牙设备特征值对应服务的 uuid + */ + serviceId: string; + /** + * 蓝牙设备特征值对应的二进制值 + */ + value: ArrayBuffer; + }; + } & ErrMsgResponse + ): void; + } + + /** + * 读取低功耗蓝牙设备特征值中的数据。调用后在 my.onBLECharacteristicValueChange() 事件中接收数据返回。 + */ + function readBLECharacteristicValue(options: ReadBLECharacteristicValueOptions): void; + + interface NotifyBLECharacteristicValueChangeOptions extends BaseOptions { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 蓝牙特征值对应 service 的 uuid + */ + serviceId: string; + /** + * 蓝牙特征值的 uuid + */ + characteristicId: string; + /** + * notify 的 descriptor 的 uuid (只有android 会用到,非必填,默认值00002902-0000-10008000-00805f9b34fb) + */ + descriptorId?: string; + /** + * 是否启用notify或indicate + */ + state?: boolean; + } + function notifyBLECharacteristicValueChange(optons: NotifyBLECharacteristicValueChangeOptions): void; + + interface NotifyBLECharacteristicValueChangedOptions extends BaseOptions { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 蓝牙特征值对应服务的 uuid + */ + serviceId: string; + /** + * 蓝牙特征值的 uuid + */ + characteristicId: string; + /** + * notify 的 descriptor 的 uuid (只有android 会用到,非必填,默认值00002902-0000-10008000-00805f9b34fb) + */ + descriptorId?: string; + /** + * true: 启用 notify; false: 停用 notify + */ + state: boolean; + success(res: ErrMsgResponse): void; + } + /** + * 启用低功耗蓝牙设备特征值变化时的 notify 功能。注意:设备的特征值必须支持 notify/indicate 才可以成功调用,具体参照 characteristic 的 properties 属性 另外,必须先启用 notify 才能监听到设备 characteristicValueChange 事件。 + */ + function notifyBLECharacteristicValueChanged(options: NotifyBLECharacteristicValueChangedOptions): void; + + interface GetBLEDeviceServicesOptions extends BaseOptions { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 成功则返回本机蓝牙适配器状态 + */ + success(res: { + services: Array<{ + /** + * 蓝牙设备服务的 uuid + */ + serviceId: string; + /** + * 该服务是否为主服务 + */ + isPrimary: boolean; + }>; + } & ErrMsgResponse): void; + } + /** + * 获取蓝牙设备所有 service(服务) + */ + function getBLEDeviceServices(options: GetBLEDeviceServicesOptions): void; + + interface GetBLEDeviceCharacteristicsOptions extends BaseOptions { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 蓝牙服务 uuid + */ + serviceId: string; + /** + * 成功则返回本机蓝牙适配器状态 + */ + success(res: { + characteristics: Array<{ + /** + * 蓝牙设备特征值的 uuid + */ + characteristicId: string; + /** + * 蓝牙设备特征值对应服务的 uuid + */ + serviceId: string; + /** + * 蓝牙设备特征值对应的16进制值 + */ + value: ArrayBuffer; + /** + * 该特征值支持的操作类型 + */ + properties: Array<{ + /** + * 该特征值是否支持 read 操作 + */ + read: boolean; + /** + * 该特征值是否支持 write 操作 + */ + write: boolean; + /** + * 该特征值是否支持 notify 操作 + */ + notify: boolean; + /** + * 该特征值是否支持 indicate 操作 + */ + indicate: boolean; + }>; + }>; + } & ErrMsgResponse): void; + } + /** + * 获取蓝牙设备所有 characteristic(特征值) + */ + function getBLEDeviceCharacteristics(options: GetBLEDeviceCharacteristicsOptions): void; + + interface OnBluetoothDeviceFoundOptions extends BaseOptions { + success?(res: { + devices: BluetoothDevice[]; + }): void; + } + /** + * 搜索到新的蓝牙设备时触发此事件。 + */ + function onBluetoothDeviceFound(options: OnBluetoothDeviceFoundOptions): void; + + /** + * 移除寻找到新的蓝牙设备事件的监听。 + */ + function offBluetoothDeviceFound(callback?: any): void; + + interface OnBLECharacteristicValueChangeOptions extends BaseOptions { + success?(res: { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 蓝牙特征值对应 service 的 uuid + */ + serviceId: string; + /** + * 蓝牙特征值的 uuid + */ + characteristicId: string; + /** + * 特征值最新的16进制值 + */ + value: ArrayBuffer; + }): void; + } + /** + * 监听低功耗蓝牙设备的特征值变化的事件。 + */ + function onBLECharacteristicValueChange(options: OnBLECharacteristicValueChangeOptions): void; + + interface OnBLEConnectionStateChangedOptions extends BaseOptions { + success?(res: { + /** + * 蓝牙设备 id,参考 device 对象 + */ + deviceId: string; + /** + * 连接目前的状态 + */ + connected: boolean; + }): void; + } + /** + * 移除低功耗蓝牙设备的特征值变化事件的监听。 + */ + function offBLECharacteristicValueChange(callback?: any): void; + + /** + * 监听低功耗蓝牙连接的错误事件,包括设备丢失,连接异常断开等。 + */ + function onBLEConnectionStateChanged(options: OnBLEConnectionStateChangedOptions): void; + + /** + * 移除低功耗蓝牙连接状态变化事件的监听。 + */ + function offBLEConnectionStateChanged(): void; + + interface BluetoothAdapterState { + /** + * 蓝牙适配器是否可用 + */ + available: boolean; + /** + * 蓝牙适配器是否处于搜索状态 + */ + discovering: boolean; + } + /** + * 监听本机蓝牙状态变化的事件。 + */ + function onBluetoothAdapterStateChange(callback: (res: BluetoothAdapterState) => void): void; + + /** + * 移除本机蓝牙状态变化的事件的监听。 + */ + function offBluetoothAdapterStateChange(): void; + //#endregion +} + +// iBeacon +declare namespace my { + //#region iBeacon https://docs.alipay.com/mini/api/yqleyc + interface StartBeaconDiscoveryOptions extends BaseOptions { + /** + * iBeacon设备广播的 uuids + */ + uuids: string[]; + success?(res: ErrMsgResponse): void; + } + /** + * 开始搜索附近的iBeacon设备 + */ + function startBeaconDiscovery(options: StartBeaconDiscoveryOptions): void; + + interface StopBeaconDiscoveryOptions extends BaseOptions { + success?(res: ErrMsgResponse): void; + } + /** + * 停止搜索附近的iBeacon设备 + */ + function stopBeaconDiscovery(options: StopBeaconDiscoveryOptions): void; + + interface Beacon { + /** iBeacon 设备广播的 uuid */ + uuid: string; + /** iBeacon 设备的主 id */ + major: string; + /** iBeacon 设备的次 id */ + minor: string; + /** 表示设备距离的枚举值(0-3分别代表:未知、极近、近、远) */ + proximity: 0 | 1 | 2 | 3; + /** iBeacon 设备的距离 */ + accuracy: number; + /** iBeacon 信号强度 */ + rssi: number; + } + interface GetBeaconsSuccess { + beacons: Beacon[]; + /** + * errorCode=0 ,接口调用成功 + */ + errCode: string; + /** + * ok + */ + errMsg: string; + } + interface GetBeaconsOptions extends BaseOptions { + success?(options: GetBeaconsSuccess): void; + } + /** + * 获取所有已搜索到的iBeacon设备 + */ + function getBeacons(options: GetBeaconsOptions): void; + + interface BeaconUpdateOptions extends BaseOptions { + success?(res: { + beacons: Beacon[]; + }): void; + } + /** + * 监听 iBeacon 设备的更新事件 + */ + function onBeaconUpdate(options: BeaconUpdateOptions): void; + + interface BeaconServiceChangeOptions extends BaseOptions { + success?(res: { + /** + * 服务目前是否可用 + */ + available: boolean; + /** + * 目前是否处于搜索状态 + */ + discovering: boolean; + }): void; + } + /** + * 监听 iBeacon 服务的状态变化 + */ + function onBeaconServiceChange(options: BeaconServiceChangeOptions): void; + //#endregion +} + +// 数据安全 +declare namespace my { + //#region 数据安全 https://docs.alipay.com/mini/api/data-safe + interface RsaOptions extends BaseOptions { + /** + * 使用rsa加密还是rsa解密,encrypt加密,decrypt解密 + */ + action: string; + /** + * 要处理的文本,加密为原始文本,解密为Base64编码格式文本 + */ + text: string; + /** + * rsa秘钥,加密使用公钥,解密使用私钥 + */ + key: string; + success?(res: { + /** + * 经过处理过后得到的文本,加密为Base64编码文本,解密为原始文本 + */ + text: string; + }): void; + } + /** + * 非对称加密。 + */ + function rsa(options: RsaOptions): void; + //#endregion +} + +// 分享 +declare namespace my { + //#region 分享 https://docs.alipay.com/mini/api/share_app + //#endregion +} + +// 自定义分析 +declare namespace my { + //#region 自定义分析 https://docs.alipay.com/mini/api/report + /** + * 自定义分析数据的上报接口。使用前需要在小程序管理后台的事件管理中新建事件,并配置好事件名和字段。 + * + * @param eventName 自定义事件名,需申请 + * @param data 上报的数据 + */ + function reportAnalytics(eventName: string, data: any): void; + + /** + * 隐藏分享按钮。 + */ + function hideShareMenu(options?: BaseOptions): void; + //#endregion +} + +declare namespace my { + interface LaunchOptions { + /** + * 打开小程序的路径 + */ + path: string; + /** + * 打开小程序的query + */ + query: object; + /** + * 打开小程序的[场景值] + */ + scene: number; + /** + * shareTicket,详见 获取更多[转发信息] + */ + shareTicket: string; + /** + * 当场景为由从另一个小程序或公众号或App打开时,返回此字段 + */ + referrerInfo: object; + /** + * 来源小程序或公众号或App的 appId,详见下方说明 + */ + "referrerInfo.appId": string; + /** + * 来源小程序传过来的数据,scene=1037或1038时支持 + */ + "referrerInfo.extraData": object; + // #endregion + } + interface AppOptions { + /** + * 监听小程序初始化。 + * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) + * 生命周期函数 + */ + onLaunch?: (this: App, option: LaunchOptions) => void; + /** + * 监听小程序显示。 + * 当小程序启动,或从后台进入前台显示,会触发 onShow + * 生命周期函数 + */ + onShow?: (this: App, option: LaunchOptions) => void; + /** + * 监听小程序隐藏。 + * 当小程序从前台进入后台,会触发 onHide + * 生命周期函数 + */ + onHide?: (this: App) => void; + /** + * 错误监听函数 + * 当小程序发生脚本错误或者 api 调用失败时 + * 会触发 onError 并带上错误信息 + */ + onError?: (this: App, msg: string) => void; + /** + * 小程序退出时触发 + */ + onUnlaunch?: (this: App) => void; + /** + * 全局Data + */ + globalData?: object; + [key: string]: any; + } + interface CreateIntersectionObserverOption { + thresholds?: [number, number]; + initialRatio?: number; + selectAll?: boolean; + } + + interface Margins { + left?: number; + right?: number; + top?: number; + bottom?: number; + } + interface ObserveResponse { + id: string; + dataset: any; + time: number; + intersectionRatio: number; // 相交区域占目标节点的布局区域的比例 + boundingClientRect: RectArea; + intersectionRect: RectArea; + relativeRect: RectArea; + } + interface IntersectionObserver { + relativeTo(selector?: string, margins?: Margins): IntersectionObserver; + relativeToViewport(margins?: Margins): IntersectionObserver; + observe( + selector?: string, + callback?: (response: ObserveResponse) => void + ): IntersectionObserver; + disconnect(): void; + } + interface ComponentRelation { + /** 目标组件的相对关系,可选的值为 parent 、 child 、 ancestor 、 descendant */ + type: "parent" | "child" | "ancestor" | "descendant"; + /** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */ + target?: string; + /** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */ + linked?: (target: Component) => void; + /** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */ + linkChanged?: (target: Component) => void; + /** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */ + unlinked?: (target: Component) => void; + } + interface Component { + /** + * 组件的文件路径 + */ + is: string; + /** + * 节点id + */ + id: string; + /** + * 节点dataset + */ + dataset: string; + /** + * 组件数据,包括内部数据和属性值 + */ + data: any; + + /** + * 组件数据,包括内部数据和属性值(与 data 一致) + */ + properties: any; + /** + * 将数据从逻辑层发送到视图层,同时改变对应的 this.data 的值 + * 1. 直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致。 + * 2. 单次设置的数据不能超过1024kB,请尽量避免一次设置过多的数据。 + * 3. 请不要把 data 中任何一项的 value 设为 undefined ,否则这一项将不被设置并可能遗留一些潜在问题 + * @param data object 以 key,value 的形式表示将 this.data 中的 key 对应的值改变成 value + * @param [callback] callback 是一个回调函数,在这次setData对界面渲染完毕后调用 + */ + setData( + data: any, + callback?: () => void + ): void; + hasBehavior(behavior: any): boolean; + triggerEvent( + name: string, + details?: any, + options?: Partial<{ + bubbles: boolean; + composed: boolean; + capturePhase: boolean; + }> + ): void; + createSelectorQuery(): SelectorQuery; + createIntersectionObserver( + options?: CreateIntersectionObserverOption + ): IntersectionObserver; + /** + * 使用选择器选择组件实例节点 + * 返回匹配到的第一个组件实例对象 + */ + selectComponent(selector: string): Component; + /** + * selector 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组 + */ + selectAllComponents(selector: string): Component[]; + getRelationNodes(relationKey: string): ComponentRelation[]; + } + interface Page extends Component { + /** + * data + */ + data: any; + /** + * 强制更新 + */ + forceUpdate(): void; + /** + * 字段可以获取到当前页面的路径。 + */ + route(): void; + /** + * 更新 + */ + update(): void; + /** + * 将页面滚动到目标位置。 + * + * scrollTop 滚动到页面的目标位置(单位px) + * [duration] 滚动动画的时长,默认300ms,单位 ms + */ + pageScrollTo(option?: PageScrollToOptions): void; + [key: string]: any; + } + interface App { + data: any; + /** + * 获取当前页面 + */ + getCurrentPage(): Page; + [key: string]: any; + } + interface EventTarget { + id: string; + tagName: string; + dataset: { [name: string]: string }; + } + type TouchEventType = + | "tap" + | "touchstart" + | "touchmove" + | "touchcancel" + | "touchend" + | "touchforcechange"; + + type TransitionEventType = + | "transitionend" + | "animationstart" + | "animationiteration" + | "animationend"; + + type EventType = + | "input" + | "form" + | "submit" + | "scroll" + | TouchEventType + | TransitionEventType + | "tap" + | "longpress"; + interface BaseEvent { + type: T; + timeStamp: number; + currentTarget: EventTarget; + target: EventTarget; + detail: Detail; + } + interface Options { + query: any; // 当前小程序的 query + path: string; // 当前小程序的页面地址 + } + interface PageOptions { + data: any; + onLaunch(this: Page, options: Options): void; + onShow(this: Page, options: Options): void; + onHide(this: Page): void; + onError(this: Page): void; + [key: string]: any; + } + function postMessage(param: any): void; + type onMessageFun = (p: any) => void; + let onMessage: onMessageFun; +} + +declare function App(app: Partial): void; + +declare function getApp(): my.App; + +declare function Behavior(options?: any): my.Component; + +declare function Component(options?: any): my.Component; + +declare function Page(options: Partial): void; + +declare function getCurrentPages(): my.Page[]; diff --git a/types/ali-app/tsconfig.json b/types/ali-app/tsconfig.json new file mode 100644 index 0000000000..a2402fac2c --- /dev/null +++ b/types/ali-app/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "esnext", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "ali-app-tests.ts" + ], + "exclude": [ + ".prettierrc" + ] +} \ No newline at end of file diff --git a/types/ali-app/tslint.json b/types/ali-app/tslint.json new file mode 100644 index 0000000000..f491d1bed9 --- /dev/null +++ b/types/ali-app/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-mergeable-namespace": false, + "no-unnecessary-generics": false + } +} \ No newline at end of file diff --git a/types/ali-oss/ali-oss-tests.ts b/types/ali-oss/ali-oss-tests.ts new file mode 100644 index 0000000000..dc751b8d44 --- /dev/null +++ b/types/ali-oss/ali-oss-tests.ts @@ -0,0 +1,25 @@ +import * as OSS from 'ali-oss'; + +const ossOptions: OSS.Options = { + accessKeyId: 'your access key', + accessKeySecret: 'your access secret', + bucket: 'your bucket name', + region: 'oss-cn-hangzhou' +}; + +const client = new OSS(ossOptions); + +const clusterOptions: OSS.ClusterOptions = { + clusters: [], +}; + +const clusterClient = new OSS.Cluster(clusterOptions); + +const imageOptions: OSS.ImageClientOptions = { + imageHost: 'xxxx', + accessKeyId: 'xxxx', + accessKeySecret: 'xxxx', + bucket: 'xxxx' +}; + +const imageClient = new OSS.ImageClient(imageOptions); diff --git a/types/ali-oss/index.d.ts b/types/ali-oss/index.d.ts new file mode 100644 index 0000000000..13f7f56ff9 --- /dev/null +++ b/types/ali-oss/index.d.ts @@ -0,0 +1,873 @@ +// Type definitions for ali-oss 6.0 +// Project: https://github.com/ali-sdk/ali-oss +// Definitions by: Ptrdu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export = OSS; + +// basic OSS +declare namespace OSS { + interface Options { + accessKeyId: string; // access secret you create + accessKeySecret: string; // access secret you create + stsToken?: string; // used by temporary authorization + bucket?: string; // the default bucket you want to access If you don't have any bucket, please use putBucket() create one first. + endpoint?: string; // oss region domain. It takes priority over region. + region?: string; // the bucket data region location, please see Data Regions, default is oss-cn-hangzhou. + internal?: boolean; // access OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set true to save lot of money. + secure?: boolean; // instruct OSS client to use HTTPS (secure: true) or HTTP (secure: false) protocol. + timeout?: string | number; // instance level timeout for all operations, default is 60s + } + + interface Bucket { + name: string; + region: string; + creationDate: string; + StorageClass: StorageType; + } + + type StorageType = "Standard" | "IA" | "Archive"; + + type ACLType = "public-read-write" | "public-read" | "and private"; + + type HTTPMethods = "GET" | "POST" | "DELETE" | "PUT"; + + interface RequestOptions { + // the operation timeout + timeout?: number; + } + + type RuleStatusType = "Enabled" | "Disabled"; + + interface LifecycleRule { + id?: string; // rule id, if not set, OSS will auto create it with random string. + prefix: string; // store prefix + status: RuleStatusType; // rule status, allow values: Enabled or Disabled + days?: number | string; // expire after the days + date: string; // expire date, e.g.: 2022-10-11T00:00:00.000Z date and days only set one. + } + + interface CORSRule { + allowedOrigin: string | string[]; // configure for Access-Control-Allow-Origin header + allowedMethod: string | string[]; // configure for Access-Control-Allow-Methods header + allowedHeader?: string | string[]; // configure for Access-Control-Allow-Headers header + exposeHeader?: string | string[]; // configure for Access-Control-Expose-Headers header + maxAgeSeconds?: string | string[]; // configure for Access-Control-Max-Age header + } + + interface OwnerType { + id: string; + displayName: string; + } + + interface ObjectMeta { + name: string; // object name on oss + lastModified: string; // object last modified GMT date, e.g.: 2015-02-19T08:39:44.000Z + etag: string; // object etag contains ", e.g.: "5B3C1A2E053D763E1B002CC607C5A0FE" + type: string; // object type, e.g.: Normal + size: number; // object size, e.g.: 344606 + storageClass: StorageType; + owner: OwnerType; + } + + interface NormalSuccessResponse { + // response status + status: number; + // response headers + headers: object; // todo the object in detail + // response size + size: number; + // request total use time (ms) + rt: number; + } + + interface UserMeta { + uid: number; + pid: number; + } + + interface ObjectCallback { + url: string; // After a file is uploaded successfully, the OSS sends a callback request to this URL. + host?: string; // The host header value for initiating callback requests. + body: string; // The value of the request body when a callback is initiated, for example, key=$(key)&etag=$(etag)&my_var=$(x:my_var). + contentType?: string; // The Content-Type of the callback requests initiatiated, It supports application/x-www-form-urlencoded and application/json, and the former is the default value. + customValue?: object; + headers?: object; // extra headers, detail see RFC 2616 + } + + interface ModifyData { + lastModified: string; // object last modified GMT string + etag: string; // object etag contains ", e.g.: "5B3C1A2E053D763E1B002CC607C5A0FE" + } + + interface Checkpoint { + file: any; // The file object selected by the user, if the browser is restarted, it needs the user to manually trigger the settings + name: string; // object key + fileSize: number; + partSize: number; + uploadId: string; + doneParts: Array<{ number: number, etag: string }>; + } + + interface ObjectPart { + PartNumber: number; + LastModified: any; // {Date} Time when a part is uploaded. + ETag: string; + size: number; + } + + interface Upload { + name: string; + uploadId: string; + initiated: any; + } + + interface Channel { + Name: string; + Description: string; + Status: string; + LastModified: string; + PublishUrls: string[]; + PlayUrls: string[]; + } + + interface ChannelHistory { + StartTime: string; // + EndTime: string; + RemoteAddr: string; // the remote addr + } +// parameters type + interface ListBucketsQueryType { + prefix?: string; // search buckets using prefix key + marker?: string; // search start from marker, including marker key + 'max-keys'?: string | number; // max buckets, default is 100, limit to 1000 + } + + interface PutBucketOptions { + timeout: number; + storageClass: StorageType; + } + + interface PutBucketWebsiteConfig { + index: string; // default page, e.g.: index.html + error?: string; // error page, e.g.: 'error.html' + } + + interface ListObjectsQuery { + prefix?: string; // search object using prefix key + marker?: string; // search start from marker, including marker key + delimiter?: string; // delimiter search scope e.g. / only search current dir, not including subdir + 'max-keys': string | number; // max objects, default is 100, limit to 1000 + } + + interface ListObjectResult { + objects: ObjectMeta[]; + prefixes: string[]; + isTruncated: boolean; + nextMarker: string; + res: NormalSuccessResponse; + } + + interface PutObjectOptions { + timeout?: number; // the operation timeout + mime?: string; // custom mime, will send with Content-Type entity header + meta?: UserMeta; // user meta, will send with x-oss-meta- prefix string e.g.: { uid: 123, pid: 110 } + callback: ObjectCallback; + } + + interface PutObjectResult { + name: string; + data: object; + res: NormalSuccessResponse; + } + + interface PutStreamOptions { + contentLength?: number; // the stream length, chunked encoding will be used if absent + timeout: number; // the operation timeout + mime: string; // custom mime, will send with Content-Type entity header + meta: UserMeta; + callback: ObjectCallback; + } + + interface AppendObjectOptions { + position?: string; // specify the position which is the content length of the latest object + timeout?: number; // the operation timeout + mime?: string; // custom mime, will send with Content-Type entity header + meta?: UserMeta; + headers?: object; + } + + interface AppendObjectResult { + name: string; + url: string; // the url of oss + res: NormalSuccessResponse; + nextAppendPosition: string; // the next position + } + + interface HeadObjectOptions { + timeout?: number; + headers?: object; + } + + interface HeadObjectResult { + status: number; // response status, maybe 200 or 304 + meta: UserMeta; + res: NormalSuccessResponse; + } + + interface GetObjectOptions { + timeout?: number; + process?: string; // image process params, will send with x-oss-process e.g.: {process: 'image/resize,w_200'} + headers?: object; + } + + interface GetObjectResult { + content?: any; // file content buffer if file parameter is null or ignore + res: NormalSuccessResponse; + } + + interface GetStreamOptions { + timeout?: number; + process?: string; // image process params, will send with x-oss-process e.g.: {process: 'image/resize,w_200'} + headers?: object; + } + + interface GetStreamResult { + stream?: any; // readable stream instance if response status is not 200, stream will be null. + res: NormalSuccessResponse; + } + + interface CopyObjectOptions { + timeout?: number; + meta?: UserMeta; + headers?: object; + } + + interface CopyAndPutMetaResult { + data: ModifyData; + res: NormalSuccessResponse; + } + + interface DeleteMultiOptions { + quite?: boolean; // quite mode or verbose mode, default is false + timeout?: number; + } + + interface DeleteMultiResult { + deleted?: string[]; // deleted object names list + res: NormalSuccessResponse; + } + + interface ResponseHeaderType { + 'content-type'?: string; + 'content-disposition'?: string; + 'cache-control'?: string; + } + + interface SignatureUrlOptions { + expires?: number; // after expires seconds, the url will become invalid, default is 1800 + method?: HTTPMethods; // the HTTP method, default is 'GET' + 'Content-Type'?: string; // set the request content type + process?: string; + response?: ResponseHeaderType; // set the response headers for download + callback?: ObjectCallback; + } + + interface GetACLResult { + acl: ACLType; + res: NormalSuccessResponse; + } + + interface InitMultipartUploadOptions { + timeout?: number; + mime?: string; // Mime file type + meta?: UserMeta; + headers?: object; + } + + interface InitMultipartUploadResult { + res: { status: number, headers: object, size: number, rt: number }; + bucket: string; // bucket name + name: string; // object name store on OSS + uploadId: string; // upload id, use for uploadPart, completeMultipart + } + + interface UploadPartResult { + name: string; + etag: string; + res: NormalSuccessResponse; + } + + interface CompleteMultipartUploadOptions { + timeout?: number; + callback?: ObjectCallback; + headers?: object; + } + + interface CompleteMultipartUploadResult { + bucket: string; + name: string; + etag: string; + data: object; + res: NormalSuccessResponse; + } + + interface MultipartUploadOptions { + parallel?: number; // the number of parts to be uploaded in parallel + partSize?: number; // the suggested size for each part + progress?: (...args: any[]) => any; // the progress callback called after each successful upload of one part + checkpoint?: Checkpoint; // the checkpoint to resume upload, if this is provided, it will continue the upload from where interrupted, otherwise a new multipart upload will be created. + meta?: UserMeta; + mime?: string; + callback?: ObjectCallback; + headers?: object; + timeout?: number; + copyheaders?: object; // {Object} only uploadPartCopy api used, detail + } + + interface MultipartUploadResult { + bucket: string; + name: string; + etag: string; + data: object; + res: NormalSuccessResponse; + } + + interface MultipartUploadCopyResult { + bucket: string; + name: string; + etag: string; + res: NormalSuccessResponse; + } + + interface MultipartUploadCopySourceData { + sourceKey: string; // the source object name + sourceBucketName: string; // sourceData. the source bucket name + startOffset: number; // data copy start byte offset, e.g: 0 + endOffset: number; // data copy end byte offset, e.g: 102400 + } + + interface ListPartsQuery { + 'max-parts': number; // The maximum part number in the response of the OSS. default value: 1000. + 'part-number-marker': number; // Starting position of a specific list. A part is listed only when the part number is greater than the value of this parameter. + 'encoding-type': string; // Specify the encoding of the returned content and the encoding type. Optional value: url + } + + interface ListPartsResult { + uploadId: string; + bucket: string; + name: string; + PartNumberMarker: number; + nextPartNumberMarker: number; + maxParts: number; + isTruncated: boolean; + parts: ObjectPart[]; + res: NormalSuccessResponse; + } + + interface ListUploadsQuery { + prefix?: string; + 'max-uploads'?: number; + 'key-marker'?: string; + 'upload-id-marker'?: string; + } + + interface ListUploadsResult { + res: NormalSuccessResponse; + bucket: string; + nextKeyMarker: any; + nextUploadIdMarker: any; + isTruncated: boolean; + uploads: Upload[]; + } + + interface PutChannelConf { + Description?: string; + Status?: string; + Target?: { + Type: string, + FragDuration: number, + FragCount: number, + PlaylistName: string + }; + } + + interface PutChannelResult { + publishUrls: string[]; + playUrls: string[]; + res: NormalSuccessResponse; + } + + interface GetChannelResult { + Status: string; + ConnectedTime?: string; + RemoteAddr?: string; + Video?: object; + Audio?: object; + res: NormalSuccessResponse; + } + + interface ListChannelsQuery { + prefix: string; // the channel id prefix (returns channels with this prefix) + marker: string; // the channel id marker (returns channels after this id) + 'max-keys ': number; // max number of channels to return + } + + interface ListChannelsResult { + channels: Channel[]; + nextMarker: string | null; + isTruncated: boolean; + res: NormalSuccessResponse; + } + + interface ChannelHistoryResult { + records: ChannelHistory; + res: NormalSuccessResponse; + } + + interface GetRtmpUrlOptions { + expires?: number; // the expire time in seconds of the url + params?: object; // the additional parameters for url, e.g.: {playlistName: 'play.m3u8'} + timeout?: number; // the operation timeout + } +} + +/// cluster +declare namespace OSS { + interface ClusterType { + host: string; + accessKeyId: string; + accessKeySecret: string; + } + + interface ClusterOptions { + clusters: ClusterType[]; + schedule?: string; + } + + class Cluster { + constructor(options: ClusterOptions) + + list(query: ListObjectsQuery | null, options: RequestOptions): Promise; + + put(name: string, file: any, options?: PutObjectOptions): Promise; + + putStream(name: string, stream: any, options?: PutStreamOptions): Promise<{ name: string, res: NormalSuccessResponse }>; + + head(name: string, options?: HeadObjectOptions): Promise; + + get(name: string, file?: any, options?: GetObjectOptions): Promise; + + getStream(name?: string, options?: GetStreamOptions): Promise; + + delete(name: string, options?: RequestOptions): Promise; + + copy(name: string, sourceName: string, options?: CopyObjectOptions): Promise; + + putMeta(name: string, meta: UserMeta, options: RequestOptions): Promise; + + deleteMulti(names: string[], options?: DeleteMultiOptions): Promise; + + signatureUrl(name: string, options?: SignatureUrlOptions): string; + + putACL(name: string, acl: ACLType, options?: RequestOptions): Promise; + + restore(name: string, options?: RequestOptions): Promise; + } +} + +// image +declare namespace OSS { + interface ImageClientOptions { + imageHost: string; // your image service domain that binding to a OSS bucket + accessKeyId: string; // access key you create on aliyun console website + accessKeySecret: string; // access secret you create + bucket: string; // the default bucket you want to access If you don't have any bucket, please use putBucket() create one first. + region?: string; // the bucket data region location, please see Data Regions, default is oss-cn-hangzhou + internal?: boolean; // access OSS with aliyun internal network or not, default is false If your servers are running on aliyun too, you can set true to save lot of money. + timeout?: string | number; // instance level timeout for all operations, default is 60s + } + + interface ImageGetOptions { + timeout?: number; + headers?: object; + } + + interface StyleData { + Name: string; // style name + Content: string; // style content + CreateTime: string; // style create time + LastModifyTime: string; // style last modify time + } + + class ImageClient { + constructor(options: ImageClientOptions) + + /** + * Get an image from the image channel. + */ + get(name: string, file?: any, options?: ImageGetOptions): Promise<{ content: any, res: NormalSuccessResponse }>; + + /** + * Get an image read stream. + */ + getStream(name: string, options?: ImageGetOptions): Promise<{ stream: any, res: NormalSuccessResponse }>; + + /** + * Get a image exif info by image object name from the image channel. + */ + getExif(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>; + + /** + * Get a image info and exif info by image object name from the image channel. + */ + getInfo(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>; + + /** + * todo + */ + putStyle(name: string, style: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>; + + /** + * Get a style by name from the image channel. + */ + getStyle(name: string, options?: RequestOptions): Promise<{ data: StyleData, res: NormalSuccessResponse}>; + + /** + * Get all styles from the image channel. + */ + listStyle(options?: RequestOptions): Promise; + + /** + * todo + */ + deleteStyle(styleName: string, options?: RequestOptions): Promise; + + /** + * Create a signature url for directly download. + */ + signatureUrl(name: string, options?: { expires?: string, timeout?: string }): string; + } +} + +declare class OSS { + constructor(options: OSS.Options) + + /******************************************* the bucket operations *************************************************/ + + // base operators + /** + * List buckets in this account. + */ + listBuckets(query: OSS.ListBucketsQueryType | null, options?: OSS.RequestOptions): Promise; + + /** + * Create a new bucket. + */ + putBucket(name: string, options?: OSS.PutBucketOptions): Promise<{ bucket: string, res: OSS.NormalSuccessResponse }>; + + /** + * Use the bucket. + */ + useBucket(name: string): void; + + /** + * Delete an empty bucket. + */ + deleteBucket(name: string, options?: OSS.RequestOptions): Promise; + + /** + * Get bucket information,include CreationDate、ExtranetEndpoint、IntranetEndpoint、Location、Name、StorageClass、 Owner、AccessControlList + */ + getBucketInfo(name: string): Promise; + + /** + * Get bucket location + */ + getBucketLocation(name: string): Promise; + + // ACL operations + /** + * Update the bucket ACL. + */ + putBucketACL(name: string, acl: OSS.ACLType, options?: OSS.RequestOptions): Promise; + + /** + * Get the bucket ACL. + * acl - acl settings string + */ + getBucketACL(name: string, options?: OSS.RequestOptions): Promise<{ acl: string, res: OSS.NormalSuccessResponse }>; + + // logging operations + /** + * Update the bucket logging settings. Log file will create every one hour and name format: -YYYY-mm-DD-HH-MM-SS-UniqueString. + */ + putBucketLogging(name: string, prefix?: string, options?: OSS.RequestOptions): Promise; + + /** + * Get the bucket logging settings. + */ + getBucketLogging(name: string, options?: OSS.RequestOptions): Promise<{ enable: boolean, prefix: string | null, res: OSS.NormalSuccessResponse }>; + + /** + * Delete the bucket logging settings. + */ + deleteBucketLogging(name: string, options?: OSS.RequestOptions): Promise; + + // Website operations + /** + * Set the bucket as a static website. + */ + putBucketWebsite(name: string, config: OSS.PutBucketWebsiteConfig): Promise; + + /** + * Get the bucket website config. + */ + getBucketWebsite(name: string, options?: OSS.RequestOptions): Promise<{ index: string, error: string, res: OSS.NormalSuccessResponse }>; + + /** + * Delete the bucket website config. + */ + deleteBucketWebsite(name: string, options?: OSS.RequestOptions): Promise; + + // referer operations + /** + * Set the bucket request Referer white list. + */ + putBucketReferer(name: string, allowEmpty: boolean, referers: string[], options?: OSS.RequestOptions): Promise; + + /** + * Get the bucket request Referer white list. + */ + getBucketReferer(name: string, options?: OSS.RequestOptions): Promise<{ allowEmpty: boolean, referers: string[], res: OSS.NormalSuccessResponse }>; + + /** + * Delete the bucket request Referer white list. + */ + deleteBucketReferer(name: string, options?: OSS.RequestOptions): Promise; + + // lifecycle operations + /** + * Set the bucket object lifecycle. + */ + putBucketLifecycle(name: string, rules: OSS.LifecycleRule[], options?: OSS.RequestOptions): Promise; + + /** + * Get the bucket object lifecycle. + */ + getBucketLifecycle(name: string, options?: OSS.RequestOptions): Promise<{ rules: OSS.LifecycleRule[], res: OSS.NormalSuccessResponse }>; + + /** + * Delete the bucket object lifecycle. + */ + deleteBucketLifecycle(name: string, options?: OSS.RequestOptions): Promise; + + // CORS operations + /** + * Set CORS rules of the bucket object + */ + putBucketCORS(name: string, rules: OSS.CORSRule[], options?: OSS.RequestOptions): Promise; + + /** + * Get CORS rules of the bucket object. + */ + getBucketCORS(name: string): Promise<{ rules: OSS.CORSRule[], res: OSS.NormalSuccessResponse }>; + + /** + * Delete CORS rules of the bucket object. + */ + deleteBucketCORS(name: string): Promise; + + /********************************************************** Object operations ********************************************/ + /** + * List objects in the bucket. + */ + list(query: OSS.ListObjectsQuery | null, options: OSS.RequestOptions): Promise; + + /** + * Add an object to the bucket. + */ + put(name: string, file: any, options?: OSS.PutObjectOptions): Promise; + + /** + * Add a stream object to the bucket. + */ + putStream(name: string, stream: any, options?: OSS.PutStreamOptions): Promise<{ name: string, res: OSS.NormalSuccessResponse }>; + + /** + * Append an object to the bucket, it's almost same as put, but it can add content to existing object rather than override it. + */ + append(name: string, file: any, options?: OSS.AppendObjectOptions): Promise; + + /** + * Get the Object url. If provide baseUrl, will use baseUrl instead the default endpoint. + */ + getObjectUrl(name: string, baseUrl?: string): string; + + /** + * Get the Object url. If provide baseUrl, will use baseUrl instead the default bucket and endpoint. Suggest use generateObjectUrl instead of getObjectUrl. + */ + generateObjectUrl(name: string, baseUrl?: string): string; + + /** + * Head an object and get the meta info. + */ + head(name: string, options?: OSS.HeadObjectOptions): Promise; + + /** + * Get an object from the bucket. + */ + get(name: string, file?: any, options?: OSS.GetObjectOptions): Promise; + + /** + * Get an object read stream. + */ + getStream(name?: string, options?: OSS.GetStreamOptions): Promise; + + /** + * Delete an object from the bucket. + */ + delete(name: string, options?: OSS.RequestOptions): Promise; + + /** + * Copy an object from sourceName to name. + */ + copy(name: string, sourceName: string, options?: OSS.CopyObjectOptions): Promise; + + /** + * Set an exists object meta. + */ + putMeta(name: string, meta: OSS.UserMeta, options: OSS.RequestOptions): Promise; + + /** + * Delete multi objects in one request. + */ + deleteMulti(names: string[], options?: OSS.DeleteMultiOptions): Promise; + + /** + * Create a signature url for download or upload object. When you put object with signatureUrl ,you need to pass Content-Type.Please look at the example. + */ + signatureUrl(name: string, options?: OSS.SignatureUrlOptions): string; + + /** + * Set object's ACL. + */ + putACL(name: string, acl: OSS.ACLType, options?: OSS.RequestOptions): Promise; + + /** + * Get object's ACL. + */ + getACL(name: string, options?: OSS.RequestOptions): Promise; + + /** + * Restore Object. + */ + restore(name: string, options?: OSS.RequestOptions): Promise; + + /** + * multi upload + */ + initMultipartUpload(name: string, options?: OSS.InitMultipartUploadOptions): Promise; + + /** + * After initiating a Multipart Upload event, you can upload data in parts based on the specified object name and Upload ID. + */ + uploadPart(name: string, uploadId: string, partNo: number, file: any, start: number, end: number, options?: OSS.RequestOptions): Promise; + + /** + * Using Upload Part Copy, you can copy data from an existing object and upload a part of the data. + * When copying a file larger than 1 GB, you must use the Upload Part Copy method. If you want to copy a file smaller than 1 GB, see Copy Object. + */ + uploadPartCopy( + name: string, + uploadId: string, + partNo: number, + range: string, + sourceData: { sourceKey: string, sourceBucketName: string }, + options: { timeout?: number, headers?: object } + ): Promise; + + /** + * After uploading all data parts, you must call the Complete Multipart Upload API to complete Multipart Upload for the entire file. + */ + completeMultipartUpload( + name: string, + uploadId: string, + parts: Array<{ number: number, etag: string }>, + options?: OSS.CompleteMultipartUploadOptions + ): Promise; + + /** + * Upload file with OSS multipart. + */ + multipartUpload(name: string, file: any, options: OSS.MultipartUploadOptions): Promise; + + /** + * Copy file with OSS multipart. + * this function contains head, initMultipartUpload, uploadPartCopy, completeMultipartUpload. + * When copying a file larger than 1 GB, you should use the Upload Part Copy method. If you want to copy a file smaller than 1 GB, see Copy Object. + */ + multipartUploadCopy(name: string, sourceData: OSS.MultipartUploadCopySourceData, options?: OSS.MultipartUploadOptions): Promise; + + /** + * The ListParts command can be used to list all successfully uploaded parts mapped to a specific upload ID, i.e.: those not completed and not aborted. + */ + listParts(name: string, uploadId: string, query?: OSS.ListPartsQuery, options?: OSS.RequestOptions): Promise; + + /** + * List on-going multipart uploads, i.e.: those not completed and not aborted. + */ + listUploads(query: OSS.ListUploadsQuery, options?: OSS.RequestOptions): Promise; + + /** + * Abort a multipart upload for object. + */ + abortMultipartUpload(name: string, uploadId: string, options?: OSS.RequestOptions): Promise; + + /************************************************ RTMP Operations *************************************************************/ + /** + * Create a live channel. + */ + putChannel(id: string, conf: OSS.PutChannelConf, options?: OSS.RequestOptions): Promise; + + /** + * Get live channel info. + */ + getChannel(id: string, options?: OSS.RequestOptions): Promise<{ data: OSS.PutChannelConf, res: OSS.NormalSuccessResponse }>; + + /** + * Delete a live channel. + */ + deleteChannel(id: string, options?: OSS.RequestOptions): Promise; + + /** + * Change the live channel status. + */ + putChannelStatus(id: string, status?: string, options?: OSS.RequestOptions): Promise; + + /** + * Get the live channel status. + */ + getChannelStatus(id: string, options?: OSS.RequestOptions): Promise; + + /** + * List channels. + */ + listChannels(query: OSS.ListChannelsQuery, options?: OSS.RequestOptions): Promise; + + /** + * Get the live channel history. + */ + getChannelHistory(id: string, options?: OSS.RequestOptions): Promise; + + /** + * Create a VOD playlist for the channel. + */ + createVod(id: string, name: string, time: { startTime: number, endTime: number }, options?: OSS.RequestOptions): Promise; + + /** + * Get signatured rtmp url for publishing. + */ + getRtmpUrl(channelId?: string, options?: OSS.GetRtmpUrlOptions): string; +} diff --git a/types/ali-oss/tsconfig.json b/types/ali-oss/tsconfig.json new file mode 100644 index 0000000000..6a0fb7441b --- /dev/null +++ b/types/ali-oss/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ali-oss-tests.ts" + ] +} diff --git a/types/ali-oss/tslint.json b/types/ali-oss/tslint.json new file mode 100644 index 0000000000..8192d88dd1 --- /dev/null +++ b/types/ali-oss/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-mergeable-namespace": false + } +} diff --git a/types/alt/tslint.json b/types/alt/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/alt/tslint.json +++ b/types/alt/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/amplitude-js/amplitude-js-tests.ts b/types/amplitude-js/amplitude-js-tests.ts index 4f3c2ea307..c5ffbe9898 100644 --- a/types/amplitude-js/amplitude-js-tests.ts +++ b/types/amplitude-js/amplitude-js-tests.ts @@ -1,85 +1,110 @@ // Tests for Amplitude SDK TypeScript definitions module Amplitude.Tests { + function all() { - amplitude.init('YOUR_API_KEY_HERE', null, { - // optional configuration options + var client: amplitude.AmplitudeClient = new amplitude.AmplitudeClient(); + var identify: amplitude.Identify = new amplitude.Identify(); + var revenue: amplitude.Revenue = new amplitude.Revenue(); + + client = amplitude.getInstance(); + client = amplitude.getInstance('some name'); + + amplitude.__VERSION__ === '1.2.3'; + amplitude.options.logLevel = 'WARN'; + + amplitude.init('API_KEY', 'USER_ID', { saveEvents: true, includeUtm: true, includeReferrer: true, batchEvents: true, eventUploadThreshold: 50 - }); - amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE', null, () => {}); + }, function () { }); + amplitude.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true }); + amplitude.init('API_KEY', 'USER_ID'); + amplitude.init('API_KEY'); - amplitude.logEvent('EVENT_IDENTIFIER_HERE'); - amplitude.setUserId('USER_ID_HERE'); - amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE'); - amplitude.setUserId(null); // not string 'null' - amplitude.setVersionName('VERSION_NAME_HERE'); - - amplitude.regenerateDeviceId(); - amplitude.setDeviceId('CUSTOM_DEVICE_ID'); - - amplitude.logEvent('EVENT_IDENTIFIER_HERE', { - 'color': 'blue', - 'age': 20, - 'key': 'value' - }); + amplitude.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 }); + amplitude.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' }); amplitude.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { }); + amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' }); + + amplitude.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0'); + amplitude.setDomain('.amplitude.com'); + amplitude.setGroup('orgId', '15'); + amplitude.setGroup('orgId', ['15', '16']); + amplitude.setUserId('joe@gmail.com'); + amplitude.setUserProperties({ 'gender': 'female', 'sign_up_complete': true }) + amplitude.setVersionName('1.12.3'); + amplitude.isNewSession(); + amplitude.getSessionId() === 123; - let identify = new amplitude.Identify().set('gender', 'female').set('age', 20); amplitude.identify(identify); + amplitude.logRevenue(3.99, 1, 'product_1234'); + amplitude.logRevenueV2(revenue); - identify = new amplitude.Identify().setOnce('sign_up_date', '08/24/2015'); - amplitude.identify(identify); - identify = new amplitude.Identify().setOnce('sign_up_date', '09/14/2015'); - amplitude.identify(identify); + client.init('API_KEY', 'USER_ID', { + saveEvents: true, + includeUtm: true, + includeReferrer: true, + batchEvents: true, + eventUploadThreshold: 50 + }, function () { }); + client.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true }); + client.init('API_KEY', 'USER_ID'); + client.init('API_KEY'); - identify = new amplitude.Identify().unset('gender').unset('age'); - amplitude.identify(identify); + client.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 }); + client.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' }); + client.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { }); + client.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' }); + client.logEventWithTimestamp('EVENT_IDENTIFIER_HERE', { 'key': 'value' }, 1505430378000, (httpCode, response) => { }); + + client.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0'); + client.setDomain('.amplitude.com'); + client.setUserId('joe@gmail.com'); + client.setOptOut(true); + client.setGroup('type', 'name'); + client.setGroup('type', ['name', 'name2']); + client.setUserProperties({ 'gender': 'female', 'sign_up_complete': true }); + client.setGlobalUserProperties({ 'gender': 'female', 'sign_up_complete': true }); + client.setVersionName('1.12.3'); + client.setSessionId(1505430378000); + + client.options.logLevel = 'WARN'; + client.getSessionId() === 123; + client.isNewSession() === true; + client.regenerateDeviceId(); + client.clearUserProperties(); + + client.identify(identify); + client.logRevenue(3.99, 1, 'product_1234'); + client.logRevenueV2(revenue); + + + identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31'); identify = new amplitude.Identify().add('karma', 1).add('friends', 1); - amplitude.identify(identify); - - identify = new amplitude.Identify().append('ab-tests', 'new-user-test').append('some_list', [1, 2, 3, 4, 'values']); - amplitude.identify(identify); - - identify = new amplitude.Identify().prepend('ab-tests', 'new-user-test').prepend('some_list', [1, 2, 3, 4, 'values']); - amplitude.identify(identify); - - identify = new amplitude.Identify() - .set('karma', 10) - .add('karma', 1) - .unset('karma'); - amplitude.identify(identify); - + identify = new amplitude.Identify().set('karma', 10).add('karma', 1).unset('karma'); + identify = new amplitude.Identify().append('ab-tests', 'new-user-tests'); + identify.append('some_list', [1, 2, 3, 4, 'values']); + identify = new amplitude.Identify().prepend('ab-tests', 'new-user-tests'); + identify.prepend('some_list', [1, 2, 3, 4, 'values']); + identify = new amplitude.Identify().set('user_type', 'beta'); + identify.set('name', { 'first': 'John', 'last': 'Doe' }); + identify = new amplitude.Identify().setOnce('sign_up_date', '2016-04-01'); + identify = new amplitude.Identify().unset('user_type').unset('age'); identify = new amplitude.Identify() .set('colors', ['rose', 'gold']) .append('ab-tests', 'campaign_a') .append('existing_list', [4, 5]); - amplitude.identify(identify); - amplitude.setUserProperties({ - gender: 'female', - age: 20 - }); - amplitude.clearUserProperties(); - - amplitude.setOptOut(true); - amplitude.setOptOut(false); - - amplitude.setGroup('orgId', '15'); - amplitude.setGroup('sport', ['soccer', 'tennis']); - - // TODO: Implement those. - /* - var revenue = new amplitude.Revenue().setProductId('com.company.productId').setPrice(3.99).setQuantity(3); - amplitude.logRevenueV2(revenue); - - amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' }); - */ + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99); + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setEventProperties({ 'city': 'San Francisco' }); + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setQuantity(5); + revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setRevenueType('purchase'); } + } diff --git a/types/amplitude-js/index.d.ts b/types/amplitude-js/index.d.ts index 613f5ad5d8..1cdb843589 100644 --- a/types/amplitude-js/index.d.ts +++ b/types/amplitude-js/index.d.ts @@ -1,61 +1,146 @@ -// Type definitions for Amplitude SDK 2.12.1 +// Type definitions for Amplitude SDK 4.4.0 // Project: https://github.com/amplitude/Amplitude-Javascript // Definitions by: Arvydas Sidorenko -// Definitions: https://github.com/Asido/DefinitelyTyped +// Dan Manastireanu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module amplitude { + + type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void; + type LogReturn = number | void; + interface Config { + apiEndpoint?: string; batchEvents?: boolean; cookieExpiration?: number; cookieName?: string; + userId?: string; deviceId?: string; + deviceIdFromUrlParam?: boolean; domain?: string; eventUploadPeriodMillis?: number; eventUploadThreshold?: number; + forceHttps?: boolean; + includeGclid?: boolean; includeReferrer?: boolean; includeUtm?: boolean; language?: string; + logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO'; optOut?: boolean; platform?: string; saveEvents?: boolean; savedMaxCount?: number; + saveParamsReferrerOncePerSession?: boolean; sessionTimeout?: number; + trackingOptions?: { + city?: boolean; + country?: boolean; + device_model?: boolean; + dma?: boolean; + ip_address?: boolean; + language?: boolean; + os_name?: boolean; + os_version?: boolean; + platform?: boolean; + region?: boolean; + version_name?: boolean; + }, + unsentKey?: string; + unsentIdentifyKey?: string; uploadBatchSize?: number; } export class Identify { set(key: string, value: any): Identify; setOnce(key: string, value: any): Identify; - add(key: string, value: number): Identify; + add(key: string, value: number | string): Identify; append(key: string, value: any): Identify; prepend(key: string, value: any): Identify; unset(key: string): Identify; } - export function init(apiKey: string): void; - export function init(apiKey: string, userId: string): void; - export function init(apiKey: string, userId: string, options: Config): void; - export function init(apiKey: string, userId: string, options: Config, callback: () => void): void; + export class Revenue { + + setProductId(productId: string): Revenue; + setQuantity(quantity: number): Revenue; + setPrice(price: number): Revenue; + setRevenueType(revenueType: string): Revenue; + setEventProperties(eventProperties: any): Revenue; + } + + export class AmplitudeClient { + + constructor(instanceName?: string); + + options: Config; + + init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void; + + setVersionName(versionName: string): void; + + isNewSession(): boolean; + setSessionId(sessionId: number): void; + getSessionId(): number; + + setDomain(domain: string): void; + setUserId(userId: string): void; + + setDeviceId(id: string): void; + regenerateDeviceId(): void; + + identify(identify_obj: Identify, opt_callback?: Callback): void; + + setUserProperties(properties: any): void; + setGlobalUserProperties(properties: any): void; + clearUserProperties(): void; + + setOptOut(enable: boolean): void; + + setGroup(groupType: string, groupName: string | string[]): void; + + logEvent(event: string, data?: any, callback?: Callback): LogReturn; + logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; + logRevenueV2(revenue_obj: Revenue): LogReturn; + logRevenue(pric: number, quantity: number, product: string): LogReturn; + logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; + } + + // Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied) + + export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void; export function setVersionName(version: string): void; + + export function isNewSession(): boolean; + export function getSessionId(): number; + + export function setDomain(domain: string): void; + export function setUserId(userId: string): void; export function setDeviceId(id: string): void; export function regenerateDeviceId(): void; - export function identify(identify: Identify): void; + export function identify(identify: Identify, callback?: Callback): void; - export function setUserProperties(properties: Object): void; + export function setUserProperties(properties: any): void; + export function setGlobalUserProperties(properties: any): void; export function clearUserProperties(): void; export function setOptOut(optOut: boolean): void; export function setGroup(groupType: string, groupName: string | string[]): void; - export function logEvent(event: string): void; - export function logEvent(event: string, data: Object): void; - export function logEvent(event: string, data: Object, callback: (httpCode: number, response: any) => void): void; + export function logEvent(event: string, data?: any, callback?: Callback): LogReturn; + export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn; + export function logRevenueV2(revenue_obj: Revenue): LogReturn; + export function logRevenue(pric: number, quantity: number, product: string): LogReturn; + export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn; + + + export function getInstance(instanceName?: string): AmplitudeClient; + export const __VERSION__: string; export var options: Config; } diff --git a/types/amqplib/index.d.ts b/types/amqplib/index.d.ts index 9ad6d9ceda..2ea088f841 100644 --- a/types/amqplib/index.d.ts +++ b/types/amqplib/index.d.ts @@ -8,7 +8,7 @@ import * as Promise from 'bluebird'; import * as events from 'events'; -import { Replies, Options, Message } from './properties'; +import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties'; export * from './properties'; export interface Connection extends events.EventEmitter { @@ -40,10 +40,10 @@ export interface Channel extends events.EventEmitter { publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; - consume(queue: string, onMessage: (msg: Message | null) => any, options?: Options.Consume): Promise; + consume(queue: string, onMessage: (msg: ConsumeMessage | null) => any, options?: Options.Consume): Promise; cancel(consumerTag: string): Promise; - get(queue: string, options?: Options.Get): Promise; + get(queue: string, options?: Options.Get): Promise; ack(message: Message, allUpTo?: boolean): void; ackAll(): void; diff --git a/types/amqplib/properties.d.ts b/types/amqplib/properties.d.ts index 9f96b14f5c..97dc8ac393 100644 --- a/types/amqplib/properties.d.ts +++ b/types/amqplib/properties.d.ts @@ -145,12 +145,32 @@ export interface Message { properties: MessageProperties; } -export interface MessageFields { +export interface GetMessage extends Message { + fields: GetMessageFields; +} + +export interface ConsumeMessage extends Message { + fields: ConsumeMessageFields; +} + +export interface CommonMessageFields { deliveryTag: number; redelivered: boolean; exchange: string; routingKey: string; - messageCount: string; +} + +export interface MessageFields extends CommonMessageFields { + messageCount?: number; + consumerTag?: string; +} + +export interface GetMessageFields extends CommonMessageFields { + messageCount: number; +} + +export interface ConsumeMessageFields extends CommonMessageFields { + deliveryTag: number; } export interface MessageProperties { diff --git a/types/amqplib/tslint.json b/types/amqplib/tslint.json index bfc9508c49..f64a783725 100644 --- a/types/amqplib/tslint.json +++ b/types/amqplib/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // All are TODOs + "no-any-union": false, "no-empty-interface": false, "prefer-const": false } diff --git a/types/angular-bootstrap-lightbox/tslint.json b/types/angular-bootstrap-lightbox/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/angular-bootstrap-lightbox/tslint.json +++ b/types/angular-bootstrap-lightbox/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 6885916e8a..db74c97d10 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -76,6 +76,7 @@ declare module 'angular' { interface IConfirmDialog extends IPresetDialog { cancel(cancel: string): IConfirmDialog; + multiple(multiple: boolean): IConfirmDialog; } interface IPromptDialog extends IPresetDialog { @@ -340,6 +341,7 @@ declare module 'angular' { interface IMenuService { hide(response?: any, options?: any): IPromise; + open(event?: MouseEvent): void; } interface IColorPalette { diff --git a/types/angular-meteor/tslint.json b/types/angular-meteor/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/angular-meteor/tslint.json +++ b/types/angular-meteor/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/angular-pdfjs-viewer/tsconfig.json b/types/angular-pdfjs-viewer/tsconfig.json index bdae87bf50..05a851782e 100644 --- a/types/angular-pdfjs-viewer/tsconfig.json +++ b/types/angular-pdfjs-viewer/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/angular-promise-tracker/angular-promise-tracker-tests.ts b/types/angular-promise-tracker/angular-promise-tracker-tests.ts index 0365709cf5..6b8b8abd31 100644 --- a/types/angular-promise-tracker/angular-promise-tracker-tests.ts +++ b/types/angular-promise-tracker/angular-promise-tracker-tests.ts @@ -1,5 +1,5 @@ -angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker', - ($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => { +angular.module('promise-tracker-tests', []).run(['$q', '$http', 'promiseTracker', + ($q: angular.IQService, $http: angular.IHttpService, promiseTracker: angular.promisetracker.PromiseTrackerService) => { const trackerWithoutOptions = promiseTracker(); const options = { @@ -19,4 +19,8 @@ angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker', const addedPromise: angular.IDeferred = trackerWithOptions.addPromise(promiseToAdd); const trackerWithSomeOptions = promiseTracker({activationDelay: 500}); + + $http.post('/foo', {}, { }); + $http.post('/foo', {}, { tracker: trackerWithOptions }); + $http.post('/foo', {}, { tracker: [trackerWithoutOptions, trackerWithOptions] }); }]); diff --git a/types/angular-promise-tracker/index.d.ts b/types/angular-promise-tracker/index.d.ts index 85a87bad63..78849fa3e1 100644 --- a/types/angular-promise-tracker/index.d.ts +++ b/types/angular-promise-tracker/index.d.ts @@ -28,4 +28,8 @@ declare module 'angular' { (options?: PromiseTrackerOptions): PromiseTracker; } } + + interface IRequestShortcutConfig { + tracker?: angular.promisetracker.PromiseTracker | angular.promisetracker.PromiseTracker[]; + } } diff --git a/types/angular-q-extras/tsconfig.json b/types/angular-q-extras/tsconfig.json index 3047a809eb..973131f033 100644 --- a/types/angular-q-extras/tsconfig.json +++ b/types/angular-q-extras/tsconfig.json @@ -6,7 +6,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/angular-toastr/angular-toastr-tests.ts b/types/angular-toastr/angular-toastr-tests.ts index 6cb4290b3c..37a9885e9c 100644 --- a/types/angular-toastr/angular-toastr-tests.ts +++ b/types/angular-toastr/angular-toastr-tests.ts @@ -16,6 +16,10 @@ angular closeButton: false, closeHtml: '', extendedTimeOut: 1000, + extraData: { + txt: "sample text", + action: () => {/* Do action */}, + }, iconClasses: { error: 'toast-error', info: 'toast-info', @@ -29,7 +33,6 @@ angular progressBar: false, tapToDismiss: true, templates: { - toast: 'directives/toast/toast.html', progressbar: 'directives/progressbar/progressbar.html' }, diff --git a/types/angular-toastr/index.d.ts b/types/angular-toastr/index.d.ts index 21cf13cce2..f264e71f46 100644 --- a/types/angular-toastr/index.d.ts +++ b/types/angular-toastr/index.d.ts @@ -24,6 +24,7 @@ declare module 'angular' { closeButton?: boolean; closeHtml?: string; extendedTimeOut?: number; + extraData?: any, messageClass?: string; onHidden?: (wasClicked: boolean, toast: angular.toastr.IToast) => void; onShown?: (toast: angular.toastr.IToast) => void; diff --git a/types/angular-ui-sortable/angular-ui-sortable-tests.ts b/types/angular-ui-sortable/angular-ui-sortable-tests.ts index 9ecde2f92a..9418b5741c 100644 --- a/types/angular-ui-sortable/angular-ui-sortable-tests.ts +++ b/types/angular-ui-sortable/angular-ui-sortable-tests.ts @@ -16,6 +16,9 @@ interface SortLogInfo { Text: string; } +// Ensure that the jQuery-ui defined `sortable()` method is not overwritten +jQuery().sortable(); // $ExpectType JQuery + myApp.controller('sortableController', function ($scope: MySortableControllerScope) { $scope.sortableOptions = { activate: function(e, ui) { @@ -84,6 +87,7 @@ myApp.controller('sortableController', function ($scope: MySortableControllerSco update: function(e, ui) { var jQueryEventObject: JQueryEventObject = e; var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + ui.item.sortable; // $ExpectType UISortableProperties var voidcanceled: void = ui.item.sortable.cancel(); var isCanceled: Boolean = ui.item.sortable.isCanceled(); var isCustomHelperUsed: Boolean =ui.item.sortable.isCustomHelperUsed(); diff --git a/types/angular-ui-sortable/index.d.ts b/types/angular-ui-sortable/index.d.ts index aa81038346..9ecf06e112 100644 --- a/types/angular-ui-sortable/index.d.ts +++ b/types/angular-ui-sortable/index.d.ts @@ -2,12 +2,16 @@ // Project: https://github.com/angular-ui/ui-sortable // Definitions by: Thodoris Greasidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 /// +/// import * as ng from 'angular'; +// Diff / Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766 +type Omit = Pick; + declare module 'angular' { export namespace ui { @@ -79,11 +83,11 @@ declare module 'angular' { isCustomHelperUsed(): Boolean; } - interface UISortableUIItem extends ng.IAugmentedJQuery { + interface UISortableUIItem extends Omit { sortable: UISortableProperties; } - interface UISortableUIParams extends SortableUIParams { + interface UISortableUIParams extends Omit { item: UISortableUIItem; } diff --git a/types/angular-wizard/index.d.ts b/types/angular-wizard/index.d.ts index 33fa8b2b0a..fa14a2f2f7 100644 --- a/types/angular-wizard/index.d.ts +++ b/types/angular-wizard/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mgonto/angular-wizard // Definitions by: Marko Jurisic , Ronald Wildenberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 import * as angular from 'angular'; diff --git a/types/angular-wizard/tslint.json b/types/angular-wizard/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/angular-wizard/tslint.json +++ b/types/angular-wizard/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/animejs/index.d.ts b/types/animejs/index.d.ts index a975f59513..069187b15e 100644 --- a/types/animejs/index.d.ts +++ b/types/animejs/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -type FunctionBasedParamter = (element: HTMLElement, index: number, length: number) => number; +type FunctionBasedParameter = (element: HTMLElement, index: number, length: number) => number; type AnimeCallbackFunction = (anim: anime.AnimeInstance) => void; // Allowing null is necessary because DOM queries may not return anything. type AnimeTarget = string | object | HTMLElement | SVGElement | NodeList | null; @@ -55,10 +55,10 @@ declare namespace anime { interface AnimeAnimParams { targets: AnimeTarget | ReadonlyArray; - duration?: number | FunctionBasedParamter; - delay?: number | FunctionBasedParamter; - elasticity?: number | FunctionBasedParamter; - round?: number | boolean | FunctionBasedParamter; + duration?: number | FunctionBasedParameter; + delay?: number | FunctionBasedParameter; + elasticity?: number | FunctionBasedParameter; + round?: number | boolean | FunctionBasedParameter; easing?: EasingOptions | string | ReadonlyArray; @@ -106,7 +106,7 @@ declare namespace anime { } interface AnimeTimelineAnimParams extends AnimeAnimParams { - offset: number | string | FunctionBasedParamter; + offset: number | string | FunctionBasedParameter; } interface AnimeTimelineInstance extends AnimeInstance { diff --git a/types/ansi-styles/index.d.ts b/types/ansi-styles/index.d.ts index a07ac962ab..b67cdada41 100644 --- a/types/ansi-styles/index.d.ts +++ b/types/ansi-styles/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: bryn austin bellomy // plylrnsdy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.1 import { EscapeCode } from './escape-code'; diff --git a/types/ansi/ansi-tests.ts b/types/ansi/ansi-tests.ts new file mode 100644 index 0000000000..0c033c6839 --- /dev/null +++ b/types/ansi/ansi-tests.ts @@ -0,0 +1,32 @@ +import ansi = require('ansi'); +const cursor = ansi(process.stdout); + +Object.keys({ + white: 37 + , black: 30 + , blue: 34 + , cyan: 36 + , green: 32 + , magenta: 35 + , red: 31 + , yellow: 33 + , grey: 90 + , brightBlack: 90 + , brightRed: 91 + , brightGreen: 92 + , brightYellow: 93 + , brightBlue: 94 + , brightMagenta: 95 + , brightCyan: 96 + , brightWhite: 97 +}).forEach((color) => { + const cname = color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`); + + ((cursor[color] as (...anything: any[]) => ansi.Cursor)() + .bold() + .bg)[color === 'blue' || color === 'brightBlue' ? 'black' : 'blue']() + .write( + `Hello, bold ${cname} world!\n` + ) + .reset(); +}); diff --git a/types/ansi/index.d.ts b/types/ansi/index.d.ts new file mode 100644 index 0000000000..4e486d61ef --- /dev/null +++ b/types/ansi/index.d.ts @@ -0,0 +1,181 @@ +// Type definitions for ansi 0.3 +// Project: https://www.npmjs.com/package/ansi +// Definitions by: Gustavo6046 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/** + * References: + * + * - http://en.wikipedia.org/wiki/ANSI_escape_code + * - http://www.termsys.demon.co.uk/vtansi.htm + * + */ + +/// +import { Stream } from "stream"; + +interface CursorOptions { + enabled: boolean; + buffering: boolean; +} + +declare function ansi(stream: Stream, options?: CursorOptions): ansi.Cursor; + +declare namespace ansi { + class Cursor { + bg: Colorer; + fg: Colorer; + + constructor(stream: Stream, options?: CursorOptions); + + /** + * Helper function that calls `write()` on the underlying Stream. + * Returns `this` instead of the write() return value to keep + * the chaining going. + */ + write(data: string): Cursor; + + /** + * Buffer `write()` calls into memory. + * + * @api public + */ + buffer(): Cursor; + + /** + * Write out the in-memory buffer. + * + * @api public + */ + flush(): Cursor; + + /** + * Makes a beep sound! + */ + beep(): Cursor; + + /** + * Moves cursor to specific position + */ + goto(x?: number, y?: number): Cursor; + + /** + * Resets all ANSI formatting on the stream. + */ + reset(): Cursor; + + /** + * Sets the foreground color with the given RGB values. + * The closest match out of the 216 colors is picked. + */ + rgb(r: number, g: number, b: number): Cursor; + + /** + * Accepts CSS color codes for use with ANSI escape codes. + * For example: `#FF000` would be bright red. + */ + hex(color: string): Cursor; + + up(): Cursor; + down(): Cursor; + forward(): Cursor; + back(): Cursor; + nextLine(): Cursor; + previousLine(): Cursor; + horizontalAbsolute(): Cursor; + eraseData(): Cursor; + eraseLine(): Cursor; + scrollUp(): Cursor; + scrollDown(): Cursor; + savePosition(): Cursor; + restorePosition(): Cursor; + queryPosition(): Cursor; + hide(): Cursor; + show(): Cursor; + + bold(): Cursor; + italic(): Cursor; + underline(): Cursor; + inverse(): Cursor; + resetbold(): Cursor; + resetitalic(): Cursor; + resetunderline(): Cursor; + resetinverse(): Cursor; + + white(): Cursor; + black(): Cursor; + blue(): Cursor; + cyan(): Cursor; + green(): Cursor; + magenta(): Cursor; + red(): Cursor; + yellow(): Cursor; + grey(): Cursor; + brightBlack(): Cursor; + brightRed(): Cursor; + brightGreen(): Cursor; + brightYellow(): Cursor; + brightBlue(): Cursor; + brightMagenta(): Cursor; + brightCyan(): Cursor; + brightWhite(): Cursor; + } + + /** + * The `Colorer` class manages both the background and foreground colors. + */ + class Colorer { + constructor(cursor: Cursor, base: string); + + /** + * Write an ANSI color code, ensuring that the same code doesn't get rewritten. + */ + _setColorCode(code: string): Colorer; + + /** + * Resets the color. + */ + reset(): Cursor; + + /** + * Sets the foreground color with the given RGB values. + * The closest match out of the 216 colors is picked. + */ + rgb(r: number, g: number, b: number): Cursor; + + /** + * Accepts CSS color codes for use with ANSI escape codes. + * For example: `#FF000` would be bright red. + */ + hex(color: string): Cursor; + + white(): Cursor; + black(): Cursor; + blue(): Cursor; + cyan(): Cursor; + green(): Cursor; + magenta(): Cursor; + red(): Cursor; + yellow(): Cursor; + grey(): Cursor; + brightBlack(): Cursor; + brightRed(): Cursor; + brightGreen(): Cursor; + brightYellow(): Cursor; + brightBlue(): Cursor; + brightMagenta(): Cursor; + brightCyan(): Cursor; + brightWhite(): Cursor; + } + + interface Cursor { + [key: string]: ((...anything: any[]) => Cursor) | Colorer; + } + + interface Colorer { + [key: string]: (...anything: any[]) => (Cursor | Colorer); + } +} + +export = ansi; diff --git a/types/ansi/tsconfig.json b/types/ansi/tsconfig.json new file mode 100644 index 0000000000..8c698148e6 --- /dev/null +++ b/types/ansi/tsconfig.json @@ -0,0 +1,24 @@ +{ + "files": [ + "index.d.ts", + "ansi-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "noEmit": true, + "types": [], + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/ansi/tslint.json b/types/ansi/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/ansi/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/aos/aos-tests.ts b/types/aos/aos-tests.ts new file mode 100644 index 0000000000..3936d80499 --- /dev/null +++ b/types/aos/aos-tests.ts @@ -0,0 +1,35 @@ +import * as Aos from "aos"; + +const options: Aos.AosOptions = { + disable: () => true, + startEvent: "DOMContentLoaded", + initClassName: "aos-init", + animatedClassName: "aos-animate", + useClassNames: false, + + offset: 120, + delay: 0, + duration: 400, + easing: "ease-in-out-back", + once: false, + mirror: false, + anchorPlacement: "center-bottom" +}; + +Aos.init(); +Aos.init(options); + +Aos.refresh(); +Aos.refreshHard(); + +document.addEventListener("aos:in", event => { + event; + event.detail; +}); + +document.addEventListener("aos:out", () => {}); + +// aos also creates custom events for every unique id, which you can't cover in d.ts +document.addEventListener("aos:in:sectionId" as Aos.AosEventType, event => { + event.detail; +}); diff --git a/types/aos/global.d.ts b/types/aos/global.d.ts new file mode 100644 index 0000000000..63b6e26f9d --- /dev/null +++ b/types/aos/global.d.ts @@ -0,0 +1,7 @@ +interface Document { + addEventListener( + type: Aos.AosEventType, + listener: (event: Aos.AosEvent) => void, + options?: boolean | AddEventListenerOptions + ): void; +} diff --git a/types/aos/index.d.ts b/types/aos/index.d.ts new file mode 100644 index 0000000000..1e1a9f7cc6 --- /dev/null +++ b/types/aos/index.d.ts @@ -0,0 +1,130 @@ +// Type definitions for aos 3.0 +// Project: https://github.com/michalsnik/aos +// Definitions by: Rostislav Shermenyov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare namespace Aos { + type easingOptions = + | "linear" + | "ease" + | "ease-in" + | "ease-out" + | "ease-in-out" + | "ease-in-back" + | "ease-out-back" + | "ease-in-out-back" + | "ease-in-sine" + | "ease-out-sine" + | "ease-in-out-sine" + | "ease-in-quad" + | "ease-out-quad" + | "ease-in-out-quad" + | "ease-in-cubic" + | "ease-out-cubic" + | "ease-in-out-cubic" + | "ease-in-quart" + | "ease-out-quart" + | "ease-in-out-quart"; + + type anchorPlacementOptions = + | "top-bottom" + | "top-center" + | "top-top" + | "center-bottom" + | "center-center" + | "center-top" + | "bottom-bottom" + | "bottom-center" + | "bottom-top"; + + interface Aos { + /** + * Initializing AOS + * - Create options merging defaults with user defined options + * - Set attributes on as global setting - css relies on it + * - Attach preparing elements to options.startEvent, + * window resize and orientation change + * - Attach function that handle scroll and everything connected to it + * to window scroll event and fire once document is ready to set initial state + * @param options options + */ + init(options?: AosOptions): void; + /** + * Refresh AOS + */ + refresh(): void; + /** + * Hard refresh + * create array with new elements and trigger refresh + */ + refreshHard(): void; + } + + interface AosOptions { + // #region Global settings + /** + * Class applied on animation + */ + animatedClassName?: string; + /** + * Accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function + */ + disable?: "phone" | "tablet" | "mobile" | boolean | (() => boolean); + /** + * Class applied after initialization + */ + initClassName?: string; + /** + * Name of the event dispatched on the document, that AOS should initialize on + */ + startEvent?: string; + /** + * If true, will add content of `data-aos` as classes on scroll + */ + useClassNames?: boolean; + // #endregion + + // #region Settings that can be overridden on per-element basis, by `data-aos-*` attributes + /** + * Defines which position of the element regarding to window should trigger the animation + */ + anchorPlacement?: anchorPlacementOptions; + /** + * Values from 0 to 3000, with step 50ms + */ + delay?: number; + /** + * Values from 0 to 3000, with step 50ms + */ + duration?: number; + /** + * Default easing for AOS animations + */ + easing?: easingOptions; + /** + * Whether elements should animate out while scrolling past them + */ + mirror?: boolean; + /** + * Offset (in px) from the original trigger point + */ + offset?: number; + /** + * Whether animation should happen only once - while scrolling down + */ + once?: boolean; + // #endregion + } + + interface AosEvent extends Event { + detail: Element; + } + + type AosEventType = "aos:in" | "aos:out"; +} + +declare const Aos: Aos.Aos; + +export = Aos; +export as namespace Aos; diff --git a/types/aos/tsconfig.json b/types/aos/tsconfig.json new file mode 100644 index 0000000000..9af3663613 --- /dev/null +++ b/types/aos/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "global.d.ts", + "aos-tests.ts" + ] +} diff --git a/types/mali/tslint.json b/types/aos/tslint.json similarity index 100% rename from types/mali/tslint.json rename to types/aos/tslint.json diff --git a/types/aphrodite/index.d.ts b/types/aphrodite/index.d.ts index 3e7807b6b6..f41aadec46 100644 --- a/types/aphrodite/index.d.ts +++ b/types/aphrodite/index.d.ts @@ -12,7 +12,7 @@ type FontFamily = | BaseCSSProperties['fontFamily'] | CSS.FontFace; -type Omit = Pick; +type Omit = Pick>; type CSSProperties = Omit & { fontFamily?: FontFamily | FontFamily[]; diff --git a/types/apollo-codegen/index.d.ts b/types/apollo-codegen/index.d.ts index ea5d415418..4309db4116 100644 --- a/types/apollo-codegen/index.d.ts +++ b/types/apollo-codegen/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/apollographql/apollo-codegen // Definitions by: Bradley Ayers , Maria Carrasco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Options } from 'graphql/utilities/schemaPrinter'; diff --git a/types/apollo-upload-client/index.d.ts b/types/apollo-upload-client/index.d.ts index 7c1e3cb7b6..c6476f2ae9 100644 --- a/types/apollo-upload-client/index.d.ts +++ b/types/apollo-upload-client/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jaydenseric/apollo-upload-client#readme // Definitions by: Edward Sammut Alessi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.6 import { ApolloLink } from "apollo-link"; import { HttpOptions } from "apollo-link-http-common"; diff --git a/types/apollo-upload-client/tsconfig.json b/types/apollo-upload-client/tsconfig.json index 2a023ff111..a78e75500c 100644 --- a/types/apollo-upload-client/tsconfig.json +++ b/types/apollo-upload-client/tsconfig.json @@ -2,7 +2,9 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", "dom" + "es6", + "dom", + "esnext.asynciterable" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/apostrophe/index.d.ts b/types/apostrophe/index.d.ts index bab1b3a7de..9c415a3931 100644 --- a/types/apostrophe/index.d.ts +++ b/types/apostrophe/index.d.ts @@ -7,7 +7,10 @@ export = apostrophe; export as namespace apos; -declare function apostrophe(options: any, ...args: any[]): any; +declare function apostrophe( + options: apostrophe.AposConstructor, + ...args: any[] +): any; declare namespace apostrophe { const moogBundle: { @@ -15,6 +18,20 @@ declare namespace apostrophe { modules: string[]; }; + // Pass in custom modules as first argument + // second argument is additional custom options e.g. restApi exposed by apostrophe-headless + interface AposConstructor { + afterInit?: () => void; + afterListen?: () => void; + initFailed?: (error: any) => void; + baseUrl?: string; + modules: { [K in AposCoreModules & M]?: AposModuleOptions | O }; + prefix?: string; + root?: string; + rootDir?: string; + shortName: string; + } + const ui: { globalBusy: (state: any) => any; link: ( @@ -124,8 +141,18 @@ declare namespace apostrophe { name: string; type: string; label: string; + help?: string; required?: boolean; options?: AposObject; + choices?: SelectChoice[]; + widgetType?: string; + titleField?: string; + schema?: Field[]; + } + + interface SelectChoice { + label: string; + value: string; } type Fields = Field[]; @@ -290,6 +317,7 @@ declare namespace apostrophe { label: string; fields: string[]; }[]; + beforeConstruct?: (self: any, options: any) => any; defer?: boolean; filters?: { projection?: { diff --git a/types/app-module-path/app-module-path-tests.ts b/types/app-module-path/app-module-path-tests.ts new file mode 100644 index 0000000000..5dc1012ca1 --- /dev/null +++ b/types/app-module-path/app-module-path-tests.ts @@ -0,0 +1,7 @@ +import { addPath, enableForDir, removePath } from 'app-module-path'; + +addPath('/tmp'); + +enableForDir('/tmp'); + +removePath('/tmp'); diff --git a/types/app-module-path/index.d.ts b/types/app-module-path/index.d.ts new file mode 100644 index 0000000000..00280c4191 --- /dev/null +++ b/types/app-module-path/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for app-module-path 2.2 +// Project: https://github.com/patrick-steele-idem/app-module-path-node +// Definitions by: Timur Manyanov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +export function addPath(path: string, parent?: any): void; + +export function enableForDir(dir: string): void; + +export function removePath(path: string): void; diff --git a/types/app-module-path/tsconfig.json b/types/app-module-path/tsconfig.json new file mode 100644 index 0000000000..93d4d0a365 --- /dev/null +++ b/types/app-module-path/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "app-module-path-tests.ts" + ] +} diff --git a/types/app-module-path/tslint.json b/types/app-module-path/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/app-module-path/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/arangodb/index.d.ts b/types/arangodb/index.d.ts index 32ad04210b..238cea2379 100644 --- a/types/arangodb/index.d.ts +++ b/types/arangodb/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/arangodb/arangodb // Definitions by: Alan Plum // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// @@ -1440,6 +1440,81 @@ declare module "@arangodb/foxx/router" { export = createRouter; } +declare module "@arangodb/foxx/queues" { + interface QueueItem { + name: string; + mount: string; + backOff?: ((failureCount: number) => number) | number; + maxFailures?: number; + schema?: Foxx.Schema; + preprocess?: (data: any) => any; + } + + interface Script { + name: string; + mount: string; + } + + type JobCallback = (result: any, jobData: any, job: ArangoDB.Document) => void; + + interface Job { + status: string; + queue: string; + type: Script; + failures: object[]; + runs: number; + data: any; + created: number; + modified: number; + delayUntil: number; + maxFailures: number; + repeatDelay: number; + repeatTimes: number; + repeatUntil: number; + success?: string; + failure?: string; + runFailures: number; + abort(): void; + } + + interface JobOptions { + success?: JobCallback; + failure?: JobCallback; + delayUntil?: number | Date; + backOff?: ((failureCount: number) => number) | number; + maxFailures?: number; + repeatTimes?: number; + repeatUntil?: number | Date; + repeatDelay?: number; + } + + interface Queue { + push(item: QueueItem, data: any, opts?: JobOptions): void; + get(jobId: string): ArangoDB.Document; + delete(jobId: string): boolean; + pending(script?: Script): string[]; + progress(script?: Script): string[]; + complete(script?: Script): string[]; + failed(script?: Script): string[]; + all(script?: Script): string[]; + } + + function createQueue(name: string, maxWorkers?: number): Queue; + function deleteQueue(name: string): boolean; + function get(name: string): Queue; + + export { + createQueue as create, + deleteQueue as delete, + get, + JobOptions, + Job, + Queue, + QueueItem, + Script, + }; +} + declare module "@arangodb/foxx/graphql" { import { formatError, GraphQLSchema } from "graphql"; type GraphQLModule = object; @@ -1698,7 +1773,7 @@ declare module "@arangodb/crypto" { key: string | null, token: string, noVerify?: boolean - ): string | null; + ): object | null; function md5(message: string): string; function sha1(message: string): string; function sha224(message: string): string; diff --git a/types/arangodb/tsconfig.json b/types/arangodb/tsconfig.json index f778fd7c47..d30610b604 100644 --- a/types/arangodb/tsconfig.json +++ b/types/arangodb/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": ["es6", "esnext.asynciterable"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/arcgis-js-api/index.d.ts b/types/arcgis-js-api/index.d.ts index 97eb679110..28e51384c9 100644 --- a/types/arcgis-js-api/index.d.ts +++ b/types/arcgis-js-api/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for ArcGIS API for JavaScript 4.8 +// Type definitions for ArcGIS API for JavaScript 4.9 // Project: http://js.arcgis.com // Definitions by: Esri // Bjorn Svensson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.7 interface HashMap { @@ -300,6 +300,14 @@ declare namespace __esri { * */ clone(): Basemap; + /** + * Loads all the externally loadable resources associated with the basemap. For the basemap this will load all the base layers and reference layers. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html#loadAll) + * + * + */ + loadAll(): IPromise; } interface BasemapConstructor { @@ -625,7 +633,7 @@ declare namespace __esri { */ interface config { /** - * The URL for font resources used by the [Font](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Font.html#family) class with 2D WebGL enabled [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html). To use your own hosted fonts, make sure to follow our naming conventions (e.g. "arial-unicode-ms-bold"). + * The URL for font resources used by the [Font](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Font.html#family) class in [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) labels. To use your own hosted fonts, you must follow the kebab-case naming convention (e.g. "arial-unicode-ms-bold"). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#fontsUrl) * @@ -686,42 +694,6 @@ declare namespace __esri { export interface configRequest extends Object { - /** - * Indicates whether the library automatically detects if [CORS](http://enable-cors.org/) (Cross-Origin Resource Sharing) specification is supported by ArcGIS Servers used in your application. Upon successful detection, the server will be added to `corsEnabledServers` list. CORS detection will not be performed for a server if it is already listed in `corsEnabledServers`. The default is `true` if your application is running in a web browser, or `false` if your application is running on [Apache Cordova](https://cordova.apache.org/) platform. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - */ - corsDetection?: boolean; - /** - * Number of seconds to wait for response from the ArcGIS Server during CORS detection. If the detection is not complete before this time expires, then it is assumed that the server does not support CORS. Applicable when `corsDetection` is true. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - * - * @default 15 - */ - corsDetectionTimeout?: number; - /** - * A list of servers known to support CORS specification. By default, this list includes many Esri hosted servers that are known to support CORS and is updated at every release as the list grows. The API is capable of automatically detecting CORS support for servers used in an application (see `corsDetection`). If you are aware that a server supports CORS, add it to this list. Since the API includes some servers by default it's important to add items onto this array rather than overwriting it. Example: - * ```js - * // Add a known server to the list. - * require(["esri/config"], function(esriConfig) { - * esriConfig.request.corsEnabledServers.push(".:"); - * }); - * ``` - * - * You can also pass objects to this property with the following specification: - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - */ - corsEnabledServers?: (string | configRequestCorsEnabledServers)[]; - /** - * Indicates whether the proxy specified in `proxyUrl` is used for all AJAX requests made using [request](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html) and images added using `` element. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - * - * @default false - */ - forceProxy?: boolean; /** * List of domain suffixes known to support https. This will automatically upgrade requests made to such domains to use https instead of http when the application is not running on http. Note that port numbers should not be included in the domain suffix to be matched. If no `httpsDomains` list exists , the API redirects all calls using https. If the list exists and a domain of a required http resource is not listed, the API sends the URL as it is specified within the code. Likewise, if the list exists and the domain of a required http resource is listed in it, the API sends an https request to that resource. The list includes the following domain suffixes by default: * * `arcgis.com` @@ -769,6 +741,12 @@ declare namespace __esri { * @default 2000 */ maxUrlLength?: number; + /** + * A proxy rule defines a proxy for a set of resources with an identical URL prefix. When using [esriRequest](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html), if a target URL matches a rule, then the request will be sent to the specified proxy. Rather than populating this array directly, use the urlUtils.addProxyRule() method. Rule objects have the following properties: + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) + */ + proxyRules?: configRequestProxyRules[]; /** * Resource proxy for your application. It is used by the library when communicating with a web server hosted on a domain that is different from the domain where your application is hosted. The library may or may not use the proxy depending on the type of request made, whether the server support CORS, whether the application is being run on older versions of browsers etc. To keep it simple, it is recommended that you always configure a resource proxy for your application. You can download the resource proxy from this [GitHub repo](https://github.com/Esri/resource-proxy). * ```js @@ -789,13 +767,16 @@ declare namespace __esri { */ timeout?: number; /** - * Indicates whether the library will use [CORS](http://enable-cors.org/)-enabled requests when communicating with a web server hosted on a domain that is different from the domain where the application is hosted. If `true`, AJAX requests are directly made to servers that support CORS. If `with-credentials` is specified, then AJAX requests will use credentials stored in a client's cookies. If `false`, direct requests are not made. A proxy will be used if available. + * **Since:** 4.9 Indicates whether cross origin requests made to the associated server should include credentials such as cookies and authorization headers. + * ```js + * require(["esri/config"], function(esriConfig) { + * esriConfig.request.trustedServers.push("[//].[:]"); + * }); + * ``` * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - * - * @default with-credentials */ - useCors?: string | boolean; + trustedServers?: string[]; /** * **Since:** 4.5 Indicates whether `esri/request` will request a credential from `IdentityManager`. * @@ -804,30 +785,6 @@ declare namespace __esri { * @default true */ useIdentity?: boolean; - /** - * A proxy rule defines a proxy for a set of resources with an identical URL prefix. When using [esriRequest](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html), if a target URL matches a rule, then the request will be sent to the specified proxy. Rather than populating this array directly, use the urlUtils.addProxyRule() method. Rule objects have the following properties: - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - */ - proxyRules?: configRequestProxyRules[]; - } - - - export interface configRequestCorsEnabledServers extends Object { - /** - * The host name of the server to add to the list of CORS-enabled servers. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - */ - host?: string | RegExp; - /** - * Indicates whether requests made to the associated server should include credentials such as cookies and authorization headers. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) - * - * @default false - */ - withCredentials?: boolean; } @@ -909,7 +866,7 @@ declare namespace __esri { */ after?: AfterInterceptorCallback; /** - * Callback function that can make changes to the URL or options before the request is sent. + * Make changes to the request URL or options before the request is sent. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor) */ @@ -921,13 +878,13 @@ declare namespace __esri { */ headers?: any; /** - * Sets or adds a query parameter into `requestOptions.query`. See also: [requestOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions). + * Sets or adds query parameters into `requestOptions.query`. See also: [requestOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor) */ query?: any; /** - * Hardcodes the response. The request will not be sent. This is resolved as the response `data`. + * Hardcodes the [response](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestResponse). The request will not be sent. This is resolved as the response `data`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor) */ @@ -1000,7 +957,7 @@ declare namespace __esri { */ declared(baseClass: T, ...mixinClasses: any[]): T; /** - * This convenience decorator is used to define an [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html) property. Any property defined with this decorator can now be `get` and `set`. In addition, you can [watch for any property changes](https://developers.arcgis.com/javascript/latest/guide/working-with-props/index.html). Many times this decorator is used in conjunction with the [@renderable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-support-widget.html) decorator. + * This convenience decorator is used to define an [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html) property. Any property defined with this decorator can now be `get` and `set`. In addition, you can [watch for any property changes](https://developers.arcgis.com/javascript/latest/guide/working-with-props/index.html). Many times this decorator is used in conjunction with the [@renderable](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-support-widget.html#renderable) decorator. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-accessorSupport-decorators.html#property) * @@ -1935,25 +1892,19 @@ declare namespace __esri { export const workers: workers; - /** - * The Connection class is used to access code loaded into a separate thread via the [workers framework](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers.html). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html) - */ interface Connection { /** - * A convenient method that broadcasts a message to all workers. Use this method if it is mandatory that all workers need to have a piece of information which is critical for them to process additional requests. + * A convenient method that invokes a method on each worker. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#broadcast) * - * @param methodName The name of the method to invoke on all workers. - * @param data The object which contains all required parameters to be passed to the method. The data passed between the main thread and the workers framework are copied, not shared. Objects are serialized and de-serialized on both ends. - * @param transferList An array of [Transferable](https://developer.mozilla.org/en-US/docs/Web/API/Transferable) objects. Transferable objects are transferred from one context to another with a zero-copy operation, which results in a big performance improvement when sending large data sets. + * @param methodName The name of the remote method to invoke on all workers. + * @param data The unique parameter passed as argument of the remote method. * */ - broadcast(methodName: string, data?: any, transferList?: any[]): IPromise; + broadcast(methodName: string, data?: any): IPromise[]; /** - * Closes the existing connection instance to workers. Notify all workers to destroy the connection instance and unload the connection module. + * Closes the existing connection instance to workers. Notifies all workers to destroy the connection instance and dispose the remote module. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#close) * @@ -1961,19 +1912,30 @@ declare namespace __esri { */ close(): void; /** - * Invokes a method on the script loaded with the workers framework. + * Invokes a [method](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#basic-invocation) on the remote module loaded with the worker. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#invoke) * * @param methodName The name of the method to be invoked in the script. - * @param data The object which contains all required parameters to be passed to the method. The data passed between the main thread and the workers framework are copied, not shared. Objects are serialized and de-serialized on both ends. - * @param transferList An array of [Transferable](https://developer.mozilla.org/en-US/docs/Web/API/Transferable) objects. Each transferable object in the array should have a corresponding entry in the data object. Transferable objects are transferred from one context to another with a zero-copy operation, which results in a big performance improvement when sending large data sets. + * @param data The unique parameter passed as argument of the remote method. See [Passing multiple parameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#multiple-parameters) section to pass more than one parameter to the remote method. + * @param transferList An array of [Transferable](https://developer.mozilla.org/en-US/docs/Web/API/Transferable) objects. Each transferable object in the array should have a corresponding entry in the data object. See [Using transferables](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html#using-transferables) section for more information. * */ invoke(methodName: string, data?: any, transferList?: any[]): IPromise; } - export const Connection: Connection; + interface ConnectionConstructor { + /** + * This class is used to execute remote methods located on the module loaded into a separate thread via the [workers framework](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers.html). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-workers-Connection.html) + */ + + + new(): Connection; + } + + export const Connection: ConnectionConstructor; export interface workersOpenOptions extends Object { @@ -3642,7 +3604,7 @@ declare namespace __esri { /** - * Creates a mesh representing a box. The spatial reference of the resulting mesh is the same as the location where it is placed. **Box UV coordinate space** The box geometry will have UV coordinates generated according to the following scheme: + * Creates a mesh representing a box. The spatial reference of the resulting mesh is the same as the location where it is placed. **Box UV coordinate space** The box geometry will have UV coordinates generated according to the following scheme: * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#createBox) * @@ -3656,7 +3618,7 @@ declare namespace __esri { */ createBox(location: Point, params?: MeshCreateBoxParams): Mesh; /** - * Creates a mesh representing a cylinder. The spatial reference of the resulting mesh is the same as the location where it is placed. **Cylinder UV coordinate space** The cylinder geometry will have UV coordinates generated according to the following scheme (example is shown for 8 vertices cylinder): + * Creates a mesh representing a cylinder. The spatial reference of the resulting mesh is the same as the location where it is placed. **Cylinder UV coordinate space** The cylinder geometry will have UV coordinates generated according to the following scheme (example is shown for 8 vertices cylinder): * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#createCylinder) * @@ -3681,7 +3643,7 @@ declare namespace __esri { */ createFromPolygon(polygon: Polygon, params?: MeshCreateFromPolygonParams): Mesh; /** - * Creates a mesh representing a plane. The spatial reference of the resulting mesh is the same as the location where it is placed. A plane consists of two triangles and may be conveniently oriented at creation time. **Plane UV coordinate space** The plane geometry will have UV coordinates generated according to the following scheme: + * Creates a mesh representing a plane. The spatial reference of the resulting mesh is the same as the location where it is placed. A plane consists of two triangles and may be conveniently oriented at creation time. **Plane UV coordinate space** The plane geometry will have UV coordinates generated according to the following scheme: * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#createPlane) * @@ -3695,7 +3657,7 @@ declare namespace __esri { */ createPlane(location: Point, params?: MeshCreatePlaneParams): Mesh; /** - * Creates a mesh representing a sphere. The spatial reference of the resulting mesh is the same as the location where it is placed. **Sphere UV coordinate space** The sphere geometry will have UV coordinates generated according to the following scheme (example is shown for 8x8 vertices sphere): + * Creates a mesh representing a sphere. The spatial reference of the resulting mesh is the same as the location where it is placed. **Sphere UV coordinate space** The sphere geometry will have UV coordinates generated according to the following scheme (example is shown for 8x8 vertices sphere): * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#createSphere) * @@ -4040,11 +4002,17 @@ declare namespace __esri { */ uv?: Float32Array | number[] | Float64Array; /** - * A flat array of the vertex normals (3 elements per vertex). + * A flat array of the vertex normals (3 elements per vertex ranging from -1 to 1). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#vertexAttributes) */ - normal?: Float32Array | number[] | Uint32Array; + normal?: Float32Array | number[] | Float64Array; + /** + * **Since: 4.9** A flat array of the vertex colors (4 elements per vertex ranging from 0 to 255). Vertex colors are multiplied by the component material color (if any is defined). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#vertexAttributes) + */ + color?: Uint8Array | number[] | Uint8ClampedArray; } export interface MeshVertexAttributes extends AnonymousAccessor { @@ -4061,11 +4029,17 @@ declare namespace __esri { */ uv?: Float32Array; /** - * A flat array of the vertex normals (3 elements per vertex). + * A flat array of the vertex normals (3 elements per vertex ranging from -1 to 1). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#vertexAttributes) */ normal?: Float32Array; + /** + * **Since: 4.9** A flat array of the vertex colors (4 elements per vertex ranging from 0 to 255). Vertex colors are multiplied by the component material color (if any is defined). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#vertexAttributes) + */ + color?: Uint8Array; } interface Multipoint extends Geometry { @@ -4901,6 +4875,20 @@ declare namespace __esri { export const GeographicTransformationStep: GeographicTransformationStepConstructor; interface ImageMeshColor extends Accessor { + /** + * A direct reference to the image data. The image data can be an [image element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement), [canvas element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) or [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData). The data property is mutually exclusive with the url property, setting the data will clear the url (if there is one). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-ImageMeshColor.html#data) + */ + data: HTMLImageElement | HTMLCanvasElement | ImageData; + /** + * Indicates whether the image data should be interpreted as being semi-transparent. The default value is automatically derived when the data property contains a canvas element or an ImageData object. In all other cases it defaults to `false`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-ImageMeshColor.html#transparent) + * + * @default undefined + */ + transparent: boolean; /** * For ImageMeshColor the type is always `image`. * @@ -4908,7 +4896,7 @@ declare namespace __esri { */ readonly type: "image"; /** - * The url to the image resource. This can either be a remote url (absolute or relative) or a data url. + * The url to the image resource. This can either be a remote url (absolute or relative) or a data url. The url property is mutually exclusive with the data property, setting the url will clear the data (if there is one). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-ImageMeshColor.html#url) */ @@ -4926,7 +4914,7 @@ declare namespace __esri { interface ImageMeshColorConstructor { /** - * ImageMeshColor is a type of mesh color that represents an image mapped to the mesh by its uv vertex attributes. ImageMeshColor instances can be used with the [MeshComponent.material.color](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshComponent.html#material) property. + * ImageMeshColor is a type of mesh color that represents an image mapped to the mesh by its uv vertex attributes. ImageMeshColor instances can be used with the [MeshComponent.material.color](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshComponent.html#material) property. Images can be referred to either by url or directly by data ( [image element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement), [canvas element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) or [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData)). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-ImageMeshColor.html) */ @@ -4938,7 +4926,21 @@ declare namespace __esri { interface ImageMeshColorProperties { /** - * The url to the image resource. This can either be a remote url (absolute or relative) or a data url. + * A direct reference to the image data. The image data can be an [image element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement), [canvas element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) or [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData). The data property is mutually exclusive with the url property, setting the data will clear the url (if there is one). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-ImageMeshColor.html#data) + */ + data?: HTMLImageElement | HTMLCanvasElement | ImageData; + /** + * Indicates whether the image data should be interpreted as being semi-transparent. The default value is automatically derived when the data property contains a canvas element or an ImageData object. In all other cases it defaults to `false`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-ImageMeshColor.html#transparent) + * + * @default undefined + */ + transparent?: boolean; + /** + * The url to the image resource. This can either be a remote url (absolute or relative) or a data url. The url property is mutually exclusive with the data property, setting the url will clear the data (if there is one). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-ImageMeshColor.html#url) */ @@ -5081,7 +5083,7 @@ declare namespace __esri { */ createFromElevation(source: ElevationLayer | Ground | ElevationSampler, extent: Extent, params?: meshUtilsCreateFromElevationParams): IPromise; /** - * Georeferences vertices specified in a Cartesian coordinate system. This is useful when converting general 3D model meshes not typically georeferenced. This method operates on mesh vertex attributes and will convert positions and normals (if specified) from a local (0, 0, 0) Cartesian system to the properly georeferenced coordinates at the specified location. + * Georeferences vertices specified in a Cartesian coordinate system. This is useful when converting general 3D model meshes not typically georeferenced. This method operates on mesh vertex attributes and will convert positions and normals (if specified) from a local (0, 0, 0) Cartesian system to the properly georeferenced coordinates at the specified `location`. The `location`'s coordinate system determines the units of the converted positions. If the coordinate system is WGS84, metric units are used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-meshUtils.html#georeference) * @@ -5172,9 +5174,10 @@ declare namespace __esri { * * @param geometries An array of geometries to normalize. * @param geometryService A geometry service used to perform the normalization. If this value is `null` then the default geometry service in [esriConfig.geometryServiceUrl](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#geometryServiceUrl) is used. + * @param requestOptions Additional [options](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#esriRequest) to be used for the data request. * */ - normalizeCentralMeridian(geometries: Geometry[], geometryService?: GeometryService): IPromise; + normalizeCentralMeridian(geometries: Geometry[], geometryService?: GeometryService, requestOptions?: any): IPromise; } export const normalizeUtils: normalizeUtils; @@ -5315,7 +5318,7 @@ declare namespace __esri { */ popupTemplate: PopupTemplate; /** - * The [Symbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html) for the graphic. Choosing a symbol for a graphic depends on the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html) type (SceneView or MapView), and the [geometry type](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html#type) of the graphic. If the symbol is not specified for a graphic in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html), it displays using the symbol defined in the layer's [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html). Each graphic may have its own symbol specified when the parent layer is a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html). + * The [Symbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html) for the graphic. Choosing a symbol for a graphic depends on the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html) type (SceneView or MapView), and the [geometry type](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html#type) of the graphic. Each graphic may have its own symbol specified when the parent layer is a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html). For a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) the symbol of each graphic should not be set by the developer since the graphics' rendering properties are determined by the layer's [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#symbol) */ @@ -5407,7 +5410,7 @@ declare namespace __esri { */ popupTemplate?: PopupTemplateProperties; /** - * The [Symbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html) for the graphic. Choosing a symbol for a graphic depends on the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html) type (SceneView or MapView), and the [geometry type](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html#type) of the graphic. If the symbol is not specified for a graphic in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html), it displays using the symbol defined in the layer's [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html). Each graphic may have its own symbol specified when the parent layer is a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html). + * The [Symbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html) for the graphic. Choosing a symbol for a graphic depends on the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html) type (SceneView or MapView), and the [geometry type](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html#type) of the graphic. Each graphic may have its own symbol specified when the parent layer is a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html). For a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) the symbol of each graphic should not be set by the developer since the graphics' rendering properties are determined by the layer's [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#symbol) */ @@ -5424,7 +5427,7 @@ declare namespace __esri { interface Ground extends Accessor, Loadable, JSONSupport { /** - * A collection of [ElevationLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html) that define the elevation or terrain that makes up the ground surface. When elevation layers are added to the ground, the topographical variations of the surface are rendered in 3D as they would appear in the real world. ![elev-default](https://developers.arcgis.com/javascript/latest/assets/img/apiref/ground/elev-default.png) When the layers collection is empty, the ground surface is flat. ![no-elev](https://developers.arcgis.com/javascript/latest/assets/img/apiref/ground/no-elev.png) + * A collection of [ElevationLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html) that define the elevation or terrain that makes up the ground surface. When elevation layers are added to the ground, the topographical variations of the surface are rendered in 3D as they would appear in the real world. ![elev-default](https://developers.arcgis.com/javascript/assets/img/apiref/ground/elev-default.png) When the layers collection is empty, the ground surface is flat. ![no-elev](https://developers.arcgis.com/javascript/assets/img/apiref/ground/no-elev.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html#layers) */ @@ -5479,6 +5482,14 @@ declare namespace __esri { * */ createElevationSampler(extent: Extent, options?: GroundCreateElevationSamplerOptions): IPromise; + /** + * Loads all the externally loadable resources associated with the ground. For the ground this will load all the layers. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html#loadAll) + * + * + */ + loadAll(): IPromise; /** * Queries the ground layer services for elevation values for the given geometry. The returned result contains a copy of the geometry with z-values sampled from elevation data from the first layer that has data available. * @@ -5509,7 +5520,7 @@ declare namespace __esri { interface GroundProperties extends LoadableProperties { /** - * A collection of [ElevationLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html) that define the elevation or terrain that makes up the ground surface. When elevation layers are added to the ground, the topographical variations of the surface are rendered in 3D as they would appear in the real world. ![elev-default](https://developers.arcgis.com/javascript/latest/assets/img/apiref/ground/elev-default.png) When the layers collection is empty, the ground surface is flat. ![no-elev](https://developers.arcgis.com/javascript/latest/assets/img/apiref/ground/no-elev.png) + * A collection of [ElevationLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html) that define the elevation or terrain that makes up the ground surface. When elevation layers are added to the ground, the topographical variations of the surface are rendered in 3D as they would appear in the real world. ![elev-default](https://developers.arcgis.com/javascript/assets/img/apiref/ground/elev-default.png) When the layers collection is empty, the ground surface is flat. ![no-elev](https://developers.arcgis.com/javascript/assets/img/apiref/ground/no-elev.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html#layers) */ @@ -6474,11 +6485,9 @@ declare namespace __esri { * @param extent The extent of the view. This value is provided by the [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param width The width of the view in pixels. This value is provided by the [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param height The height of the view in pixels. This value is provided by the [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). - * @param options Optional settings for the image request. The options have the following properties. - * @param options.allowImageDataAccess Indicates if access to pixels of the image is allowed. This value must be set to `true` if the layer will be drawn in 3D and [WebGL textures](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL) are required to display the layer. Loading of WebGL textures is dependent on [cross-domain access](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL#Cross-domain_textures) controls. This option allows cross-domain access to create WebGL textures. * */ - fetchImage(extent: Extent, width: number, height: number, options?: BaseDynamicLayerFetchImageOptions): IPromise; + fetchImage(extent: Extent, width: number, height: number): IPromise; /** * This method returns a URL to an image for a given extent, width, and height. Override this method to construct the URL for the image based on user interaction. * @@ -6513,16 +6522,6 @@ declare namespace __esri { } - - export interface BaseDynamicLayerFetchImageOptions extends Object { - /** - * Indicates if access to pixels of the image is allowed. This value must be set to `true` if the layer will be drawn in 3D and [WebGL textures](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL) are required to display the layer. Loading of WebGL textures is dependent on [cross-domain access](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL#Cross-domain_textures) controls. This option allows cross-domain access to create WebGL textures. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BaseDynamicLayer.html#fetchImage) - */ - allowImageDataAccess?: boolean; - } - export interface BaseDynamicLayerLayerviewCreateEvent { layerView: LayerView; @@ -6721,10 +6720,9 @@ declare namespace __esri { * @param row The row (y) position of the tile fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param col The column (x) position of the tile to fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param options Optional settings for the tile request. The options have the following properties. - * @param options.allowImageDataAccess Indicates if access to pixels of the image is allowed. This value must be set to `true` if the layer will be drawn in 3D and [WebGL textures](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL) are required to display the layer. Loading of WebGL textures is dependent on [cross-domain access](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL#Cross-domain_textures) controls. This option allows cross-domain access to create WebGL textures. * */ - fetchTile(level: number, row: number, col: number, options?: BaseTileLayerFetchTileOptions): IPromise; + fetchTile(level: number, row: number, col: number, options?: any): IPromise; /** * Returns the bounds of the tile as an array of four numbers that be readily converted to an [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) object. The value for each item in the array is described in the following table: * @@ -6755,7 +6753,7 @@ declare namespace __esri { * @param col Tile column. This value is provided by the [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * */ - getTileUrl(level: number, row: number, col: number): string | IPromise; + getTileUrl(level: number, row: number, col: number): string; on(name: "layerview-create", eventHandler: BaseTileLayerLayerviewCreateEventHandler): IHandle; @@ -6792,16 +6790,6 @@ declare namespace __esri { tileInfo?: TileInfoProperties; } - - export interface BaseTileLayerFetchTileOptions extends Object { - /** - * Indicates if access to pixels of the image is allowed. This value must be set to `true` if the layer will be drawn in 3D and [WebGL textures](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL) are required to display the layer. Loading of WebGL textures is dependent on [cross-domain access](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL#Cross-domain_textures) controls. This option allows cross-domain access to create WebGL textures. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BaseTileLayer.html#fetchTile) - */ - allowImageDataAccess?: boolean; - } - export interface BaseTileLayerLayerviewCreateEvent { layerView: LayerView; @@ -6964,7 +6952,7 @@ declare namespace __esri { */ elevationInfo: CSVLayerElevationInfo; /** - * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/latest/assets/img/samples/city-points-declutter.gif) + * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/assets/img/samples/city-points-declutter.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#featureReduction) */ @@ -6977,9 +6965,7 @@ declare namespace __esri { fields: Field[]; /** * The label definition for this layer, specified as an array of [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html). Use this property to specify labeling properties for the layer. For labels to display in the view, the [labelsVisible](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#labelsVisible) property of this layer must be set to `true`. Multiple Label classes with different `where` clauses can be used to define several labels with varying styles on the same feature. Likewise, multiple label classes may be used to label different types of features (for example blue labels for lakes and green labels for parks). - * > **Known Limitations** - * * WebGL must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. - * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). + * > **Known Limitations** Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#labelingInfo) */ @@ -6987,7 +6973,6 @@ declare namespace __esri { /** * Indicates whether to display labels for this layer. If `true`, labels will appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#labelingInfo) property. * > **Known Limitations** - * * WebGL must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Currently the `labelsVisible` property must be explicitly set to `true` for labels to be printed. * @@ -7017,7 +7002,7 @@ declare namespace __esri { */ longitudeField: string; /** - * The maximum scale at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. + * The maximum scale (most zoomed in) at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#maxScale) * @@ -7025,7 +7010,7 @@ declare namespace __esri { */ maxScale: number; /** - * The minimum scale at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. + * The minimum scale (most zoomed out) at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#minScale) * @@ -7059,7 +7044,7 @@ declare namespace __esri { */ renderer: Renderer; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. As screen size perspective changes the size based on distance to the camera, it should be set to false when using {@link module:esri/renderers/Renderer#SizeVisualVariable size visual variables}. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#screenSizePerspectiveEnabled) @@ -7209,7 +7194,7 @@ declare namespace __esri { */ elevationInfo?: CSVLayerElevationInfo; /** - * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/latest/assets/img/samples/city-points-declutter.gif) + * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/assets/img/samples/city-points-declutter.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#featureReduction) */ @@ -7222,9 +7207,7 @@ declare namespace __esri { fields?: FieldProperties[]; /** * The label definition for this layer, specified as an array of [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html). Use this property to specify labeling properties for the layer. For labels to display in the view, the [labelsVisible](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#labelsVisible) property of this layer must be set to `true`. Multiple Label classes with different `where` clauses can be used to define several labels with varying styles on the same feature. Likewise, multiple label classes may be used to label different types of features (for example blue labels for lakes and green labels for parks). - * > **Known Limitations** - * * WebGL must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. - * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). + * > **Known Limitations** Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#labelingInfo) */ @@ -7232,7 +7215,6 @@ declare namespace __esri { /** * Indicates whether to display labels for this layer. If `true`, labels will appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#labelingInfo) property. * > **Known Limitations** - * * WebGL must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Currently the `labelsVisible` property must be explicitly set to `true` for labels to be printed. * @@ -7262,7 +7244,7 @@ declare namespace __esri { */ longitudeField?: string; /** - * The maximum scale at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. + * The maximum scale (most zoomed in) at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#maxScale) * @@ -7270,7 +7252,7 @@ declare namespace __esri { */ maxScale?: number; /** - * The minimum scale at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. + * The minimum scale (most zoomed out) at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#minScale) * @@ -7304,7 +7286,7 @@ declare namespace __esri { */ renderer?: RendererProperties; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. As screen size perspective changes the size based on distance to the camera, it should be set to false when using {@link module:esri/renderers/Renderer#SizeVisualVariable size visual variables}. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html#screenSizePerspectiveEnabled) @@ -7422,7 +7404,6 @@ declare namespace __esri { * @param width The width of the view in pixels. * @param height The height of the view in pixels. * @param options The parameter options is an object with the following properties. - * @param options.allowImageDataAccess Indicates if the access to the pixels of the image is required. * @param options.rotation The rotation in degrees of the exported image. Available since ArcGIS Server 10.3. * @param options.pixelRatio The ratio of the resolution in physical pixels of the image to the resolution it will be displayed at. * @@ -7469,12 +7450,6 @@ declare namespace __esri { export interface DynamicLayerFetchImageOptions extends Object { - /** - * Indicates if the access to the pixels of the image is required. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-DynamicLayer.html#fetchImage) - */ - allowImageDataAccess?: boolean; /** * The rotation in degrees of the exported image. Available since ArcGIS Server 10.3. * @@ -7585,7 +7560,7 @@ declare namespace __esri { interface ElevationLayerConstructor { /** - * ElevationLayer is a tile layer used for rendering elevations in [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A default [world elevation layer](http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer) can be added to the map by setting the [map's ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#ground) property to `world-elevation`. + * ElevationLayer is a tile layer used for rendering elevations in [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A default [world elevation layer](https://www.arcgis.com/home/item.html?id=7029fb60158543ad845c7e1527af11e4) can be added to the map by setting the [map's ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#ground) property to `world-elevation`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html) */ @@ -7725,8 +7700,7 @@ declare namespace __esri { */ copyright: string; /** - * The SQL where clause used to filter features on the client. Only the features that satisfy the definition expression are displayed in the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). Setting a definition expression is useful when the dataset is large and you don't want to bring all features to the client for analysis. Definition expressions may be set when a layer is constructed prior to it loading in the view or after it has been added to the map. If the definition expression is set after the layer has been added to the map, the view will automatically refresh itself to display the features that satisfy the new definition expression. - * > **Known Limitations** Definition expressions will not be honored when working with FeatureLayers created from client-side graphics. + * The SQL where clause used to filter features on the client. Only the features that satisfy the definition expression are displayed in the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). Setting a definition expression is useful when the dataset is large and you don't want to bring all features to the client for analysis. Definition expressions may be set when a layer is constructed prior to it loading in the view or after it has been added to the map. If the definition expression is set after the layer has been added to the map, the view will automatically refresh itself to display the features that satisfy the new definition expression. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#definitionExpression) */ @@ -7744,19 +7718,19 @@ declare namespace __esri { */ dynamicDataSource: DynamicMapLayer | DynamicDataLayer; /** - * Specifies how graphics are placed on the vertical axis (z). This property may only be used in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/index.html) for an example of how this property may be used. + * Specifies how features are placed on the vertical axis (z). This property may only be used in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/index.html) for an example of how this property may be used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) */ elevationInfo: FeatureLayerElevationInfo; /** - * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/latest/assets/img/samples/city-points-declutter.gif) + * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/assets/img/samples/city-points-declutter.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#featureReduction) */ featureReduction: FeatureLayerFeatureReduction; /** - * An array of fields in the layer. Each field represents an attribute that may contain a value for each feature in the layer. For example, a field named `POP_2015`, stores information about total population as a numeric value for each feature; this value represents the total number of people living within the geographic bounds of the feature. This property must be set in the constructor when creating a FeatureLayer from client-side [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). To create FeatureLayers from client-side graphics you must also set the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties. + * An array of fields in the layer. Each field represents an attribute that may contain a value for each feature in the layer. For example, a field named `POP_2015`, stores information about total population as a numeric value for each feature; this value represents the total number of people living within the geographic bounds of the feature. This property must be set in the constructor when creating a FeatureLayer from client-side [features](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). To create FeatureLayers from client-side features you must also set the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields) */ @@ -7768,13 +7742,13 @@ declare namespace __esri { */ readonly gdbVersion: string; /** - * The geometry type of features in the layer. All features must be of the same type. This property is read-only when the layer is created from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url). However, when creating a FeatureLayer from client-side graphics, this property must be specified in the layer's constructor along with the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties. **Possible Values:** point | mulitpoint | polyline | polygon | extent | mesh + * The geometry type of features in the layer. All features must be of the same type. This property is read-only when the layer is created from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url). When creating a FeatureLayer from client-side features, this property is inferred by the geometryType of the features provided in the layer's [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source) property. **Possible Values:** point | multipoint | polyline | polygon | extent | mesh * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType) */ geometryType: string; /** - * Value is `true` if attachments are enabled on the feature layer. + * Indicates if attachments are enabled on the feature layer. Use `FeatureLayer.capabilities.data.supportsAttachment` instead. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#hasAttachments) * @@ -7782,19 +7756,19 @@ declare namespace __esri { */ readonly hasAttachments: boolean; /** - * Indicates if the features in the layer have M values. + * Indicates whether the client-side features in the layer have `M` (measurement) values. Use the `supportsM` property in the FeatureLayer's [capabilities.data](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) object to verify if `M` values are supported on [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm) features. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#hasM) * - * @default false + * @default undefined */ readonly hasM: boolean; /** - * Indicates if the features in the layer have Z values. See [elevationInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) for details regarding placement and rendering of graphics with z-values in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). + * Indicates whether the client-side features in the layer have `Z` (elevation) values. Refer to [elevationInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) for details regarding placement and rendering of features with z-values in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). Use the `supportsZ` property in the FeatureLayer's [capabilities.data](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) object to verify if `Z` values are supported on [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm) features. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#hasZ) * - * @default false + * @default undefined */ readonly hasZ: boolean; /** @@ -7806,7 +7780,6 @@ declare namespace __esri { /** * The label definition for this layer, specified as an array of [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html). Use this property to specify labeling properties for the layer such as label expression, placement, and size. The [labelsVisible](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#labelsVisible) property of this layer must be set to `true` for labels to display in the view. Multiple Label classes with different `where` clauses can be used to define several labels with varying styles on the same feature. Likewise, multiple label classes may be used to label different types of features (for example blue labels for lakes and green labels for parks). * > **Known Limitations** - * * [WebGL](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-rendering) must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. Be sure to review the [WebGL limitations](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-limitations). * * Currently only FeatureLayers with point and polygon geometries are supported. * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -7816,9 +7789,8 @@ declare namespace __esri { /** * Indicates whether to display labels for this layer. If `true`, labels will appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#labelingInfo) property. * > **Known Limitations** - * * [WebGL](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-rendering) must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. Be sure to review the [WebGL limitations](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-limitations). * * Currently only FeatureLayers with point and polygon geometries are supported. - * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). + * * Currently 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) only support one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) per feature. * * Currently the `labelsVisible` property must be explicitly set to `true` for labels to be printed. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#labelsVisible) @@ -7846,7 +7818,7 @@ declare namespace __esri { */ legendEnabled: boolean; /** - * The name of one of the provided [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields) for each graphic containing a unique value or identifier for that graphic. This is required when constructing a FeatureLayer from a collection of client-side [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). When creating a FeatureLayer from client-side graphics, the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. + * The name of an `oid` [field](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields) containing a unique value or identifier for each feature in the layer. This is required when constructing a FeatureLayer from a collection of client-side [features](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField) */ @@ -7872,7 +7844,13 @@ declare namespace __esri { */ popupTemplate: PopupTemplate; /** - * The renderer assigned to the layer. The renderer defines how to visualize each feature in the layer. Depending on the renderer type, features may be visualized with the same symbol, or with varying symbols based on the values of provided attribute fields or functions. However, when creating a FeatureLayer from client-side graphics, this property must be specified in the layer's constructor along with the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), and [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType) properties. + * Array of [relationships](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html) set up for the layer. Each object in the array describes the layer's [relationship](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html) with another layer or table. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#relationships) + */ + readonly relationships: Relationship; + /** + * The renderer assigned to the layer. The renderer defines how to visualize each feature in the layer. Depending on the renderer type, features may be visualized with the same symbol, or with varying symbols based on the values of provided attribute fields or functions. However, when creating a FeatureLayer from client-side features, this property must be specified in the layer's constructor along with the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField) properties. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) */ @@ -7894,7 +7872,7 @@ declare namespace __esri { */ returnZ: boolean; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. As screen size perspective changes the size based on distance to the camera, it should be set to false when using {@link module:esri/renderers/Renderer#SizeVisualVariable size visual variables}. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#screenSizePerspectiveEnabled) @@ -7903,13 +7881,13 @@ declare namespace __esri { */ screenSizePerspectiveEnabled: boolean; /** - * A collection of [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) objects used to create a FeatureLayer. This property should only used when creating a FeatureLayer from client-side graphics. When creating a FeatureLayer from client-side graphics, the [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. + * A collection of [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) objects used to create a FeatureLayer. The geometry of each feature all must have a matching [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType). This property should only be used when creating a FeatureLayer from client-side features. When creating a FeatureLayer from client-side features, the [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. Use [applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) method to add, remove, and update features from a layer at runtime. Once `applyEdits()` resolves successfully, use [queryFeatures()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures) to return updated features. The [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference) and [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType) properties are determined based on the features provided to this property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source) */ source: Collection; /** - * The spatial reference of the layer. When creating the layer from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url), the spatial reference is read from the service. This property should be set explicitly when creating a FeatureLayer from client-side graphics. When creating a FeatureLayer from client-side graphics, the [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. + * The spatial reference of the layer. When creating the layer from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url), the spatial reference is read from the service. When creating a FeatureLayer from client-side features, this property is inferred from the geometries of the features provided in the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source) property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference) */ @@ -7952,7 +7930,18 @@ declare namespace __esri { readonly version: number; /** - * Applies edits to features in a feature layer. New features can be created and existing features can be updated or deleted. Feature geometries and/or attributes may be modified. Only applicable to layers in a [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm). + * Adds an attachment to a feature. This operation is available only if the layer's [capabilities.data.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) is set to `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#addAttachment) + * + * @param feature Feature to which the attachment is to be added. + * @param attachment HTML form that contains a file upload field pointing to the file to be added as an attachment. + * + */ + addAttachment(feature: Graphic, attachment: HTMLFormElement | FormData): IPromise; + /** + * Applies edits to features in a layer. New features can be created and existing features can be updated or deleted. Feature geometries and/or attributes may be modified. Only applicable to layers in a [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm) and client-side features set through the layer's [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source). + * > **Known Limitations** FeatureLayer.applyEdits() is not supported for client-side features in [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) * @@ -7971,6 +7960,16 @@ declare namespace __esri { * */ createQuery(): Query; + /** + * Deletes attachments from a feature. This operation is available only if the layer's [capabilities.data.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) is set to `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#deleteAttachments) + * + * @param feature Feature containing attachments to be deleted. + * @param attachmentIds Ids of the attachments to be deleted. + * + */ + deleteAttachments(feature: Graphic, attachmentIds: number[]): IPromise; /** * Returns a [FeatureType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureType.html) describing the feature's type. This is applicable if the layer containing the feature has a [typeIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#typeIdField). * @@ -7991,32 +7990,33 @@ declare namespace __esri { * */ getFieldDomain(fieldName: string, options?: FeatureLayerGetFieldDomainOptions): Domain; + /** + * Query information about attachments associated with features. It will return an error if the layer's [capabilities.data.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property is `false`. Attachments for multiple features can be queried if the layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) is `true`. + * > **Known Limitations** When the layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property is `false`, [AttachmentQuery.objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#objectIds) property only accepts a single `objectId`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryAttachments) + * + * @param attachmentQuery Specifies the attachment parameters for query. + * + */ + queryAttachments(attachmentQuery: AttachmentQuery | AttachmentQueryProperties): IPromise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against the feature service and returns the [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) of features that satisfy the query. If no parameters are specified, then the extent and count of all features satisfying the layer's configuration/filters are returned. This is valid only for [hosted feature services](http://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm) on [arcgis.com](http://arcgis.com) and for ArcGIS Server 10.3.1 and later. * > To query for the extent of features/graphics available to or visible in the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html) on the client rather than making a server-side query, you must use the [FeatureLayerView.queryExtent()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#queryExtent) method. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryExtent) * - * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, then the extent and count of all features satisfying the layer's configuration/filters are returned. If working with a FeatureLayer created from a FeatureCollection (via [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source)), only the [geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#geometry), [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#objectIds), and [spatialRelationship](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship) properties should be specified. Adding any other properties will return an error. If specifying a spatialRelationship, note that `intersects` is the only supported operation. + * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, then the extent and count of all features satisfying the layer's configuration/filters are returned. * */ queryExtent(params?: Query | QueryProperties): IPromise; /** - * Query information about attachments associated with a specified feature. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatureAttachments) - * - * @param feature The feature to query. - * - */ - queryFeatureAttachments(feature: Graphic): IPromise; - /** - * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against the feature service and returns the number of features that satisfy the query. If no parameters are specified, then the total number of features satisfying the layer's configuration/filters is returned. + * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against the feature service and returns the number of features that satisfy the query. If no parameters are specified, the total number of features satisfying the layer's configuration/filters is returned. * > To query for the count of features/graphics available to or visible in the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html) on the client rather than making a server-side query, you must use the [FeatureLayerView.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#queryFeatureCount) method. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatureCount) * - * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, then the total number of features satisfying the layer's configuration/filters is returned. If working with a FeatureLayer created from a FeatureCollection (via [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source)), only the [geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#geometry), [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#objectIds), and [spatialRelationship](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship) properties should be specified. Adding any other properties will return an error. If specifying a spatialRelationship, note that `intersects` is the only supported operation. + * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, the total number of features satisfying the layer's configuration/filters is returned. * */ queryFeatureCount(params?: Query | QueryProperties): IPromise; @@ -8026,7 +8026,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures) * - * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, then all features satisfying the layer's configuration/filters are returned. If working with a FeatureLayer created from a FeatureCollection (via [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source)), only the [geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#geometry), [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#objectIds), and [spatialRelationship](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship) properties should be specified. Adding any other properties will return an error. If specifying a spatialRelationship, note that `intersects` is the only supported operation. + * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, then all features satisfying the layer's configuration/filters are returned. * */ queryFeatures(params?: Query | QueryProperties): IPromise; @@ -8036,10 +8036,30 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryObjectIds) * - * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, then the Object IDs of all features satisfying the layer's configuration/filters are returned. If working with a FeatureLayer created from a FeatureCollection (via [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source)), only the [geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#geometry), [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#objectIds), and [spatialRelationship](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship) properties should be specified. Adding any other properties will return an error. If specifying a spatialRelationship, note that `intersects` is the only supported operation. + * @param params Specifies the attributes and spatial filter of the query. If no parameters are specified, then the Object IDs of all features satisfying the layer's configuration/filters are returned. * */ queryObjectIds(params?: Query | QueryProperties): IPromise; + /** + * Executes a [RelationshipQuery](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html) against the feature service and returns [FeatureSets](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html) grouped by source layer or table objectIds. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryRelatedFeatures) + * + * @param relationshipQuery Specifies relationship parameters for querying related features or records from a layer or a table. + * + */ + queryRelatedFeatures(relationshipQuery: RelationshipQuery | RelationshipQueryProperties): IPromise; + /** + * Updates an existing attachment for a feature. This operation is available only if the layer's [capabilities.data.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) is set to `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#updateAttachment) + * + * @param feature The feature containing the attachment to be updated. + * @param attachmentId Id of the attachment to be updated. + * @param attachment HTML form that contains a file upload field pointing to the file to be added as an attachment. + * + */ + updateAttachment(feature: Graphic, attachmentId: number, attachment: HTMLFormElement | FormData): IPromise; on(name: "layerview-create", eventHandler: FeatureLayerLayerviewCreateEventHandler): IHandle; @@ -8049,7 +8069,7 @@ declare namespace __esri { interface FeatureLayerConstructor { /** - * A FeatureLayer is a single layer that can be created from a [Map Service](http://server.arcgis.com/en/server/latest/publish-services/windows/what-is-a-map-service.htm) or [Feature Service](http://server.arcgis.com/en/server/latest/publish-services/windows/what-is-a-feature-service-.htm); ArcGIS Online or ArcGIS Enterprise portal items; or from an array of client-side graphics. It is composed of discrete features, each of which has a [Geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html) that allows it to be rendered in either a 2D [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) as a [graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) with spatial context. Features also contain data [attributes](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#attributes) that provide additional information about the real-world feature it represents; attributes may be viewed in [popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#popupTemplate) windows and used for [rendering](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) the layer. FeatureLayers may be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures), [analyzed](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html), and [rendered](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) to visualize data in a spatial context. + * A FeatureLayer is a single layer that can be created from a [Map Service](http://server.arcgis.com/en/server/latest/publish-services/windows/what-is-a-map-service.htm) or [Feature Service](http://server.arcgis.com/en/server/latest/publish-services/windows/what-is-a-feature-service-.htm); ArcGIS Online or ArcGIS Enterprise portal items; or from an array of client-side features. It is composed of discrete features, each of which has a [Geometry](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html) that allows it to be rendered in either a 2D [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) as a [graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) with spatial context. Features also contain data [attributes](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#attributes) that provide additional information about the real-world feature it represents; attributes may be viewed in [popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#popupTemplate) windows and used for [rendering](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) the layer. FeatureLayers may be [queried](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures), [analyzed](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html), and [rendered](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) to visualize data in a spatial context. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) */ @@ -8069,8 +8089,7 @@ declare namespace __esri { */ copyright?: string; /** - * The SQL where clause used to filter features on the client. Only the features that satisfy the definition expression are displayed in the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). Setting a definition expression is useful when the dataset is large and you don't want to bring all features to the client for analysis. Definition expressions may be set when a layer is constructed prior to it loading in the view or after it has been added to the map. If the definition expression is set after the layer has been added to the map, the view will automatically refresh itself to display the features that satisfy the new definition expression. - * > **Known Limitations** Definition expressions will not be honored when working with FeatureLayers created from client-side graphics. + * The SQL where clause used to filter features on the client. Only the features that satisfy the definition expression are displayed in the [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). Setting a definition expression is useful when the dataset is large and you don't want to bring all features to the client for analysis. Definition expressions may be set when a layer is constructed prior to it loading in the view or after it has been added to the map. If the definition expression is set after the layer has been added to the map, the view will automatically refresh itself to display the features that satisfy the new definition expression. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#definitionExpression) */ @@ -8088,25 +8107,25 @@ declare namespace __esri { */ dynamicDataSource?: DynamicMapLayer | DynamicDataLayer; /** - * Specifies how graphics are placed on the vertical axis (z). This property may only be used in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/index.html) for an example of how this property may be used. + * Specifies how features are placed on the vertical axis (z). This property may only be used in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/index.html) for an example of how this property may be used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) */ elevationInfo?: FeatureLayerElevationInfo; /** - * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/latest/assets/img/samples/city-points-declutter.gif) + * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. Currently this property is only supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) for point features with non-draped [Icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. ![declutter](https://developers.arcgis.com/javascript/assets/img/samples/city-points-declutter.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#featureReduction) */ featureReduction?: FeatureLayerFeatureReduction; /** - * An array of fields in the layer. Each field represents an attribute that may contain a value for each feature in the layer. For example, a field named `POP_2015`, stores information about total population as a numeric value for each feature; this value represents the total number of people living within the geographic bounds of the feature. This property must be set in the constructor when creating a FeatureLayer from client-side [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). To create FeatureLayers from client-side graphics you must also set the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties. + * An array of fields in the layer. Each field represents an attribute that may contain a value for each feature in the layer. For example, a field named `POP_2015`, stores information about total population as a numeric value for each feature; this value represents the total number of people living within the geographic bounds of the feature. This property must be set in the constructor when creating a FeatureLayer from client-side [features](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). To create FeatureLayers from client-side features you must also set the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields) */ fields?: FieldProperties[]; /** - * The geometry type of features in the layer. All features must be of the same type. This property is read-only when the layer is created from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url). However, when creating a FeatureLayer from client-side graphics, this property must be specified in the layer's constructor along with the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties. **Possible Values:** point | mulitpoint | polyline | polygon | extent | mesh + * The geometry type of features in the layer. All features must be of the same type. This property is read-only when the layer is created from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url). When creating a FeatureLayer from client-side features, this property is inferred by the geometryType of the features provided in the layer's [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source) property. **Possible Values:** point | multipoint | polyline | polygon | extent | mesh * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType) */ @@ -8120,7 +8139,6 @@ declare namespace __esri { /** * The label definition for this layer, specified as an array of [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html). Use this property to specify labeling properties for the layer such as label expression, placement, and size. The [labelsVisible](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#labelsVisible) property of this layer must be set to `true` for labels to display in the view. Multiple Label classes with different `where` clauses can be used to define several labels with varying styles on the same feature. Likewise, multiple label classes may be used to label different types of features (for example blue labels for lakes and green labels for parks). * > **Known Limitations** - * * [WebGL](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-rendering) must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. Be sure to review the [WebGL limitations](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-limitations). * * Currently only FeatureLayers with point and polygon geometries are supported. * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -8130,9 +8148,8 @@ declare namespace __esri { /** * Indicates whether to display labels for this layer. If `true`, labels will appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#labelingInfo) property. * > **Known Limitations** - * * [WebGL](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-rendering) must be enabled in 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) for labels to display. Be sure to review the [WebGL limitations](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#webgl-limitations). * * Currently only FeatureLayers with point and polygon geometries are supported. - * * Currently only one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) is supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). + * * Currently 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) only support one [LabelClass](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html) per feature. * * Currently the `labelsVisible` property must be explicitly set to `true` for labels to be printed. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#labelsVisible) @@ -8160,7 +8177,7 @@ declare namespace __esri { */ legendEnabled?: boolean; /** - * The name of one of the provided [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields) for each graphic containing a unique value or identifier for that graphic. This is required when constructing a FeatureLayer from a collection of client-side [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). When creating a FeatureLayer from client-side graphics, the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. + * The name of an `oid` [field](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields) containing a unique value or identifier for each feature in the layer. This is required when constructing a FeatureLayer from a collection of client-side [features](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField) */ @@ -8186,7 +8203,7 @@ declare namespace __esri { */ popupTemplate?: PopupTemplateProperties; /** - * The renderer assigned to the layer. The renderer defines how to visualize each feature in the layer. Depending on the renderer type, features may be visualized with the same symbol, or with varying symbols based on the values of provided attribute fields or functions. However, when creating a FeatureLayer from client-side graphics, this property must be specified in the layer's constructor along with the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), and [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType) properties. + * The renderer assigned to the layer. The renderer defines how to visualize each feature in the layer. Depending on the renderer type, features may be visualized with the same symbol, or with varying symbols based on the values of provided attribute fields or functions. However, when creating a FeatureLayer from client-side features, this property must be specified in the layer's constructor along with the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField) properties. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) */ @@ -8208,7 +8225,7 @@ declare namespace __esri { */ returnZ?: boolean; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. As screen size perspective changes the size based on distance to the camera, it should be set to false when using {@link module:esri/renderers/Renderer#SizeVisualVariable size visual variables}. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#screenSizePerspectiveEnabled) @@ -8217,13 +8234,13 @@ declare namespace __esri { */ screenSizePerspectiveEnabled?: boolean; /** - * A collection of [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) objects used to create a FeatureLayer. This property should only used when creating a FeatureLayer from client-side graphics. When creating a FeatureLayer from client-side graphics, the [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. + * A collection of [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) objects used to create a FeatureLayer. The geometry of each feature all must have a matching [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType). This property should only be used when creating a FeatureLayer from client-side features. When creating a FeatureLayer from client-side features, the [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. Use [applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) method to add, remove, and update features from a layer at runtime. Once `applyEdits()` resolves successfully, use [queryFeatures()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures) to return updated features. The [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference) and [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType) properties are determined based on the features provided to this property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source) */ source?: CollectionProperties; /** - * The spatial reference of the layer. When creating the layer from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url), the spatial reference is read from the service. This property should be set explicitly when creating a FeatureLayer from client-side graphics. When creating a FeatureLayer from client-side graphics, the [fields](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fields), [objectIdField](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#objectIdField), [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source), [geometryType](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType), and [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#renderer) properties must also be set. + * The spatial reference of the layer. When creating the layer from a [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#url), the spatial reference is read from the service. When creating a FeatureLayer from client-side features, this property is inferred from the geometries of the features provided in the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source) property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#spatialReference) */ @@ -8248,52 +8265,6 @@ declare namespace __esri { url?: string; } - - export interface AttachmentInfo extends Object { - /** - * The content type of the attachment. For example, `image/jpeg`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#AttachmentInfo) - */ - contentType: string; - /** - * The identifier for the attachment. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#AttachmentInfo) - */ - id: number; - /** - * Keywords for the attachment. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#AttachmentInfo) - */ - keywords: string; - /** - * The name of the attachment. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#AttachmentInfo) - */ - name: string; - /** - * The parent object id of the attachment. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#AttachmentInfo) - */ - parentObjectId: number; - /** - * The size of the attachment. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#AttachmentInfo) - */ - size: number; - /** - * The URL of the attachment. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#AttachmentInfo) - */ - url: string; - } - /** * FeatureEditResult represents the result of adding, updating or deleting a feature. * @@ -8385,7 +8356,7 @@ declare namespace __esri { */ supportsM: boolean; /** - * Indicates if the features in the layer support Z values. Requires ArcGIS Server service 10.1 or greater. See [elevationInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) for details regarding placement and rendering of graphics with z-values in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). + * Indicates if the features in the layer support Z values. Requires ArcGIS Server service 10.1 or greater. See [elevationInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) for details regarding placement and rendering of features with z-values in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) */ @@ -8504,6 +8475,12 @@ declare namespace __esri { export interface FeatureLayerCapabilitiesQuery extends Object { + /** + * Indicates if the layer supports [queryAttachments()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryAttachments) operation. If `false`, [queryAttachments()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryAttachments) can only return attachments for one feature at a time. If `true`, `queryAttachments()` can return attachments for array of [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#objectIds). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) + */ + supportsAttachments: boolean; /** * Indicates if the geometry centroid associated with each polygon feature can be returned. This operation is only supported in ArcGIS Online hosted feature services. * @@ -8534,6 +8511,12 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) */ supportsGeometryProperties: boolean; + /** + * Indicates if the layer supports the [having](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#having) clause on the service. Requires an ArcGIS Server service 10.6.1 or greater. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) + */ + supportsHavingClause: boolean; /** * Indicates if features returned in the query response can be ordered by one or more fields. Requires an ArcGIS Server service 10.3 or greater. * @@ -8609,27 +8592,27 @@ declare namespace __esri { export interface FeatureLayerElevationInfo extends Object { /** - * Defines how the graphic is placed with respect to the terrain surface. If the geometry consists of multiple points (e.g. lines or polygons), the elevation is evaluated separately for each point. See the table below for a list of possible values. + * Defines how the feature is placed with respect to the terrain surface. If the geometry consists of multiple points (e.g. lines or polygons), the elevation is evaluated separately for each point. See the table below for a list of possible values. * * Mode | Description * ------|------------ - * on-the-ground | Graphics are draped on the terrain surface. This is the default value for features with [Polyline](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polyline.html) or [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html) geometries and features with [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) geometries rendered with [ObjectSymbol3DLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html). - * relative-to-ground | Graphics are placed at an elevation relative to the terrain surface. The graphic's elevation is determined by summing up the terrain elevation and the geometry's z-value (if present). If `featureExpressionInfo` is defined, the result of the expression is used instead of the geometry’s z-value. `relative-to-ground` is the default value for [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) geometries rendered with [IconSymbol3DLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html). - * absolute-height | Graphics are placed at an absolute height above sea level. This height is determined by the geometry's z-value (if present). If `featureExpressionInfo` is defined, the result of the expression is used instead of the geometry’s z-value. This mode doesn't take the elevation of the terrain into account. This is the default value of features with any geometry type where [hasZ](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#hasZ) is `true`. - * relative-to-scene | Graphics are aligned to buildings and other objects part of 3D Object [SceneLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html) or [IntegratedMeshLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-IntegratedMeshLayer.html), depending on which has higher elevation. If the graphic is not directly above a building or any other feature, it is aligned to the terrain surface elevation. If defined, the result of `featureExpressionInfo` is added to the 3D Object/terrain surface elevation. In this mode z-values are ignored. + * on-the-ground | Features are draped on the terrain surface. This is the default value for features with [Polyline](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polyline.html) or [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html) geometries and features with [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) geometries rendered with [ObjectSymbol3DLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html). + * relative-to-ground | Features are placed at an elevation relative to the terrain surface. The feature's elevation is determined by summing up the terrain elevation and the geometry's z-value (if present). If `featureExpressionInfo` is defined, the result of the expression is used instead of the geometry’s z-value. `relative-to-ground` is the default value for [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) geometries rendered with [IconSymbol3DLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html). + * absolute-height | Features are placed at an absolute height above sea level. This height is determined by the geometry's z-value (if present). If `featureExpressionInfo` is defined, the result of the expression is used instead of the geometry’s z-value. This mode doesn't take the elevation of the terrain into account. This is the default value of features with any geometry type where [hasZ](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#hasZ) is `true`. + * relative-to-scene | Features are aligned to buildings and other objects part of 3D Object [SceneLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html) or [IntegratedMeshLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-IntegratedMeshLayer.html), depending on which has higher elevation. If the feature is not directly above a building or any other feature, it is aligned to the terrain surface elevation. If defined, the result of `featureExpressionInfo` is added to the 3D Object/terrain surface elevation. In this mode z-values are ignored. * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) */ mode: string; /** - * An elevation offset, which is added to the vertical position of the graphic. If `unit` is not defined, the offset is in `meters`. When `mode = "on-the-ground"`, this property has no effect. + * An elevation offset, which is added to the vertical position of the feature. If `unit` is not defined, the offset is in `meters`. When `mode = "on-the-ground"`, this property has no effect. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) */ offset?: number; /** - * This object contains information about setting a custom height on the graphic. If this property is set, then z values are not considered for calculating graphic height. + * This object contains information about setting a custom height on the feature. If this property is set, then z values are not considered for calculating feature height. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) */ @@ -8645,7 +8628,7 @@ declare namespace __esri { export interface FeatureLayerElevationInfoFeatureExpressionInfo extends Object { /** - * An [Arcade expression](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) evaluating to a number that determines the height of the graphic. If the geometry has z-values, they will be ignored and only `featureExpressionInfo` is used to calculate the vertical position of the graphic. When `mode = "on-the-ground"`, this property has no effect. For line and polygon geometries the result of the expression is the same for all vertices of a feature. + * An [Arcade expression](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) evaluating to a number that determines the height of the feature. If the geometry has z-values, they will be ignored and only `featureExpressionInfo` is used to calculate the vertical position of the feature. When `mode = "on-the-ground"`, this property has no effect. For line and polygon geometries the result of the expression is the same for all vertices of a feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#elevationInfo) */ @@ -8801,7 +8784,7 @@ declare namespace __esri { */ graphics: Collection; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html#screenSizePerspectiveEnabled) @@ -8893,7 +8876,7 @@ declare namespace __esri { */ graphics?: CollectionProperties; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html#screenSizePerspectiveEnabled) @@ -9317,7 +9300,7 @@ declare namespace __esri { */ title: string; /** - * The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. **Possible values:** base-dynamic | base-elevation | base-tile | elevation | feature | graphics | group | imagery | integrated-mesh | map-image | open-street-map | point-cloud | scene | stream | tile | unknown | unsupported | vector-tile | web-tile + * The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. **Possible values:** base-dynamic | base-elevation | base-tile | bing-maps | elevation | feature | graphics | group | imagery | integrated-mesh | map-image | open-street-map | point-cloud | scene | stream | tile | unknown | unsupported | vector-tile | web-tile * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#type) */ @@ -9454,7 +9437,20 @@ declare namespace __esri { portalItem: PortalItem; } - interface MapImageLayer extends Layer, ArcGISMapService, ArcGISDynamicMapService, DynamicLayer, ScaleRangeLayer, RefreshableLayer { + interface MapImageLayer extends Layer, SublayersOwner, ArcGISMapService, ArcGISDynamicMapService, DynamicLayer, ScaleRangeLayer, RefreshableLayer { + /** + * A flat [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of all the [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#sublayers) in the MapImageLayer including the sublayers of its sublayers. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#allSublayers) + */ + readonly allSublayers: Collection; + /** + * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) objects that allow you to alter the properties of one or more sublayers of the MapImageLayer. If this property is not specified, all the sublayers from the service are displayed as defined in the service. If an empty array is passed to this property then none of the sublayers from the service are displayed in the layer. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). They may be [added](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#add), [removed](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#remove), or [reordered](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#reorder) using the [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) extends [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html), its properties may be [watched](https://developers.arcgis.com/javascript/latest/guide/working-with-props/index.html#watchProperties). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#sublayers) + */ + sublayers: Collection; + on(name: "layerview-create", eventHandler: MapImageLayerLayerviewCreateEventHandler): IHandle; @@ -9476,7 +9472,12 @@ declare namespace __esri { export const MapImageLayer: MapImageLayerConstructor; interface MapImageLayerProperties extends LayerProperties, ArcGISMapServiceProperties, ArcGISDynamicMapServiceProperties, DynamicLayerProperties, ScaleRangeLayerProperties, RefreshableLayerProperties { - + /** + * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) objects that allow you to alter the properties of one or more sublayers of the MapImageLayer. If this property is not specified, all the sublayers from the service are displayed as defined in the service. If an empty array is passed to this property then none of the sublayers from the service are displayed in the layer. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). They may be [added](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#add), [removed](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#remove), or [reordered](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#reorder) using the [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) extends [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html), its properties may be [watched](https://developers.arcgis.com/javascript/latest/guide/working-with-props/index.html#watchProperties). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#sublayers) + */ + sublayers?: CollectionProperties; } export interface MapImageLayerLayerviewCreateEvent { @@ -9579,12 +9580,6 @@ declare namespace __esri { } interface ArcGISDynamicMapService { - /** - * A flat [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of all the [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISDynamicMapService.html#sublayers) in the MapImageLayer including the sublayers of its sublayers. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISDynamicMapService.html#allSublayers) - */ - readonly allSublayers: Collection; /** * The output dots per inch (DPI) of the MapImageLayer. * @@ -9631,12 +9626,6 @@ declare namespace __esri { * @default true */ imageTransparency: boolean; - /** - * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) objects that allow you to alter the properties of one or more sublayers of the MapImageLayer. If this property is not specified, all the sublayers from the service are displayed as defined in the service. If an empty array is passed to this property then none of the sublayers from the service are displayed in the layer. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). They may be [added](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#add), [removed](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#remove), or [reordered](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#reorder) using the [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) extends [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html), its properties may be [watched](https://developers.arcgis.com/javascript/latest/guide/working-with-props/index.html#watchProperties). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISDynamicMapService.html#sublayers) - */ - sublayers: Collection; /** * Gets the parameters of the exported image to use when calling the [export REST operation](https://developers.arcgis.com/rest/services-reference/export-map.htm). @@ -9651,23 +9640,6 @@ declare namespace __esri { * */ createExportImageParameters(extent: Extent, width: number, height: number, options?: ArcGISDynamicMapServiceCreateExportImageParametersOptions): any; - /** - * Returns a deep clone of a map service's [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) as defined by the service. This is useful for scenarios when the developer is unfamiliar with the service sublayers and needs to "reset" the layer's sublayers to match those defined by the service. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISDynamicMapService.html#createServiceSublayers) - * - * - */ - createServiceSublayers(): Collection; - /** - * Returns the sublayer with the given layerId. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISDynamicMapService.html#findSublayerById) - * - * @param id The [id](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#id) of the sublayer. - * - */ - findSublayerById(id: number): Sublayer; } interface ArcGISDynamicMapServiceConstructor { @@ -9725,12 +9697,6 @@ declare namespace __esri { * @default true */ imageTransparency?: boolean; - /** - * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) objects that allow you to alter the properties of one or more sublayers of the MapImageLayer. If this property is not specified, all the sublayers from the service are displayed as defined in the service. If an empty array is passed to this property then none of the sublayers from the service are displayed in the layer. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). They may be [added](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#add), [removed](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#remove), or [reordered](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#reorder) using the [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. Because [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) extends [Accessor](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html), its properties may be [watched](https://developers.arcgis.com/javascript/latest/guide/working-with-props/index.html#watchProperties). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISDynamicMapService.html#sublayers) - */ - sublayers?: CollectionProperties; } @@ -10160,7 +10126,13 @@ declare namespace __esri { export interface ArcGISMapServiceCapabilitiesExportMap extends Object { /** - * Indicates if sublayers rendering can be modifyied or added using dynamic layers. + * Indicates if sublayers can be added, removed, or reordered. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISMapService.html#capabilities) + */ + supportsSublayersChanges: boolean; + /** + * Indicates if sublayers rendering can be modified or added using dynamic layers. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ArcGISMapService.html#capabilities) */ @@ -10286,7 +10258,7 @@ declare namespace __esri { interface ScaleRangeLayer { /** - * The maximum scale at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. + * The maximum scale (most zoomed in) at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#maxScale) * @@ -10294,7 +10266,7 @@ declare namespace __esri { */ maxScale: number; /** - * The minimum scale at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. + * The minimum scale (most zoomed out) at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#minScale) * @@ -10313,7 +10285,7 @@ declare namespace __esri { interface ScaleRangeLayerProperties { /** - * The maximum scale at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. + * The maximum scale (most zoomed in) at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#maxScale) * @@ -10321,7 +10293,7 @@ declare namespace __esri { */ maxScale?: number; /** - * The minimum scale at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. + * The minimum scale (most zoomed out) at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-ScaleRangeLayer.html#minScale) * @@ -10438,6 +10410,34 @@ declare namespace __esri { versionString: string; } + interface SublayersOwner { + /** + * Returns a deep clone of a map service's [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) as defined by the service. This is useful for scenarios when the developer is unfamiliar with the service sublayers and needs to "reset" the layer's sublayers to match those defined by the service. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-SublayersOwner.html#createServiceSublayers) + * + * + */ + createServiceSublayers(): Collection; + /** + * Returns the sublayer with the given layerId. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-SublayersOwner.html#findSublayerById) + * + * @param id The [id](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#id) of the sublayer. + * + */ + findSublayerById(id: number): Sublayer; + } + + interface SublayersOwnerConstructor { + + + new(): SublayersOwner; + } + + export const SublayersOwner: SublayersOwnerConstructor; + interface OpenStreetMapLayer extends WebTileLayer { on(name: "layerview-create", eventHandler: OpenStreetMapLayerLayerviewCreateEventHandler): IHandle; @@ -10607,7 +10607,7 @@ declare namespace __esri { */ elevationInfo: SceneLayerElevationInfo; /** - * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. This property is only supported for point scene layers with non-draped [Icon](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. [![declutter](https://developers.arcgis.com/javascript/latest/assets/img/samples/city-points-declutter.gif)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-point-styles/index.html) + * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. This property is only supported for point scene layers with non-draped [Icon](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. [![declutter](https://developers.arcgis.com/javascript/assets/img/samples/city-points-declutter.gif)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-point-styles/index.html) * > **Known Limitation** When applying featureReduction on a point SceneLayer layer updates are slow. This will be addressed in upcoming releases. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#featureReduction) @@ -10675,7 +10675,7 @@ declare namespace __esri { */ renderer: Renderer; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. As screen size perspective changes the size based on distance to the camera, it should be set to false when using {@link module:esri/renderers/Renderer#SizeVisualVariable size visual variables}. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#screenSizePerspectiveEnabled) @@ -10780,7 +10780,7 @@ declare namespace __esri { */ elevationInfo?: SceneLayerElevationInfo; /** - * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. This property is only supported for point scene layers with non-draped [Icon](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. [![declutter](https://developers.arcgis.com/javascript/latest/assets/img/samples/city-points-declutter.gif)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-point-styles/index.html) + * Configures the method for decluttering overlapping features in the view. If this property is not set (or set to `null`), every feature is drawn individually. This property is only supported for point scene layers with non-draped [Icon](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) or [Text](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html) symbol layers. [![declutter](https://developers.arcgis.com/javascript/assets/img/samples/city-points-declutter.gif)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-point-styles/index.html) * > **Known Limitation** When applying featureReduction on a point SceneLayer layer updates are slow. This will be addressed in upcoming releases. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#featureReduction) @@ -10848,7 +10848,7 @@ declare namespace __esri { */ renderer?: RendererProperties; /** - * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) + * Apply perspective scaling to screen-size point symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [labels](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html) or [callouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-Callout3D.html) integrate better in the 3D scene by applying a certain perspective projection to the sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). `layer.screenSizePerspectiveEnabled = true` ![screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-screenSize-perspective.png) `layer.screenSizePerspectiveEnabled = false` ![no-screen-size-perspective](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-no-screenSize-perspective.png) * > **Known Limitations** Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes with point features located far from the ground surface. In these cases it may be better to turn off screen size perspective. As screen size perspective changes the size based on distance to the camera, it should be set to false when using {@link module:esri/renderers/Renderer#SizeVisualVariable size visual variables}. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#screenSizePerspectiveEnabled) @@ -10930,7 +10930,7 @@ declare namespace __esri { */ geometryDefinition: Extent; /** - * Maximum number of features to show per trackId + * Maximum number of features to show per [trackId](https://enterprise.arcgis.com/en/geoevent/latest/get-started/essential-geoevent-server-vocabulary.htm#ESRI_SECTION1_F45BBCE9ADFA4E57AF38DD225921EFCD). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#maximumTrackPoints) */ @@ -10943,7 +10943,7 @@ declare namespace __esri { purgeOptions: StreamLayerPurgeOptions; /** - * Updates the [filter](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#filter) on the layer. The filter is updated on all views that contain the layer. If the input `filterChanges` object is `undefined` or `null`, the spatial and attribute filters are removed. To update the filter on a single layer view associated with the layer, use the [StreamLayerView.updateFilter()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#updateFilter) method after getting the layer view object. Filter changes only apply to incoming features. Features already displayed in the view are not filtered. Therefore, you may want to clear the graphics in the layer view prior to applying a new filter. To do so, get the layer view then call [removeAll()](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#removeAll) on the [StreamLayerView.graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#graphics). You may also filter features already present in the view using the [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. See the examples below. + * Updates the [filter](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#filter) on the layer. The filter is updated on all views that contain the layer. If the input `filterChanges` object is `undefined` or `null`, the spatial and attribute filters are removed. To update the filter on a single layer view associated with the layer, use the [StreamLayerView.updateFilter()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#updateFilter) method after getting the layer view object. Filter changes only apply to incoming features. Features already displayed in the view will be removed automatically. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#updateFilter) * @@ -10988,7 +10988,7 @@ declare namespace __esri { */ geometryDefinition?: ExtentProperties; /** - * Maximum number of features to show per trackId + * Maximum number of features to show per [trackId](https://enterprise.arcgis.com/en/geoevent/latest/get-started/essential-geoevent-server-vocabulary.htm#ESRI_SECTION1_F45BBCE9ADFA4E57AF38DD225921EFCD). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#maximumTrackPoints) */ @@ -11070,6 +11070,12 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-CodedValueDomain.html#codedValues) */ codedValues: CodedValueDomainCodedValues[]; + /** + * The domain type. This value is always `coded-value`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-CodedValueDomain.html#type) + */ + readonly type: "coded-value"; /** * Returns the name of the coded-value associated with the specified code. @@ -11418,45 +11424,67 @@ declare namespace __esri { interface Field extends Accessor, JSONSupport { /** - * The alias name for the field. + * The display name for the field. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#alias) + * + * @default null */ alias: string; + /** + * The default value set for the field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#defaultValue) + * + * @default undefined + */ + defaultValue: number | string | any | any; /** * The domain associated with the field. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#domain) + * + * @default null */ domain: Domain; /** * Indicates whether the field is editable. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#editable) + * + * @default true */ editable: boolean; /** * The field length. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#length) + * + * @default -1 */ length: number; /** * The name of the field. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#name) + * + * @default null */ name: string; /** * Indicates if the field can accept `null` values. *Requires ArcGIS Server version 10.1 or greater.* * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#nullable) + * + * @default true */ nullable: boolean; /** * The data type of the field. **Possible Values:** small-integer | integer | single | double | long | string | date | oid | geometry | blob | raster | guid | global-id | xml * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#type) + * + * @default null */ type: string; } @@ -11473,45 +11501,67 @@ declare namespace __esri { interface FieldProperties { /** - * The alias name for the field. + * The display name for the field. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#alias) + * + * @default null */ alias?: string; + /** + * The default value set for the field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#defaultValue) + * + * @default undefined + */ + defaultValue?: number | string | any | any; /** * The domain associated with the field. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#domain) + * + * @default null */ domain?: DomainProperties; /** * Indicates whether the field is editable. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#editable) + * + * @default true */ editable?: boolean; /** * The field length. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#length) + * + * @default -1 */ length?: number; /** * The name of the field. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#name) + * + * @default null */ name?: string; /** * Indicates if the field can accept `null` values. *Requires ArcGIS Server version 10.1 or greater.* * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#nullable) + * + * @default true */ nullable?: boolean; /** * The data type of the field. **Possible Values:** small-integer | integer | single | double | long | string | date | oid | geometry | blob | raster | guid | global-id | xml * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#type) + * + * @default null */ type?: string; } @@ -11672,6 +11722,12 @@ declare namespace __esri { } interface InheritedDomain extends Domain { + /** + * The domain type. This value is always `inherited`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-InheritedDomain.html#type) + */ + readonly type: "inherited"; } interface InheritedDomainConstructor { @@ -11806,7 +11862,7 @@ declare namespace __esri { * > **Known Limitations** * * Currently, if the label has a [line callout](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-LineCallout3D.html) in a 3D SceneView, then only `above-center` is supported. * * Label placement only applies to [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) layers in 3D SceneViews. - * * FeatureLayers only support labeling for [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) and [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html) geometries rendered with WebGL. + * * FeatureLayers only support labeling for [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) and [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html) geometries. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#labelPlacement) * @@ -11814,7 +11870,7 @@ declare namespace __esri { */ labelPlacement: string; /** - * The maximum scale to show labels. The value of maxScale should always be less than the value of [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#minScale). If the value is `0`, then the label's visibility isn't dependent on maximum scale. + * The maximum scale (most zoomed in) at which labels are visible in the view. A value of `0` means the label's visibility does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#maxScale) * @@ -11822,7 +11878,7 @@ declare namespace __esri { */ maxScale: number; /** - * The minimum scale to show labels. The value of minScale should always be greater than the value of [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#maxScale). If the value of this property is `0`, then the visibility of labels isn't dependent on minimum scale. + * The minimum scale (most zoomed out) at which labels are visible in the view. A value of `0` means the label's visibility does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#minScale) * @@ -11891,7 +11947,7 @@ declare namespace __esri { * > **Known Limitations** * * Currently, if the label has a [line callout](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-callouts-LineCallout3D.html) in a 3D SceneView, then only `above-center` is supported. * * Label placement only applies to [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) layers in 3D SceneViews. - * * FeatureLayers only support labeling for [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) and [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html) geometries rendered with WebGL. + * * FeatureLayers only support labeling for [Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html) and [Polygon](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html) geometries. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#labelPlacement) * @@ -11899,7 +11955,7 @@ declare namespace __esri { */ labelPlacement?: string; /** - * The maximum scale to show labels. The value of maxScale should always be less than the value of [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#minScale). If the value is `0`, then the label's visibility isn't dependent on maximum scale. + * The maximum scale (most zoomed in) at which labels are visible in the view. A value of `0` means the label's visibility does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#maxScale) * @@ -11907,7 +11963,7 @@ declare namespace __esri { */ maxScale?: number; /** - * The minimum scale to show labels. The value of minScale should always be greater than the value of [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#maxScale). If the value of this property is `0`, then the visibility of labels isn't dependent on minimum scale. + * The minimum scale (most zoomed out) at which labels are visible in the view. A value of `0` means the label's visibility does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#minScale) * @@ -12388,6 +12444,12 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RangeDomain.html#minValue) */ minValue: number; + /** + * The domain type. This value is always `range`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RangeDomain.html#type) + */ + readonly type: "range"; } interface RangeDomainConstructor { @@ -12489,49 +12551,33 @@ declare namespace __esri { interface Relationship extends Accessor { /** - * The cardinality which specifies the number of objects in the origin [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) related to the number of objects in the destination [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). A relationship can have one of three cardinalities: - * * "one-to-one" - * * "one-to-many" - * * "many-to-many" - * - * - * Please see the [Desktop help](http://desktop.arcgis.com/en/arcmap/10.3/manage-data/relationships/relationship-class-properties.htm#GUID-989CB1D1-AC51-4A4C-8D9D-0AB9E647FFFD) for additional information on cardinality. + * The cardinality which specifies the number of objects in the origin [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) related to the number of objects in the destination [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). Please see the [Desktop help](http://desktop.arcgis.com/en/arcmap/10.3/manage-data/relationships/relationship-class-properties.htm#GUID-989CB1D1-AC51-4A4C-8D9D-0AB9E647FFFD) for additional information on cardinality. **Possible values:** one-to-one | one-to-many | many-to-many * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#cardinality) - * - * @default null */ cardinality: string; /** * The unique ID for the relationship. These ids for the relationships the [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) participates in are listed in the ArcGIS Services directory. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#id) - * - * @default null */ id: number; /** * The field used to establish the relate within the [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#keyField) - * - * @default null */ keyField: string; /** * The name of the relationship. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#name) - * - * @default null */ name: string; /** * The unique ID of the related [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#relatedTableId) - * - * @default null */ relatedTableId: number; } @@ -12546,49 +12592,33 @@ declare namespace __esri { interface RelationshipProperties { /** - * The cardinality which specifies the number of objects in the origin [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) related to the number of objects in the destination [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). A relationship can have one of three cardinalities: - * * "one-to-one" - * * "one-to-many" - * * "many-to-many" - * - * - * Please see the [Desktop help](http://desktop.arcgis.com/en/arcmap/10.3/manage-data/relationships/relationship-class-properties.htm#GUID-989CB1D1-AC51-4A4C-8D9D-0AB9E647FFFD) for additional information on cardinality. + * The cardinality which specifies the number of objects in the origin [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) related to the number of objects in the destination [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). Please see the [Desktop help](http://desktop.arcgis.com/en/arcmap/10.3/manage-data/relationships/relationship-class-properties.htm#GUID-989CB1D1-AC51-4A4C-8D9D-0AB9E647FFFD) for additional information on cardinality. **Possible values:** one-to-one | one-to-many | many-to-many * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#cardinality) - * - * @default null */ cardinality?: string; /** * The unique ID for the relationship. These ids for the relationships the [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) participates in are listed in the ArcGIS Services directory. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#id) - * - * @default null */ id?: number; /** * The field used to establish the relate within the [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#keyField) - * - * @default null */ keyField?: string; /** * The name of the relationship. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#name) - * - * @default null */ name?: string; /** * The unique ID of the related [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Relationship.html#relatedTableId) - * - * @default null */ relatedTableId?: number; } @@ -12621,11 +12651,11 @@ declare namespace __esri { */ labelsVisible: boolean; /** - * The [MapImageLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html) to which the sublayer belongs. + * The [MapImageLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html) or [TileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html) to which the sublayer belongs. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#layer) */ - layer: MapImageLayer; + layer: MapImageLayer | TileLayer; /** * Indicates whether the layer will be included in the legend. When `false`, the layer will be excluded from the legend. * @@ -12635,37 +12665,13 @@ declare namespace __esri { */ legendEnabled: boolean; /** - * The maximum scale at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The user or developer can only set `minScale` and `maxScale` if the new values are within the scale range defined in the map service. - * ```js - * // the service specifies minScale = 10000 and maxScale = 500000 - * - * // this is valid - * sublayer.minScale = 30000; - * sublayer.maxScale = 100000; - * - * // this is not valid because the values are - * // outside the range specified by the service - * sublayer.minScale = 5000; - * sublayer.maxScale = 1000000; - * ``` + * The maximum scale (most zoomed in) at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#maxScale) */ maxScale: number; /** - * The minimum scale at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The user or developer can only set `minScale` and `maxScale` if the new values are within the scale range defined in the map service. - * ```js - * // the service specifies minScale = 10000 and maxScale = 500000 - * - * // this is valid - * sublayer.minScale = 30000; - * sublayer.maxScale = 100000; - * - * // this is not valid because the values are - * // outside the range specified by the service - * sublayer.minScale = 5000; - * sublayer.maxScale = 1000000; - * ``` + * The minimum scale (most zoomed out) at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#minScale) */ @@ -12687,7 +12693,7 @@ declare namespace __esri { /** * The popup template for the sublayer. When set, the `popupTemplate` allows users to access attributes and display their values in the [view's popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#popup) when the user clicks the image. Sublayers with a [RasterDataSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#RasterDataSource) cannot be queried and therefore do not support [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). * > **Known Limitations** - * * [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expressions are not supported in PopupTemplates set on MapImageLayer sublayers unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. + * * [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expressions are not supported in PopupTemplates set on MapImageLayer sublayers or TileLayer sublayers unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupTemplate) */ @@ -12695,7 +12701,7 @@ declare namespace __esri { /** * The renderer to apply to the sublayer. This value overrides the renderer read from the map service. * > **Known Limitations** - * * [3D symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol3D.html) are not currently supported in renderers set on MapImageLayer sublayers. + * * [3D symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol3D.html) are not currently supported in renderers set on sublayers. * * [Visual variables](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-SimpleRenderer.html#visualVariables) and [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expressions are not supported in renderers set on MapImageLayer sublayers unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#renderer) @@ -12724,7 +12730,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#url) */ - url: string; + readonly url: string; /** * Indicates if the layer is visible in the view. * @@ -12769,7 +12775,7 @@ declare namespace __esri { interface SublayerConstructor { /** - * Represents a sublayer in a [MapImageLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html). MapImageLayer allows you to display, query, and analyze layers from data defined in a [map service](http://server.arcgis.com/en/server/latest/publish-services/windows/what-is-a-map-service.htm). Map services contain sublayers with properties such as [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#renderer), [labelingInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#labelingInfo), and [definitionExpression](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#definitionExpression), and others that are defined on the server. The properties of each sublayer on the map service may be dynamically changed by the user or developer. + * Represents a sublayer in a [MapImageLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html) or a [TileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html). MapImageLayer allows you to display, query, and analyze layers from data defined in a [map service](http://server.arcgis.com/en/server/latest/publish-services/windows/what-is-a-map-service.htm). Map services contain sublayers with properties such as [renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#renderer), [labelingInfo](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#labelingInfo), and [definitionExpression](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#definitionExpression), and others that are defined on the server. The properties of each MapImageLayer sublayer on the map service may be dynamically changed by the user or developer. The properties of each TileLayer sublayer are read-only, and cannot be modified. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) */ @@ -12807,11 +12813,11 @@ declare namespace __esri { */ labelsVisible?: boolean; /** - * The [MapImageLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html) to which the sublayer belongs. + * The [MapImageLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html) or [TileLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html) to which the sublayer belongs. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#layer) */ - layer?: MapImageLayerProperties; + layer?: MapImageLayerProperties | TileLayerProperties; /** * Indicates whether the layer will be included in the legend. When `false`, the layer will be excluded from the legend. * @@ -12821,37 +12827,13 @@ declare namespace __esri { */ legendEnabled?: boolean; /** - * The maximum scale at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The user or developer can only set `minScale` and `maxScale` if the new values are within the scale range defined in the map service. - * ```js - * // the service specifies minScale = 10000 and maxScale = 500000 - * - * // this is valid - * sublayer.minScale = 30000; - * sublayer.maxScale = 100000; - * - * // this is not valid because the values are - * // outside the range specified by the service - * sublayer.minScale = 5000; - * sublayer.maxScale = 1000000; - * ``` + * The maximum scale (most zoomed in) at which the layer is visible in the view. If the map is zoomed in beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#minScale) value, and greater than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#maxScale) */ maxScale?: number; /** - * The minimum scale at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a maximum scale. The user or developer can only set `minScale` and `maxScale` if the new values are within the scale range defined in the map service. - * ```js - * // the service specifies minScale = 10000 and maxScale = 500000 - * - * // this is valid - * sublayer.minScale = 30000; - * sublayer.maxScale = 100000; - * - * // this is not valid because the values are - * // outside the range specified by the service - * sublayer.minScale = 5000; - * sublayer.maxScale = 1000000; - * ``` + * The minimum scale (most zoomed out) at which the layer is visible in the view. If the map is zoomed out beyond this scale, the layer will not be visible. A value of `0` means the layer does not have a minimum scale. The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#maxScale) value, and lesser than or equal to the service specification. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#minScale) */ @@ -12873,7 +12855,7 @@ declare namespace __esri { /** * The popup template for the sublayer. When set, the `popupTemplate` allows users to access attributes and display their values in the [view's popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#popup) when the user clicks the image. Sublayers with a [RasterDataSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#RasterDataSource) cannot be queried and therefore do not support [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). * > **Known Limitations** - * * [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expressions are not supported in PopupTemplates set on MapImageLayer sublayers unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. + * * [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expressions are not supported in PopupTemplates set on MapImageLayer sublayers or TileLayer sublayers unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupTemplate) */ @@ -12881,7 +12863,7 @@ declare namespace __esri { /** * The renderer to apply to the sublayer. This value overrides the renderer read from the map service. * > **Known Limitations** - * * [3D symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol3D.html) are not currently supported in renderers set on MapImageLayer sublayers. + * * [3D symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol3D.html) are not currently supported in renderers set on sublayers. * * [Visual variables](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-SimpleRenderer.html#visualVariables) and [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expressions are not supported in renderers set on MapImageLayer sublayers unless they reference ArcGIS Enterprise 10.6 map services (or later) created from ArcGIS Pro. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#renderer) @@ -12905,12 +12887,6 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#title) */ title?: string; - /** - * The URL to the REST endpoint of the sublayer. This allows you to view the schema of fields and query tables located in registered workspaces. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#url) - */ - url?: string; /** * Indicates if the layer is visible in the view. * @@ -13802,13 +13778,35 @@ declare namespace __esri { title?: string; } - interface TileLayer extends Layer, ArcGISMapService, ArcGISCachedService, RefreshableLayer, ScaleRangeLayer, PortalLayer { + interface TileLayer extends Layer, SublayersOwner, ArcGISMapService, ArcGISCachedService, RefreshableLayer, ScaleRangeLayer, PortalLayer { + /** + * A flat [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of all the [sublayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html#sublayers) in the TileLayer including the sublayers of its sublayers. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html#allSublayers) + */ + readonly allSublayers: Collection; /** * The URL that points to the location of the layer's attribution data. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html#attributionDataUrl) */ readonly attributionDataUrl: string; + /** + * Indicates if the layer has attribution data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html#hasAttributionData) + */ + readonly hasAttributionData: boolean; + /** + * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [Sublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html) objects. All sublayers are referenced in the order in which they are drawn in the view (bottom to top). Sublayer properties on TileLayer are read-only, with the following exceptions: + * * [legendEnabled](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#legendEnabled) + * * [popupEnabled](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupEnabled) + * * [popupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#popupTemplate) + * * [title](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Sublayer.html#title) + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html#sublayers) + */ + readonly sublayers: Collection; /** * An array of tile servers used for changing map tiles. * @@ -13837,7 +13835,6 @@ declare namespace __esri { * @param row The row(y) position of the tile fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param col The column(x) position of the tile to fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param options Optional settings for the tile request. The options have the following properties. - * @param options.allowImageDataAccess Indicates if the access to pixels of the image is allowed. * @param options.timestamp Number to append to the tile request to prevent fetching the tile from the browser cache. * */ @@ -13905,12 +13902,6 @@ declare namespace __esri { export interface TileLayerFetchTileOptions extends Object { - /** - * Indicates if the access to pixels of the image is allowed. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html#fetchTile) - */ - allowImageDataAccess?: boolean; /** * Number to append to the tile request to prevent fetching the tile from the browser cache. * @@ -14181,7 +14172,7 @@ declare namespace __esri { */ styleUrl: string; /** - * Asbolute URL for sprites included in a style. + * Absolute URL for sprites included in a style. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-VectorTileLayer.html#currentStyleInfo) */ @@ -14261,7 +14252,6 @@ declare namespace __esri { * @param row The row(y) position of the tile fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param column The column(x) position of the tile to fetch. This value is provided by [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html). * @param options Optional settings for the tile request. The options have the following properties. - * @param options.allowImageDataAccess Indicates if the access to pixels of the image is allowed. * @param options.timestamp A timestamp to append to the tile url to avoid loading a cached version of the tile. * */ @@ -14339,12 +14329,6 @@ declare namespace __esri { export interface WebTileLayerFetchTileOptions extends Object { - /** - * Indicates if the access to pixels of the image is allowed. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WebTileLayer.html#fetchTile) - */ - allowImageDataAccess?: boolean; /** * A timestamp to append to the tile url to avoid loading a cached version of the tile. * @@ -14474,7 +14458,6 @@ declare namespace __esri { * @param width The width of the view in pixels. * @param height The height of the view in pixels. * @param options The parameter options is an object with the following properties. - * @param options.allowImageDataAccess Indicates if the access to the pixels of the image is required. * @param options.pixelRatio The ratio of the resolution in physical pixels of the image to the resolution it will be displayed at. * @param options.rotation The rotation in degrees of the exported image. * @@ -14635,12 +14618,6 @@ declare namespace __esri { export interface WMSLayerFetchImageOptions extends Object { - /** - * Indicates if the access to the pixels of the image is required. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html#fetchImage) - */ - allowImageDataAccess?: boolean; /** * The ratio of the resolution in physical pixels of the image to the resolution it will be displayed at. * @@ -14812,30 +14789,35 @@ declare namespace __esri { * * Value | Description * ------|------------ - * streets | ![basemap-streets](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets.jpg) - * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/satellite.jpg) - * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/hybrid.jpg) - * topo | ![basemap-topo](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/topo.jpg) - * gray | ![basemap-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/gray.jpg) - * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/dark-gray.jpg) - * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/oceans.jpg) - * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/national-geographic.jpg) - * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/terrain.jpg) - * osm | ![basemap-osm](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/osm.jpg) - * dark-gray-vector | ![dark-gray-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/dark-gray.jpg) - * gray-vector | ![gray-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/gray.jpg) - * streets-vector | ![streets-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets.jpg) - * topo-vector | ![topo-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/topo.jpg) - * streets-night-vector | ![streets-night-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets-night.jpg) - * streets-relief-vector | ![streets-relief-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets-relief.jpg) - * streets-navigation-vector | ![streets-navigation-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets-navigation.jpg) + * streets | ![basemap-streets](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets.jpg) + * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/satellite.jpg) + * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/hybrid.jpg) + * topo | ![basemap-topo](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/topo.jpg) + * gray | ![basemap-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/gray.jpg) + * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/dark-gray.jpg) + * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/oceans.jpg) + * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/national-geographic.jpg) + * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/terrain.jpg) + * osm | ![basemap-osm](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/osm.jpg) + * dark-gray-vector | ![dark-gray-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/dark-gray.jpg) + * gray-vector | ![gray-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/gray.jpg) + * streets-vector | ![streets-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets.jpg) + * topo-vector | ![topo-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/topo.jpg) + * streets-night-vector | ![streets-night-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets-night.jpg) + * streets-relief-vector | ![streets-relief-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets-relief.jpg) + * streets-navigation-vector | ![streets-navigation-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets-navigation.jpg) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) */ basemap: Basemap; /** - * Specifies the surface properties for the map. This property is only relevant when adding the map to a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). It renders the terrain or topographical variations in the real world on the map's surface with a collection of [ElevationLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html). This value can be an instance of [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html), or the string `world-elevation` for a default instance of ground using the [World Elevation Service](https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer). The ground may not be set to `null` or `undefined`, it is guaranteed to always contain an instance of type [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html). The elevation can be removed from the ground by setting the ground property to a new empty [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html) instance or by removing all the ground layers. + * Specifies the surface properties for the map. This property is only relevant when adding the map to a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). It renders the terrain or topographical variations in the real world on the map's surface with a collection of [ElevationLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html). This value can be an instance of [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html), or one of the following strings: + * * `world-elevation` for a default instance of ground using the [Terrain3D Service](https://www.arcgis.com/home/item.html?id=7029fb60158543ad845c7e1527af11e4). + * * `world-topobathymetry` for an instance of ground that combines surface elevation and bathymetry using the [TopoBathy3D Service](https://www.arcgis.com/home/item.html?id=0c69ba5a5d254118841d43f03aa3e97d). + * + * + * The ground may not be set to `null` or `undefined`, it is guaranteed to always contain an instance of type [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html). The elevation can be removed from the ground by setting the ground property to a new empty [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html) instance or by removing all the ground layers. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#ground) */ @@ -14860,30 +14842,35 @@ declare namespace __esri { * * Value | Description * ------|------------ - * streets | ![basemap-streets](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets.jpg) - * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/satellite.jpg) - * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/hybrid.jpg) - * topo | ![basemap-topo](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/topo.jpg) - * gray | ![basemap-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/gray.jpg) - * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/dark-gray.jpg) - * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/oceans.jpg) - * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/national-geographic.jpg) - * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/terrain.jpg) - * osm | ![basemap-osm](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/osm.jpg) - * dark-gray-vector | ![dark-gray-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/dark-gray.jpg) - * gray-vector | ![gray-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/gray.jpg) - * streets-vector | ![streets-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets.jpg) - * topo-vector | ![topo-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/topo.jpg) - * streets-night-vector | ![streets-night-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets-night.jpg) - * streets-relief-vector | ![streets-relief-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets-relief.jpg) - * streets-navigation-vector | ![streets-navigation-vector](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets-navigation.jpg) + * streets | ![basemap-streets](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets.jpg) + * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/satellite.jpg) + * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/hybrid.jpg) + * topo | ![basemap-topo](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/topo.jpg) + * gray | ![basemap-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/gray.jpg) + * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/dark-gray.jpg) + * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/oceans.jpg) + * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/national-geographic.jpg) + * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/terrain.jpg) + * osm | ![basemap-osm](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/osm.jpg) + * dark-gray-vector | ![dark-gray-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/dark-gray.jpg) + * gray-vector | ![gray-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/gray.jpg) + * streets-vector | ![streets-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets.jpg) + * topo-vector | ![topo-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/topo.jpg) + * streets-night-vector | ![streets-night-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets-night.jpg) + * streets-relief-vector | ![streets-relief-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets-relief.jpg) + * streets-navigation-vector | ![streets-navigation-vector](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets-navigation.jpg) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) */ basemap?: BasemapProperties | string; /** - * Specifies the surface properties for the map. This property is only relevant when adding the map to a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). It renders the terrain or topographical variations in the real world on the map's surface with a collection of [ElevationLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html). This value can be an instance of [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html), or the string `world-elevation` for a default instance of ground using the [World Elevation Service](https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer). The ground may not be set to `null` or `undefined`, it is guaranteed to always contain an instance of type [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html). The elevation can be removed from the ground by setting the ground property to a new empty [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html) instance or by removing all the ground layers. + * Specifies the surface properties for the map. This property is only relevant when adding the map to a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). It renders the terrain or topographical variations in the real world on the map's surface with a collection of [ElevationLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html). This value can be an instance of [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html), or one of the following strings: + * * `world-elevation` for a default instance of ground using the [Terrain3D Service](https://www.arcgis.com/home/item.html?id=7029fb60158543ad845c7e1527af11e4). + * * `world-topobathymetry` for an instance of ground that combines surface elevation and bathymetry using the [TopoBathy3D Service](https://www.arcgis.com/home/item.html?id=0c69ba5a5d254118841d43f03aa3e97d). + * + * + * The ground may not be set to `null` or `undefined`, it is guaranteed to always contain an instance of type [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html). The elevation can be removed from the ground by setting the ground property to a new empty [Ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html) instance or by removing all the ground layers. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#ground) */ @@ -14902,7 +14889,7 @@ declare namespace __esri { interface PopupTemplate extends Accessor, JSONSupport { /** - * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each object represents an action or function that may be executed by clicking the icon or image symbolizing them in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). By default, every [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. PopupTemplates do not have default actions. To override actions on the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) using PopupTemplate see [overwriteActions](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#overwriteActions). Actions defined in a PopupTemplate will only appear in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) for features or layers that apply that particular PopupTemplate. The order of each action in the popup is the same order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event in [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the PopupTemplate that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. + * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each object represents an action or function that may be executed by clicking the icon or image symbolizing them in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). By default, every [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. PopupTemplates do not have default actions. To override actions on the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) using PopupTemplate see [overwriteActions](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#overwriteActions). Actions defined in a PopupTemplate will only appear in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) for features or layers that apply that particular PopupTemplate. The order of each action in the popup is the same order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event in [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the PopupTemplate that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#actions) */ @@ -14953,6 +14940,14 @@ declare namespace __esri { * @default null */ layerOptions: PopupTemplateLayerOptions; + /** + * An array of fields used in the PopupTemplate. Use this property to indicate what fields are required to fully render the PopupTemplate. To fetch the values from all fields, use `["*"]`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#outFields) + * + * @default null + */ + outFields: string[]; /** * Indicates whether actions should replace existing [popup actions](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#actions). * @@ -14985,7 +14980,7 @@ declare namespace __esri { interface PopupTemplateProperties { /** - * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each object represents an action or function that may be executed by clicking the icon or image symbolizing them in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). By default, every [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. PopupTemplates do not have default actions. To override actions on the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) using PopupTemplate see [overwriteActions](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#overwriteActions). Actions defined in a PopupTemplate will only appear in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) for features or layers that apply that particular PopupTemplate. The order of each action in the popup is the same order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event in [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the PopupTemplate that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. + * A [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each object represents an action or function that may be executed by clicking the icon or image symbolizing them in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). By default, every [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. PopupTemplates do not have default actions. To override actions on the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) using PopupTemplate see [overwriteActions](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#overwriteActions). Actions defined in a PopupTemplate will only appear in the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) for features or layers that apply that particular PopupTemplate. The order of each action in the popup is the same order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event in [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the PopupTemplate that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#actions) */ @@ -15036,6 +15031,14 @@ declare namespace __esri { * @default null */ layerOptions?: PopupTemplateLayerOptions; + /** + * An array of fields used in the PopupTemplate. Use this property to indicate what fields are required to fully render the PopupTemplate. To fetch the values from all fields, use `["*"]`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#outFields) + * + * @default null + */ + outFields?: string[]; /** * Indicates whether actions should replace existing [popup actions](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#actions). * @@ -15053,7 +15056,7 @@ declare namespace __esri { } /** - * Attachments are a type of popup element. Similar to text and media elements, attachments can only be set within the content. ![popuptemplate-attachments-element](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-attachments-element.png) The object specification for the fields popup element is provided below. + * Attachments are a type of popup element. Similar to text and media elements, attachments can only be set within the content. ![popuptemplate-attachments-element](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-attachments-element.png) The object specification for the fields popup element is provided below. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#attachments) */ @@ -15067,7 +15070,7 @@ declare namespace __esri { } /** - * It is possible to set the fieldInfos directly within the PopupTemplate's content. If the fieldInfos is not set within the content, it will revert to whatever may be set within the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#fieldInfos) property. ![popuptemplate-fields-element](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-fields-element.png) The object specification for the fields popup element is provided below. + * It is possible to set the fieldInfos directly within the PopupTemplate's content. If the fieldInfos is not set within the content, it will revert to whatever may be set within the [PopupTemplate.fieldInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#fieldInfos) property. ![popuptemplate-fields-element](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-fields-element.png) The object specification for the fields popup element is provided below. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#fields) */ @@ -15087,7 +15090,7 @@ declare namespace __esri { } /** - * It is possible to set media elements such as charts and/or images within the PopupTemplate's content. This content is set within the mediaInfos. ![popuptemplate-media-element](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-media-element.png) The object specification for the media popup element is provided below. + * It is possible to set media elements such as charts and/or images within the PopupTemplate's content. This content is set within the mediaInfos. ![popuptemplate-media-element](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-media-element.png) The object specification for the media popup element is provided below. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#media) */ @@ -15207,7 +15210,7 @@ declare namespace __esri { } /** - * An object used to define descriptive text as an element within the PopupTemplate's content. The text may reference values returned from a field attribute or an [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression. ![popuptemplate-text-element](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-text-element.png) The object specification for the text popup element is provided below. + * An object used to define descriptive text as an element within the PopupTemplate's content. The text may reference values returned from a field attribute or an [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression. ![popuptemplate-text-element](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-text-element.png) The object specification for the text popup element is provided below. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html#text) */ @@ -15368,6 +15371,8 @@ declare namespace __esri { * When `true`, the organization's public items, groups and users are included in search queries. When `false`, no public items outside of the organization are included. However, public items which are part of the organization are included. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#canSearchPublic) + * + * @default true */ canSearchPublic: boolean; /** @@ -15849,6 +15854,8 @@ declare namespace __esri { * When `true`, the organization's public items, groups and users are included in search queries. When `false`, no public items outside of the organization are included. However, public items which are part of the organization are included. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#canSearchPublic) + * + * @default true */ canSearchPublic?: boolean; /** @@ -17573,19 +17580,11 @@ declare namespace __esri { */ defaultSymbol: Symbol; /** - * The name of the attribute field the renderer uses to render data. A function may also be used to return a numeric value if the data does not already explicitly exist in a field. + * The name of a numeric attribute field whose data determines the symbol of each feature based on the class breaks defined in [classBreakInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html#classBreakInfos). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html#field) */ - field: string | Function; - /** - * If `true`, graphics with attribute values equal to the max value of a class will be included in that class. Set this property to `false` if the desired behavior is to make a class include values less than, but not equal to the max value. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html#isMaxInclusive) - * - * @default true - */ - isMaxInclusive: boolean; + field: string; /** * An object providing options for displaying the renderer in the Legend. * @@ -17712,19 +17711,11 @@ declare namespace __esri { */ defaultSymbol?: SymbolProperties; /** - * The name of the attribute field the renderer uses to render data. A function may also be used to return a numeric value if the data does not already explicitly exist in a field. + * The name of a numeric attribute field whose data determines the symbol of each feature based on the class breaks defined in [classBreakInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html#classBreakInfos). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html#field) */ - field?: string | Function; - /** - * If `true`, graphics with attribute values equal to the max value of a class will be included in that class. Set this property to `false` if the desired behavior is to make a class include values less than, but not equal to the max value. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html#isMaxInclusive) - * - * @default true - */ - isMaxInclusive?: boolean; + field?: string; /** * An object providing options for displaying the renderer in the Legend. * @@ -18550,17 +18541,11 @@ declare namespace __esri { */ maxDataValue: number; /** - * Indicates the source of the data values used to determine the size of each feature. - * - * Value Type | Description - * ------|----------- - * String | The name of the numeric attribute field that contains the data values used to determine the size of each feature. - * Function | A function that iterates through each [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html), which includes the feature's attributes, and returns the value used to determine the size of the given feature. - * + * The name of the numeric attribute field that contains the data values used to determine the size of each feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#BoundedMinMax) */ - field?: string | Function; + field?: string; /** * The minimum data value used in the size ramp. Features with this value or lower will be rendered at the size defined in `minSize`. * @@ -18605,7 +18590,7 @@ declare namespace __esri { } /** - * The **color** visual variable defines how a continuous color ramp is applied to features based on the values of a numeric attribute field. The minimum and maximum values of the data should be indicated along with their respective color values. You must specify `stops` to construct the color ramp, and either `field` or `valueExpression` to define the driving value. [![renderer-vv-color](https://developers.arcgis.com/javascript/latest/assets/img/samples/7-vv-color.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-color/index.html) The object specification for color is provided below. + * The **color** visual variable defines how a continuous color ramp is applied to features based on the values of a numeric attribute field. The minimum and maximum values of the data should be indicated along with their respective color values. You must specify `stops` to construct the color ramp, and either `field` or `valueExpression` to define the driving value. [![renderer-vv-color](https://developers.arcgis.com/javascript/assets/img/samples/7-vv-color.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-color/index.html) The object specification for color is provided below. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ @@ -18617,41 +18602,35 @@ declare namespace __esri { */ type: string; /** - * Indicates the source of the data values used to determine the color of each feature. - * - * Value Type | Description - * ------|----------- - * String | The name of the numeric attribute field that contains the data values used to determine the color of each feature. - * Function | A function that iterates through each [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) including a feature's attributes and returns the value used to determine the color of the given feature. - * + * The name of the numeric attribute field that contains the data values used to determine the color of each feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - field: string | Function; + field?: string; /** * Name of the numeric attribute field by which to normalize the data. If this field is used, then the values in `stops` should be normalized as percentages or ratios. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - normalizationField: string; + normalizationField?: string; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression evaluating to a number. This expression can reference field values using the `$feature` global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. This takes precedence over `field`. Therefore, this property is typically used as an alternative to `field` in visual variables. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - valueExpression: string; + valueExpression?: string; /** * The title identifying and describing the associated [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression as defined in the `valueExpression` property. This is displayed as the title of the corresponding color ramp in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) in the absence of a provided `title` in the `legendOptions` property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - valueExpressionTitle: string; + valueExpressionTitle?: string; /** * An object providing options for displaying the color ramp in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - legendOptions: ColorVisualVariableLegendOptions; + legendOptions?: ColorVisualVariableLegendOptions; /** * An array of objects that defines the color ramp in a sequence of stops. At least two stops are required. Features with values between the given stops will be assigned colors along the ramp proportional to the minimum and maximum values used. The stops must be listed in ascending order based on the value of the `value` property in each stop. Each stop object has the following specification: * @@ -18661,7 +18640,7 @@ declare namespace __esri { } /** - * The **opacity** visual variable defines the opacity of each feature's symbol based on a numeric attribute field value. The minimum and maximum values of the data should be indicated along with their respective opacity values. The specification for this object is provided below. You must specify `stops` to construct the opacity ramp, and either `field` or `valueExpression` to define the driving value. [![renderer-vv-opacity](https://developers.arcgis.com/javascript/latest/assets/img/samples/12-vv-transparency.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-opacity/index.html) + * The **opacity** visual variable defines the opacity of each feature's symbol based on a numeric attribute field value. The minimum and maximum values of the data should be indicated along with their respective opacity values. The specification for this object is provided below. You must specify `stops` to construct the opacity ramp, and either `field` or `valueExpression` to define the driving value. [![renderer-vv-opacity](https://developers.arcgis.com/javascript/assets/img/samples/12-vv-transparency.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-opacity/index.html) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ @@ -18673,41 +18652,35 @@ declare namespace __esri { */ type: string; /** - * Indicates the source of the data values used to determine the opacity of each feature. - * - * Value Type | Description - * ------|----------- - * String | The name of the numeric attribute field that contains the data values used to determine the opacity of each feature. - * Function | A function that iterates through each [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) including the attributes of the feature and returns the value used to determine the opacity of the given feature. - * + * The name of the numeric attribute field that contains the data values used to determine the opacity of each feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - field: string | Function; + field?: string; /** * Name of the attribute field by which to normalize the data. If this field is used, then the values in `stops` should be normalized as percentages or ratios. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - normalizationField: string; + normalizationField?: string; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression evaluating to a number. This expression can reference field values using the `$feature` global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. This takes precedence over `field`. Therefore, this property is typically used as an alternative to `field` in visual variables. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - valueExpression: string; + valueExpression?: string; /** * The title identifying and describing the associated [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression as defined in the `valueExpression` property. This is displayed as the title of the corresponding opacity ramp in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) in the absence of a provided `title` in the `legendOptions` property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - valueExpressionTitle: string; + valueExpressionTitle?: string; /** * An object providing options for displaying the opacity ramp in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - legendOptions: OpacityVisualVariableLegendOptions; + legendOptions?: OpacityVisualVariableLegendOptions; /** * An array of objects that defines the thematic opacity ramp in a sequence of stops. At least two stops are required. The stops must be listed in ascending order based on the value of the `value` property in each stop. Each stop object has the following specification: * @@ -18717,7 +18690,7 @@ declare namespace __esri { } /** - * Defines a [size visual variable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) where data values are interpreted as real-world sizes based on a given unit. Features are then sized according to the real-world measurements, not thematic values and screen units. [![renderer-vv-rw](https://developers.arcgis.com/javascript/latest/assets/img/samples/2-extrude-height.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-buildings-3d/index.html) The object specification for this object is provided below. + * Defines a [size visual variable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) where data values are interpreted as real-world sizes based on a given unit. Features are then sized according to the real-world measurements, not thematic values and screen units. [![renderer-vv-rw](https://developers.arcgis.com/javascript/assets/img/samples/2-extrude-height.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-buildings-3d/index.html) The object specification for this object is provided below. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RealWorldSize) */ @@ -18729,17 +18702,11 @@ declare namespace __esri { */ type: string; /** - * Indicates the source of the data values used to determine the size of each feature. - * - * Value Type | Description - * ------|----------- - * String | The name of the numeric attribute field that contains the data values used to determine the size of each feature. - * Function | A function that iterates through each [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html), which includes the feature's attributes, and returns the value used to determine the size of the given feature. - * + * The name of the numeric attribute field that contains the data values used to determine the size of each feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RealWorldSize) */ - field?: string | Function; + field?: string; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression evaluating to a number. This expression can reference field values using the `$feature` global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. This takes precedence over `field`. Therefore, this property is typically used as an alternative to `field` in visual variables. * @@ -18772,7 +18739,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RealWorldSize) */ - valueRepresentation: string; + valueRepresentation?: string; /** * An object providing options for displaying the size ramp in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @@ -18803,7 +18770,7 @@ declare namespace __esri { } /** - * The **rotation** visual variable defines how features rendered with [marker symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-MarkerSymbol.html) or [text symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html) in a MapView or [3D object symbol layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html) in a SceneView are rotated. The rotation value is determined by mapping the values to data in a field, or by other arithmetic means with a function. This object may be used to depict variables such as wind direction, vehicle heading, etc. [![renderer-vv-rotation](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/renderer-vv-rotation.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-rotation/index.html) + * The **rotation** visual variable defines how features rendered with [marker symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-MarkerSymbol.html) or [text symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html) in a MapView or [3D object symbol layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html) in a SceneView are rotated. The rotation value is determined by mapping the values to data in a field, or by other arithmetic means with an Arcade expression. This object may be used to depict variables such as wind direction, vehicle heading, etc. [![renderer-vv-rotation](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/renderer-vv-rotation.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-rotation/index.html) * > **Known Limitations** In a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) rotation visual variables are not currently supported with [marker symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-MarkerSymbol.html), [text symbols](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html), [3D icon symbol layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html) and [3D text symbol layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) @@ -18816,23 +18783,17 @@ declare namespace __esri { */ type: string; /** - * Indicates the source of the rotation angle of each feature. - * - * Value Type | Description - * ------|----------- - * String | The name of the numeric attribute field that contains the rotation angle of each feature. - * Function | A function that iterates through each [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html), which includes the feature's attributes, and returns the rotation angle of the given feature. - * + * The name of the numeric attribute field that contains the rotation angle of each feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) */ - field: string | Function; + field?: string; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression evaluating to a number. This expression can reference field values using the `$feature` global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. This takes precedence over `field`. Therefore, this property is typically used as an alternative to `field` in visual variables. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) */ - valueExpression: string; + valueExpression?: string; /** * Only applicable when working in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). Defines the axis the rotation visual variable should be applied to when rendering features with an [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html). If the symbol resource is aligned such that its forward facing side points in the direction of the y-axis (the y-axis always points North in WGS84 or WebMercator coordinates), its upwards facing side is pointing in the direction of the z-axis, and its right-hand side points in the direction of the x-axis (the x-axis always points East in WGS84 or WebMercator coordinates), then the following rotation axis will rotate the symbol as indicated by their name. * @@ -18873,17 +18834,11 @@ declare namespace __esri { */ type: string; /** - * Indicates the source of the data values used to determine the size of each feature. - * - * Value Type | Description - * ------|----------- - * String | The name of the numeric attribute field that contains the data values used to determine the size of each feature. - * Function | A function that iterates through each [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html), which includes the feature's attributes, and returns the value used to determine the size of the given feature. - * + * The name of the numeric attribute field that contains the data values used to determine the size of each feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ScaleDependentIcons) */ - field?: string | Function; + field?: string; /** * The name of the numeric attribute field used to normalize the data in `field`. If this field is used, then the values in `maxDataValue` and `minDataValue` should be normalized as percentages or ratios. * @@ -18987,7 +18942,7 @@ declare namespace __esri { * * **[RealWorldSize](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RealWorldSize)** - Feature sizes are determined based on real-world measurements and units, not thematic values and screen units. * * - * [![renderer-unique-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/renderer-unique-vv.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-multivariate-2d/index.html) + * [![renderer-unique-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/renderer-unique-vv.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-multivariate-2d/index.html) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) */ @@ -19007,17 +18962,11 @@ declare namespace __esri { */ type: string; /** - * Indicates the source of the data values used to determine the size of each feature. - * - * Value Type | Description - * ------|----------- - * String | The name of the numeric attribute field that contains the data values used to determine the size of each feature. - * Function | A function that iterates through each [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html), which includes the feature's attributes, and returns the value used to determine the size of the given feature. - * + * The name of the numeric attribute field that contains the data values used to determine the size of each feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ThematicStops) */ - field?: string | Function; + field?: string; /** * The name of the numeric attribute field used to normalize the data in `field`. If this field is used, then the values in `stops` should be normalized as percentages or ratios. * @@ -19094,13 +19043,13 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - title: string; + title?: string; /** * Indicates whether to show the color ramp in the legend. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - showLegend: boolean; + showLegend?: boolean; } @@ -19122,7 +19071,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) */ - label: string; + label?: string; } @@ -19132,13 +19081,13 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - title: string; + title?: string; /** * Indicates whether to show the opacity ramp in the legend. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - showLegend: boolean; + showLegend?: boolean; } @@ -19160,7 +19109,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) */ - label: string; + label?: string; } @@ -19314,6 +19263,50 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html) */ interface color { + /** + * Generates a continuous color [Renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) representing the age of features based on one or more fields. The age of a feature is calculated based on a given `startTime` and `endTime`, one of which must be a date field in the input `layer`. This method generates an Arcade expression and calculates statistics on the output of the expression to accomplish this. The resulting renderer contains a continuous color visual variable that maps optimal colors based on the indicated basemap to data values based on the resulting statistics of the expression. You are required to provide a `layer`, `view`, `startTime`, and `endTime` to generate this renderer. Optionally, you can set a `unit` and a `theme` for the visualization. Other options are provided for convenience for more involved custom visualization authoring applications. For example, if you already generated statistics in another operation, you can pass the statistics object to the `statistics` parameter to avoid making an extra call to the server. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + * + * @param params Input parameters for generating a continuous color visualization of age for time data returned from start and/or end date field(s). See the table below for details of each parameter. + * @param params.layer The layer for which the visualization is generated. + * @param params.view The view instance in which the visualization will be rendered. + * @param params.startTime The name of the field, or a date value representing the start time in the age calculation. If a date value is specified, then the `endTime` paramter must reference a Date field in the layer. + * @param params.endTime The name of the field, or a date value representing the end time in the age calculation. If a date value is specified, then the `startTime` paramter must reference a Date field in the layer. + * @param params.unit The time unit used to calculate the difference between `endTime` and `startTime`. If a unit is not specified, then a suggested unit is determined based on the spread and distribution of the data. **Possible Values:** years | months | days | hours | minutes | seconds + * @param params.basemap The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * @param params.theme + * Determines which values will be emphasized in the continuous ramp and the map. Possible values are listed below. + * + * | Value | Description | Example | + * | ----- | ----------- | ------- | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | + * @param params.legendOptions Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. The `createAgeRenderer()` method generates an Arcade expression and executes a statistics query against the layer for the result of the expression. If statistics for the expression have already been generated, then pass the object here to avoid making a second statistics query. + * @param params.colorScheme In authoring apps, the user may select a pre-defined color scheme. Pass the scheme object to this property to avoid getting one based on a `theme` and the `basemap`. + * @param params.symbolType + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * @param params.defaultSymbolEnabled Enables the `defaultSymbol` on the renderer and assigns it to features with no value. + * @param params.colorMixMode + * **This option only applies to generating renderers for mesh SceneLayers**. Specifies how the symbol's color is applied to the geometry color/texture. See the documentation in [FillSymbol3DLayer.material](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#material) for more context. See the table below for possible values. + * + * Value | Description + * ------|------------ + * tint | Applies the symbol `color` to the desaturated geometry/texture color. + * replace | Removes the geometry/texture color and applies the symbol `color`. + * multiply | Multiplies geometry/texture color value with the symbol `color` value. The result is a darker color. Multiplying with white keeps the geometry color the same. + * + */ + createAgeRenderer(params: colorCreateAgeRendererParams): IPromise; /** * Generates a [ClassBreaksRenderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html) that may be applied directly to the layer used to call this method. The resulting renderer defines the symbol color of each feature based on the value of the given `field` value. A default color scheme is determined based on the given `basemap`. Depending on the `classificationMethod`, class breaks (or data ranges) are generated based on the statistics of the data. Each feature is assigned a color based on the class break in which the value of the `field` falls. In most cases you will provide a `layer`, `basemap`, `field`, and `classificationMethod` to generate this renderer. This is a scenario in which the statistics of the data aren't well known and the user doesn't know what colors to use in the visualization. You can also use a `valueExpression` instead of a `field` to visualize features based on a value returned from a script executed at runtime. The other options are provided for convenience for more involved custom visualization authoring applications. * @@ -19348,7 +19341,7 @@ declare namespace __esri { * @param params.colorScheme In authoring apps, the user may select a pre-defined color scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This option only applies to service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.legendOptions Provides options for setting a title to describe a field instead of using the field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @param params.minValue A minimum value set by the user. Use this in conjunction with `maxValue` to generate class breaks between lower and upper bounds. This will be the lower bound of the lowest class break. @@ -19389,14 +19382,14 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * @param params.colorScheme In authoring apps, the user may select a pre-defined color scheme. Pass the scheme object to this property to avoid getting one based on a `theme` and the `basemap`. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.legendOptions Provides options for setting a title to a field when an expression is provided instead of a field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. @@ -19466,14 +19459,14 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * @param params.colorScheme In authoring apps, the user may select a pre-defined color scheme. Pass the scheme object to this property to avoid getting one based on a `theme` and the `basemap`. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.legendOptions Provides options for setting a title to a field when an expression is provided instead of a field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. @@ -19488,6 +19481,56 @@ declare namespace __esri { export const color: color; + /** + * The result object of the [createAgeRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) method. See the table below for details of each property. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + export interface AgeRendererResult extends Object { + /** + * The renderer object configured to best match the given basemap and the spread of the data. Set this on a layer's `renderer` property to update its visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + renderer: ClassBreaksRenderer; + /** + * A color visual variable configured based on the statistics of the data and the given basemap and scheme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + visualVariable: ColorVisualVariable; + /** + * The time unit used to represent age in the output `renderer`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + unit: string; + /** + * The color scheme used by the visual variable. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + colorScheme: ColorScheme; + /** + * Indicates whether default values are used in the absence of sufficient data and/or statistics from the layer. Default values are typically used when all features have the same field value or no value at all. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + defaultValuesUsed: boolean; + /** + * Basic statistics returned from a query to the service for data from the given field name or expression. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + statistics: SummaryStatisticsResult; + /** + * The ID of the basemap used to determine the optimal fill color of the features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#AgeRendererResult) + */ + basemapId: string; + } + /** * The result object of the [createClassBreaksRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createClassBreaksRenderer) method. See the table below for details of each property. * @@ -19527,6 +19570,134 @@ declare namespace __esri { } + export interface colorCreateAgeRendererParams extends Object { + /** + * The layer for which the visualization is generated. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + layer: FeatureLayer | SceneLayer | CSVLayer; + /** + * The view instance in which the visualization will be rendered. + * + * [Read more...](global.html) + */ + view: View; + /** + * The name of the field, or a date value representing the start time in the age calculation. If a date value is specified, then the `endTime` paramter must reference a Date field in the layer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + startTime: Date | string | number; + /** + * The name of the field, or a date value representing the end time in the age calculation. If a date value is specified, then the `startTime` paramter must reference a Date field in the layer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + endTime: Date | string | number; + /** + * The time unit used to calculate the difference between `endTime` and `startTime`. If a unit is not specified, then a suggested unit is determined based on the spread and distribution of the data. **Possible Values:** years | months | days | hours | minutes | seconds + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + unit?: string; + /** + * The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + * + * @default gray + */ + basemap?: string | Basemap; + /** + * Determines which values will be emphasized in the continuous ramp and the map. Possible values are listed below. + * + * | Value | Description | Example | + * | ----- | ----------- | ------- | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + theme?: string; + /** + * Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + legendOptions?: colorCreateAgeRendererParamsLegendOptions; + /** + * A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. The `createAgeRenderer()` method generates an Arcade expression and executes a statistics query against the layer for the result of the expression. If statistics for the expression have already been generated, then pass the object here to avoid making a second statistics query. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + statistics?: SummaryStatisticsResult; + /** + * In authoring apps, the user may select a pre-defined color scheme. Pass the scheme object to this property to avoid getting one based on a `theme` and the `basemap`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + colorScheme?: ColorScheme; + /** + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + * + * @default 2d + */ + symbolType?: string; + /** + * Enables the `defaultSymbol` on the renderer and assigns it to features with no value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + * + * @default true + */ + defaultSymbolEnabled?: boolean; + /** + * **This option only applies to generating renderers for mesh SceneLayers**. Specifies how the symbol's color is applied to the geometry color/texture. See the documentation in [FillSymbol3DLayer.material](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#material) for more context. See the table below for possible values. + * + * Value | Description + * ------|------------ + * tint | Applies the symbol `color` to the desaturated geometry/texture color. + * replace | Removes the geometry/texture color and applies the symbol `color`. + * multiply | Multiplies geometry/texture color value with the symbol `color` value. The result is a darker color. Multiplying with white keeps the geometry color the same. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + * + * @default replace + */ + colorMixMode?: string; + } + + + export interface colorCreateAgeRendererParamsLegendOptions extends Object { + /** + * The title used to represent the age color ramp in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + title?: string; + /** + * Indicates whether to include the age renderer in the legend. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createAgeRenderer) + */ + showLegend?: boolean; + } + + export interface colorCreateClassBreaksRendererParams extends Object { /** * The layer for which the visualization is generated. @@ -19625,7 +19796,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This option only applies to service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createClassBreaksRenderer) */ @@ -19743,10 +19914,10 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createContinuousRenderer) @@ -19771,7 +19942,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createContinuousRenderer) */ @@ -19979,10 +20150,10 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createVisualVariable) @@ -20007,7 +20178,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createVisualVariable) */ @@ -20272,7 +20443,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-location.html#createRenderer) */ - locationScheme?: PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme; + locationScheme?: LocationScheme; /** * The SceneView instance in which the visualization will be rendered. This parameter is required if `symbolType = "3d-volumetric"`, except for layers with a `mesh` geometryType. * @@ -20328,7 +20499,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-location.html#RendererResult) */ - locationScheme: PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme; + locationScheme: LocationScheme; /** * The ID of the basemap used to determine the optimal fill color of the features. * @@ -20354,7 +20525,7 @@ declare namespace __esri { * @param params.normalizationField The name of the field to normalize the values of the given `field`. Providing a normalization field helps minimize some visualization errors and standardizes the data so all features are visualized with minimal bias due to area differences or count variation. This option is commonly used when visualizing densities. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.legendOptions Provides options for setting a title to a field when an expression is provided instead of a field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. @@ -20401,7 +20572,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-opacity.html#createVisualVariable) */ @@ -20486,6 +20657,578 @@ declare namespace __esri { authoringInfo: AuthoringInfo; } + /** + * This object contains a helper method for generating a predominance visualization. Visualizing predominance involves coloring a [layer’s](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html) features based on which attribute among a set of competing numeric attributes wins or beats the others in total count. Common applications of this include visualizing election results, survey results, and demographic majorities. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html) + */ + interface predominance { + /** + * Generates a predominance renderer based on a set of competing numeric fields. Visualizing predominance involves coloring a [layer’s](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html) features based on which attribute among a set of competing numeric attributes wins or beats the others in total count. Common applications of this include visualizing election results, survey results, and demographic majorities. For example, suppose you have a layer of U.S. counties with fields containing the total sales of various crops: wheat, soybeans, corn, cotton, and vegetables. If a feature has the following values for each field: + * + * Field Name | Count | Color + * -----------|-------|------ + * Wheat | 130 | purple + * Soybeans | 2000 | blue + * Corn | 0 | yellow + * Cotton | 300 | green + * Vegetables | 120 | red + * + * Then the renderer symbolizes the feature with a blue color since Soybeans is the predominant crop. The predominant field of a feature is determined based on the result of an Arcade expression generated by this method. You are required to provide a `layer`, `view`, and list of `fields` to generate this renderer. Optionally, you can set `includeSizeVariable` to `true` to change the size of each feature to indicate how influential the feature is compared to the entire layer as a whole. You can also set `includeOpacityVariable` to `true` to add opacity to each feature depending on how strong the predominant field is compared to all the other fields. For the example above, the feature would likely be opaque since Soybeans beats all other features combined by a wide margin. If the Soybean total were still the highest, but only 301, then the feature would be very transparent, indicating the Soybean total wins, but not by a wide margin. Other options are provided for convenience for more involved custom visualization authoring applications. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + * + * @param params Input parameters for generating a predominance visualization based on a set of competing field(s). See the table below for details of each parameter. + * @param params.layer The layer for which the visualization is generated. + * @param params.view The view instance in which the visualization will be rendered. + * @param params.fields A set of competing numeric fields used as the basis of the predominance visualization. For example, if creating an election map, you would indicate the names of each field representing the candidate or political party where total votes are stored. + * @param params.basemap The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * @param params.includeOpacityVariable Indicates whether to include data-driven opacity in the final renderer. If `true`, features where the predominant value beats all others by a large margin are given a high opacity. Features where the predominant value beats others by a small margin will be assigned a low opacity, indicating that while the feature has a winning value, it doesn't win by much. ![predominance-opacity](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/predominance-opacity.png) + * @param params.includeSizeVariable Indicates whether to include data-driven size in the final renderer. If `true`, features will be assigned a sized based on the sum of all competing values in the `fields` param. Features with small total counts will be sized with small icons or lines depending on the geometry type of the layer, and features with large total counts will be sized with large icons or lines. Enabling this option is good for visualizing how influential a particular feature is compared to the dataset as a whole. It removes bias introduced by features with large geographic areas, but relatively small data values. ![predominance-size](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/predominance-size.png) + * @param params.legendOptions Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. The `createAgeRenderer()` method generates an Arcade expression and executes a statistics query against the layer for the result of the expression. If statistics for the expression have already been generated, then pass the object here to avoid making a second statistics query. + * @param params.sortBy + * Indicates how values should be sorted in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). See the table below for information about values that may be passed to this parameter. + * + * Possible Value | Description + * ---------------|------------ + * count | Unique values/types will be sorted from highest to lowest based on the count of features that fall in each category. + * value | Unique values/types will be sorted in the order they were specified in the `fields` parameter. + * + * **Possible Values:** count | value + * @param params.predominanceScheme In authoring apps, the user may select a pre-defined predominance scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. + * @param params.symbolType + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * @param params.defaultSymbolEnabled Enables the `defaultSymbol` on the renderer and assigns it to features with no value. + * @param params.colorMixMode + * **This option only applies to generating renderers for mesh SceneLayers**. Specifies how the symbol's color is applied to the geometry color/texture. See the documentation in [FillSymbol3DLayer.material](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#material) for more context. See the table below for possible values. + * + * Value | Description + * ------|------------ + * tint | Applies the symbol `color` to the desaturated geometry/texture color. + * replace | Removes the geometry/texture color and applies the symbol `color`. + * multiply | Multiplies geometry/texture color value with the symbol `color` value. The result is a darker color. Multiplying with white keeps the geometry color the same. + * + */ + createRenderer(params: predominanceCreateRendererParams): IPromise; + } + + export const predominance: predominance; + + + export interface predominanceCreateRendererParams extends Object { + /** + * The layer for which the visualization is generated. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + layer: FeatureLayer | SceneLayer | CSVLayer; + /** + * The view instance in which the visualization will be rendered. + * + * [Read more...](global.html) + */ + view: View; + /** + * A set of competing numeric fields used as the basis of the predominance visualization. For example, if creating an election map, you would indicate the names of each field representing the candidate or political party where total votes are stored. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + fields: predominanceCreateRendererParamsFields[]; + /** + * The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + * + * @default gray + */ + basemap?: string | Basemap; + /** + * Indicates whether to include data-driven opacity in the final renderer. If `true`, features where the predominant value beats all others by a large margin are given a high opacity. Features where the predominant value beats others by a small margin will be assigned a low opacity, indicating that while the feature has a winning value, it doesn't win by much. ![predominance-opacity](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/predominance-opacity.png) + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + includeOpacityVariable?: boolean; + /** + * Indicates whether to include data-driven size in the final renderer. If `true`, features will be assigned a sized based on the sum of all competing values in the `fields` param. Features with small total counts will be sized with small icons or lines depending on the geometry type of the layer, and features with large total counts will be sized with large icons or lines. Enabling this option is good for visualizing how influential a particular feature is compared to the dataset as a whole. It removes bias introduced by features with large geographic areas, but relatively small data values. ![predominance-size](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/predominance-size.png) + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + includeSizeVariable?: boolean; + /** + * Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + legendOptions?: predominanceCreateRendererParamsLegendOptions; + /** + * A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. The `createAgeRenderer()` method generates an Arcade expression and executes a statistics query against the layer for the result of the expression. If statistics for the expression have already been generated, then pass the object here to avoid making a second statistics query. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + statistics?: SummaryStatisticsResult; + /** + * Indicates how values should be sorted in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). See the table below for information about values that may be passed to this parameter. + * + * Possible Value | Description + * ---------------|------------ + * count | Unique values/types will be sorted from highest to lowest based on the count of features that fall in each category. + * value | Unique values/types will be sorted in the order they were specified in the `fields` parameter. + * + * **Possible Values:** count | value + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + * + * @default count + */ + sortBy?: string; + /** + * In authoring apps, the user may select a pre-defined predominance scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + predominanceScheme?: PredominanceScheme; + /** + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + * + * @default 2d + */ + symbolType?: string; + /** + * Enables the `defaultSymbol` on the renderer and assigns it to features with no value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + * + * @default true + */ + defaultSymbolEnabled?: boolean; + /** + * **This option only applies to generating renderers for mesh SceneLayers**. Specifies how the symbol's color is applied to the geometry color/texture. See the documentation in [FillSymbol3DLayer.material](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#material) for more context. See the table below for possible values. + * + * Value | Description + * ------|------------ + * tint | Applies the symbol `color` to the desaturated geometry/texture color. + * replace | Removes the geometry/texture color and applies the symbol `color`. + * multiply | Multiplies geometry/texture color value with the symbol `color` value. The result is a darker color. Multiplying with white keeps the geometry color the same. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + * + * @default replace + */ + colorMixMode?: string; + } + + + export interface predominanceCreateRendererParamsFields extends Object { + /** + * The name of a numeric field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + name: string; + /** + * The label describing the field name (or category) in the legend. This is should be used if the given field doesn't have an intuitive field name. For example, for a field named `dem` representing the total vote count for the Democratic party, you can set the label to `Democrat` to clarify the name of the category in the final visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + label?: string; + } + + + export interface predominanceCreateRendererParamsLegendOptions extends Object { + /** + * The title used to describe the renderer in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + title?: string; + /** + * Indicates whether to include the renderer in the legend. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) + */ + showLegend?: boolean; + } + + /** + * The result object of the [createRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#createRenderer) method. See the table below for details of each property. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + export interface predominanceRendererResult extends Object { + /** + * The unique value renderer object representing the predominance visualization. Set this on a layer's `renderer` property to update its visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + renderer: UniqueValueRenderer; + /** + * An array of objects describing the value, symbol, and count of each unique type or category represented in the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + predominantCategoryInfos: UniqueValueInfo[]; + /** + * An array of objects describing the values or categories excluded from consideration in visualizing data from the given fields. The specification of each object matches that of the objects specified in the `predominantCategoryInfos` property. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + excludedCategoryInfos: any[]; + /** + * A size visual variable representing the total count of all fields included in the predominance visualization. This is included if the `includeSizeVariable` parameter is true. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + size?: sizeVisualVariableResult; + /** + * An opacity visual variable representing the percentage of the total count comprised by the predominant value of all fields. This variable indicates the strength of a particular value's predominance compared to the other values. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + opacity?: opacityVisualVariableResult; + /** + * The predominance scheme used by the renderer based on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + predominanceScheme: PredominanceScheme; + /** + * The ID of the basemap used to determine the optimal fill color of the features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html#RendererResult) + */ + basemapId: string; + } + + /** + * This object contains a helper method for creating a renderer for exploring the relationship between two numeric attributes. This is commonly known as a [bivariate choropleth](http://www.joshuastevens.net/cartography/make-a-bivariate-choropleth-map/) visualization. This renderer classifies each variable in either 2, 3, or 4 classes along separate color ramps. One of those ramps is rotated 90 degrees and overlaid on the other to create a 2x2, 3x3, or 4x4 square grid. The x-axis indicates the range of values for one variable, and the y-axis indicates the range for the second variable. The squares running diagonal from the lower left corner to the upper right corner indicate features where the two variables may be related or in agreement with one another. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html) + */ + interface relationship { + /** + * Generates a relationship renderer (bivariate choropleth) based on a set of competing numeric fields. Each feature's category is determined based on the result of an Arcade expression generated internally by this method. You are required provide a `layer`, `view`, `field1` name, and `field2` name to generate this renderer. Optionally, you can set the `focus` to change the rotation of the legend and the `numClasses` parameter to change the grid size of the legend. Other options are provided for convenience for more involved custom visualization authoring applications. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + * + * @param params Input parameters for generating a relationship visualization based on a pair of numeric field(s). See the table below for details of each parameter. + * @param params.layer The layer for which the visualization is generated. + * @param params.view The view instance in which the visualization will be rendered. + * @param params.field1 A numeric field that will be used to explore its relationship with `field2`. In the default visualization, the values of this field are rendered along the vertical axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * @param params.field2 A numeric field that will be used to explore its relationship with `field1`. In the default visualization, the values of this field are rendered along the horizontal axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * @param params.classificationMethod The method for classifying each field's data values. See [classBreaks](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-classBreaks.html#classBreaks) for more information about each classification type. **Possible Values:** quantile | equal-interval | natural-breaks + * @param params.focus + * Determines the orientation of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). This value does not change the renderer or symbology of any features in the layer. This affects the legend only. See the table below for a description of the possible values. See the class description at the top of this page for a more thorough explanation of how to read the legend. + * + * Value | Example | Description + * ------|-------------|-------- + * null | ![relationship-legend-null](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-null.png) | The legend renders as a square. The top right corner of the legend indicates that values from both `field1` and `field2` are considered high. | + * HH | ![relationship-legend-hh](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-hh.png) | The legend renders as a diamond with the focus on the top corner where values from both `field1` and `field2` are considered high. | + * HL | ![relationship-legend-hl](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-hl.png) | The legend renders as a diamond with the focus on the top corner where values from `field1` are high and values from `field2` are low. | + * LH | ![relationship-legend-lh](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-lh.png) | The legend renders as a diamond with the focus on the top corner where values from `field1` are low and values from `field2` are high. | + * LL | ![relationship-legend-ll](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-ll.png) | The legend renders as a diamond with the focus on the top corner where values from both `field1` and `field2` are considered low. | + * @param params.numClasses + * Indicates the number of classes by which to break up the values of each field. More classes give you more detail, but more colors, making the visualization more difficult to understand. There are only three possible values. + * + * 2 classes | 3 classes | 4 classes + * --|--|--- + * ![relationship-breaks-2](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-breaks-2.png) | ![relationship-breaks-3](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-breaks-3.png) | ![relationship-breaks-4](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-breaks-4.png) + * + * **Possible Values:** 2 | 3 | 4 + * @param params.basemap The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * @param params.legendOptions Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * @param params.relationshipScheme In authoring apps, the user may select a pre-defined relationship scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. + * @param params.symbolType + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * @param params.defaultSymbolEnabled Enables the `defaultSymbol` on the renderer and assigns it to features with no value or that fall outside of the prescribed class breaks. + * @param params.colorMixMode + * **This option only applies to generating renderers for mesh SceneLayers**. Specifies how the symbol's color is applied to the geometry color/texture. See the documentation in [FillSymbol3DLayer.material](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#material) for more context. See the table below for possible values. + * + * Value | Description + * ------|------------ + * tint | Applies the symbol `color` to the desaturated geometry/texture color. + * replace | Removes the geometry/texture color and applies the symbol `color`. + * multiply | Multiplies geometry/texture color value with the symbol `color` value. The result is a darker color. Multiplying with white keeps the geometry color the same. + * + */ + createRenderer(params: relationshipCreateRendererParams): IPromise; + } + + export const relationship: relationship; + + + export interface relationshipCreateRendererParams extends Object { + /** + * The layer for which the visualization is generated. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + layer: FeatureLayer | SceneLayer | CSVLayer; + /** + * The view instance in which the visualization will be rendered. + * + * [Read more...](global.html) + */ + view: View; + /** + * A numeric field that will be used to explore its relationship with `field2`. In the default visualization, the values of this field are rendered along the vertical axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + field1: relationshipCreateRendererParamsField1; + /** + * A numeric field that will be used to explore its relationship with `field1`. In the default visualization, the values of this field are rendered along the horizontal axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + field2: relationshipCreateRendererParamsField2; + /** + * The method for classifying each field's data values. See [classBreaks](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-classBreaks.html#classBreaks) for more information about each classification type. **Possible Values:** quantile | equal-interval | natural-breaks + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + * + * @default quantile + */ + classificationMethod?: string; + /** + * Determines the orientation of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). This value does not change the renderer or symbology of any features in the layer. This affects the legend only. See the table below for a description of the possible values. See the class description at the top of this page for a more thorough explanation of how to read the legend. + * + * Value | Example | Description + * ------|-------------|-------- + * null | ![relationship-legend-null](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-null.png) | The legend renders as a square. The top right corner of the legend indicates that values from both `field1` and `field2` are considered high. | + * HH | ![relationship-legend-hh](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-hh.png) | The legend renders as a diamond with the focus on the top corner where values from both `field1` and `field2` are considered high. | + * HL | ![relationship-legend-hl](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-hl.png) | The legend renders as a diamond with the focus on the top corner where values from `field1` are high and values from `field2` are low. | + * LH | ![relationship-legend-lh](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-lh.png) | The legend renders as a diamond with the focus on the top corner where values from `field1` are low and values from `field2` are high. | + * LL | ![relationship-legend-ll](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-legend-ll.png) | The legend renders as a diamond with the focus on the top corner where values from both `field1` and `field2` are considered low. | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + focus?: string; + /** + * Indicates the number of classes by which to break up the values of each field. More classes give you more detail, but more colors, making the visualization more difficult to understand. There are only three possible values. + * + * 2 classes | 3 classes | 4 classes + * --|--|--- + * ![relationship-breaks-2](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-breaks-2.png) | ![relationship-breaks-3](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-breaks-3.png) | ![relationship-breaks-4](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/smartmapping/relationship-breaks-4.png) + * + * **Possible Values:** 2 | 3 | 4 + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + * + * @default 3 + */ + numClasses?: number; + /** + * The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + * + * @default gray + */ + basemap?: string | Basemap; + /** + * Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + legendOptions?: relationshipCreateRendererParamsLegendOptions; + /** + * In authoring apps, the user may select a pre-defined relationship scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + relationshipScheme?: RelationshipScheme; + /** + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + * + * @default 2d + */ + symbolType?: string; + /** + * Enables the `defaultSymbol` on the renderer and assigns it to features with no value or that fall outside of the prescribed class breaks. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + * + * @default true + */ + defaultSymbolEnabled?: boolean; + /** + * **This option only applies to generating renderers for mesh SceneLayers**. Specifies how the symbol's color is applied to the geometry color/texture. See the documentation in [FillSymbol3DLayer.material](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#material) for more context. See the table below for possible values. + * + * Value | Description + * ------|------------ + * tint | Applies the symbol `color` to the desaturated geometry/texture color. + * replace | Removes the geometry/texture color and applies the symbol `color`. + * multiply | Multiplies geometry/texture color value with the symbol `color` value. The result is a darker color. Multiplying with white keeps the geometry color the same. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + * + * @default replace + */ + colorMixMode?: string; + } + + + export interface relationshipCreateRendererParamsField1 extends Object { + /** + * The name of a numeric field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + field: string; + /** + * The name of a numeric field used to normalize the given `field`. In choropleth visualizations it is best practice to normalize your data values if they haven't already been normalized. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + normalizationField?: string; + /** + * The maximum bound of values to visualize in the given field. If a feature's value is greater than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + maxValue?: number; + /** + * The minimum bound of values to visualize in the given field. If a feature's value is less than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + minValue?: number; + } + + + export interface relationshipCreateRendererParamsField2 extends Object { + /** + * The name of a numeric field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + field: string; + /** + * The name of a numeric field used to normalize the given `field`. In choropleth visualizations it is best practice to normalize your data values if they haven't already been normalized. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + normalizationField?: string; + /** + * The maximum bound of values to visualize in the given field. If a feature's value is greater than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + maxValue?: number; + /** + * The minimum bound of values to visualize in the given field. If a feature's value is less than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + minValue?: number; + } + + + export interface relationshipCreateRendererParamsLegendOptions extends Object { + /** + * The title used to describe the renderer in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + title?: string; + /** + * Indicates whether to include the renderer in the legend. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) + */ + showLegend?: boolean; + } + + /** + * The result object of the [createRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#createRenderer) method. See the table below for details of each property. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + export interface relationshipRendererResult extends Object { + /** + * The renderer object representing the relationship visualization. Set this on a layer's `renderer` property to update its visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + renderer: UniqueValueRenderer; + /** + * Describes each class break for both fields considered in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + classBreaks: RendererResultClassBreaks; + /** + * Describes each container or bin used in the visualization. Each unique value info object describes a class break for `field1` and `field2`. Therefore, features with the same color fall share will have values that fall in the same class break for `field1` and the same class break for `field2`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + uniqueValueInfos: UniqueValueInfo[]; + /** + * The relationship scheme used by the renderer based on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + relationshipScheme: RelationshipScheme; + /** + * The ID of the basemap used to determine the optimal fill colors of the features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + basemapId: string; + } + + + export interface RendererResultClassBreaks extends Object { + /** + * The class breaks generated for values in the `field1` parameter. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + field1: ClassBreaksResult; + /** + * The class breaks generated for values in the `field2` parameter. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html#RendererResult) + */ + field2: ClassBreaksResult; + } + /** * This object contains helper methods for generating data-driven visualizations with continuous size or class breaks based on a field value or expression from features in a [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html). The methods in this module generate renderer or visual variable objects that may be applied directly to a supported layer. The renderers specify how features should be visualized based on data values and sizes optimized based on the indicated basemap. * @@ -20493,7 +21236,34 @@ declare namespace __esri { */ interface size { /** - * Generates a [ClassBreaksRenderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html) that may be applied directly to the layer used to call this method. The resulting renderer defines the symbol size of each feature based on the value of the given `field` value. A default size scheme is determined based on the given `basemap`. Depending on the `classificationMethod`, class breaks (or data ranges) are generated based on the statistics of the data. Each feature is assigned a color based on the class break in which the value of the `field` falls. In most cases you will provide a `layer`, `basemap`, `field`, and `classificationMethod` to generate this renderer. This is a scenario in which the statistics of the data aren't well known and the user doesn't know what sizes to use in the visualization. You can also use a `valueExpression` instead of a `field` to visualize features based on a value returned from a script executed at runtime. The other options are provided for convenience for more involved custom visualization authoring applications. + * Generates a continuous size [Renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) representing the age of features based on one or more fields. The age of a feature is calculated based on a given `startTime` and `endTime`, one of which must be a date field in the input `layer`. This method generates an Arcade expression and calculates statistics on the output of the expression to accomplish this. The resulting renderer contains a continuous size visual variable that maps optimal sizes based on the indicated basemap to data values based on the resulting statistics of the expression. You are required to provide a `layer`, `view`, `startTime`, and `endTime` to generate this renderer. Optionally, you can set a `unit` for the visualization. Other options are provided for convenience for more involved custom visualization authoring applications. For example, if you already generated statistics in another operation, you can pass the statistics object to the `statistics` parameter to avoid making an extra call to the server. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + * + * @param params Input parameters for generating a continuous size visualization of age for time data returned from start and/or end date field(s). See the table below for details of each parameter. + * @param params.layer The layer for which the visualization is generated. + * @param params.view The view instance in which the visualization will be rendered. + * @param params.startTime The name of the field, or a date value representing the start time in the age calculation. If a date value is specified, then the `endTime` paramter must reference a Date field in the layer. + * @param params.endTime The name of the field, or a date value representing the end time in the age calculation. If a date value is specified, then the `startTime` paramter must reference a Date field in the layer. + * @param params.unit The time unit used to calculate the difference between `endTime` and `startTime`. If a unit is not specified, then a suggested unit is determined based on the spread and distribution of the data. **Possible Values:** years | months | days | hours | minutes | seconds + * @param params.basemap The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * @param params.legendOptions Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. The `createAgeRenderer()` method generates an Arcade expression and executes a statistics query against the layer for the result of the expression. If statistics for the expression have already been generated, then pass the object here to avoid making a second statistics query. + * @param params.sizeScheme In authoring apps, the user may select a pre-defined size scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. + * @param params.symbolType + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * @param params.defaultSymbolEnabled Enables the `defaultSymbol` on the renderer and assigns it to features with no value. + * + */ + createAgeRenderer(params: sizeCreateAgeRendererParams): IPromise; + /** + * Generates a [ClassBreaksRenderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html) that may be applied directly to the layer used to call this method. The resulting renderer defines the symbol size of each feature based on the value of the given `field` value. A default size scheme is determined based on the given `basemap`. Depending on the `classificationMethod`, class breaks (or data ranges) are generated based on the statistics of the data. Each feature is assigned a size based on the class break in which the value of the `field` falls. In most cases you will provide a `layer`, `basemap`, `field`, and `classificationMethod` to generate this renderer. This is a scenario in which the statistics of the data aren't well known and the user doesn't know what sizes to use in the visualization. You can also use a `valueExpression` instead of a `field` to visualize features based on a value returned from a script executed at runtime. The other options are provided for convenience for more involved custom visualization authoring applications. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createClassBreaksRenderer) * @@ -20526,7 +21296,7 @@ declare namespace __esri { * @param params.sizeScheme In authoring apps, the user may select a pre-defined size scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.legendOptions Provides options for setting a title to describe a field instead of using the field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @param params.minValue A minimum value set by the user. Use this in conjunction with `maxValue` to generate class breaks between lower and upper bounds. This will be the lower bound of the lowest class break. @@ -20546,7 +21316,7 @@ declare namespace __esri { */ createClassBreaksRenderer(params: sizeCreateClassBreaksRendererParams): IPromise; /** - * Generates a [Renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) that may be applied directly to the layer used to call this method. The renderer contains a continuous size visual variable that maps marker sizes to specific stop values based on queried statistics from the indicated field or expression. In most cases you will provide a `layer`, `basemap`, and `field` to generate this renderer. This is a scenario in which the statistics of the data aren't well known and the user doesn't know what colors to use in the visualization. You can also use a `valueExpression` instead of a `field` to visualize features based on a value returned from a script executed at runtime. The other options are provided for convenience for more involved custom visualization authoring applications. For example, if you already generated statistics in another operation, you can pass the statistics object to the `statistics` parameter to avoid making an extra call to the server. + * Generates a [Renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) that may be applied directly to the layer used to call this method. The renderer contains a continuous size visual variable that maps marker sizes to specific stop values based on queried statistics from the indicated field or expression. In most cases you will provide a `layer`, `basemap`, and `field` to generate this renderer. This is a scenario in which the statistics of the data aren't well known and the user doesn't know what sizes to use in the visualization. You can also use a `valueExpression` instead of a `field` to visualize features based on a value returned from a script executed at runtime. The other options are provided for convenience for more involved custom visualization authoring applications. For example, if you already generated statistics in another operation, you can pass the statistics object to the `statistics` parameter to avoid making an extra call to the server. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createContinuousRenderer) * @@ -20558,7 +21328,7 @@ declare namespace __esri { * @param params.sizeScheme In authoring apps, the user may select a pre-defined size scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.legendOptions Provides options for setting a title to a field when an expression is provided instead of a field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. @@ -20579,7 +21349,7 @@ declare namespace __esri { */ createContinuousRenderer(params: sizeCreateContinuousRendererParams): IPromise; /** - * This method generates an array of size visual variables with default stops that are optimally chosen based on the statistics queried for the indicated field or expression and mapped to appropriate sizes. There are two different ways this method may be called. The most common case is by providing a `layer`, `basemap`, and `field`. This is the scenario where the statistics of the data aren't well known and the user doesn't know what colors to use. You can optionally use a `valueExpression` instead of a field to visualize features based on a numeric value returned from a script executed at runtime. The other options are provided for convenience for more involved custom visualization authoring applications. For example, if you already generated statistics in another operation, you can pass the object in the `statistics` parameter to avoid making an extra call to the server. You can also provide a `colorScheme` if you don't want one picked for you. In this case the `basemap` and `theme` options would be ignored. The resulting array of visual variables will contain exactly one size visual variable unless the `axis` parameter is set to "height". + * This method generates an array of size visual variables with default stops that are optimally chosen based on the statistics queried for the indicated field or expression and mapped to appropriate sizes. There are two different ways this method may be called. The most common case is by providing a `layer`, `basemap`, and `field`. This is the scenario where the statistics of the data aren't well known and the user doesn't know what sizes to use. You can optionally use a `valueExpression` instead of a field to visualize features based on a numeric value returned from a script executed at runtime. The other options are provided for convenience for more involved custom visualization authoring applications. For example, if you already generated statistics in another operation, you can pass the object in the `statistics` parameter to avoid making an extra call to the server. You can also provide a `sizeScheme` if you don't want one picked for you. In this case the `basemap` and `theme` options would be ignored. The resulting array of visual variables will contain exactly one size visual variable unless the `axis` parameter is set to "height". * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createVisualVariables) * @@ -20591,7 +21361,7 @@ declare namespace __esri { * @param params.sizeScheme In authoring apps, the user may select a pre-defined size scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.legendOptions Provides options for setting a title to a field when an expression is provided instead of a field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. @@ -20607,6 +21377,56 @@ declare namespace __esri { export const size: size; + /** + * The result object of the [createAgeRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) method. See the table below for details of each property. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + export interface sizeAgeRendererResult extends Object { + /** + * The renderer object configured to best match the given basemap and the spread of the data. Set this on a layer's `renderer` property to update its visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + renderer: ClassBreaksRenderer; + /** + * Size visual variables configured based on the statistics of the data and the given basemap and scheme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + visualVariables: SizeVisualVariable[]; + /** + * The time unit used to represent age in the output `renderer`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + unit: string; + /** + * The size scheme used by the visual variables. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + sizeScheme: SizeScheme; + /** + * Indicates whether default values are used in the absence of sufficient data and/or statistics from the layer. Default values are typically used when all features have the same field value or no value at all. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + defaultValuesUsed: boolean; + /** + * Basic statistics returned from a query for the generated expression. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + statistics: SummaryStatisticsResult; + /** + * The ID of the basemap used to determine the optimal fill color of the features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#AgeRendererResult) + */ + basemapId: string; + } + /** * The result object of the [createClassBreaksRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createClassBreaksRenderer) method. See the table below for details of each property. * @@ -20630,7 +21450,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#ClassBreaksRendererResult) */ - sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme: SizeScheme; /** * Indicates whether default values are used in the absence of sufficient data and/or statistics from the layer. Default values are typically used when all features have the same field value or no value at all. * @@ -20668,7 +21488,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#ContinuousRendererResult) */ - sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme: SizeScheme; /** * Indicates whether default values are used in the absence of sufficient data and/or statistics from the layer. Default values are typically used when all features have the same field value or no value at all. * @@ -20690,6 +21510,105 @@ declare namespace __esri { } + export interface sizeCreateAgeRendererParams extends Object { + /** + * The layer for which the visualization is generated. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + layer: FeatureLayer | SceneLayer | CSVLayer; + /** + * The view instance in which the visualization will be rendered. + * + * [Read more...](global.html) + */ + view: View; + /** + * The name of the field, or a date value representing the start time in the age calculation. If a date value is specified, then the `endTime` paramter must reference a Date field in the layer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + startTime: Date | string | number; + /** + * The name of the field, or a date value representing the end time in the age calculation. If a date value is specified, then the `startTime` paramter must reference a Date field in the layer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + endTime: Date | string | number; + /** + * The time unit used to calculate the difference between `endTime` and `startTime`. If a unit is not specified, then a suggested unit is determined based on the spread and distribution of the data. **Possible Values:** years | months | days | hours | minutes | seconds + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + unit?: string; + /** + * The [named string](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap) or basemap object of the Esri basemap that will be paired with the output visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + * + * @default gray + */ + basemap?: string | Basemap; + /** + * Provides options for modifying [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) properties describing the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + legendOptions?: sizeCreateAgeRendererParamsLegendOptions; + /** + * A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. The `createAgeRenderer()` method generates an Arcade expression and executes a statistics query against the layer for the result of the expression. If statistics for the expression have already been generated, then pass the object here to avoid making a second statistics query. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + statistics?: SummaryStatisticsResult; + /** + * In authoring apps, the user may select a pre-defined size scheme. Pass the scheme object to this property to avoid getting one based on the `basemap`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + sizeScheme?: SizeScheme; + /** + * The type of symbol to generate. This depends on the view in which you are working and the desired visualization. This parameter does not need to be specified for layers with a `mesh` geometry type. Possible values are described below. + * + * | Value | Description | + * | ----- | ----------- | + * | 2d | Generates a visualization using 2D symbols such as [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), or [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html). Use this option if generating a visualization for data in a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html). | + * | 3d-flat | Generates a visualization using 3D symbols with flat symbol layers such as [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html), [LineSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3DLayer.html), or [FillSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html). Use this option if generating a 2D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). | + * | 3d-volumetric | Generates a visualization using 3D symbols with volumetric symbol layers such as [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html), [PathSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PathSymbol3DLayer.html), or [ExtrudeSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ExtrudeSymbol3DLayer.html). Use this option if generating a 3D visualization for data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). A SceneView instance must be provided to the `view` parameter if this option is used. | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + * + * @default 2d + */ + symbolType?: string; + /** + * Enables the `defaultSymbol` on the renderer and assigns it to features with no value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + * + * @default true + */ + defaultSymbolEnabled?: boolean; + } + + + export interface sizeCreateAgeRendererParamsLegendOptions extends Object { + /** + * The title used to represent the age size ramp in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + title?: string; + /** + * Indicates whether to include the age renderer in the legend. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createAgeRenderer) + */ + showLegend?: boolean; + } + + export interface sizeCreateClassBreaksRendererParams extends Object { /** * The layer for which the visualization is generated. @@ -20774,7 +21693,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createClassBreaksRenderer) */ - sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme?: SizeScheme; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @@ -20788,7 +21707,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createClassBreaksRenderer) */ @@ -20892,7 +21811,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createContinuousRenderer) */ - sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme?: SizeScheme; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @@ -20906,7 +21825,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createContinuousRenderer) */ @@ -21022,7 +21941,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createVisualVariables) */ - sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme?: SizeScheme; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @@ -21036,7 +21955,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createVisualVariables) */ @@ -21090,7 +22009,7 @@ declare namespace __esri { * * @default all */ - axis?: boolean; + axis?: string; } @@ -21126,7 +22045,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#VisualVariableResult) */ - sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme: SizeScheme; /** * Indicates whether default values were used in the absence of sufficient data and/or statistics from the layer. Default values are typically used when all features have the same field value or no value at all. * @@ -21255,7 +22174,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#RendererResult) */ - uniqueValueInfos: RendererResultUniqueValueInfos[]; + uniqueValueInfos: UniqueValueInfo[]; /** * An array of objects describing the values or categories excluded from consideration in visualizing data from the given field. The specification of each object matches that of the objects specified in the `uniqueValueInfos` property. * @@ -21267,7 +22186,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#RendererResult) */ - typeScheme: PointTypeScheme | PolylineTypeScheme | PolygonTypeScheme | MeshTypeScheme; + typeScheme: TypeScheme; /** * The ID of the basemap used to determine the optimal color scheme to represent the categorical variable. * @@ -21311,7 +22230,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#createPCClassRenderer) */ - typeScheme?: PointTypeScheme; + typeScheme?: TypeSchemeForPoint; /** * A statistics object generated from the [uniqueValues](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-uniqueValues.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. * @@ -21371,7 +22290,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#createRenderer) */ - typeScheme?: PointTypeScheme | PolylineTypeScheme | PolygonTypeScheme | MeshTypeScheme; + typeScheme?: TypeScheme; /** * An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number or a string. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @@ -21451,30 +22370,34 @@ declare namespace __esri { title: string; } - - export interface RendererResultUniqueValueInfos extends Object { + /** + * Describes the symbol, label, and value of a unique value generated by the [createRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#createRenderer) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#UniqueValueInfo) + */ + export interface UniqueValueInfo extends Object { /** - * A unique value representing a type or category of features in the layer. + * A unique value representing a type or category of features in a layer. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#RendererResult) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#UniqueValueInfo) */ value: string | number; /** - * The number of features assigned the given `value` (or belonging to the given category). + * The number of features with the given `value` (or belonging to the given category). * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#RendererResult) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#UniqueValueInfo) */ count: number; /** * The label describing the value or category in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#RendererResult) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#UniqueValueInfo) */ label: string; /** * The symbol used to represent features belonging to the given category. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#RendererResult) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-type.html#UniqueValueInfo) */ symbol: Symbol; } @@ -21497,7 +22420,7 @@ declare namespace __esri { * @param params.normalizationField The name of the field to normalize the values of the given `field`. Providing a normalization field helps minimize some visualization errors and standardizes the data so all features are visualized with minimal bias due to area differences or count variation. This option is commonly used when visualizing densities. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. * @param params.minValue A custom minimum value set by the user. Use this in conjunction with `maxValue` to generate statistics between lower and upper bounds. This will be the lowest stop in the returned visual variables. @@ -21530,7 +22453,7 @@ declare namespace __esri { * @param params.normalizationField The name of the field to normalize the values of the given `field`. Providing a normalization field helps minimize some visualization errors and standardizes the data so all features are visualized with minimal bias due to area differences or count variation. This option is commonly used when visualizing densities. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. * @param params.valueExpressionTitle Text describing the value returned from the `valueExpression`. This is used by the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html) widget. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter is only supported for service based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.statistics A statistics object generated from the [summaryStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html) function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. * @param params.minValue A custom minimum value set by the user. Use this in conjunction with `maxValue` to generate statistics between lower and upper bounds. This will be the lowest stop in the returned visual variables. @@ -21631,7 +22554,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter is only supported for service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#createContinuousRenderer) */ @@ -21709,10 +22632,10 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#createContinuousRenderer) @@ -21749,7 +22672,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#createContinuousRenderer) */ - sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme?: SizeScheme; /** * Provides options for setting a title to a field when an expression is provided instead of a field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @@ -21809,7 +22732,7 @@ declare namespace __esri { */ valueExpressionTitle?: string; /** - * A SQL expression evaluating to a number. This parameter is only supported for service based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#createVisualVariables) */ @@ -21871,10 +22794,10 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#createVisualVariables) @@ -21919,7 +22842,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#createVisualVariables) */ - sizeScheme?: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme?: SizeScheme; /** * Provides options for setting a title to a field when an expression is provided instead of a field name. This title will represent the field in the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * @@ -22011,7 +22934,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#ContinuousRendererResult) */ - sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme: SizeScheme; } @@ -22043,7 +22966,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-univariateColorSize.html#VisualVariablesResult) */ - sizeScheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme; + sizeScheme: SizeScheme; } /** @@ -22075,7 +22998,7 @@ declare namespace __esri { * @param params.maxValue The maximum bounding value for the class breaks definition. Use this in conjunction with `minValue` to generate class breaks between lower and upper bounds. * @param params.numClasses Indicates the number of classes to generate for the class breaks definition. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.view A [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) or [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) instance is required when a `valueExpression` is specified. * @param params.features A subset of features for which to generate the class breaks. @@ -22153,7 +23076,7 @@ declare namespace __esri { */ valueExpression?: string; /** - * A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-classBreaks.html#classBreaks) */ @@ -22261,7 +23184,7 @@ declare namespace __esri { * @param params.maxValue The maximum bounding value for the histogram. Use this in conjunction with `minValue` to generate a histogram between custom lower and upper bounds. * @param params.numBins Indicates the number of classes to generate for the histogram. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.view A [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) or [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) instance is required when a `valueExpression` is specified. * @param params.features A subset of features for which to generate the histogram. @@ -22341,7 +23264,7 @@ declare namespace __esri { */ valueExpression?: string; /** - * A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-histogram.html#histogram) */ @@ -22429,7 +23352,7 @@ declare namespace __esri { * @param params.layer The layer from which to generate statistics for the given `field`. * @param params.field The name of the numeric field for which the summary statistics will be generated. This property is ignored if a `valueExpression` is used. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. - * @param params.sqlExpression A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.normalizationField The field by which to normalize the values returned from the given `field`. * @param params.minValue The minimum bounding value for the statistics calculation. Use this in conjunction with `maxValue` to generate statistics between lower and upper bounds. @@ -22516,7 +23439,7 @@ declare namespace __esri { */ valueExpression?: string; /** - * A SQL expression evaluating to a number. This parameter only applies to service-based FeatureLayers. + * A SQL expression evaluating to a number. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-summaryStatistics.html#summaryStatistics) */ @@ -22574,7 +23497,7 @@ declare namespace __esri { * @param params.layer The layer from which to query for unique values. * @param params.field The name of the numeric or string field from which the unique values will be obtained. This property is ignored if a `valueExpression` is used. * @param params.valueExpression An [Arcade](https://developers.arcgis.com/javascript/latest/guide/arcade/index.html) expression that returns a number or string. This expression can reference field values using the `$feature` global variable. This property overrides the `field` property and therefore is used instead of an input `field` value. - * @param params.sqlExpression A SQL expression evaluating to a number or string. This parameter only applies to service-based FeatureLayers. + * @param params.sqlExpression A SQL expression evaluating to a number or string. * @param params.sqlWhere A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization. * @param params.returnAllCodedValues Indicates that all domain codes should be returned if the given field has domain values. * @param params.view A [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) or [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) instance is required when a `valueExpression` is specified. @@ -22595,7 +23518,7 @@ declare namespace __esri { */ export interface UniqueValuesResult extends Object { /** - * An array of objects, each containing a unique value/type/category present in the field specifed in the [uniqueValues()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-uniqueValues.html#uniqueValues) query. See table below for the specification of each object. + * An array of objects, each containing a unique value/type/category present in the field specified in the [uniqueValues()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-uniqueValues.html#uniqueValues) query. See table below for the specification of each object. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-uniqueValues.html#UniqueValuesResult) */ @@ -22623,7 +23546,7 @@ declare namespace __esri { */ valueExpression?: string; /** - * A SQL expression evaluating to a number or string. This parameter only applies to service-based FeatureLayers. + * A SQL expression evaluating to a number or string. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-statistics-uniqueValues.html#uniqueValues) */ @@ -22690,6 +23613,19 @@ declare namespace __esri { * */ flipColors(scheme: ColorScheme): ColorScheme; + /** + * Returns all schemes matching the given color ramp. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#getMatchingSchemes) + * + * @param theme The name of the theme from which to get color schemes. + * @param colors An array of colors used to match with schemes for the given theme. + * @param geometryType The geometry type of the layer for which the color scheme will be applied. + * @param worldScale Indicates whether 3D volumetric symbols will be used in the visualization. + * @param view The [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) instance used to calculate the suggested sizes of the symbols. This is required for 3D visualizations. + * + */ + getMatchingSchemes(theme: string, colors: Color[], geometryType: string, worldScale?: boolean, view?: SceneView): ColorScheme[]; /** * Returns a primary scheme and secondary schemes defining symbol properties for data-driven color visualizions in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). The `basemap` parameter determines the color schemes of the graphics used to visualize each feature. The `geometryType` determines which type of symbol to return. * @@ -22703,15 +23639,15 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * @param params.view The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols. * @param params.worldScale Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. * */ - getSchemes(params: colorGetSchemesParams): any; + getSchemes(params: colorGetSchemesParams): ColorSchemes; /** * Returns metadata for the available themes. If a `basemap` is provided, returns themes that look best with the given basemap. * @@ -22744,10 +23680,10 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#getSchemes) @@ -22772,11 +23708,18 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) */ - export interface ColorScheme extends Object { + export type ColorScheme = ColorSchemeForPoint | ColorSchemeForPolyline | ColorSchemeForPolygon | ColorSchemeForMesh; + + /** + * Properties defining the symbology scheme used to visualize mesh features with attribute data-driven color. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) + */ + export interface ColorSchemeForMesh extends Object { /** * The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: `//`. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) */ id: string; /** @@ -22784,92 +23727,344 @@ declare namespace __esri { * * | Value | Description | Example | * | ----- | ----------- | ------- | - * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-high-to-low.png) | - * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-above-and-below.png) | - * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-centered-on.png) | - * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/sm-extremes.png) | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | * * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) */ theme: string; /** * The continuous color ramp that will be applied to the visualization. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) */ colors: Color[]; /** * The color of the symbol used to indicate features with no data and features that are out of range. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) */ noDataColor: Color; /** * Predefined classed color schemes to use for the visualization. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) */ - colorsForClassBreaks: ColorSchemeColorsForClassBreaks[]; + colorsForClassBreaks: ColorSchemeForMeshColorsForClassBreaks[]; + /** + * The opacity of the symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize point features with attribute data-driven color. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + export interface ColorSchemeForPoint extends Object { + /** + * The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: `//`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + id: string; + /** + * Indicates which values will be emphasized in the continuous ramp and the map. Possible values are listed below. + * + * | Value | Description | Example | + * | ----- | ----------- | ------- | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + theme: string; + /** + * The continuous color ramp that will be applied to the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + colors: Color[]; + /** + * The color of the symbol used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + noDataColor: Color; + /** + * Predefined classed color schemes to use for the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + colorsForClassBreaks: ColorSchemeForPointColorsForClassBreaks[]; /** * Properties for defining the outline of the symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) */ - outline: ColorSchemeOutline; + outline: ColorSchemeForPointOutline; /** - * The default size of the symbol in pixels or points if the geometry type is `point`. + * The default size of the symbol in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) */ size: number; /** - * The default width of the symbol in pixels or points if the geometry type is `polyline`. + * The opacity of the symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize polygon features with attribute data-driven color. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + export interface ColorSchemeForPolygon extends Object { + /** + * The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: `//`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + id: string; + /** + * Indicates which values will be emphasized in the continuous ramp and the map. Possible values are listed below. + * + * | Value | Description | Example | + * | ----- | ----------- | ------- | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + theme: string; + /** + * The continuous color ramp that will be applied to the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + colors: Color[]; + /** + * The color of the symbol used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + noDataColor: Color; + /** + * Predefined classed color schemes to use for the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + colorsForClassBreaks: ColorSchemeForPolygonColorsForClassBreaks[]; + /** + * Properties for defining the outline of the symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + outline: ColorSchemeForPolygonOutline; + /** + * The opacity of the symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize polyline features with attribute data-driven color. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + export interface ColorSchemeForPolyline extends Object { + /** + * The unique id of the color scheme to usee in the visualization. The id is assigned based on the following template: `//`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + id: string; + /** + * Indicates which values will be emphasized in the continuous ramp and the map. Possible values are listed below. + * + * | Value | Description | Example | + * | ----- | ----------- | ------- | + * | high-to-low | High values are emphasized with strong colors. | ![high-to-low](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-high-to-low.png) | + * | above-and-below | Values centered around a given point (e.g. the average) are visualized with weak colors while other values are emphasized with strong colors. | ![above-and-below](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-above-and-below.png) | + * | centered-on | Values centered around a given point (e.g. the average) are emphasized with strong colors while other values are visualized with weak colors. | ![centered-on](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-centered-on.png) | + * | extremes | High and low values are emphasized with strong colors. All others are visualized with weak colors. | ![extremes](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/sm-extremes.png) | + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + theme: string; + /** + * The continuous color ramp that will be applied to the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + colors: Color[]; + /** + * The color of the symbol used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + noDataColor: Color; + /** + * Predefined classed color schemes to use for the visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + colorsForClassBreaks: ColorSchemeForPolylineColorsForClassBreaks[]; + /** + * The default width of the symbol in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) */ width: number; /** * The opacity of the symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) */ opacity: number; } + /** + * The return object of the [getSchemes()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#getSchemes) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemes) + */ + export interface ColorSchemes extends Object { + /** + * The color scheme best suited for the given basemap and geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemes) + */ + primaryScheme: ColorScheme; + /** + * Additional color schemes that may be used to visualize data of the given geometry type overlaid on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemes) + */ + secondarySchemes: ColorScheme[]; + /** + * The ID of the basemap associated with the given schemes. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemes) + */ + basemapId: string; + } - export interface ColorSchemeColorsForClassBreaks extends Object { + + export interface ColorSchemeForMeshColorsForClassBreaks extends Object { /** * An array of hex color strings. Each color is assigned to a specific break in classed color visualizations. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) */ colors: Color[]; /** * The number of classes used in the classed color visualization. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForMesh) */ numClasses: number; } - export interface ColorSchemeOutline extends Object { + export interface ColorSchemeForPointColorsForClassBreaks extends Object { + /** + * An array of hex color strings. Each color is assigned to a specific break in classed color visualizations. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + colors: Color[]; + /** + * The number of classes used in the classed color visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) + */ + numClasses: number; + } + + + export interface ColorSchemeForPointOutline extends Object { /** * The outline color of the symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) */ color: Color; /** * The width of the symbol in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPoint) */ width: number; } + export interface ColorSchemeForPolygonColorsForClassBreaks extends Object { + /** + * An array of hex color strings. Each color is assigned to a specific break in classed color visualizations. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + colors: Color[]; + /** + * The number of classes used in the classed color visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + numClasses: number; + } + + + export interface ColorSchemeForPolygonOutline extends Object { + /** + * The outline color of the symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + color: Color; + /** + * The width of the symbol in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolygon) + */ + width: number; + } + + + export interface ColorSchemeForPolylineColorsForClassBreaks extends Object { + /** + * An array of hex color strings. Each color is assigned to a specific break in classed color visualizations. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + colors: Color[]; + /** + * The number of classes used in the classed color visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-color.html#ColorSchemeForPolyline) + */ + numClasses: number; + } + + interface symbologyLocation { /** * Clones a location scheme object. @@ -22879,7 +24074,7 @@ declare namespace __esri { * @param scheme The location scheme object to clone. * */ - cloneScheme(scheme: PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme): PointLocationScheme | PolylineLocationScheme | PolygonLocationScheme; + cloneScheme(scheme: LocationScheme): LocationScheme; /** * Returns a primary scheme and secondary schemes defining symbol properties for location-only visualizions in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or [SceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html). The `basemap` parameter determines the color of the graphics used to visualize each feature. The `geometryType` determines which type of symbol to return. * @@ -22892,7 +24087,7 @@ declare namespace __esri { * @param params.worldScale Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. * */ - getSchemes(params: locationGetSchemesParams): any; + getSchemes(params: locationGetSchemesParams): LocationSchemes; } export const symbologyLocation: symbologyLocation; @@ -22926,59 +24121,86 @@ declare namespace __esri { } /** - * Properties defining the location-only symbology scheme used to visualize point features. + * Defines the symbology scheme used to visualize default location-based symbols depending on the layer's geometry type. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PointLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationScheme) */ - export interface PointLocationScheme extends Object { + export type LocationScheme = LocationSchemeForPoint | LocationSchemeForPolyline | LocationSchemeForPolygon | LocationSchemeForMesh; + + /** + * Properties defining the location-only symbology scheme used to visualize mesh features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForMesh) + */ + export interface LocationSchemeForMesh extends Object { /** - * The fill color of the marker symbol. + * The color of the fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PointLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForMesh) */ color: Color; /** - * Properties for defining the outline of the marker symbol. + * The opacity of the fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PointLocationScheme) - */ - outline: PointLocationSchemeOutline; - /** - * The size of the marker symbol in pixels or points. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PointLocationScheme) - */ - size: number; - /** - * The opacity of the marker symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PointLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForMesh) */ opacity: number; } /** - * Properties defining the location-only symbology scheme used to visualize polygon features driven by attribute data. + * Properties defining the location-only symbology scheme used to visualize point features. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolygonLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPoint) */ - export interface PolygonLocationScheme extends Object { + export interface LocationSchemeForPoint extends Object { + /** + * The fill color of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPoint) + */ + color: Color; + /** + * Properties for defining the outline of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPoint) + */ + outline: LocationSchemeForPointOutline; + /** + * The size of the marker symbol in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPoint) + */ + size: number; + /** + * The opacity of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPoint) + */ + opacity: number; + } + + /** + * Properties defining the location-only symbology scheme used to visualize polygon features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolygon) + */ + export interface LocationSchemeForPolygon extends Object { /** * The color of the fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolygonLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolygon) */ color: Color; /** * Properties for defining the outline of the fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolygonLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolygon) */ - outline: PolygonLocationSchemeOutline; + outline: LocationSchemeForPolygonOutline; /** * The opacity of the fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolygonLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolygon) */ opacity: number; } @@ -22986,62 +24208,711 @@ declare namespace __esri { /** * Properties defining the location-only symbology scheme used to visualize polyline features. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolylineLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolyline) */ - export interface PolylineLocationScheme extends Object { + export interface LocationSchemeForPolyline extends Object { /** * The color of the line symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolylineLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolyline) */ color: Color; /** * The width of the line symbol in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolylineLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolyline) */ width: number; /** * The opacity of the line symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolylineLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolyline) */ opacity: number; } + /** + * The return object of the [getSchemes()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#getSchemes) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemes) + */ + export interface LocationSchemes extends Object { + /** + * The location scheme best suited for the given basemap and geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemes) + */ + primaryScheme: LocationScheme; + /** + * Additional location schemes that may be used to visualize data of the given geometry type overlaid on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemes) + */ + secondarySchemes: LocationScheme[]; + /** + * The ID of the basemap associated with the given schemes. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemes) + */ + basemapId: string; + } - export interface PointLocationSchemeOutline extends Object { + + export interface LocationSchemeForPointOutline extends Object { /** * The outline color of the marker symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PointLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPoint) */ color: Color; /** * The width of the marker symbol in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PointLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPoint) */ width: number; } - export interface PolygonLocationSchemeOutline extends Object { + export interface LocationSchemeForPolygonOutline extends Object { /** * The outline color of the fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolygonLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolygon) */ color: Color; /** * The width of the fill symbol in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#PolygonLocationScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-location.html#LocationSchemeForPolygon) */ width: number; } + interface symbologyPredominance { + /** + * Clones a predominance scheme object. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#cloneScheme) + * + * @param scheme The predominance scheme object to clone. + * + */ + cloneScheme(scheme: PredominanceScheme): PredominanceScheme; + /** + * Returns a primary scheme and secondary schemes defining symbol properties for predominance-based data-driven visualizations in a [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html). The `basemap` parameter determines the color of the symbols used to visualize each feature. The `geometryType` determines which type of symbol to return. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#getSchemes) + * + * @param params See the table below for details of each parameter that may be passed to this function. + * @param params.basemap The basemap to pair with the visualization. This value indicates the best symbol color for visualizing features with the given basemap. + * @param params.geometryType The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh + * @param params.numColors The number of unique values to include in the predominance visualization. + * @param params.theme Determines which set of primary and secondary color schemes to return **Possible Values:** default + * @param params.worldScale Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. + * @param params.view The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols. + * + */ + getSchemes(params: predominanceGetSchemesParams): PredominanceSchemes; + } + + export const symbologyPredominance: symbologyPredominance; + + + export interface predominanceGetSchemesParams extends Object { + /** + * The basemap to pair with the visualization. This value indicates the best symbol color for visualizing features with the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#getSchemes) + */ + basemap: string | Basemap; + /** + * The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#getSchemes) + */ + geometryType: string; + /** + * The number of unique values to include in the predominance visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#getSchemes) + */ + numColors: number; + /** + * Determines which set of primary and secondary color schemes to return **Possible Values:** default + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#getSchemes) + * + * @default default + */ + theme?: string; + /** + * Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#getSchemes) + */ + worldScale?: boolean; + /** + * The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols. + * + * [Read more...](global.html) + */ + view?: SceneView; + } + + /** + * Defines the symbology scheme used to visualize predominance based on the layer's geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceScheme) + */ + export type PredominanceScheme = PredominanceSchemeForPoint | PredominanceSchemeForPolyline | PredominanceSchemeForPolygon | PredominanceSchemeForMesh; + + /** + * Properties defining the symbology scheme used to visualize predominance for mesh features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForMesh) + */ + export interface PredominanceSchemeForMesh extends Object { + /** + * The fill colors of the mesh symbols used for each category. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForMesh) + */ + colors: Color[]; + /** + * The color of the fill symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForMesh) + */ + noDataColor: Color; + /** + * The opacity of the symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForMesh) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize predominance for point features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + export interface PredominanceSchemeForPoint extends Object { + /** + * The fill colors of the point symbols used for each category. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + colors: Color[]; + /** + * The color of the point symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + noDataColor: Color; + /** + * Properties for defining the outline of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + outline: PredominanceSchemeForPointOutline; + /** + * The opacity of the point symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + opacity: number; + /** + * The scheme defining the size visual variable if included in a predominance visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + sizeScheme: SizeSchemeForPoint; + } + + /** + * Properties defining the symbology scheme used to visualize predominance for polygon features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + export interface PredominanceSchemeForPolygon extends Object { + /** + * The fill colors of the polygon symbols used for each category. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + colors: Color[]; + /** + * The color of the fill symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + noDataColor: Color; + /** + * Properties for defining the outline of the fill symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + outline: PredominanceSchemeForPolygonOutline; + /** + * The opacity of the symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + opacity: number; + /** + * The scheme defining the size visual variable if included in a predominance visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + sizeScheme: SizeSchemeForPolygon; + } + + /** + * Properties defining the symbology scheme used to visualize predominance for polyline features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolyline) + */ + export interface PredominanceSchemeForPolyline extends Object { + /** + * The colors of the line symbols used for each category. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolyline) + */ + colors: Color[]; + /** + * The color of the line symbol used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolyline) + */ + noDataColor: Color; + /** + * The default width of the line symbol in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolyline) + */ + width: number; + /** + * The opacity of the line symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolyline) + */ + opacity: number; + /** + * The scheme defining the size visual variable if included in a predominance visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolyline) + */ + sizeScheme: SizeSchemeForPolyline; + } + + /** + * The return object of the [getSchemes()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#getSchemes) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemes) + */ + export interface PredominanceSchemes extends Object { + /** + * The predominance scheme best suited for the given basemap and geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemes) + */ + primaryScheme: PredominanceScheme; + /** + * Additional predominance schemes that may be used to visualize data of the given geometry type overlaid on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemes) + */ + secondarySchemes: PredominanceScheme[]; + /** + * The ID of the basemap associated with the given schemes. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemes) + */ + basemapId: string; + } + + + export interface PredominanceSchemeForPointOutline extends Object { + /** + * The outline color of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + color: Color; + /** + * The width of the marker symbol in points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPoint) + */ + width: number; + } + + + export interface PredominanceSchemeForPolygonOutline extends Object { + /** + * The outline color of the fill symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + color: Color; + /** + * The width of the fill symbol's outline in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-predominance.html#PredominanceSchemeForPolygon) + */ + width: number; + } + + + interface symbologyRelationship { + /** + * Clones a relationship (bivariate color) scheme object. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#cloneScheme) + * + * @param scheme The relationship scheme object to clone. + * + */ + cloneScheme(scheme: RelationshipScheme): RelationshipScheme; + /** + * Returns a primary scheme and secondary schemes defining symbol properties for relationship-based (bivariate choropleth) data-driven visualizations in a [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html). The `basemap` parameter determines the color of the symbols used to visualize each feature. The `geometryType` determines which type of symbol to return. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#getSchemes) + * + * @param params See the table below for details of each parameter that may be passed to this function. + * @param params.basemap The basemap to pair with the visualization. This value indicates the best symbol colors for visualizing features with the given basemap. + * @param params.geometryType The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh + * @param params.theme Determines which set of primary and secondary color schemes to return **Possible Values:** default + * @param params.worldScale Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. + * @param params.view The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols. + * + */ + getSchemes(params: relationshipGetSchemesParams): RelationshipSchemes; + } + + export const symbologyRelationship: symbologyRelationship; + + + export interface relationshipGetSchemesParams extends Object { + /** + * The basemap to pair with the visualization. This value indicates the best symbol colors for visualizing features with the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#getSchemes) + */ + basemap: string | Basemap; + /** + * The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#getSchemes) + */ + geometryType: string; + /** + * Determines which set of primary and secondary color schemes to return **Possible Values:** default + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#getSchemes) + * + * @default default + */ + theme?: string; + /** + * Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#getSchemes) + */ + worldScale?: boolean; + /** + * The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols. + * + * [Read more...](global.html) + */ + view?: SceneView; + } + + /** + * Defines the symbology scheme used to visualize relationship renderers (bivariate color) based on the layer's geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipScheme) + */ + export type RelationshipScheme = RelationshipSchemeForPoint | RelationshipSchemeForPolyline | RelationshipSchemeForPolygon | RelationshipSchemeForMesh; + + /** + * Properties defining the symbology scheme used to visualize relationship renderers (bivariate color) for mesh features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForMesh) + */ + export interface RelationshipSchemeForMesh extends Object { + /** + * The ID uniquely identifying the color scheme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForMesh) + */ + id: string; + /** + * Defines the colors to use in each bin of the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForMesh) + */ + colorsForClassBreaks: RelationshipSchemeForMeshColorsForClassBreaks[]; + /** + * The color of the fill symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForMesh) + */ + noDataColor: Color; + /** + * The opacity of the fill symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForMesh) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize relationship renderers (bivariate color) for point features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + export interface RelationshipSchemeForPoint extends Object { + /** + * The ID uniquely identifying the color scheme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + id: string; + /** + * Defines the colors to use in each bin of the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + colorsForClassBreaks: RelationshipSchemeForPointColorsForClassBreaks[]; + /** + * The color of the point symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + noDataColor: Color; + /** + * Properties for defining the outline of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + outline: RelationshipSchemeForPointOutline; + /** + * The opacity of the point symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + opacity: number; + /** + * The size of the point symbol in points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + size: number; + } + + /** + * Properties defining the symbology scheme used to visualize relationship renderers (bivariate color) for polygon features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + export interface RelationshipSchemeForPolygon extends Object { + /** + * The ID uniquely identifying the color scheme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + id: string; + /** + * Defines the colors to use in each bin of the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + colorsForClassBreaks: RelationshipSchemeForPolygonColorsForClassBreaks[]; + /** + * The color of the fill symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + noDataColor: Color; + /** + * Properties for defining the outline of the fill symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + outline: RelationshipSchemeForPolygonOutline; + /** + * The opacity of the fill symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize relationship renderers (bivariate color) for polyline features. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + export interface RelationshipSchemeForPolyline extends Object { + /** + * The ID uniquely identifying the color scheme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + id: string; + /** + * Defines the colors to use in each bin of the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + colorsForClassBreaks: RelationshipSchemeForPolylineColorsForClassBreaks[]; + /** + * The color of the line symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + noDataColor: Color; + /** + * The opacity of the line symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + opacity: number; + /** + * The width of the line symbol in points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + width: number; + } + + /** + * The return object of the [getSchemes()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#getSchemes) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemes) + */ + export interface RelationshipSchemes extends Object { + /** + * The relationship scheme best suited for the given basemap and geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemes) + */ + primaryScheme: RelationshipScheme; + /** + * Additional relationship schemes that may be used to visualize data of the given geometry type overlaid on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemes) + */ + secondarySchemes: RelationshipScheme[]; + /** + * The ID of the basemap associated with the given schemes. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemes) + */ + basemapId: string; + } + + + export interface RelationshipSchemeForMeshColorsForClassBreaks extends Object { + /** + * The colors of the fill symbols used for each bin in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForMesh) + */ + colors: Color[][]; + /** + * The number of breaks (rows/columns) for each variable in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForMesh) + */ + numClasses: number; + } + + + export interface RelationshipSchemeForPointColorsForClassBreaks extends Object { + /** + * The fill colors of the point symbols used for each bin in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + colors: Color[][]; + /** + * The number of breaks (rows/columns) for each variable in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + numClasses: number; + } + + + export interface RelationshipSchemeForPointOutline extends Object { + /** + * The outline color of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + color: Color; + /** + * The width of the outline in points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPoint) + */ + width: number; + } + + + export interface RelationshipSchemeForPolygonColorsForClassBreaks extends Object { + /** + * The colors of the fill symbols used for each bin in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + colors: Color[][]; + /** + * The number of breaks (rows/columns) for each variable in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + numClasses: number; + } + + + export interface RelationshipSchemeForPolygonOutline extends Object { + /** + * The outline color of the fill symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + color: Color; + /** + * The width of the outline in points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolygon) + */ + width: number; + } + + + export interface RelationshipSchemeForPolylineColorsForClassBreaks extends Object { + /** + * The colors of the line symbols used for each bin in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + colors: Color[][]; + /** + * The number of breaks (rows/columns) for each variable in the relationship visualization. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-relationship.html#RelationshipSchemeForPolyline) + */ + numClasses: number; + } + + interface symbologySize { /** * Clones a size scheme object. @@ -23051,7 +24922,7 @@ declare namespace __esri { * @param scheme The SizeScheme object to clone. * */ - cloneScheme(scheme: PointSizeScheme | PolylineSizeScheme | PolygonSizeScheme): any; + cloneScheme(scheme: SizeScheme): SizeScheme; /** * Returns a primary scheme and secondary schemes defining symbol properties for size-based data-driven visualizions in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). The `basemap` parameter determines the color of the graphics used to visualize each feature. The `geometryType` determines which type of symbol to return. * @@ -23059,148 +24930,16 @@ declare namespace __esri { * * @param params See the table below for details of each parameter that may be passed to this function. * @param params.basemap The basemap to pair with the visualization. This value indicates the best symbol color for visualizing features against the given basemap. - * @param params.geometryType The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon + * @param params.geometryType The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon * @param params.view The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols. * @param params.worldScale Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. * */ - getSchemes(params: sizeGetSchemesParams): any; + getSchemes(params: sizeGetSchemesParams): SizeSchemes; } export const symbologySize: symbologySize; - /** - * Properties defining the symbology scheme used to visualize point features driven by attribute data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - export interface PointSizeScheme extends Object { - /** - * The fill color of the marker symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - color: Color; - /** - * The color of the marker symbol used to indicate features with no data and features that are out of range. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - noDataColor: Color; - /** - * Properties for defining the outline of the marker symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - outline: PointSizeSchemeOutline; - /** - * The default size of the marker symbol in pixels or points. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - size: number; - /** - * The size of the marker symbol (in pixels or points) used to indicate features with no data and features that are out of range. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - noDataSize: number; - /** - * The minimum size of a marker symbol in pixels or points representing features with low data values. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - minSize: number; - /** - * The maximum size of a marker symbol in pixels or points representing features with high data values. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - maxSize: number; - /** - * The opacity of the marker symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) - */ - opacity: number; - } - - /** - * Properties defining the symbology scheme used to visualize polygon features driven by attribute data. When visualized by size, polygons are represented with marker symbols. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) - */ - export interface PolygonSizeScheme extends Object { - /** - * The scheme defining the symbology of the marker symbol used to represent polygon features by size. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) - */ - marker: PointSizeScheme; - /** - * The schema defining the backgound symbol of the feature. This is a fill symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) - */ - background: PolygonSizeSchemeBackground; - /** - * The opacity of the symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) - */ - opacity: number; - } - - /** - * Properties defining the symbology scheme used to visualize polyline features driven by attribute data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - export interface PolylineSizeScheme extends Object { - /** - * The color of the line symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - color: Color; - /** - * The color of the line symbol used to indicate features with no data and features that are out of range. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - noDataColor: Color; - /** - * The default width of the line symbol in pixels or points. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - width: number; - /** - * The width of the line symbol in pixels or points used to indicate features with no data and features that are out of range. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - noDataWidth: number; - /** - * The minimum width of a line symbol in pixels or points representing features with low data values. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - minWidth: number; - /** - * The maximum width of a line symbol in pixels or points representing features with high data values. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - maxWidth: number; - /** - * The opacity of the line symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolylineSizeScheme) - */ - opacity: number; - } - export interface sizeGetSchemesParams extends Object { /** @@ -23210,7 +24949,7 @@ declare namespace __esri { */ basemap: string | Basemap; /** - * The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon + * The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#getSchemes) */ @@ -23229,50 +24968,215 @@ declare namespace __esri { worldScale?: boolean; } + /** + * Properties defining the symbology scheme used to visualize features with attribute data-driven size. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeScheme) + */ + export type SizeScheme = SizeSchemeForPoint | SizeSchemeForPolyline | SizeSchemeForPolygon; - export interface PointSizeSchemeOutline extends Object { + /** + * Properties defining the symbology scheme used to visualize point features driven by attribute data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + export interface SizeSchemeForPoint extends Object { + /** + * The fill color of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + color: Color; + /** + * The color of the marker symbol used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + noDataColor: Color; + /** + * Properties for defining the outline of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + outline: SizeSchemeForPointOutline; + /** + * The default size of the marker symbol in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + size: number; + /** + * The size of the marker symbol (in pixels or points) used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + noDataSize: number; + /** + * The minimum size of a marker symbol in pixels or points representing features with low data values. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + minSize: number; + /** + * The maximum size of a marker symbol in pixels or points representing features with high data values. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + maxSize: number; + /** + * The opacity of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize polygon features driven by attribute data. When visualized by size, polygons are represented with marker symbols. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) + */ + export interface SizeSchemeForPolygon extends Object { + /** + * The scheme defining the symbology of the marker symbol used to represent polygon features by size. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) + */ + marker: SizeSchemeForPoint; + /** + * The schema defining the backgound symbol of the feature. This is a fill symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) + */ + background: SizeSchemeForPolygonBackground; + /** + * The opacity of the symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize polyline features driven by attribute data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + export interface SizeSchemeForPolyline extends Object { + /** + * The color of the line symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + color: Color; + /** + * The color of the line symbol used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + noDataColor: Color; + /** + * The default width of the line symbol in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + width: number; + /** + * The width of the line symbol in pixels or points used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + noDataWidth: number; + /** + * The minimum width of a line symbol in pixels or points representing features with low data values. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + minWidth: number; + /** + * The maximum width of a line symbol in pixels or points representing features with high data values. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + maxWidth: number; + /** + * The opacity of the line symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolyline) + */ + opacity: number; + } + + /** + * The return object of the [getSchemes()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#getSchemes) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemes) + */ + export interface SizeSchemes extends Object { + /** + * The size scheme best suited for the given basemap and geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemes) + */ + primaryScheme: SizeScheme; + /** + * Additional size schemes that may be used to visualize data of the given geometry type overlaid on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemes) + */ + secondarySchemes: SizeScheme[]; + /** + * The ID of the basemap associated with the given schemes. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemes) + */ + basemapId: string; + } + + + export interface SizeSchemeForPointOutline extends Object { /** * The outline color of the marker symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) */ color: Color; /** * The width of the marker symbol in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PointSizeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPoint) */ width: number; } - export interface PolygonSizeSchemeBackground extends Object { + export interface SizeSchemeForPolygonBackground extends Object { /** * The color of the fill symbol representing the polygon. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) */ color: Color; /** * Properties for defining the outline of the background fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) */ - outline: PolygonSizeSchemeBackgroundOutline; + outline: SizeSchemeForPolygonBackgroundOutline; } - export interface PolygonSizeSchemeBackgroundOutline extends Object { + export interface SizeSchemeForPolygonBackgroundOutline extends Object { /** * The outline color of the background fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) */ color: Color; /** * The width of the background fill symbol's outline in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#PolygonSizeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-size.html#SizeSchemeForPolygon) */ width: number; } @@ -23287,163 +25191,35 @@ declare namespace __esri { * @param scheme The type scheme object to clone. * */ - cloneScheme(scheme: PointTypeScheme | PolylineTypeScheme | PolygonTypeScheme | MeshTypeScheme): any; + cloneScheme(scheme: TypeScheme): TypeScheme; /** - * Returns a primary scheme and secondary schemes defining symbol properties for type-based data-driven visualizions in a [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html). The `basemap` parameter determines the color of the graphics used to visualize each feature. The `geometryType` determines which type of symbol to return. + * Returns a primary scheme and secondary schemes defining symbol properties for type-based data-driven visualizations in a [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html). The `basemap` parameter determines the color of the graphics used to visualize each feature. The `geometryType` determines which type of symbol to return. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#getSchemes) * * @param params See the table below for details of each parameter that may be passed to this function. - * @param params.basemap The basemap to pair with the visualization. This value indicates the best symbol color for visualizing features against the given basemap. - * @param params.geometryType The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh + * @param params.basemap The basemap to pair with the visualization. This value indicates the best symbol color for visualizing features with the given basemap. + * @param params.geometryType The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh * @param params.theme Determines whether to return a standardized unique value scheme for point cloud class renderers (i.e. when the `CLASS_CODE` field is driving the visualization in a [PointCloudLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-PointCloudLayer.html)), or to return the other default primary schemes used in other unique value renderers generated for non-point cloud layer types. **Possible Values:** point-cloud-class | default * @param params.worldScale Indicates if the size units of the scheme will be in meters. This should be `true` when the scheme is intended for 3D volumetric symbology. A `view` must be provided if this property is set to `true`. * @param params.view The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols. * */ - getSchemes(params: typeGetSchemesParams): any; + getSchemes(params: typeGetSchemesParams): TypeSchemes; } export const symbologyType: symbologyType; - /** - * Properties defining the symbology scheme used to visualize mesh features driven by type-based attribute data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#MeshTypeScheme) - */ - export interface MeshTypeScheme extends Object { - /** - * The fill colors of the symbols comprising the theme. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#MeshTypeScheme) - */ - colors: Color[]; - /** - * The color of the fill symbol used to indicate features with no data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#MeshTypeScheme) - */ - noDataColor: Color; - /** - * The opacity of the symbol (0 - 1). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#MeshTypeScheme) - */ - opacity: number; - } - - /** - * Properties defining the symbology scheme used to visualize point features driven by type-based attribute data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) - */ - export interface PointTypeScheme extends Object { - /** - * The fill colors of the point symbols comprising the theme. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) - */ - colors: Color[]; - /** - * The color of the point symbol used to indicate features with no data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) - */ - noDataColor: Color; - /** - * Properties for defining the outline of the marker symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) - */ - outline: PointTypeSchemeOutline; - /** - * The default size of the point symbol in pixels, points, or real-world units. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) - */ - size: number; - /** - * The opacity of the point symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) - */ - opacity: number; - } - - /** - * Properties defining the symbology scheme used to visualize polygon features driven by type-based attribute data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolygonTypeScheme) - */ - export interface PolygonTypeScheme extends Object { - /** - * The fill colors of the symbols comprising the theme. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolygonTypeScheme) - */ - colors: Color[]; - /** - * The color of the fill symbol used to indicate features with no data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolygonTypeScheme) - */ - noDataColor: Color; - /** - * Properties for defining the outline of the fill symbol. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolygonTypeScheme) - */ - outline: PolygonTypeSchemeOutline; - /** - * The opacity of the symbol (0 - 1). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolygonTypeScheme) - */ - opacity: number; - } - - /** - * Properties defining the symbology scheme used to visualize polyline features driven by type-based attribute data. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolylineTypeScheme) - */ - export interface PolylineTypeScheme extends Object { - /** - * The colors of the line symbols comprising the theme. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolylineTypeScheme) - */ - colors: Color[]; - /** - * The color of the line symbol used to indicate features with no data and features that are out of range. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolylineTypeScheme) - */ - noDataColor: Color; - /** - * The default width of the line symbol in pixels or points. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolylineTypeScheme) - */ - width: number; - /** - * The opacity of the line symbol (0 - 1). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolylineTypeScheme) - */ - opacity: number; - } - export interface typeGetSchemesParams extends Object { /** - * The basemap to pair with the visualization. This value indicates the best symbol color for visualizing features against the given basemap. + * The basemap to pair with the visualization. This value indicates the best symbol color for visualizing features with the given basemap. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#getSchemes) */ basemap: string | Basemap; /** - * The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh + * The geometry type of the features to visualize. **Possible Values:** point | multipoint | polyline | polygon | mesh * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#getSchemes) */ @@ -23470,34 +25246,195 @@ declare namespace __esri { view?: SceneView; } + /** + * Properties defining the symbology scheme used to visualize features with attribute data-driven types. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeScheme) + */ + export type TypeScheme = TypeSchemeForPoint | TypeSchemeForPolyline | TypeSchemeForPolygon | TypeSchemeForMesh; - export interface PointTypeSchemeOutline extends Object { + /** + * Properties defining the symbology scheme used to visualize mesh features driven by type-based attribute data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForMesh) + */ + export interface TypeSchemeForMesh extends Object { + /** + * The fill colors of the symbols comprising the theme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForMesh) + */ + colors: Color[]; + /** + * The color of the fill symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForMesh) + */ + noDataColor: Color; + /** + * The opacity of the symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForMesh) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize point features driven by type-based attribute data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) + */ + export interface TypeSchemeForPoint extends Object { + /** + * The fill colors of the point symbols comprising the theme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) + */ + colors: Color[]; + /** + * The color of the point symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) + */ + noDataColor: Color; + /** + * Properties for defining the outline of the marker symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) + */ + outline: TypeSchemeForPointOutline; + /** + * The default size of the point symbol in pixels, points, or real-world units. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) + */ + size: number; + /** + * The opacity of the point symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize polygon features driven by type-based attribute data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolygon) + */ + export interface TypeSchemeForPolygon extends Object { + /** + * The fill colors of the symbols comprising the theme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolygon) + */ + colors: Color[]; + /** + * The color of the fill symbol used to indicate features with no data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolygon) + */ + noDataColor: Color; + /** + * Properties for defining the outline of the fill symbol. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolygon) + */ + outline: TypeSchemeForPolygonOutline; + /** + * The opacity of the symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolygon) + */ + opacity: number; + } + + /** + * Properties defining the symbology scheme used to visualize polyline features driven by type-based attribute data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolyline) + */ + export interface TypeSchemeForPolyline extends Object { + /** + * The colors of the line symbols comprising the theme. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolyline) + */ + colors: Color[]; + /** + * The color of the line symbol used to indicate features with no data and features that are out of range. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolyline) + */ + noDataColor: Color; + /** + * The default width of the line symbol in pixels or points. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolyline) + */ + width: number; + /** + * The opacity of the line symbol (0 - 1). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolyline) + */ + opacity: number; + } + + /** + * The return object of the [getSchemes()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#getSchemes) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemes) + */ + export interface TypeSchemes extends Object { + /** + * The type scheme best suited for the given basemap and geometry type. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemes) + */ + primaryScheme: TypeScheme; + /** + * Additional type schemes that may be used to visualize data of the given geometry type overlaid on the given basemap. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemes) + */ + secondarySchemes: TypeScheme[]; + /** + * The ID of the basemap associated with the given schemes. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemes) + */ + basemapId: string; + } + + + export interface TypeSchemeForPointOutline extends Object { /** * The outline color of the marker symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) */ color: Color; /** * The width of the marker symbol in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PointTypeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPoint) */ width: number; } - export interface PolygonTypeSchemeOutline extends Object { + export interface TypeSchemeForPolygonOutline extends Object { /** * The outline color of the fill symbol. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolygonTypeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolygon) */ color: Color; /** * The width of the fill symbol's outline in pixels or points. * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#PolygonTypeScheme) + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-symbology-type.html#TypeSchemeForPolygon) */ width: number; } @@ -23510,25 +25447,25 @@ declare namespace __esri { */ classificationMethod: string; /** - * field for relationship. + * A numeric field used for generating a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html) along with [field2](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2). In the default visualization, the values of this field are rendered along the vertical axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1) */ - field1: any; + field1: AuthoringInfoField1; /** - * field for relationship. + * A numeric field used for generating a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html) along with [field1](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1). In the default visualization, the values of this field are rendered along the horizontal axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2) */ - field2: any; + field2: AuthoringInfoField2; /** - * An array of string values representing field names used for creating predominance renderers. + * An array of string values representing field names used for creating a [predominance renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#fields) */ fields: string[]; /** - * focus for relationship. + * The focus of a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html). This determines the orientation of the legend. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#focus) */ @@ -23540,7 +25477,7 @@ declare namespace __esri { */ lengthUnit: string; /** - * numClasses for relationship. + * The number of classes used to classify each field of a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html). This determines the number of categories in the legend. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#numClasses) */ @@ -23552,7 +25489,7 @@ declare namespace __esri { */ standardDeviationInterval: number; /** - * Indicates the renderer type generated from one of the Smart Mapping functions. **Possible Values:** class-breaks-size | class-breaks-color | predominance | univariate-color-size + * Indicates the renderer type generated from one of the Smart Mapping functions. **Possible Values:** class-breaks-size | class-breaks-color | classed-color | classed-size | predominance | relationship | univariate-color-size * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#type) */ @@ -23592,25 +25529,25 @@ declare namespace __esri { */ classificationMethod?: string; /** - * field for relationship. + * A numeric field used for generating a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html) along with [field2](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2). In the default visualization, the values of this field are rendered along the vertical axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1) */ - field1?: any; + field1?: AuthoringInfoField1; /** - * field for relationship. + * A numeric field used for generating a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html) along with [field1](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1). In the default visualization, the values of this field are rendered along the horizontal axis of the [Legend](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2) */ - field2?: any; + field2?: AuthoringInfoField2; /** - * An array of string values representing field names used for creating predominance renderers. + * An array of string values representing field names used for creating a [predominance renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-predominance.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#fields) */ fields?: string[]; /** - * focus for relationship. + * The focus of a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html). This determines the orientation of the legend. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#focus) */ @@ -23622,7 +25559,7 @@ declare namespace __esri { */ lengthUnit?: string; /** - * numClasses for relationship. + * The number of classes used to classify each field of a [relationship renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-relationship.html). This determines the number of categories in the legend. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#numClasses) */ @@ -23634,7 +25571,7 @@ declare namespace __esri { */ standardDeviationInterval?: number; /** - * Indicates the renderer type generated from one of the Smart Mapping functions. **Possible Values:** class-breaks-size | class-breaks-color | predominance | univariate-color-size + * Indicates the renderer type generated from one of the Smart Mapping functions. **Possible Values:** class-breaks-size | class-breaks-color | classed-color | classed-size | predominance | relationship | univariate-color-size * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#type) */ @@ -23647,6 +25584,62 @@ declare namespace __esri { visualVariables?: AuthoringInfoVisualVariableProperties[]; } + + export interface AuthoringInfoField1 extends Object { + /** + * The name of a numeric field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1) + */ + field: string; + /** + * The name of a numeric field used to normalize the given `field`. In choropleth visualizations it is best practice to normalize your data values if they haven't already been normalized. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1) + */ + normalizationField?: string; + /** + * The maximum bound of values to visualize in the given field. If a feature's value is greater than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1) + */ + maxValue?: number; + /** + * The minimum bound of values to visualize in the given field. If a feature's value is less than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field1) + */ + minValue?: number; + } + + + export interface AuthoringInfoField2 extends Object { + /** + * The name of a numeric field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2) + */ + field: string; + /** + * The name of a numeric field used to normalize the given `field`. In choropleth visualizations it is best practice to normalize your data values if they haven't already been normalized. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2) + */ + normalizationField?: string; + /** + * The maximum bound of values to visualize in the given field. If a feature's value is greater than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2) + */ + maxValue?: number; + /** + * The minimum bound of values to visualize in the given field. If a feature's value is less than this value, then it will be assigned the default symbol of the renderer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-support-AuthoringInfo.html#field2) + */ + minValue?: number; + } + interface AuthoringInfoVisualVariable extends Accessor, JSONSupport { /** * If an age or timeline renderer was generated, indicates the end time of the visualization. @@ -23863,11 +25856,11 @@ declare namespace __esri { */ defaultSymbol: Symbol; /** - * The name of the attribute field the renderer uses to match unique values or types. A function may also be used to return a string value representing unique types if the desired type does not already explicitly exist in a field. + * The name of the attribute field the renderer uses to match unique values or types. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#field) */ - field: string | Function; + field: string; /** * If needed, specifies the name of an additional attribute field the renderer will use to match values. For example, if you specify two fields: * ```js @@ -24033,11 +26026,11 @@ declare namespace __esri { */ defaultSymbol?: SymbolProperties; /** - * The name of the attribute field the renderer uses to match unique values or types. A function may also be used to return a string value representing unique types if the desired type does not already explicitly exist in a field. + * The name of the attribute field the renderer uses to match unique values or types. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#field) */ - field?: string | Function; + field?: string; /** * If needed, specifies the name of an additional attribute field the renderer will use to match values. For example, if you specify two fields: * ```js @@ -24159,16 +26152,17 @@ declare namespace __esri { interface VisualVariablesMixin { /** - * Visual variables define the parameters for data-driven geographic visualizations of numeric data. They allow you to easily map continuous ramps of [color](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable), [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable), [opacity](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable), and/or [rotation](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) to minimum and maximum data values of one of the layer's numeric attribute fields. Visual variables can primarily be used in two ways. **1**. Thematic mapping Visual variables allow you to easily create stunning visualizations based on thematic attributes (e.g. population, education, rank, money, magnitude, etc.) in either 2D or 3D. This is accomplished by mapping data values from a numeric field attribute to color, size, and/or opacity values. The renderer then takes over and re-sizes or shades features based on the value of the given field and its position relative to the minimum and maximum values. The sample below uses three visual variables (size, color, and opacity). [![renderer-unique-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/renderer-unique-vv.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-multivariate-2d/index.html) **2**. Mapping real-world sizes The [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) visual variable can be used to visualize the true sizes of features (e.g. tree canopy, road width, building height, etc.) based on their size in the real world. This can be particularly powerful when working in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). The image below shows a layer of building footprints that uses visual variables to extrude each feature to the true height of the buildings based on data stored in an attribute field. [![renderer-vv-rw](https://developers.arcgis.com/javascript/latest/assets/img/samples/2-extrude-height.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-buildings-3d/index.html) The `visualVariables` property of the renderer is an array of objects called "visual variables". Each object must indicate the type of visual variable to apply (e.g. color, size, opacity, rotation), the numeric field from which to drive the visualization, and the ramp of visual values to map to the data. The following list identifies each visual variable type and provides a link to the specification table of each. + * Visual variables define the parameters for data-driven geographic visualizations of numeric data. They allow you to easily map continuous ramps of [color](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable), [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable), [opacity](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable), and/or [rotation](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) to minimum and maximum data values of one of the layer's numeric attribute fields. Visual variables can primarily be used in two ways. **1**. Thematic mapping Visual variables allow you to easily create stunning visualizations based on thematic attributes (e.g. population, education, rank, money, magnitude, etc.) in either 2D or 3D. This is accomplished by mapping data values from a numeric field attribute to color, size, and/or opacity values. The renderer then takes over and re-sizes or shades features based on the value of the given field and its position relative to the minimum and maximum values. The sample below uses three visual variables (size, color, and opacity). [![renderer-unique-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/renderer-unique-vv.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-multivariate-2d/index.html) **2**. Mapping real-world sizes The [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) visual variable can be used to visualize the true sizes of features (e.g. tree canopy, road width, building height, etc.) based on their size in the real world. This can be particularly powerful when working in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). The image below shows a layer of building footprints that uses visual variables to extrude each feature to the true height of the buildings based on data stored in an attribute field. [![renderer-vv-rw](https://developers.arcgis.com/javascript/assets/img/samples/2-extrude-height.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-buildings-3d/index.html) The `visualVariables` property of the renderer is an array of objects called "visual variables". Each object must indicate the type of visual variable to apply (e.g. color, size, opacity, rotation), the numeric field from which to drive the visualization, and the ramp of visual values to map to the data. The following list identifies each visual variable type and provides a link to the specification table of each. * * Type | Object Specification | Legend Example * -----|----------------------|--------------- - * color | [ColorVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/legend-color-vv.png) - * size | [SizeVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/legend-size-vv.png) - * opacity | [OpacityVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/legend-opacity-vv.png) + * color | [ColorVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/legend-color-vv.png) + * size | [SizeVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/legend-size-vv.png) + * opacity | [OpacityVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/legend-opacity-vv.png) * rotation | [RotationVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) | - * - * See the [Visualize features with realistic 3D symbols](https://developers.arcgis.com/javascript/latest/sample-code/visualization-trees-realistic/index.html) for an example of using multiple visual variables to visualize your data. + * See the [Visualize features with realistic 3D symbols](https://developers.arcgis.com/javascript/latest/sample-code/visualization-trees-realistic/index.html) for an example of using multiple visual variables to visualize your data. + * > **Known Limitations** Color and opacity visual variables must not have more than 8 stops and size visual variables must not have more than 6 stops. This does not apply to variables driven by view scale. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-VisualVariablesMixin.html#visualVariables) */ @@ -24185,16 +26179,17 @@ declare namespace __esri { interface VisualVariablesMixinProperties { /** - * Visual variables define the parameters for data-driven geographic visualizations of numeric data. They allow you to easily map continuous ramps of [color](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable), [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable), [opacity](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable), and/or [rotation](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) to minimum and maximum data values of one of the layer's numeric attribute fields. Visual variables can primarily be used in two ways. **1**. Thematic mapping Visual variables allow you to easily create stunning visualizations based on thematic attributes (e.g. population, education, rank, money, magnitude, etc.) in either 2D or 3D. This is accomplished by mapping data values from a numeric field attribute to color, size, and/or opacity values. The renderer then takes over and re-sizes or shades features based on the value of the given field and its position relative to the minimum and maximum values. The sample below uses three visual variables (size, color, and opacity). [![renderer-unique-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/renderer-unique-vv.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-multivariate-2d/index.html) **2**. Mapping real-world sizes The [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) visual variable can be used to visualize the true sizes of features (e.g. tree canopy, road width, building height, etc.) based on their size in the real world. This can be particularly powerful when working in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). The image below shows a layer of building footprints that uses visual variables to extrude each feature to the true height of the buildings based on data stored in an attribute field. [![renderer-vv-rw](https://developers.arcgis.com/javascript/latest/assets/img/samples/2-extrude-height.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-buildings-3d/index.html) The `visualVariables` property of the renderer is an array of objects called "visual variables". Each object must indicate the type of visual variable to apply (e.g. color, size, opacity, rotation), the numeric field from which to drive the visualization, and the ramp of visual values to map to the data. The following list identifies each visual variable type and provides a link to the specification table of each. + * Visual variables define the parameters for data-driven geographic visualizations of numeric data. They allow you to easily map continuous ramps of [color](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable), [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable), [opacity](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable), and/or [rotation](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) to minimum and maximum data values of one of the layer's numeric attribute fields. Visual variables can primarily be used in two ways. **1**. Thematic mapping Visual variables allow you to easily create stunning visualizations based on thematic attributes (e.g. population, education, rank, money, magnitude, etc.) in either 2D or 3D. This is accomplished by mapping data values from a numeric field attribute to color, size, and/or opacity values. The renderer then takes over and re-sizes or shades features based on the value of the given field and its position relative to the minimum and maximum values. The sample below uses three visual variables (size, color, and opacity). [![renderer-unique-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/renderer-unique-vv.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-multivariate-2d/index.html) **2**. Mapping real-world sizes The [size](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) visual variable can be used to visualize the true sizes of features (e.g. tree canopy, road width, building height, etc.) based on their size in the real world. This can be particularly powerful when working in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). The image below shows a layer of building footprints that uses visual variables to extrude each feature to the true height of the buildings based on data stored in an attribute field. [![renderer-vv-rw](https://developers.arcgis.com/javascript/assets/img/samples/2-extrude-height.png)](https://developers.arcgis.com/javascript/latest/sample-code/visualization-buildings-3d/index.html) The `visualVariables` property of the renderer is an array of objects called "visual variables". Each object must indicate the type of visual variable to apply (e.g. color, size, opacity, rotation), the numeric field from which to drive the visualization, and the ramp of visual values to map to the data. The following list identifies each visual variable type and provides a link to the specification table of each. * * Type | Object Specification | Legend Example * -----|----------------------|--------------- - * color | [ColorVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/legend-color-vv.png) - * size | [SizeVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/legend-size-vv.png) - * opacity | [OpacityVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/latest/assets/img/apiref/renderers/legend-opacity-vv.png) + * color | [ColorVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#ColorVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/legend-color-vv.png) + * size | [SizeVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#SizeVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/legend-size-vv.png) + * opacity | [OpacityVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#OpacityVisualVariable) | ![legend-color-vv](https://developers.arcgis.com/javascript/assets/img/apiref/renderers/legend-opacity-vv.png) * rotation | [RotationVisualVariable](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#RotationVisualVariable) | - * - * See the [Visualize features with realistic 3D symbols](https://developers.arcgis.com/javascript/latest/sample-code/visualization-trees-realistic/index.html) for an example of using multiple visual variables to visualize your data. + * See the [Visualize features with realistic 3D symbols](https://developers.arcgis.com/javascript/latest/sample-code/visualization-trees-realistic/index.html) for an example of using multiple visual variables to visualize your data. + * > **Known Limitations** Color and opacity visual variables must not have more than 8 stops and size visual variables must not have more than 6 stops. This does not apply to variables driven by view scale. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-VisualVariablesMixin.html#visualVariables) */ @@ -24209,7 +26204,7 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#esriRequest) * * @param url The request URL. - * @param options An object with the following properties that describe the request. + * @param options The options specified by the user in the data request. See [RequestOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) for available properties. * */ esriRequest(url: string, options?: RequestOptions): IPromise; @@ -24284,25 +26279,44 @@ declare namespace __esri { */ export interface RequestOptions extends Object { /** - * Indicates if the request should be made using the HTTP POST method. By default, this is determined automatically based on the request size. This option is ignored when `responseType = "image"`. **Possible Values:** auto | post + * If the request URL points to a web server that requires parameters, specify them here. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) */ - method?: string; + query?: any; /** - * Name of the callback parameter (a special service parameter) to be specified when requesting data in JSONP format. It is ignored for all other data formats. For ArcGIS services the value is always `callback`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) - */ - callbackParamName?: string; - /** - * Response format. When this value is `image` the `method` and `timeout` options are ignored. **Possible Values:** json | xml | text | blob | array-buffer | document | image + * Response format. When this value is `image` the `headers` and `timeout` options are ignored. **Possible Values:** json | xml | text | blob | array-buffer | document | image * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) */ responseType?: string; /** - * Headers to use for the request. This is an object whose property names are header names. This is not applicable for non-XHR requests. + * [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) allows for cancelable requests. If canceled, the promise will be rejected with an error named `AbortError`. See also [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). Example: + * ```js + * const controller = new AbortController(); + * const signal = controller.signal; + * + * esriRequest(url, { signal }) + * .then((response) => { + * // The request went OK + * }) + * .catch((err) => { + * if (err.name === 'AbortError') { + * console.log('Request aborted'); + * } else { + * console.error('Error encountered', err); + * } + * }); + * + * // Abort requests that are aware of the controller's signal + * controller.abort(); + * ``` + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) + */ + signal?: AbortSignal; + /** + * Headers to use for the request. This is an object whose property names are header names. This option is ignored when `responseType = "image"`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) */ @@ -24314,11 +26328,11 @@ declare namespace __esri { */ timeout?: number; /** - * If the request URL points to a web server that requires parameters, specify them here. + * Indicates if the request should be made using the HTTP POST method. By default, this is determined automatically based on the request size. **Possible Values:** auto | post * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) */ - query?: any; + method?: string; /** * If uploading a file, specify the form data or element used to submit the file here. If a form element is specified, the parameters of the `query` will be added to the URL. If not specified, then query parameters will only be added to the URL when a GET request is used. If POST is used, then query parameters will be added to the body. * @@ -24337,12 +26351,6 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) */ cacheBust?: boolean; - /** - * Indicates whether apps are allowed to read image data (when used with Canvas) from images hosted on third-party sites. Only applicable when `responseType = "image"`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions) - */ - allowImageDataAccess?: boolean; /** * Indicates if and how requests to ArcGIS Services are authenticated. Only applicable when [`esriConfig.request.useIdentity = true`](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request). * @@ -24378,7 +26386,7 @@ declare namespace __esri { */ requestOptions?: RequestOptions; /** - * If ssl is enabled or not. + * Indicates if the request required https. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestResponse) */ @@ -24460,7 +26468,7 @@ declare namespace __esri { interface ActionButton extends ActionBase { /** - * The URL to an image that will be used to represent the action. This property will be used as a background image for the node. It may be used in conjunction with the `className` property or by itself. If neither `image` nor `className` are specified, a default icon ![default icon](https://developers.arcgis.com/javascript/latest/assets/img/guide/whats-new/41/default-action.png) will display. + * The URL to an image that will be used to represent the action. This property will be used as a background image for the node. It may be used in conjunction with the `className` property or by itself. If neither `image` nor `className` are specified, a default icon ![default icon](https://developers.arcgis.com/javascript/assets/img/guide/whats-new/41/default-action.png) will display. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html#image) */ @@ -25018,7 +27026,7 @@ declare namespace __esri { interface FillSymbol3DLayer extends Symbol3DLayer { /** - * Sets the contour edges on 3D Objects. This is only applicable for [MeshSymbol3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-MeshSymbol3D.html). ![symbol3D-edges-solid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbol3d-edges-solid-2.png) + * Sets the contour edges on 3D Objects. This is only applicable for [MeshSymbol3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-MeshSymbol3D.html). ![symbol3D-edges-solid](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbol3d-edges-solid-2.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#edges) */ @@ -25062,7 +27070,7 @@ declare namespace __esri { interface FillSymbol3DLayerProperties extends Symbol3DLayerProperties { /** - * Sets the contour edges on 3D Objects. This is only applicable for [MeshSymbol3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-MeshSymbol3D.html). ![symbol3D-edges-solid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbol3d-edges-solid-2.png) + * Sets the contour edges on 3D Objects. This is only applicable for [MeshSymbol3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-MeshSymbol3D.html). ![symbol3D-edges-solid](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbol3d-edges-solid-2.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-FillSymbol3DLayer.html#edges) */ @@ -25134,7 +27142,7 @@ declare namespace __esri { size: number; /** * The text style. Specifies whether a font should be styled: normal, italic, or oblique. **Possible Values:** normal | italic | oblique - * > **Known Limitations** `oblique` is not supported in 2D WebGL enabled [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html). + * > **Known Limitations** `oblique` is not supported in 2D [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) labels. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Font.html#style) * @@ -25143,7 +27151,7 @@ declare namespace __esri { style: "normal" | "italic" | "oblique"; /** * The text weight. Specifies the level of boldness. **Possible Values:** normal | bold | bolder | lighter - * > **Known Limitations** `bolder` and `lighter` are not supported in 2D WebGL enabled [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html). + * > **Known Limitations** `bolder` and `lighter` are not supported in 2D [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) labels. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Font.html#weight) * @@ -25199,7 +27207,7 @@ declare namespace __esri { size?: number | string; /** * The text style. Specifies whether a font should be styled: normal, italic, or oblique. **Possible Values:** normal | italic | oblique - * > **Known Limitations** `oblique` is not supported in 2D WebGL enabled [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html). + * > **Known Limitations** `oblique` is not supported in 2D [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) labels. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Font.html#style) * @@ -25208,7 +27216,7 @@ declare namespace __esri { style?: "normal" | "italic" | "oblique"; /** * The text weight. Specifies the level of boldness. **Possible Values:** normal | bold | bolder | lighter - * > **Known Limitations** `bolder` and `lighter` are not supported in 2D WebGL enabled [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html). + * > **Known Limitations** `bolder` and `lighter` are not supported in 2D [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) and [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) labels. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Font.html#weight) * @@ -25358,11 +27366,11 @@ declare namespace __esri { * * Value | Description * ------|------------ - * circle | ![s3d-icon-circle](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-icon-circle.png) - * square | ![s3d-icon-square](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-icon-square.png) - * cross | ![s3d-icon-cross](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-icon-cross.png) - * x | ![s3d-icon-x](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-icon-x.png) - * kite | ![s3d-icon-kite](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-icon-kite.png) + * circle | ![s3d-icon-circle](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-icon-circle.png) + * square | ![s3d-icon-square](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-icon-square.png) + * cross | ![s3d-icon-cross](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-icon-cross.png) + * x | ![s3d-icon-x](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-icon-x.png) + * kite | ![s3d-icon-kite](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-icon-kite.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html#resource) @@ -25444,13 +27452,13 @@ declare namespace __esri { */ screenLength?: number; /** - * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid the vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) + * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid the vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html#verticalOffset) */ minWorldLength?: number; /** - * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) + * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html#verticalOffset) */ @@ -25465,13 +27473,13 @@ declare namespace __esri { */ screenLength: number; /** - * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid the vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) + * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid the vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html#verticalOffset) */ minWorldLength?: number; /** - * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) + * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LabelSymbol3D.html#verticalOffset) */ @@ -25897,13 +27905,13 @@ declare namespace __esri { * * Value | Description * ------|------------ - * sphere | ![s3d-object-sphere](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-sphere.png) - * cylinder | ![s3d-object-cylinder](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-cylinder.png) - * cube | ![s3d-object-cube](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-cube.png) - * cone | ![s3d-object-cone](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-cone.png) - * inverted-cone | ![s3d-object-inverted-cone](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-inverted-cone.png) - * diamond | ![s3d-object-diamond](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-diamond.png) - * tetrahedron | ![s3d-object-tetrahedron](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-tetrahedron.png) + * sphere | ![s3d-object-sphere](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-sphere.png) + * cylinder | ![s3d-object-cylinder](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-cylinder.png) + * cube | ![s3d-object-cube](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-cube.png) + * cone | ![s3d-object-cone](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-cone.png) + * inverted-cone | ![s3d-object-inverted-cone](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-inverted-cone.png) + * diamond | ![s3d-object-diamond](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-diamond.png) + * tetrahedron | ![s3d-object-tetrahedron](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-tetrahedron.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-ObjectSymbol3DLayer.html#resource) @@ -26128,8 +28136,8 @@ declare namespace __esri { readonly type: "picture-marker"; /** * The URL to the image. To avoid CORS issues with this symbol, do one of the following: - * * Use an image hosted on the same domain as the application. - * * If the image is on a different domain and that server is CORS enabled, add the domain to the [corsEnabledServers](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) array. + * * Make certain that the [image](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PictureMarkerSymbol.html#url) is hosted on a [CORS enabled server](https://enable-cors.org/server.html). + * * Use an [image](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PictureMarkerSymbol.html#url) hosted on the same domain as the application. * * Install a proxy. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PictureMarkerSymbol.html#url) @@ -26179,8 +28187,8 @@ declare namespace __esri { height?: number | string; /** * The URL to the image. To avoid CORS issues with this symbol, do one of the following: - * * Use an image hosted on the same domain as the application. - * * If the image is on a different domain and that server is CORS enabled, add the domain to the [corsEnabledServers](https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request) array. + * * Make certain that the [image](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PictureMarkerSymbol.html#url) is hosted on a [CORS enabled server](https://enable-cors.org/server.html). + * * Use an [image](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PictureMarkerSymbol.html#url) hosted on the same domain as the application. * * Install a proxy. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PictureMarkerSymbol.html#url) @@ -26264,13 +28272,13 @@ declare namespace __esri { */ screenLength?: number; /** - * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) + * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PointSymbol3D.html#verticalOffset) */ minWorldLength?: number; /** - * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) + * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PointSymbol3D.html#verticalOffset) */ @@ -26285,13 +28293,13 @@ declare namespace __esri { */ screenLength: number; /** - * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) + * The minimum vertical symbol offset in world units. It acts as a lower bound to avoid vertical offset becoming too small. In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set: ![minWorldLength-on](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-minWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PointSymbol3D.html#verticalOffset) */ minWorldLength?: number; /** - * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) + * The maximum vertical symbol offset in world units. It acts as an upper bound to avoid vertical offset becoming too big. In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set: ![maxWorldLength](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3D-line-callout-maxWorldLength.gif) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PointSymbol3D.html#verticalOffset) */ @@ -26348,14 +28356,14 @@ declare namespace __esri { * * Value | Description * ------|------------- - * backward-diagonal | ![sfs-backward-diagonal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-backward-diagonal.png) - * cross | ![sfs-cross](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-cross.png) - * diagonal-cross | ![sfs-diagonal-cross](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-diagonal-cross.png) - * forward-diagonal | ![sfs-forward-diagonal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-forward-diagonal.png) - * horizontal | ![sfs-horizontal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-horizontal.png) + * backward-diagonal | ![sfs-backward-diagonal](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-backward-diagonal.png) + * cross | ![sfs-cross](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-cross.png) + * diagonal-cross | ![sfs-diagonal-cross](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-diagonal-cross.png) + * forward-diagonal | ![sfs-forward-diagonal](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-forward-diagonal.png) + * horizontal | ![sfs-horizontal](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-horizontal.png) * none | The polygon has no fill. - * solid | ![sfs-solid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-solid.png) - * vertical | ![sfs-vertical](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-vertical.png) + * solid | ![sfs-solid](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-solid.png) + * vertical | ![sfs-vertical](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-vertical.png) * * > **Known Limitations** This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -26409,14 +28417,14 @@ declare namespace __esri { * * Value | Description * ------|------------- - * backward-diagonal | ![sfs-backward-diagonal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-backward-diagonal.png) - * cross | ![sfs-cross](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-cross.png) - * diagonal-cross | ![sfs-diagonal-cross](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-diagonal-cross.png) - * forward-diagonal | ![sfs-forward-diagonal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-forward-diagonal.png) - * horizontal | ![sfs-horizontal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-horizontal.png) + * backward-diagonal | ![sfs-backward-diagonal](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-backward-diagonal.png) + * cross | ![sfs-cross](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-cross.png) + * diagonal-cross | ![sfs-diagonal-cross](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-diagonal-cross.png) + * forward-diagonal | ![sfs-forward-diagonal](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-forward-diagonal.png) + * horizontal | ![sfs-horizontal](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-horizontal.png) * none | The polygon has no fill. - * solid | ![sfs-solid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-solid.png) - * vertical | ![sfs-vertical](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sfs-vertical.png) + * solid | ![sfs-solid](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-solid.png) + * vertical | ![sfs-vertical](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sfs-vertical.png) * * > **Known Limitations** This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -26433,9 +28441,9 @@ declare namespace __esri { * * Possible Value | Example * ---------------|--------- - * butt | ![sls-cap-butt](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-cap-butt.png) - * round | ![sls-cap-round](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-cap-round.png) - * square | ![sls-cap-square](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-cap-square.png) + * butt | ![sls-cap-butt](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-cap-butt.png) + * round | ![sls-cap-round](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-cap-round.png) + * square | ![sls-cap-square](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-cap-square.png) * * > **Known Limitations** * * This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). @@ -26451,9 +28459,9 @@ declare namespace __esri { * * Possible Value | Example * ---------------|--------- - * bevel | ![sls-join-bevel](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-join-bevel.png) - * miter | ![sls-join-miter](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-join-miter.png) - * round | ![sls-join-round](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-join-round.png) + * bevel | ![sls-join-bevel](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-join-bevel.png) + * miter | ![sls-join-miter](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-join-miter.png) + * round | ![sls-join-round](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-join-round.png) * * > **Known Limitations** This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -26476,18 +28484,18 @@ declare namespace __esri { * * Value | Description * ------|------------- - * dash | ![sls-dash](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dash.png) - * dash-dot | ![sls-dash-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dash-dot.png) - * dot | ![sls-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dot.png) - * long-dash | ![sls-long-dash](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-long-dash.png) - * long-dash-dot | ![sls-long-dash-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-long-dash-dot.png) - * long-dash-dot-dot | ![sls-dash-dot-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dash-dot-dot.png) + * dash | ![sls-dash](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dash.png) + * dash-dot | ![sls-dash-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dash-dot.png) + * dot | ![sls-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dot.png) + * long-dash | ![sls-long-dash](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-long-dash.png) + * long-dash-dot | ![sls-long-dash-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-long-dash-dot.png) + * long-dash-dot-dot | ![sls-dash-dot-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dash-dot-dot.png) * none | The line has no symbol. - * short-dash | ![sls-short-dash](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dash.png) - * short-dash-dot | ![sls-short-dash-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dash-dot.png) - * short-dash-dot-dot | ![sls-short-dash-dot-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dash-dot-dot.png) - * short-dot | ![sls-short-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dot.png) - * solid | ![sls-solid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-solid.png) + * short-dash | ![sls-short-dash](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dash.png) + * short-dash-dot | ![sls-short-dash-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dash-dot.png) + * short-dash-dot-dot | ![sls-short-dash-dot-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dash-dot-dot.png) + * short-dot | ![sls-short-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dot.png) + * solid | ![sls-solid](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-solid.png) * * > **Known Limitations** This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -26533,9 +28541,9 @@ declare namespace __esri { * * Possible Value | Example * ---------------|--------- - * butt | ![sls-cap-butt](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-cap-butt.png) - * round | ![sls-cap-round](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-cap-round.png) - * square | ![sls-cap-square](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-cap-square.png) + * butt | ![sls-cap-butt](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-cap-butt.png) + * round | ![sls-cap-round](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-cap-round.png) + * square | ![sls-cap-square](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-cap-square.png) * * > **Known Limitations** * * This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). @@ -26551,9 +28559,9 @@ declare namespace __esri { * * Possible Value | Example * ---------------|--------- - * bevel | ![sls-join-bevel](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-join-bevel.png) - * miter | ![sls-join-miter](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-join-miter.png) - * round | ![sls-join-round](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/sls-join-round.png) + * bevel | ![sls-join-bevel](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-join-bevel.png) + * miter | ![sls-join-miter](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-join-miter.png) + * round | ![sls-join-round](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/sls-join-round.png) * * > **Known Limitations** This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -26576,18 +28584,18 @@ declare namespace __esri { * * Value | Description * ------|------------- - * dash | ![sls-dash](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dash.png) - * dash-dot | ![sls-dash-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dash-dot.png) - * dot | ![sls-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dot.png) - * long-dash | ![sls-long-dash](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-long-dash.png) - * long-dash-dot | ![sls-long-dash-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-long-dash-dot.png) - * long-dash-dot-dot | ![sls-dash-dot-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-dash-dot-dot.png) + * dash | ![sls-dash](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dash.png) + * dash-dot | ![sls-dash-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dash-dot.png) + * dot | ![sls-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dot.png) + * long-dash | ![sls-long-dash](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-long-dash.png) + * long-dash-dot | ![sls-long-dash-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-long-dash-dot.png) + * long-dash-dot-dot | ![sls-dash-dot-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-dash-dot-dot.png) * none | The line has no symbol. - * short-dash | ![sls-short-dash](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dash.png) - * short-dash-dot | ![sls-short-dash-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dash-dot.png) - * short-dash-dot-dot | ![sls-short-dash-dot-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dash-dot-dot.png) - * short-dot | ![sls-short-dot](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-short-dot.png) - * solid | ![sls-solid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sls-solid.png) + * short-dash | ![sls-short-dash](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dash.png) + * short-dash-dot | ![sls-short-dash-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dash-dot.png) + * short-dash-dot-dot | ![sls-short-dash-dot-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dash-dot-dot.png) + * short-dot | ![sls-short-dot](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-short-dot.png) + * solid | ![sls-solid](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sls-solid.png) * * > **Known Limitations** This property is currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * @@ -26634,11 +28642,11 @@ declare namespace __esri { * * Value | Description * ------|------------ - * circle | ![sms_circle](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-circle.png) - * cross | ![sms_cross](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-cross.png) - * diamond | ![sms_diamond](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-diamond.png) - * square | ![sms_square](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-square.png) - * x | ![sms_x](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-x.png) + * circle | ![sms_circle](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-circle.png) + * cross | ![sms_cross](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-cross.png) + * diamond | ![sms_diamond](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-diamond.png) + * square | ![sms_square](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-square.png) + * x | ![sms_x](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-x.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html#style) @@ -26713,11 +28721,11 @@ declare namespace __esri { * * Value | Description * ------|------------ - * circle | ![sms_circle](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-circle.png) - * cross | ![sms_cross](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-cross.png) - * diamond | ![sms_diamond](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-diamond.png) - * square | ![sms_square](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-square.png) - * x | ![sms_x](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols-sms-x.png) + * circle | ![sms_circle](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-circle.png) + * cross | ![sms_cross](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-cross.png) + * diamond | ![sms_diamond](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-diamond.png) + * square | ![sms_square](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-square.png) + * x | ![sms_x](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols-sms-x.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html#style) @@ -26822,7 +28830,7 @@ declare namespace __esri { interface SymbolConstructor { /** - * Symbol is the base class for all symbols. Symbols represent point, line, polygon, and mesh geometries as vector graphics within a [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). They can be set on individual [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#symbol) or in a [Renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) that is applied to a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). + * Symbol is the base class for all symbols. Symbols represent point, line, polygon, and mesh geometries as vector graphics within a [View](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html). Symbols can only be set directly on individual [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#symbol) in a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html) or in [View.graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#graphics). Otherwise they are assigned to a [Renderer](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html) that is applied to a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or a [SceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html) */ @@ -26916,13 +28924,13 @@ declare namespace __esri { * * Value | Description * ------|------------ - * icon | ![s3d-icon](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-icon-circle.png) - * object | ![s3d-object](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-object-sphere.png) - * line | ![s3d-line](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-line-line.png) - * path | ![s3d-path](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-path-tube.png) - * fill | ![s3d-fill](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-fill-solid.png) - * extrusion | ![s3d-extrusion](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-extrude-solid.png) - * text | ![s3d-text](https://developers.arcgis.com/javascript/latest/assets/img/apiref/symbols/symbols3d-label-text.png) + * icon | ![s3d-icon](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-icon-circle.png) + * object | ![s3d-object](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-object-sphere.png) + * line | ![s3d-line](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-line-line.png) + * path | ![s3d-path](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-path-tube.png) + * fill | ![s3d-fill](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-fill-solid.png) + * extrusion | ![s3d-extrusion](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-extrude-solid.png) + * text | ![s3d-text](https://developers.arcgis.com/javascript/assets/img/apiref/symbols/symbols3d-label-text.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol3DLayer.html#type) @@ -28380,7 +30388,7 @@ declare namespace __esri { updateDelay: number; /** - * Sends a request to the print service to create a print page using the options specified in the [PrintParameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-PrintParameters.html). + * Sends a request to the print service to create a printable static image of the map using the options specified in the [PrintParameters](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-PrintParameters.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-PrintTask.html#execute) * @@ -28388,7 +30396,7 @@ declare namespace __esri { * @param requestOptions Additional [options](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#esriRequest) to be used for the data request (will override requestOptions defined during construction). * */ - execute(params: PrintParameters, requestOptions?: any): IPromise; + execute(params: PrintParameters, requestOptions?: any): IPromise; } interface PrintTaskConstructor { @@ -28414,16 +30422,30 @@ declare namespace __esri { updateDelay?: number; } + /** + * Represents the reponse of the [execute()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-PrintTask.html#execute) method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-PrintTask.html#PrintResponse) + */ + export interface PrintResponse extends Object { + /** + * URL pointing to the location of the generated printout of the view. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-PrintTask.html#PrintResponse) + */ + url: string; + } + interface QueryTask extends Task { /** - * Specify the geodatabase version to display. Requires ArcGIS Server service 10.1 or greater. + * Specify the geodatabase version to query. Requires ArcGIS Server service 10.1 or greater. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#gdbVersion) */ gdbVersion: string; /** - * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against an ArcGIS Server map layer. The result is returned as a [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html), which can be accessed using the `.then()` method. A [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html) contains an array of [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) features, which can be added to the map. This array will not be populated if no results are found. + * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against the layer specified in the [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#url). The result is returned as a [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html), which can be accessed using the `.then()` method. A [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html) contains an array of [Graphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) features, which can be added to the map. This array will not be populated if no results are found. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#execute) * @@ -28433,7 +30455,17 @@ declare namespace __esri { */ execute(query: Query | QueryProperties, requestOptions?: any): IPromise; /** - * Gets a count of the number of features that satisfy the input query. Valid only for layers published using ArcGIS Server 10 SP1 or greater. Layers published with earlier versions of ArcGIS Server return an error to the `errback` param of `.then()`. + * Query information about attachments associated with features from a [feature layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) specified in the [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#url). It will return an error if the layer does not support [attachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#executeAttachmentQuery) + * + * @param attachmentQuery Specifies the attachment parameters for query. + * @param requestOptions Additional [options](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#esriRequest) to be used for the data request (will override requestOptions defined during construction). + * + */ + executeAttachmentQuery(attachmentQuery: AttachmentQuery | AttachmentQueryProperties, requestOptions?: any): IPromise; + /** + * Gets a count of the number of features that satisfy the input query. Valid for layers published with 10.0 SP1. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#executeForCount) * @@ -28443,7 +30475,7 @@ declare namespace __esri { */ executeForCount(query: Query | QueryProperties, requestOptions?: any): IPromise; /** - * Gets the extent of the features that satisfy the input query. The count of features that satisfy the input query is returned upon resolution as well. Valid only for [hosted feature services](http://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm) on [arcgis.com](http://arcgis.com) and for ArcGIS Server 10.3.1 and later. + * Gets the extent of the features that satisfy the input query. The count of features that satisfy the input query is returned upon resolution as well. At 10.3, this option is only available for [hosted feature services](https://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm). At 10.3.1, this option is available for all feature services and map service layers. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#executeForExtent) * @@ -28453,7 +30485,7 @@ declare namespace __esri { */ executeForExtent(params: Query, requestOptions?: any): IPromise; /** - * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against an ArcGIS Server map layer. The result is an array of the object IDs of features that satisfy the input query. + * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against the layer specified in the [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#url). The result is an array of the object IDs of features that satisfy the input query. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#executeForIds) * @@ -28463,11 +30495,11 @@ declare namespace __esri { */ executeForIds(query: Query | QueryProperties, requestOptions?: any): IPromise; /** - * Executes a [RelationshipQuery](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html) against an ArcGIS Server map layer (or table). If the query is successful, the result is returned as a [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html), which can be accessed using the `.then()` method. + * Executes a [RelationshipQuery](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html) against the layer or table specified in the [url](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#url). If the query is successful, the returned results are [FeatureSets](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html) grouped by source layer or table objectIds. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#executeRelationshipQuery) * - * @param relationshipQuery Specifies the attributes and spatial filter of the query. + * @param relationshipQuery Specifies relationship parameters for querying related features or records from a layer or a table. * @param requestOptions Additional [options](https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#esriRequest) to be used for the data request (will override requestOptions defined during construction). * */ @@ -28476,7 +30508,7 @@ declare namespace __esri { interface QueryTaskConstructor { /** - * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) operation on a layer. The most common method used in this class is [execute()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#execute), which executes the query as defined in the [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) object that is passed as a parameter to the function. `QueryTask.execute()` returns a Promise that resolves to a [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html), which contains the features in the layer that satisfy the [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html). + * Executes different types of query operations on a layer. The most common method used in this class is [execute()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#execute), which executes the query as defined in the [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) object that is passed as a parameter to the function. `QueryTask.execute()` returns a Promise that resolves to a [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html), which contains the features in the layer that satisfy the [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html) */ @@ -28488,13 +30520,57 @@ declare namespace __esri { interface QueryTaskProperties extends TaskProperties { /** - * Specify the geodatabase version to display. Requires ArcGIS Server service 10.1 or greater. + * Specify the geodatabase version to query. Requires ArcGIS Server service 10.1 or greater. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#gdbVersion) */ gdbVersion?: string; } + /** + * The AttachmentInfo returns information about attachments associated with a feature. This resource is available only if the [feature layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) has attachments. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#AttachmentInfo) + */ + export interface AttachmentInfo extends Object { + /** + * The content type of the attachment. For example, `image/jpeg`. See the [ArcGIS REST API documentation](https://developers.arcgis.com/rest/services-reference/query-attachments-feature-service-layer-.htm) for more information on supported attachment types. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#AttachmentInfo) + */ + contentType: string; + /** + * The identifier for the attachment. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#AttachmentInfo) + */ + id: number; + /** + * The name of the attachment. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#AttachmentInfo) + */ + name: string; + /** + * The parent or the feature object id of the attachment. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#AttachmentInfo) + */ + parentObjectId: number; + /** + * The size of the attachment. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#AttachmentInfo) + */ + size: number; + /** + * The URL of the attachment. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#AttachmentInfo) + */ + url: string; + } + interface RouteTask extends Task { /** * Solves the route against the route layer with the route parameters. @@ -28714,6 +30790,119 @@ declare namespace __esri { polygons?: PolygonProperties[]; } + interface AttachmentQuery extends Accessor, JSONSupport { + /** + * The file format that is supported by query attachment. For example, `image/jpeg`. See the [ArcGIS REST API documentation](https://developers.arcgis.com/rest/services-reference/query-attachments-feature-service-layer-.htm) for more information on supported attachment types. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#attachmentTypes) + */ + attachmentTypes: string[]; + /** + * The definition expression to be applied to the layer. Only features that satisfy the definition expression and are in the list of [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#objectIds) will be returned. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#definitionExpression) + */ + definitionExpression: string; + /** + * An array of globalIds for the features in the layer being queried. The query results will return attachments only for specified global ids. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#globalIds) + */ + globalIds: number[]; + /** + * The number of features to retrieve. This option should be used in conjunction with the [start property](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#start). Use this to implement paging (i.e. to retrieve "pages" of results when querying). Default Value is `10`. If not provided, but an instance of AttachmentQuery has a `start` property, then the default value of `num` is `maxRecordCount`. The maximum value for this parameter is the value of the layer's `maxRecordCount` of the service, which can be found at the REST endpoint of the feature layer. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#num) + */ + num: number; + /** + * An array of objectIds of the features to be queried for attachments. When the feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property is `false`, it only accepts a single `objectId`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#objectIds) + */ + objectIds: number[]; + /** + * The file size of the attachment is specified in bytes. You can enter a file size range [1000,15000] to query for attachments. The query result will return all attachments within the specified file size range (1000 - 15000). Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#size) + */ + size: number[]; + /** + * This option fetches query results by skipping a specified number of records. The query results start from the next record. The default value is `0`. This parameter only applies when the feature layer's [capabilities.query.supportsPagination](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) is `true`. You can use this option to fetch records that are beyond `maxRecordCount`. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#start) + */ + start: number; + + /** + * Creates a deep clone of AttachmentQuery object. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#clone) + * + * + */ + clone(): AttachmentQuery; + } + + interface AttachmentQueryConstructor { + /** + * This class defines parameters for executing queries for feature attachments from a [feature layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html). Once an AttachmentQuery object's properties are defined, it can then be passed into the [QueryTask.executeAttachmentQuery()](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-QueryTask.html#executeAttachmentQuery) or [FeatureLayer.queryAttachments()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryAttachments) methods, which will return attachmentInfos grouped by the source feature objectIds. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html) + */ + + new(properties?: AttachmentQueryProperties): AttachmentQuery; + + fromJSON(json: any): AttachmentQuery; + } + + export const AttachmentQuery: AttachmentQueryConstructor; + + interface AttachmentQueryProperties { + /** + * The file format that is supported by query attachment. For example, `image/jpeg`. See the [ArcGIS REST API documentation](https://developers.arcgis.com/rest/services-reference/query-attachments-feature-service-layer-.htm) for more information on supported attachment types. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#attachmentTypes) + */ + attachmentTypes?: string[]; + /** + * The definition expression to be applied to the layer. Only features that satisfy the definition expression and are in the list of [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#objectIds) will be returned. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#definitionExpression) + */ + definitionExpression?: string; + /** + * An array of globalIds for the features in the layer being queried. The query results will return attachments only for specified global ids. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#globalIds) + */ + globalIds?: number[]; + /** + * The number of features to retrieve. This option should be used in conjunction with the [start property](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#start). Use this to implement paging (i.e. to retrieve "pages" of results when querying). Default Value is `10`. If not provided, but an instance of AttachmentQuery has a `start` property, then the default value of `num` is `maxRecordCount`. The maximum value for this parameter is the value of the layer's `maxRecordCount` of the service, which can be found at the REST endpoint of the feature layer. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#num) + */ + num?: number; + /** + * An array of objectIds of the features to be queried for attachments. When the feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property is `false`, it only accepts a single `objectId`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#objectIds) + */ + objectIds?: number[]; + /** + * The file size of the attachment is specified in bytes. You can enter a file size range [1000,15000] to query for attachments. The query result will return all attachments within the specified file size range (1000 - 15000). Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#size) + */ + size?: number[]; + /** + * This option fetches query results by skipping a specified number of records. The query results start from the next record. The default value is `0`. This parameter only applies when the feature layer's [capabilities.query.supportsPagination](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) is `true`. You can use this option to fetch records that are beyond `maxRecordCount`. Requires an ArcGIS Server service 10.5 or greater and feature layer's [capabilities.query.supportsAttachments](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) to be `true`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-AttachmentQuery.html#start) + */ + start?: number; + } + interface BufferParameters extends Accessor { /** * The spatial reference in which the geometries are buffered. If `bufferSpatialReference` is not specified, the geometries are buffered in the spatial reference specified by `outSpatialReference`. If `outSpatialReference` is also not specified, they are buffered in the spatial reference of the features. @@ -31588,7 +33777,7 @@ declare namespace __esri { */ scalebarUnit?: string; /** - * An array of [LegendLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-LegendLayer.html) containing the id's of the layers that will be included in the legend. If `legendLayers` is not specified, all operational layers will be present in the legend. To specify that no layers will be included in the legend set `legendLayer = []`. + * An array of [LegendLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-LegendLayer.html) containing the id's of the layers that will be included in the legend. If `legendLayers` is not specified, all operational layers (non-tiled layers) will be present in the legend. To specify that no layers will be included in the legend set `legendLayer = []`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-PrintTemplate.html#layoutOptions) */ @@ -31733,11 +33922,17 @@ declare namespace __esri { */ geometryPrecision: number; /** - * One or more field names that will be used to group the statistics. This is only valid when [outStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outStatistics) has been defined. + * Used only in [statistical queries](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#statistic). When one or more field names are provided in this property, the output statisics will be grouped based on unique values from those fields. This is only valid when [outStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outStatistics) has been defined. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#groupByFieldsForStatistics) */ groupByFieldsForStatistics: string[]; + /** + * A condition used with [outStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outStatistics) and [groupByFieldsForStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#groupByFieldsForStatistics) to limit query results to groups that satisfy the aggregation function(s). The following aggregation functions are supported in this clause: `MIN` | `MAX` | `AVG` | `SUM` | `STDDEV` | `COUNT` | `VAR` Aggregation functions used in `having` must be included in the `outStatistics` as well. See the snippet below for an example of how this works. For service-based layer queries, this parameter applies only if the [supportsHavingClause](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property of the layer is `true`. This property is supported on all [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) queries. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#having) + */ + having: string; /** * The historic moment to query. This parameter applies only if the `supportsQueryWithHistoricMoment` capability of the service being queried is `true`. This setting is provided in the layer resource. * @@ -31745,8 +33940,8 @@ declare namespace __esri { */ historicMoment: Date; /** - * The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of [outSpatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outSpatialReference). If `outSpatialReference` is not defined, the spatial reference of the view is used. - * > **Known Limitations** This property does not apply to layer view or [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) queries. + * The maximum distance in units of [outSpatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outSpatialReference) used for generalizing geometries returned by the query operation. It limits how far any part of the generalized geometry can be from the original geometry. If `outSpatialReference` is not defined, the spatialReference of the data is used. + * > **Known Limitations** This property does not apply to [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) or [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) queries. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#maxAllowableOffset) */ @@ -32007,11 +34202,17 @@ declare namespace __esri { */ geometryPrecision?: number; /** - * One or more field names that will be used to group the statistics. This is only valid when [outStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outStatistics) has been defined. + * Used only in [statistical queries](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#statistic). When one or more field names are provided in this property, the output statisics will be grouped based on unique values from those fields. This is only valid when [outStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outStatistics) has been defined. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#groupByFieldsForStatistics) */ groupByFieldsForStatistics?: string[]; + /** + * A condition used with [outStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outStatistics) and [groupByFieldsForStatistics](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#groupByFieldsForStatistics) to limit query results to groups that satisfy the aggregation function(s). The following aggregation functions are supported in this clause: `MIN` | `MAX` | `AVG` | `SUM` | `STDDEV` | `COUNT` | `VAR` Aggregation functions used in `having` must be included in the `outStatistics` as well. See the snippet below for an example of how this works. For service-based layer queries, this parameter applies only if the [supportsHavingClause](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property of the layer is `true`. This property is supported on all [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) queries. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#having) + */ + having?: string; /** * The historic moment to query. This parameter applies only if the `supportsQueryWithHistoricMoment` capability of the service being queried is `true`. This setting is provided in the layer resource. * @@ -32019,8 +34220,8 @@ declare namespace __esri { */ historicMoment?: DateProperties; /** - * The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of [outSpatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outSpatialReference). If `outSpatialReference` is not defined, the spatial reference of the view is used. - * > **Known Limitations** This property does not apply to layer view or [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) queries. + * The maximum distance in units of [outSpatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#outSpatialReference) used for generalizing geometries returned by the query operation. It limits how far any part of the generalized geometry can be from the original geometry. If `outSpatialReference` is not defined, the spatialReference of the data is used. + * > **Known Limitations** This property does not apply to [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) or [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) queries. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#maxAllowableOffset) */ @@ -32444,13 +34645,13 @@ declare namespace __esri { interface RelationshipQuery extends Accessor, JSONSupport { /** - * The definition expression to be applied to the related table or layer. Only records that fit the definition expression and are in the list of `objectIds` will be returned. + * The definition expression to be applied to the related table or layer. Only records in the list of [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#objectIds) that satisfy the definition expression are queried for related records. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#definitionExpression) */ definitionExpression: string; /** - * Specify the geodatabase version to display. + * Specify the geodatabase version to query. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#gdbVersion) */ @@ -32462,37 +34663,37 @@ declare namespace __esri { */ geometryPrecision: number; /** - * The historic moment to query. This parameter applies only if the `supportsHistoricMoment` property of the layers being queried is set to `true`. + * The historic moment to query. This parameter applies only if the `supportsHistoricMoment` on [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property of the layer is set to `true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#historicMoment) */ historicMoment: Date; /** - * The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of `outSpatialReference`. If `outSpatialReference` is not defined, the spatial reference of the map is used. + * The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of `outSpatialReference`. If `outSpatialReference` is not defined, the [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#spatialReference) of the view is used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#maxAllowableOffset) */ maxAllowableOffset: number; /** - * A comma delimited list of ObjectIds for the features in the layer/table being queried. + * An array of objectIds for the features in the layer/table being queried. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#objectIds) */ objectIds: number[]; /** - * Attribute fields to include in the FeatureSet. Fields must exist in the map layer. You must list actual field names rather than the alias names. You are, however, able to use the alias names when you display the results. You can set field alias names in the map document. When specifying the output fields, you should limit the fields to only those you expect to use in the query or the results. The fewer fields you include, the faster the response will be. Each query must have access to the Shape and ObjectId fields for a layer. However, your list of fields does not need to include these two fields. + * Attribute fields to include in the FeatureSet. Fields must exist in the map layer. You must list actual field names rather than the alias names. You are, however, able to use the alias names when you display the results. When specifying the output fields, you should limit the fields to only those you expect to use in the query or the results. The fewer fields you include, the faster the response will be. Each query must have access to the Shape and ObjectId fields for a layer. However, your list of fields does not need to include these two fields. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#outFields) */ outFields: string[]; /** - * The spatial reference for the returned geometry. If not specified, the geometry is returned in the spatial reference of the map. + * The spatial reference for the returned geometry. If `outSpatialReference` is not defined, the [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#spatialReference) of the view is used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#outSpatialReference) */ outSpatialReference: SpatialReference; /** - * The ID of the relationship to test. The ids for the relationships the table or layer participates in are listed in the ArcGIS Services directory. + * The ID of the relationship to be queried. The ids for the relationships the table or layer participates in are listed in the ArcGIS Services directory. The ID of the relationship to be queried. The relationships that this layer/table participates in are included in the Feature Service Layer resource response. Records in tables/layers corresponding to the related table/layer of the relationship are queried. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#relationshipId) */ @@ -32528,13 +34729,13 @@ declare namespace __esri { interface RelationshipQueryProperties { /** - * The definition expression to be applied to the related table or layer. Only records that fit the definition expression and are in the list of `objectIds` will be returned. + * The definition expression to be applied to the related table or layer. Only records in the list of [objectIds](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#objectIds) that satisfy the definition expression are queried for related records. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#definitionExpression) */ definitionExpression?: string; /** - * Specify the geodatabase version to display. + * Specify the geodatabase version to query. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#gdbVersion) */ @@ -32546,37 +34747,37 @@ declare namespace __esri { */ geometryPrecision?: number; /** - * The historic moment to query. This parameter applies only if the `supportsHistoricMoment` property of the layers being queried is set to `true`. + * The historic moment to query. This parameter applies only if the `supportsHistoricMoment` on [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#capabilities) property of the layer is set to `true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#historicMoment) */ historicMoment?: DateProperties; /** - * The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of `outSpatialReference`. If `outSpatialReference` is not defined, the spatial reference of the map is used. + * The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of `outSpatialReference`. If `outSpatialReference` is not defined, the [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#spatialReference) of the view is used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#maxAllowableOffset) */ maxAllowableOffset?: number; /** - * A comma delimited list of ObjectIds for the features in the layer/table being queried. + * An array of objectIds for the features in the layer/table being queried. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#objectIds) */ objectIds?: number[]; /** - * Attribute fields to include in the FeatureSet. Fields must exist in the map layer. You must list actual field names rather than the alias names. You are, however, able to use the alias names when you display the results. You can set field alias names in the map document. When specifying the output fields, you should limit the fields to only those you expect to use in the query or the results. The fewer fields you include, the faster the response will be. Each query must have access to the Shape and ObjectId fields for a layer. However, your list of fields does not need to include these two fields. + * Attribute fields to include in the FeatureSet. Fields must exist in the map layer. You must list actual field names rather than the alias names. You are, however, able to use the alias names when you display the results. When specifying the output fields, you should limit the fields to only those you expect to use in the query or the results. The fewer fields you include, the faster the response will be. Each query must have access to the Shape and ObjectId fields for a layer. However, your list of fields does not need to include these two fields. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#outFields) */ outFields?: string[]; /** - * The spatial reference for the returned geometry. If not specified, the geometry is returned in the spatial reference of the map. + * The spatial reference for the returned geometry. If `outSpatialReference` is not defined, the [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#spatialReference) of the view is used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#outSpatialReference) */ outSpatialReference?: SpatialReferenceProperties; /** - * The ID of the relationship to test. The ids for the relationships the table or layer participates in are listed in the ArcGIS Services directory. + * The ID of the relationship to be queried. The ids for the relationships the table or layer participates in are listed in the ArcGIS Services directory. The ID of the relationship to be queried. The relationships that this layer/table participates in are included in the Feature Service Layer resource response. Records in tables/layers corresponding to the related table/layer of the relationship are queried. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-RelationshipQuery.html#relationshipId) */ @@ -33789,7 +35990,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-StatisticDefinition.html#statisticType) */ - statisticType: string; + statisticType: "count" | "sum" | "min" | "max" | "avg" | "stddev" | "var"; } interface StatisticDefinitionConstructor { @@ -33820,7 +36021,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-StatisticDefinition.html#statisticType) */ - statisticType?: string; + statisticType?: "count" | "sum" | "min" | "max" | "avg" | "stddev" | "var"; } interface TrimExtendParameters extends Accessor { @@ -39521,7 +41722,7 @@ declare namespace __esri { * * Z: Elevation * * - * ![externalRenderers-renderCoordinateTransformAt](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/3d/externalRenderers-renderCoordinateTransformAt.png) When [view.viewingMode](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode) is `global`, a linear transformation does not take the curvature of the globe or other non-linear projection aspects into account. Thus, the resulting coordinates will only appear correct within a small region around the origin of the local Cartesian system. The allowable spatial reference of `origin` depends on the [viewingMode](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode): + * ![externalRenderers-renderCoordinateTransformAt](https://developers.arcgis.com/javascript/assets/img/apiref/views/3d/externalRenderers-renderCoordinateTransformAt.png) When [view.viewingMode](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode) is `global`, a linear transformation does not take the curvature of the globe or other non-linear projection aspects into account. Thus, the resulting coordinates will only appear correct within a small region around the origin of the local Cartesian system. The allowable spatial reference of `origin` depends on the [viewingMode](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode): * * In `global` mode, it can either be Web Mercator or WGS84. * * In `local` mode, it has to match [view.spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#spatialReference). * @@ -39924,7 +42125,7 @@ declare namespace __esri { */ readonly height: number; /** - * A Popup object that displays general content or attributes from [layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers) in the [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#map). The view has a default instance of [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) with predefined styles and a template for defining content. The content in this default instance may be modified directly in the [popup's content](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#content) or in a layer's [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). You may create a new [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) instance and set it to this property to customize the style, positioning, and content of the popup in favor of using the default popup instance on the view. + * A Popup object that displays general content or attributes from [layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers) in the [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#map). The view has a default instance of [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) with predefined styles and a template for defining content. The content in this default instance may be modified directly in the [popup's content](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#content) or in a layer's [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). You may create a new [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) instance and set it to this property to customize the style, positioning, and content of the popup in favor of using the default popup instance on the view. In addition, if wanting to prevent any popups from opening, use the syntax below: * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#popup) */ @@ -39983,7 +42184,7 @@ declare namespace __esri { */ container?: HTMLDivElement | string; /** - * A Popup object that displays general content or attributes from [layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers) in the [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#map). The view has a default instance of [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) with predefined styles and a template for defining content. The content in this default instance may be modified directly in the [popup's content](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#content) or in a layer's [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). You may create a new [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) instance and set it to this property to customize the style, positioning, and content of the popup in favor of using the default popup instance on the view. + * A Popup object that displays general content or attributes from [layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers) in the [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#map). The view has a default instance of [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) with predefined styles and a template for defining content. The content in this default instance may be modified directly in the [popup's content](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#content) or in a layer's [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). You may create a new [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) instance and set it to this property to customize the style, positioning, and content of the popup in favor of using the default popup instance on the view. In addition, if wanting to prevent any popups from opening, use the syntax below: * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#popup) */ @@ -40031,10 +42232,105 @@ declare namespace __esri { } + interface GamepadInputDevice extends Accessor { + /** + * The native Gamepad object exposed by the browser. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-input-gamepad-GamepadInputDevice.html#native) + */ + readonly native: Gamepad; + } + + interface GamepadInputDeviceConstructor { + /** + * Properties and configuration of a gamepad. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-input-gamepad-GamepadInputDevice.html) + */ + + new(properties?: GamepadInputDeviceProperties): GamepadInputDevice; + } + + export const GamepadInputDevice: GamepadInputDeviceConstructor; + + interface GamepadInputDeviceProperties { + + } + + interface GamepadSettings extends Accessor { + /** + * A readonly collection of all gamepads detected. Can be watched for gamepads to be connected or disconnected. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-input-gamepad-GamepadSettings.html#devices) + */ + readonly devices: Collection; + /** + * Determines what focus is required for gamepad events to be dispatched. Possible values: document | view | none + * + * Possible Value | Description + * ---------------|------------ + * document | Gamepad events are emitted when any part of the current webpage has focus. This allows for gamepad events being emitted even while a UI element is focused. + * view | Gamepad events are emitted when the view [container element](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#container) has browser focus. This is useful when multiple views might be present on a single webpage. + * none | Gamepad events are emitted independently of focus. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-input-gamepad-GamepadSettings.html#enabledFocusMode) + * + * @default document + */ + enabledFocusMode: "document" | "view" | "none"; + } + + interface GamepadSettingsConstructor { + + + new(properties?: GamepadSettingsProperties): GamepadSettings; + } + + export const GamepadSettings: GamepadSettingsConstructor; + + interface GamepadSettingsProperties { + /** + * Determines what focus is required for gamepad events to be dispatched. Possible values: document | view | none + * + * Possible Value | Description + * ---------------|------------ + * document | Gamepad events are emitted when any part of the current webpage has focus. This allows for gamepad events being emitted even while a UI element is focused. + * view | Gamepad events are emitted when the view [container element](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#container) has browser focus. This is useful when multiple views might be present on a single webpage. + * none | Gamepad events are emitted independently of focus. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-input-gamepad-GamepadSettings.html#enabledFocusMode) + * + * @default document + */ + enabledFocusMode?: "document" | "view" | "none"; + } + + interface Input extends Accessor { + /** + * Gamepad input specific configuration settings. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-input-Input.html#gamepad) + */ + readonly gamepad: GamepadSettings; + } + + interface InputConstructor { + + + new(properties?: InputProperties): Input; + } + + export const Input: InputConstructor; + + interface InputProperties { + + } + interface CSVLayerView extends LayerView { /** - * Highlights the given feature(s). - * > **Known Limitations** In 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) this method is only supported for [CSVLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) that have opted in to [WebGL rendering](esri-layers-FeatureLayer.html#webgl-rendering). + * Highlights the given feature(s). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-CSVLayerView.html#highlight) * @@ -40044,7 +42340,8 @@ declare namespace __esri { highlight(target?: Graphic | Graphic[] | number | number[]): any; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns the [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) of features that satisfy the query. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are not currently supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia @@ -40060,7 +42357,8 @@ declare namespace __esri { queryExtent(params?: Query | QueryProperties): IPromise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns the number of features that satisfy the query. If query parameters are not provided, the count of all features available for drawing is returned. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are currently not supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia @@ -40076,7 +42374,8 @@ declare namespace __esri { queryFeatureCount(params?: Query | QueryProperties): IPromise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns a [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html). If query parameters are not provided, all features available for drawing are returned. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are currently not supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia @@ -40092,7 +42391,8 @@ declare namespace __esri { queryFeatures(params?: Query | QueryProperties): IPromise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns array of the ObjectIDs of features that satisfy the input query. If query parameters are not provided, the ObjectIDs of all features available for drawing are returned. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are currently not supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia @@ -40129,8 +42429,7 @@ declare namespace __esri { readonly layer: FeatureLayer; /** - * Highlights the given feature(s). - * > **Known Limitations** In 2D [MapViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) this method is only supported for [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) that have opted in to [WebGL rendering](esri-layers-FeatureLayer.html#webgl-rendering). + * Highlights the given feature(s). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#highlight) * @@ -40140,10 +42439,11 @@ declare namespace __esri { highlight(target?: Graphic | Graphic[] | number | number[]): any; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns the [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) of features that satisfy the query. Valid only for [hosted feature services](http://doc.arcgis.com/en/arcgis-online/share-maps/hosted-web-layers.htm) on [arcgis.com](http://arcgis.com) and for ArcGIS Server 10.3.1 and later. If query parameters are not provided, the extent and count of all features available for drawing are returned. To query for the extent of features directly from a Feature Service rather than those visible in the view, you must use the [FeatureLayer.queryExtent()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryExtent) method. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are currently not supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries are executed against quantized geometries in the layer view. The resolution of layer view geometries, is only as precise as the scale resolution of the view. Therefore, the results of the same query could be different when executed at different scales. This also means that geometries returned from any layer view query will likewise be at the same scale resolution of the view. * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. - * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): + * * Spatial queries are not currently supported if the FeatureLayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia * * Gusterberg (Ferro) (8042) – Austria/Czech Republic * * ISN2016 (8086) - Iceland @@ -40157,10 +42457,11 @@ declare namespace __esri { queryExtent(params?: Query | QueryProperties): IPromise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns the number of features that satisfy the query. If query parameters are not provided, the count of all features available for drawing is returned. To query for the count of features directly from a Feature Service rather than those visible in the view, you must use the [FeatureLayer.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatureCount) method. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are currently not supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries are executed against quantized geometries in the layer view. The resolution of layer view geometries, is only as precise as the scale resolution of the view. Therefore, the results of the same query could be different when executed at different scales. This also means that geometries returned from any layer view query will likewise be at the same scale resolution of the view. * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. - * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): + * * Spatial queries are not currently supported if the FeatureLayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia * * Gusterberg (Ferro) (8042) – Austria/Czech Republic * * ISN2016 (8086) - Iceland @@ -40174,10 +42475,11 @@ declare namespace __esri { queryFeatureCount(params?: Query | QueryProperties): IPromise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns a [FeatureSet](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-FeatureSet.html). If query parameters are not provided, all features available for drawing are returned. To execute a query against all the features in a Feature Service rather than only those in the client, you must use the [FeatureLayer.queryFeatures()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures) method. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are currently not supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries are executed against quantized geometries in the layer view. The resolution of layer view geometries, is only as precise as the scale resolution of the view. Therefore, the results of the same query could be different when executed at different scales. This also means that geometries returned from any layer view query will likewise be at the same scale resolution of the view. * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. - * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): + * * Spatial queries are not currently supported if the FeatureLayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia * * Gusterberg (Ferro) (8042) – Austria/Czech Republic * * ISN2016 (8086) - Iceland @@ -40191,10 +42493,11 @@ declare namespace __esri { queryFeatures(params?: Query | QueryProperties): IPromise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html) against features available for drawing in the layer view and returns array of the ObjectIDs of features that satisfy the input query. If query parameters are not provided, the ObjectIDs of all features available for drawing are returned. To query for ObjectIDs of features directly from a Feature Service rather than those visible in the view, you must use the [FeatureLayer.queryObjectIds()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryObjectIds) method. - * > **Known Limitations** **3D [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) limitations** Queries with `outStatistics` and any other parameter involving statistics are currently not supported. **SVG limitations (default)** Only the `geometry` , `objectIds`, and `spatialRelationship` properties are supported in the query object. Spatial queries only support [Extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) geometries with `spatialRelationship = 'intersects'`. **WebGL limitations** + * > **Known Limitations** + * * Queries with `outStatistics` and any other parameter involving statistics are currently not supported in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * Spatial queries are executed against quantized geometries in the layer view. The resolution of layer view geometries, is only as precise as the scale resolution of the view. Therefore, the results of the same query could be different when executed at different scales. This also means that geometries returned from any layer view query will likewise be at the same scale resolution of the view. * * Spatial queries have the same limitations as those listed in the [projection engine](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html) documentation. - * * Spatial queries are not currently supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): + * * Spatial queries are not currently supported if the FeatureLayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html): * * GDM 2000 (4742) – Malaysia * * Gusterberg (Ferro) (8042) – Austria/Czech Republic * * ISN2016 (8086) - Iceland @@ -40531,7 +42834,7 @@ declare namespace __esri { */ connect(): IPromise; /** - * Closes the web socket connection with the stream service. This is called internally when the StreamLayer is removed from a view. To verify when the connection is closed, watch the [connectionStatus](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#property:connectionStatus) property. + * Closes the web socket connection with the stream service. This is called internally when the StreamLayer is removed from a view. To verify when the connection is closed, watch the [connectionStatus](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#connectionStatus) property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#disconnect) * @@ -40539,7 +42842,7 @@ declare namespace __esri { */ disconnect(): void; /** - * Updates the [filter](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#filter) on the StreamLayerView. The filter is updated only on the layer view from which it is called. To update the filter on all layer views generated from a common layer, use the [StreamLayer.updateFilter()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#updateFilter) method. If the input `filter` object is `undefined` or `null`, the spatial and attribute filters are removed. Filter changes only apply to incoming features. Features already displayed in the view are not filtered. Therefore, you may want to clear the graphics in the layer view prior to applying a new filter. To do so, get the layer view then call [removeAll()](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#removeAll) on the [StreamLayerView.graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#graphics). You may also filter features already present in the view using the [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) methods. See the examples below. + * Updates the [filter](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#filter) on the StreamLayerView. The filter is updated only on the layer view from which it is called. To update the filter on all layer views generated from a common layer, use the [StreamLayer.updateFilter()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html#updateFilter) method. If the input `filter` object is `undefined` or `null`, the spatial and attribute filters are removed. Filter changes only apply to incoming features. Features already displayed in the view will be removed automatically. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html#updateFilter) * @@ -40556,7 +42859,7 @@ declare namespace __esri { interface StreamLayerViewConstructor { /** - * The StreamLayerView provides methods for connecting, disconnecting, and filtering data received from a stream service for a layer view associated with a [StreamLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html). + * Represents the [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) of a [StreamLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-StreamLayer.html) after it has been added to a [Map](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html) in either a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-StreamLayerView.html) */ @@ -40632,8 +42935,7 @@ declare namespace __esri { */ extent: Extent; /** - * Options for configuring the highlight. Use the highlight method on the appropriate [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) to highlight a feature. - * > **Known Limitations** Only [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) rendered with [WebGL](esri-layers-FeatureLayer.html#webgl-rendering) support highlight. See [FeatureLayerView.highlight()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#highlight) for details of how to highlight features. + * Options for configuring the highlight. Use the highlight method on the appropriate [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) to highlight a feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) */ @@ -40700,9 +43002,9 @@ declare namespace __esri { * @param target.scale The [MapView.scale](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#scale) to go to. * @param target.zoom The [MapView.zoom](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#zoom) to go to. * @param options Animation options. See properties below for object specifications. - * @param options.animate Indicates if the transition to the new view should be animated. + * @param options.animate Indicates if the transition to the new view should be animated. If set to false, `duration` and `easing` properties are ignored. * @param options.duration The duration of the animation in milliseconds. - * @param options.easing The easing function used for the animation. **Possible Values:** linear | ease | ease-in | ease-out | ease-in-out + * @param options.easing The easing function used for the animation. See [easing functions](https://easings.net/) for graphical representations of these functions. **Possible Values:** linear | ease | ease-in | ease-out | ease-in-out * */ goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | MapViewGoToTarget, options?: MapViewGoToOptions): IPromise; @@ -40730,9 +43032,9 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#on) * - * @param type The name of the event or the events to listen for. - * @param modifiersOrHandler Additional modifier keys to filter the events by. Alternatively, if no modifiers are required, the function to call when the event is fired. - * @param handler? The function to call when the event is fired, if modifiers were specified. + * @param type The name of the event or events to listen for. + * @param modifiersOrHandler Additional modifier keys to filter events. Please see [Key Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) for possible values. All the standard key values are supported. Alternatively, if no modifiers are required, the function will call when the event fires. The following events don't support modifier keys: `blur`, `focus`, `layerview-create`, `layerview-destroy`, `resize`. + * @param handler The function to call when the event is fired, if modifiers were specified. * */ on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle; @@ -40866,8 +43168,7 @@ declare namespace __esri { */ extent?: ExtentProperties; /** - * Options for configuring the highlight. Use the highlight method on the appropriate [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) to highlight a feature. - * > **Known Limitations** Only [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) rendered with [WebGL](esri-layers-FeatureLayer.html#webgl-rendering) support highlight. See [FeatureLayerView.highlight()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#highlight) for details of how to highlight features. + * Options for configuring the highlight. Use the highlight method on the appropriate [LayerView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) to highlight a feature. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) */ @@ -41170,7 +43471,7 @@ declare namespace __esri { export interface MapViewGoToOptions extends Object { /** - * Indicates if the transition to the new view should be animated. + * Indicates if the transition to the new view should be animated. If set to false, `duration` and `easing` properties are ignored. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo) * @@ -41181,10 +43482,12 @@ declare namespace __esri { * The duration of the animation in milliseconds. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo) + * + * @default 200 */ duration?: number; /** - * The easing function used for the animation. **Possible Values:** linear | ease | ease-in | ease-out | ease-in-out + * The easing function used for the animation. See [easing functions](https://easings.net/) for graphical representations of these functions. **Possible Values:** linear | ease | ease-in | ease-out | ease-in-out * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo) * @@ -41475,6 +43778,105 @@ declare namespace __esri { mapPoint: Point; } + interface gamepadGamepadSettings extends Accessor { + /** + * Use this property to explicitly select the gamepad device for map and scene navigation. If unspecified then all connected gamepads will be able to navigate. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#device) + * + * @default null + */ + device: GamepadInputDevice; + /** + * Whether gamepad navigation is enabled on the View. If this is enabled, but no `device` is specified, the first supported one will be selected automatically. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#enabled) + * + * @default true + */ + enabled: boolean; + /** + * This setting controls the behavior of forward and back movement of the left stick. If set to `pan`, movement will be at a constant altitude (panning the view forward and backward) whereas `zoom` will move the view in the viewing direction. Pan is best suited for exploring a scene as if on foot or in a car. Zoom mode provides great control to navigate the scene similar to a flight simulator. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#mode) + * + * @default pan + */ + mode: "pan" | "zoom"; + /** + * Determines whether pressing the tilt axis forwards make the view tilt down (towards the nadir), or up (towards the zenith). The default behavior is to tilt the view down when pressing the stick that controls tilt forwards. **Possible Values:** forward-down | forward-up + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#tiltDirection) + * + * @default forward-down + */ + tiltDirection: "forward-down" | "forward-up"; + } + + interface gamepadGamepadSettingsConstructor { + + + new(properties?: gamepadGamepadSettingsProperties): gamepadGamepadSettings; + } + + export const gamepadGamepadSettings: gamepadGamepadSettingsConstructor; + + interface gamepadGamepadSettingsProperties { + /** + * Use this property to explicitly select the gamepad device for map and scene navigation. If unspecified then all connected gamepads will be able to navigate. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#device) + * + * @default null + */ + device?: GamepadInputDeviceProperties; + /** + * Whether gamepad navigation is enabled on the View. If this is enabled, but no `device` is specified, the first supported one will be selected automatically. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#enabled) + * + * @default true + */ + enabled?: boolean; + /** + * This setting controls the behavior of forward and back movement of the left stick. If set to `pan`, movement will be at a constant altitude (panning the view forward and backward) whereas `zoom` will move the view in the viewing direction. Pan is best suited for exploring a scene as if on foot or in a car. Zoom mode provides great control to navigate the scene similar to a flight simulator. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#mode) + * + * @default pan + */ + mode?: "pan" | "zoom"; + /** + * Determines whether pressing the tilt axis forwards make the view tilt down (towards the nadir), or up (towards the zenith). The default behavior is to tilt the view down when pressing the stick that controls tilt forwards. **Possible Values:** forward-down | forward-up + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-gamepad-GamepadSettings.html#tiltDirection) + * + * @default forward-down + */ + tiltDirection?: "forward-down" | "forward-up"; + } + + interface Navigation extends Accessor { + /** + * Gamepad navigation specific configuration settings. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-navigation-Navigation.html#gamepad) + */ + readonly gamepad: gamepadGamepadSettings; + } + + interface NavigationConstructor { + + + new(properties?: NavigationProperties): Navigation; + } + + export const Navigation: NavigationConstructor; + + interface NavigationProperties { + + } + interface SceneView extends View, BreakpointsOwner { /** * Allows the view to be partially or fully transparent when composited with the webpage elements behind it. This property can only be set once at construction time. When alpha compositing is enabled, web scenes are less performant. It's important to set this property to `true` only when you need to apply transparency on the view. @@ -41499,7 +43901,7 @@ declare namespace __esri { */ center: Point; /** - * Represents an optional clipping area used to define the visible [extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) of a local scene. If defined, only data (including the basemap) within the area will be displayed. The `clippingArea` property only applies to [local](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode) scenes. ![scene-clipping-area](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-clipping-area.png%20%22Local%20scene%20with%20clippingArea%22) The clippingArea property contains an internal reference which may be modified in the future. To persist or modify the clippingArea, create a clone using [clippingArea.clone()](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html#clone). + * Represents an optional clipping area used to define the visible [extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) of a local scene. If defined, only data (including the basemap) within the area will be displayed. The `clippingArea` property only applies to [local](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode) scenes. ![scene-clipping-area](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-clipping-area.png%20%22Local%20scene%20with%20clippingArea%22) The clippingArea property contains an internal reference which may be modified in the future. To persist or modify the clippingArea, create a clone using [clippingArea.clone()](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html#clone). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clippingArea) */ @@ -41585,8 +43987,8 @@ declare namespace __esri { * * Value | Example | Description * ------|-------|------------ - * global | ![scene-global](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-global.png) | Global scenes allow the entire globe to render in the view, showing the curvature of the earth. - * local | ![scene-local](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-local.png) | Local scenes render the earth on a flat surface. They can be constrained to only show a "local" area by setting the [clippingArea](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clipplingArea) property. Local scenes also allow for displaying and exploring data that would otherwise be hidden by the surface of the earth. + * global | ![scene-global](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-global.png) | Global scenes allow the entire globe to render in the view, showing the curvature of the earth. + * local | ![scene-local](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-local.png) | Local scenes render the earth on a flat surface. They can be constrained to only show a "local" area by setting the [clippingArea](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clipplingArea) property. Local scenes also allow for displaying and exploring data that would otherwise be hidden by the surface of the earth. * * Depending on the viewing mode different [supported coordinate systems](esri-views-SceneView.html#supported-coordinate-systems) are available. * @@ -41639,11 +44041,11 @@ declare namespace __esri { * @param target.tilt The [Camera.tilt](https://developers.arcgis.com/javascript/latest/api-reference/esri-Camera.html#position) to go to. * @param target.position The [Camera.position](https://developers.arcgis.com/javascript/latest/api-reference/esri-Camera.html#position) to go to. * @param options View transition options. - * @param options.animate Indicates if the transition to the new view should be animated. + * @param options.animate Indicates if the transition to the new view should be animated. If set to false, `speedFactor`, `duration`, `maxDuration`, and `easing` properties are ignored. * @param options.speedFactor Increases or decreases the animation speed by the specified factor. A speedFactor of 2 will make the animation twice as fast, while a speedFactor of 0.5 will make the animation half as fast. Setting the speed factor will automatically adapt the default maxDuration accordingly. * @param options.duration Set the exact duration (in milliseconds) of the animation. Note that by default, animation duration is calculated based on the time required to reach the target at a constant speed. Setting duration overrides the speedFactor option. Note that the resulting duration is still limited to the maxDuration. * @param options.maxDuration The maximum allowed duration (in milliseconds) of the animation. The default maxDuration value takes the specified speedFactor into account. - * @param options.easing The easing function to use for the animation. This may either be a preset (named) function, or a user specified function. Supported named presets are: `linear`, `in-cubic`, `out-cubic`, `in-out-cubic`, `in-expo`, `out-expo`, `in-out-expo` By default, animations that are less than 1000 ms use an out easing function; longer animations use an in-out function. + * @param options.easing The easing function to use for the animation. This may either be a preset (named) function, or a user specified function. Supported named presets are: `linear`, `in-cubic`, `out-cubic`, `in-out-cubic`, `in-expo`, `out-expo`, `in-out-expo`, `in-out-coast-quadratic`. See [easing functions](https://easings.net/) for graphical representations of these functions. By default, animations that are less than 1000 ms use the `out-expo` easing function; longer animations use the `in-out-coast-quadratic` easing function. * */ goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | Camera | SceneViewGoToTarget, options?: SceneViewGoToOptions): IPromise; @@ -41671,12 +44073,26 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#on) * - * @param type The name of the event or the events to listen for. - * @param modifiersOrHandler Additional modifier keys to filter the events by. Alternatively, if no modifiers are required, the function to call when the event is fired. - * @param handler? The function to call when the event is fired, if modifiers were specified. + * @param type The name of the event or events to listen for. + * @param modifiersOrHandler Additional modifier keys to filter events. Please see [Key Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) for possible values. All the standard key values are supported. Alternatively, if no modifiers are required, the function will call when the event fires. The following events don't support modifier keys: `blur`, `focus`, `layerview-create`, `layerview-destroy`, `resize`. + * @param handler The function to call when the event is fired, if modifiers were specified. * */ on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle; + /** + * Create a screenshot of the current view. Screenshots include only elements that are rendered on the canvas (all geographical elements), but excludes overlayed DOM elements (UI, popups, measurement labels, etc.). By default, a screenshot of the whole view is created. Different options allow for creating different types of screenshots, including taking screenshots at different aspect ratios, different resolutions and creating thumbnails. Screenshots are always taken inside the padded area of the view (see [padding](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#padding)). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + * + * @param options Screenshot options. + * @param options.format The format of the resulting encoded data url. **Possible values**: jpg | png. + * @param options.quality The quality (0 to 100) of the encoded image when encoding as `jpg`. + * @param options.width The width of the screenshot (defaults to the area width). The height will be derived automatically if left unspecified, according to the aspect ratio of the of the screenshot area. + * @param options.height The height of the screenshot (defaults to the area height). The width will be derived automatically if left unspecified, according to the aspect ratio of the screenshot area. + * @param options.area Specifies whether to take a screenshot of a specific area of the view. The area coordinates are relative to the origin of the padded view (see [padding](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#padding)) and will be clipped to the view size. Defaults to the whole view (padding excluded). + * + */ + takeScreenshot(options?: SceneViewTakeScreenshotOptions): IPromise; /** * Converts the given screen point to a [map point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html). * @@ -41810,7 +44226,7 @@ declare namespace __esri { */ center?: PointProperties | number[]; /** - * Represents an optional clipping area used to define the visible [extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) of a local scene. If defined, only data (including the basemap) within the area will be displayed. The `clippingArea` property only applies to [local](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode) scenes. ![scene-clipping-area](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-clipping-area.png%20%22Local%20scene%20with%20clippingArea%22) The clippingArea property contains an internal reference which may be modified in the future. To persist or modify the clippingArea, create a clone using [clippingArea.clone()](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html#clone). + * Represents an optional clipping area used to define the visible [extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html) of a local scene. If defined, only data (including the basemap) within the area will be displayed. The `clippingArea` property only applies to [local](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#viewingMode) scenes. ![scene-clipping-area](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-clipping-area.png%20%22Local%20scene%20with%20clippingArea%22) The clippingArea property contains an internal reference which may be modified in the future. To persist or modify the clippingArea, create a clone using [clippingArea.clone()](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html#clone). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clippingArea) */ @@ -41896,8 +44312,8 @@ declare namespace __esri { * * Value | Example | Description * ------|-------|------------ - * global | ![scene-global](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-global.png) | Global scenes allow the entire globe to render in the view, showing the curvature of the earth. - * local | ![scene-local](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-local.png) | Local scenes render the earth on a flat surface. They can be constrained to only show a "local" area by setting the [clippingArea](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clipplingArea) property. Local scenes also allow for displaying and exploring data that would otherwise be hidden by the surface of the earth. + * global | ![scene-global](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-global.png) | Global scenes allow the entire globe to render in the view, showing the curvature of the earth. + * local | ![scene-local](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-local.png) | Local scenes render the earth on a flat surface. They can be constrained to only show a "local" area by setting the [clippingArea](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clipplingArea) property. Local scenes also allow for displaying and exploring data that would otherwise be hidden by the surface of the earth. * * Depending on the viewing mode different [supported coordinate systems](esri-views-SceneView.html#supported-coordinate-systems) are available. * @@ -42510,8 +44926,8 @@ declare namespace __esri { * * Known Value | Example * ------------|--------- - * low | ![scene-atmosphere](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-atmosphere.png) - * high | ![scene-atmosphere](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-atmosphere-realistic.png) + * low | ![scene-atmosphere](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-atmosphere.png) + * high | ![scene-atmosphere](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-atmosphere-realistic.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#environment) @@ -42527,8 +44943,8 @@ declare namespace __esri { * * Known Value | Example * ------------|--------- - * low | ![scene-atmosphere](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-atmosphere.png) - * high | ![scene-atmosphere](https://developers.arcgis.com/javascript/latest/assets/img/apiref/views/scene-atmosphere-realistic.png) + * low | ![scene-atmosphere](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-atmosphere.png) + * high | ![scene-atmosphere](https://developers.arcgis.com/javascript/assets/img/apiref/views/scene-atmosphere-realistic.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#environment) @@ -42612,7 +45028,7 @@ declare namespace __esri { export interface SceneViewGoToOptions extends Object { /** - * Indicates if the transition to the new view should be animated. + * Indicates if the transition to the new view should be animated. If set to false, `speedFactor`, `duration`, `maxDuration`, and `easing` properties are ignored. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#goTo) * @@ -42642,7 +45058,7 @@ declare namespace __esri { */ maxDuration?: number; /** - * The easing function to use for the animation. This may either be a preset (named) function, or a user specified function. Supported named presets are: `linear`, `in-cubic`, `out-cubic`, `in-out-cubic`, `in-expo`, `out-expo`, `in-out-expo` By default, animations that are less than 1000 ms use an out easing function; longer animations use an in-out function. + * The easing function to use for the animation. This may either be a preset (named) function, or a user specified function. Supported named presets are: `linear`, `in-cubic`, `out-cubic`, `in-out-cubic`, `in-expo`, `out-expo`, `in-out-expo`, `in-out-coast-quadratic`. See [easing functions](https://easings.net/) for graphical representations of these functions. By default, animations that are less than 1000 ms use the `out-expo` easing function; longer animations use the `in-out-coast-quadratic` easing function. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#goTo) */ @@ -42767,6 +45183,72 @@ declare namespace __esri { } + export interface SceneViewTakeScreenshotOptions extends Object { + /** + * The format of the resulting encoded data url. **Possible values**: jpg | png. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + * + * @default jpg + */ + format?: string; + /** + * The quality (0 to 100) of the encoded image when encoding as `jpg`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + * + * @default 98 + */ + quality?: number; + /** + * The width of the screenshot (defaults to the area width). The height will be derived automatically if left unspecified, according to the aspect ratio of the of the screenshot area. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + */ + width?: number; + /** + * The height of the screenshot (defaults to the area height). The width will be derived automatically if left unspecified, according to the aspect ratio of the screenshot area. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + */ + height?: number; + /** + * Specifies whether to take a screenshot of a specific area of the view. The area coordinates are relative to the origin of the padded view (see [padding](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#padding)) and will be clipped to the view size. Defaults to the whole view (padding excluded). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + */ + area?: SceneViewTakeScreenshotOptionsArea; + } + + + export interface SceneViewTakeScreenshotOptionsArea extends Object { + /** + * The x coordinate of the area. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + */ + x?: number; + /** + * The y coordinate of the area. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + */ + y?: number; + /** + * The width of the area. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + */ + width?: number; + /** + * The height of the area. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) + */ + height?: number; + } + + export interface SceneViewToMapScreenPoint extends Object { /** * The horizontal screen coordinate to convert. @@ -42782,6 +45264,26 @@ declare namespace __esri { y: number; } + /** + * Object returned when [takeScreenshot()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#takeScreenshot) promise resolves: + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#Screenshot) + */ + export interface Screenshot extends Object { + /** + * A data url representing the screenshot. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#Screenshot) + */ + dataUrl: string; + /** + * The raw RGBA image data. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#Screenshot) + */ + data: ImageData; + } + export interface SceneViewDragEventOrigin extends Object { @@ -43033,6 +45535,12 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#groundView) */ readonly groundView: GroundView; + /** + * Options to configure input handling of the View. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#input) + */ + readonly input: Input; /** * Indication whether the view is being interacted with (for example when panning). * @@ -43053,6 +45561,12 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#map) */ map: Map; + /** + * Options to configure the navigation behavior of the View. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#navigation) + */ + readonly navigation: Navigation; /** * Use the padding property to make the [center](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#center), and [extent](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#extent), etc. work off a subsection of the full view. This is particularly useful when layering UI elements or semi-transparent content on top of portions of the view. See the [view padding sample](https://developers.arcgis.com/javascript/latest/sample-code/view-padding/index.html) for an example of how this works. * @@ -43075,6 +45589,12 @@ declare namespace __esri { * @default false */ readonly ready: boolean; + /** + * Represents the current value of one pixel in the unit of the view's [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#spatialReference). The value of resolution is calculated by dividing the view's [extent width](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html#width) by [its width](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#width). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#resolution) + */ + readonly resolution: number; /** * The spatial reference of the view. This indicates the [Projected Coordinate System](https://developers.arcgis.com/rest/services-reference/projected-coordinate-systems.htm) or the [Geographic Coordinate System](https://developers.arcgis.com/rest/services-reference/geographic-coordinate-systems.htm) used to locate geographic features in the map. In a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) the following [supported coordinate systems](esri-views-SceneView.html#supported-coordinate-systems) are available. The spatial reference can either be set explicitly or automatically derived from the following: * * In the case of a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html), if the [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#map) is a [WebScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html) instance, the [WebScene.initialViewProperties.spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#initialViewProperties) is used. @@ -43289,7 +45809,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html#bookmarks) */ - bookmarks: any[]; + bookmarks: Collection; /** * The initial view of the WebMap. This object contains properties such as [viewpoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-InitialViewProperties.html#viewpoint), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-InitialViewProperties.html#spatialReference), that should be applied to the view when the WebMap loads. * @@ -43367,6 +45887,14 @@ declare namespace __esri { * */ load(): IPromise; + /** + * Loads all the externally loadable resources associated with the webmap. For the webmap this will load the ground, basemap and layers. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html#loadAll) + * + * + */ + loadAll(): IPromise; } interface WebMapConstructor { @@ -43393,7 +45921,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html#bookmarks) */ - bookmarks?: any[]; + bookmarks?: CollectionProperties; /** * The initial view of the WebMap. This object contains properties such as [viewpoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-InitialViewProperties.html#viewpoint), [spatialReference](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-InitialViewProperties.html#spatialReference), that should be applied to the view when the WebMap loads. * @@ -43426,6 +45954,66 @@ declare namespace __esri { widgets?: any; } + interface Bookmark extends Accessor { + /** + * The extent of the specified bookmark item. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html#extent) + */ + extent: Extent; + /** + * The name of the bookmark item. Used as a label in the [Bookmarks](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks.html) widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html#name) + */ + name: string; + /** + * The URL for a thumbnail image. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html#thumbnail) + */ + thumbnail: BookmarkThumbnail; + } + + interface BookmarkConstructor { + + + new(properties?: BookmarkProperties): Bookmark; + } + + export const Bookmark: BookmarkConstructor; + + interface BookmarkProperties { + /** + * The extent of the specified bookmark item. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html#extent) + */ + extent?: ExtentProperties; + /** + * The name of the bookmark item. Used as a label in the [Bookmarks](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks.html) widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html#name) + */ + name?: string; + /** + * The URL for a thumbnail image. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html#thumbnail) + */ + thumbnail?: BookmarkThumbnail; + } + + + export interface BookmarkThumbnail extends Object { + /** + * URL to a thumbnail to display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html#thumbnail) + */ + url?: string; + } + interface InitialViewProperties extends Accessor, corePromise { /** * The spatial reference of the [WebMap](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html). This indicates the [Projected Coordinate System](https://developers.arcgis.com/rest/services-reference/projected-coordinate-systems.htm) or the [Geographic Coordinate System](https://developers.arcgis.com/rest/services-reference/geographic-coordinate-systems.htm) used to locate geographic features in the map. @@ -43572,6 +46160,12 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#sourceVersion) */ readonly sourceVersion: WebSceneSourceVersion; + /** + * The URL to the thumbnail used for the web scene. The thumbnail will by default be the thumbnail URL from the portal item associated to the web scene. The thumbnail of the web scene may be updated by changing the thumbnail URL and saving the web scene. Use #updateFrom to update the thumbnail automatically from a specified view. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#thumbnailUrl) + */ + thumbnailUrl: string; /** * Triggers the loading of the WebScene instance. A WebScene is considered [loaded](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#loaded) when its [operational layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#layers), [basemap](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#basemap) and [ground](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#ground) are fully created. When created with a [portalItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#portalItem), `load()` will first fetch its data to create the content, otherwise it resolves immediately. The [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) automatically calls the `load()` method when a WebScene instance is added to its [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#map) property so it can display in the view and load each individual layer. If the WebScene is used outside of a view, for example to preload it, you must call `load()` explicitly to interact with its resources. @@ -43581,6 +46175,14 @@ declare namespace __esri { * */ load(): IPromise; + /** + * Loads all the externally loadable resources associated with the webscene. For the webscene this will load the ground, basemap, layers and slide basemaps. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#loadAll) + * + * + */ + loadAll(): IPromise; /** * Saves the webscene to its associated portal item. The portal item to save to must already exist and be valid. This is a convenience method that will use [PortalItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-PortalItem.html#update) to store the webscene in the item. The web scene is saved according to [web scene specification](https://developers.arcgis.com/web-scene-specification/) standards. Use [updateFrom](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) to store the current view properties in the webscene before saving it. Note that this saves the webscene to its existing item. Depending on how the scene is shared, users that do not own the scene may modify it. To save an existing scene as a new item owned by the user signed into the portal instance, use [saveAs()](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#saveAs). The webscene will be automatically loaded if it is not already before saving. * @@ -43612,17 +46214,19 @@ declare namespace __esri { */ toJSON(): any; /** - * Update properties of the WebScene related to the view. This should usually be called just before saving a scene. The following properties are updated from the view: 1. `initialViewProperties.spatialReference` 2. `initialViewProperties.viewingMode` 3. `clippingArea` 4. `heightModelInfo` Depending on the provided options, the following properties are also updated: 1. `initialViewProperties.environment` 1. `initialViewProperties.viewpoint` + * Update properties of the WebScene related to the view. This should usually be called just before saving a scene. The following properties are updated from the view: 1. `initialViewProperties.spatialReference` 2. `initialViewProperties.viewingMode` 3. `clippingArea` 4. `heightModelInfo` Depending on the provided options, the following properties are also updated: 1. `initialViewProperties.environment` 2. `initialViewProperties.viewpoint` 3. `thumbnail` * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) * * @param view the view to update from. * @param options update options. - * @param options.environmentExcluded update the initial environment from the view, defaults to false. - * @param options.viewpointExcluded update the initial viewpoint from the view, defaults to false. + * @param options.environmentExcluded do not update the initial environment from the view, defaults to false. + * @param options.viewpointExcluded do not update the initial viewpoint from the view, defaults to false. + * @param options.thumbnailExcluded do not update the thumbnail from the view, defaults to viewpointExcluded. + * @param options.thumbnailSize the size of the thumbnail. Defaults to 600x400 (ratio 1.5:1). Note that the thumbnail size may currently not be larger than the size of the view. * */ - updateFrom(view: SceneView, options?: WebSceneUpdateFromOptions): void; + updateFrom(view: SceneView, options?: WebSceneUpdateFromOptions): IPromise; } interface WebSceneConstructor { @@ -43693,6 +46297,12 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#presentation) */ presentation?: PresentationProperties; + /** + * The URL to the thumbnail used for the web scene. The thumbnail will by default be the thumbnail URL from the portal item associated to the web scene. The thumbnail of the web scene may be updated by changing the thumbnail URL and saving the web scene. Use #updateFrom to update the thumbnail automatically from a specified view. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#thumbnailUrl) + */ + thumbnailUrl?: string; } interface ApplicationProperties extends Accessor { @@ -44026,7 +46636,7 @@ declare namespace __esri { */ atmosphereEnabled: boolean; /** - * Specifies how the background of the scene (which lies behind sky, stars and atmosphere) should be displayed. By default this is simply a single, fully opaque, black color. + * Specifies how the background of the scene (which lies behind sky, stars and atmosphere) should be displayed. The default value of `null` displays a single, fully opaque, black color. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Environment.html#background) * @@ -44076,7 +46686,7 @@ declare namespace __esri { */ atmosphereEnabled?: boolean; /** - * Specifies how the background of the scene (which lies behind sky, stars and atmosphere) should be displayed. By default this is simply a single, fully opaque, black color. + * Specifies how the background of the scene (which lies behind sky, stars and atmosphere) should be displayed. The default value of `null` displays a single, fully opaque, black color. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Environment.html#background) * @@ -44286,16 +46896,16 @@ declare namespace __esri { * * Value | Description * ------|------------ - * streets | ![basemap-streets](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets.jpg) - * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/satellite.jpg) - * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/hybrid.jpg) - * topo | ![basemap-topo](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/topo.jpg) - * gray | ![basemap-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/gray.jpg) - * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/dark-gray.jpg) - * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/oceans.jpg) - * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/national-geographic.jpg) - * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/terrain.jpg) - * osm | ![basemap-osm](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/osm.jpg) + * streets | ![basemap-streets](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets.jpg) + * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/satellite.jpg) + * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/hybrid.jpg) + * topo | ![basemap-topo](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/topo.jpg) + * gray | ![basemap-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/gray.jpg) + * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/dark-gray.jpg) + * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/oceans.jpg) + * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/national-geographic.jpg) + * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/terrain.jpg) + * osm | ![basemap-osm](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/osm.jpg) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#basemap) @@ -44422,16 +47032,16 @@ declare namespace __esri { * * Value | Description * ------|------------ - * streets | ![basemap-streets](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/streets.jpg) - * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/satellite.jpg) - * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/hybrid.jpg) - * topo | ![basemap-topo](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/topo.jpg) - * gray | ![basemap-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/gray.jpg) - * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/dark-gray.jpg) - * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/oceans.jpg) - * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/national-geographic.jpg) - * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/terrain.jpg) - * osm | ![basemap-osm](https://developers.arcgis.com/javascript/latest/assets/img/apiref/basemap/osm.jpg) + * streets | ![basemap-streets](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/streets.jpg) + * satellite | ![basemap-satellite](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/satellite.jpg) + * hybrid | ![basemap-hybrid](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/hybrid.jpg) + * topo | ![basemap-topo](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/topo.jpg) + * gray | ![basemap-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/gray.jpg) + * dark-gray | ![basemap-dark-gray](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/dark-gray.jpg) + * oceans | ![basemap-oceans](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/oceans.jpg) + * national-geographic | ![basemap-national-geographic](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/national-geographic.jpg) + * terrain | ![basemap-terrain](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/terrain.jpg) + * osm | ![basemap-osm](https://developers.arcgis.com/javascript/assets/img/apiref/basemap/osm.jpg) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#basemap) @@ -44565,7 +47175,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#createFrom) * - * @default 112 + * @default 120 */ width?: number; /** @@ -44573,7 +47183,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#createFrom) * - * @default 61 + * @default 75 */ height?: number; } @@ -44764,17 +47374,45 @@ declare namespace __esri { export interface WebSceneUpdateFromOptions extends Object { /** - * update the initial environment from the view, defaults to false. + * do not update the initial environment from the view, defaults to false. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) */ environmentExcluded?: boolean; /** - * update the initial viewpoint from the view, defaults to false. + * do not update the initial viewpoint from the view, defaults to false. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) */ viewpointExcluded?: boolean; + /** + * do not update the thumbnail from the view, defaults to viewpointExcluded. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) + */ + thumbnailExcluded?: boolean; + /** + * the size of the thumbnail. Defaults to 600x400 (ratio 1.5:1). Note that the thumbnail size may currently not be larger than the size of the view. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) + */ + thumbnailSize?: WebSceneUpdateFromOptionsThumbnailSize; + } + + + export interface WebSceneUpdateFromOptionsThumbnailSize extends Object { + /** + * the width of the thumbnail. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) + */ + width: number; + /** + * the height of the thumbnail. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html#updateFrom) + */ + height: number; } interface AreaMeasurement3D extends Widget { @@ -44853,10 +47491,10 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-AreaMeasurement3D.html#viewModel) */ - viewModel?: AreaMeasurement3DViewModel; + viewModel?: AreaMeasurement3DViewModelProperties; } - interface AreaMeasurement3DViewModel { + interface AreaMeasurement3DViewModel extends Accessor { /** * The current measurement of the area. * @@ -44912,12 +47550,34 @@ declare namespace __esri { interface AreaMeasurement3DViewModelConstructor { - - new(properties?: any): AreaMeasurement3DViewModel; + new(properties?: AreaMeasurement3DViewModelProperties): AreaMeasurement3DViewModel; } export const AreaMeasurement3DViewModel: AreaMeasurement3DViewModelConstructor; + interface AreaMeasurement3DViewModelProperties { + /** + * Unit system (imperial, metric) or specific unit used for displaying the distance values. **Possible Values:** imperial | metric | square-inches | square-feet | square-yards | square-miles | square-meters | square-kilometers | square-us-feet | acres | ares | hectares + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-AreaMeasurement3D-AreaMeasurement3DViewModel.html#unit) + */ + unit?: string; + /** + * List of unit systems (imperial, metric) and specific units for displaying the area values. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-AreaMeasurement3D-AreaMeasurement3DViewModel.html#unitOptions) + * + * @default ["metric", "imperial", "square-inches", "square-feet", "square-yards", "square-miles", "square-us-feet", "square-meters", "square-kilometers", "acres", "ares", "hectares"] + */ + unitOptions?: string[]; + /** + * The view from which the widget will operate. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-AreaMeasurement3D-AreaMeasurement3DViewModel.html#view) + */ + view?: SceneViewProperties; + } + export interface AreaMeasurement3DViewModelMeasurement extends Object { /** @@ -45049,10 +47709,10 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Attribution.html#viewModel) */ - viewModel?: AttributionViewModel; + viewModel?: AttributionViewModelProperties; } - interface AttributionViewModel { + interface AttributionViewModel extends Accessor { /** * A collection of [AttributionItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Attribution-AttributionViewModel.html#AttributionItem)s. * @@ -45082,12 +47742,20 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Attribution-AttributionViewModel.html) */ - - new(properties?: any): AttributionViewModel; + new(properties?: AttributionViewModelProperties): AttributionViewModel; } export const AttributionViewModel: AttributionViewModelConstructor; + interface AttributionViewModelProperties { + /** + * The view from which the view model will operate. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Attribution-AttributionViewModel.html#view) + */ + view?: MapViewProperties | SceneViewProperties; + } + /** * The following properties define an attribution item that contains the attribution text for a layer. * @@ -45612,11 +48280,11 @@ declare namespace __esri { interface Bookmarks extends Widget, GoTo { /** - * A collection of [Bookmark](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html)s. + * A collection of [Bookmark](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html)s. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks.html#bookmarks) */ - bookmarks: Collection; + readonly bookmarks: Collection; /** * The widget's default CSS icon class. * @@ -45663,7 +48331,7 @@ declare namespace __esri { interface BookmarksConstructor { /** - * The Bookmarks widget allows end users to quickly navigate to a particular area of interest. It displays a list of bookmarks, which typically are defined inside the [WebMap](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html#bookmarks). + * The Bookmarks widget allows end users to quickly navigate to a particular area of interest. It displays a list of [bookmarks](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html), which typically are defined inside the [WebMap](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html#bookmarks). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks.html) */ @@ -45674,12 +48342,6 @@ declare namespace __esri { export const Bookmarks: BookmarksConstructor; interface BookmarksProperties extends WidgetProperties, GoToProperties { - /** - * A collection of [Bookmark](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html)s. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks.html#bookmarks) - */ - bookmarks?: CollectionProperties; /** * The view from which the widget will operate. * @@ -45694,61 +48356,19 @@ declare namespace __esri { viewModel?: BookmarksViewModelProperties; } - interface Bookmark { - /** - * The `active` property is true while goTo() is animating. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html#active) - * - * @default false - */ - active: boolean; - /** - * The extent of the specified bookmark item. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html#extent) - */ - extent: Extent; - /** - * The name of the bookmark item. Used as a label in the [Bookmarks](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks.html) widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html#name) - */ - name: string; - /** - * The URL for a thumbnail image. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html#thumbnail) - */ - thumbnail: BookmarkThumbnail; - } - - interface BookmarkConstructor { - - - - new(properties?: any): Bookmark; - } - - export const Bookmark: BookmarkConstructor; - - - export interface BookmarkThumbnail extends Object { - /** - * URL to a thumbnail to display. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html#thumbnail) - */ - url?: string; - } - interface BookmarksViewModel extends Accessor, GoTo { /** - * A collection of [Bookmark](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html)s. + * The [Bookmark](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html) that is being navigated to. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-BookmarksViewModel.html#activeBookmark) + */ + readonly activeBookmark: Bookmark; + /** + * A collection of [Bookmark](https://developers.arcgis.com/javascript/latest/api-reference/esri-webmap-Bookmark.html)s. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-BookmarksViewModel.html#bookmarks) */ - bookmarks: Collection; + readonly bookmarks: Collection; /** * The view model's state. **Possible Values:** loading | disabled * @@ -45784,12 +48404,6 @@ declare namespace __esri { export const BookmarksViewModel: BookmarksViewModelConstructor; interface BookmarksViewModelProperties extends GoToProperties { - /** - * A collection of [Bookmark](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-Bookmark.html)s. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Bookmarks-BookmarksViewModel.html#bookmarks) - */ - bookmarks?: CollectionProperties; /** * The view from which the widget will operate. * @@ -47399,7 +50013,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Directions.html#SearchProperties) */ - sources?: Collection; + sources?: Collection; /** * Indicates whether to display suggestions as the user enters input text in the widget. * @@ -47496,10 +50110,10 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-DirectLineMeasurement3D.html#viewModel) */ - viewModel?: DirectLineMeasurement3DViewModel; + viewModel?: DirectLineMeasurement3DViewModelProperties; } - interface DirectLineMeasurement3DViewModel { + interface DirectLineMeasurement3DViewModel extends Accessor { /** * The current measurement calculated between the two points. * @@ -47555,12 +50169,34 @@ declare namespace __esri { interface DirectLineMeasurement3DViewModelConstructor { - - new(properties?: any): DirectLineMeasurement3DViewModel; + new(properties?: DirectLineMeasurement3DViewModelProperties): DirectLineMeasurement3DViewModel; } export const DirectLineMeasurement3DViewModel: DirectLineMeasurement3DViewModelConstructor; + interface DirectLineMeasurement3DViewModelProperties { + /** + * Unit system (imperial, metric) or specific unit used for displaying the distance values. **Possible Values:** imperial | metric | inches | feet | yards | miles | nautical-miles | meters | kilometers | us-feet + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-DirectLineMeasurement3D-DirectLineMeasurement3DViewModel.html#unit) + */ + unit?: string; + /** + * List of unit systems (imperial, metric) and specific units for displaying the distance values. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-DirectLineMeasurement3D-DirectLineMeasurement3DViewModel.html#unitOptions) + * + * @default ["metric", "imperial", "inches", "feet", "yards", "miles", "nautical-miles", "us-feet", "meters", "kilometers"] + */ + unitOptions?: string[]; + /** + * The view from which the widget will operate. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-DirectLineMeasurement3D-DirectLineMeasurement3DViewModel.html#view) + */ + view?: SceneViewProperties; + } + export interface DirectLineMeasurement3DViewModelMeasurement extends Object { /** @@ -47645,13 +50281,13 @@ declare namespace __esri { */ content: Node | string | Widget; /** - * Whether the widget is currently expanded or not. + * Indicates whether the widget is currently expanded or not. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#expanded) * * @default false */ - readonly expanded: boolean; + expanded: boolean; /** * Icon font used to style the Expand button. Will automatically use the [content's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#content) iconClass if it has one. * @@ -47673,7 +50309,7 @@ declare namespace __esri { */ group: string; /** - * A number to display at the corner of the widget to indicate the number of, for example, open issues or unread notices. ![expand widget icon number](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/expand-with-iconnumber.png) + * A number to display at the corner of the widget to indicate the number of, for example, open issues or unread notices. ![expand widget icon number](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/expand-with-iconnumber.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#iconNumber) */ @@ -47777,6 +50413,14 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#content) */ content?: Node | string | WidgetProperties; + /** + * Indicates whether the widget is currently expanded or not. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#expanded) + * + * @default false + */ + expanded?: boolean; /** * Icon font used to style the Expand button. Will automatically use the [content's](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#content) iconClass if it has one. * @@ -47798,7 +50442,7 @@ declare namespace __esri { */ group?: string; /** - * A number to display at the corner of the widget to indicate the number of, for example, open issues or unread notices. ![expand widget icon number](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/expand-with-iconnumber.png) + * A number to display at the corner of the widget to indicate the number of, for example, open issues or unread notices. ![expand widget icon number](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/expand-with-iconnumber.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#iconNumber) */ @@ -48101,6 +50745,513 @@ declare namespace __esri { content?: any; } + interface FeatureForm extends Widget { + /** + * The associated feature containing the editable attributes. A common way to access this is via the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest) or [SceneView's](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#hitTest) `hitTest()` method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#feature) + */ + feature: Graphic; + /** + * Array of field configuration objects. This is where you specify what fields to display and how you wish to display them. + * > When not set, all fields except for `editor`, `globalID`, and `objectID` fields will be included, otherwise it is up to the developer to set the right field(s) to override and display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#fieldConfig) + */ + fieldConfig: FieldConfig[]; + /** + * Layer containing the editable feature attributes. If this layer is not specified, it is the same as the [graphic's layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#layer). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#layer) + */ + layer: FeatureLayer; + /** + * The view model for this widget. This is a class that contains all the logic (properties and methods) that controls this widget's behavior. See the [FeatureFormViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html) class to access all properties and methods on the widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#viewModel) + */ + viewModel: FeatureFormViewModel; + + /** + * Returns all of the field values, regardless of whether or not they were updated. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#getValues) + * + * + */ + getValues(): any; + /** + * *This method is primarily used by developers when implementing custom widgets.* It must be implemented by subclasses for rendering. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#render) + * + * + */ + render(): any; + /** + * Fires the [submit](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#event:submit) event. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#submit) + * + * + */ + submit(): void; + } + + interface FeatureFormConstructor { + /** + * The FeatureForm widget displays attributes of a feature. This widget renders input fields based on the feature's attributes and whether the field allows editing. Use this widget, in combination with [FeatureLayer.applyEdits](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits), to enable an end user to update a feature's attribute on a specified editable feature layer(s). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html) + */ + + new(properties?: FeatureFormProperties): FeatureForm; + } + + export const FeatureForm: FeatureFormConstructor; + + interface FeatureFormProperties extends WidgetProperties { + /** + * The associated feature containing the editable attributes. A common way to access this is via the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest) or [SceneView's](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#hitTest) `hitTest()` method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#feature) + */ + feature?: GraphicProperties; + /** + * Array of field configuration objects. This is where you specify what fields to display and how you wish to display them. + * > When not set, all fields except for `editor`, `globalID`, and `objectID` fields will be included, otherwise it is up to the developer to set the right field(s) to override and display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#fieldConfig) + */ + fieldConfig?: FieldConfigProperties[]; + /** + * Layer containing the editable feature attributes. If this layer is not specified, it is the same as the [graphic's layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#layer). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#layer) + */ + layer?: FeatureLayerProperties; + /** + * The view model for this widget. This is a class that contains all the logic (properties and methods) that controls this widget's behavior. See the [FeatureFormViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html) class to access all properties and methods on the widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html#viewModel) + */ + viewModel?: FeatureFormViewModelProperties; + } + + interface FeatureFormViewModel extends Accessor, Evented { + /** + * The associated feature containing the editable attributes. A common way to access this is via the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest) or [SceneView's](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#hitTest) `hitTest()` method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#feature) + */ + feature: Graphic; + /** + * Array of field configuration objects. This is where you specify what fields to display and how you wish to display them. + * > When not set, all fields except for `editor`, `globalID`, and `objectID` fields will be included, otherwise it is up to the developer to set the right field(s) to override and display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#fieldConfig) + */ + fieldConfig: FieldConfig[]; + /** + * The input fields to be rendered by the [FeatureForm](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html) widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#inputField) + */ + readonly inputField: InputField[]; + /** + * Layer containing the editable feature attributes. If this layer is not specified, it is the same as the [graphic's layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#layer). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#layer) + */ + layer: FeatureLayer; + /** + * The widget's state. Possible values are in the table below. + * + * Value | Description + * ------|------------ + * ready | Dependencies are met and has valid property values. + * disabled | Dependencies are missing and cannot provide valid inputs. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#state) + * + * @default disabled + */ + readonly state: string; + + /** + * Returns all of the field values, regardless of whether or not they were updated. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#getValues) + * + * + */ + getValues(): any; + /** + * Fires the [submit](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#event:submit) event. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#submit) + * + * + */ + submit(): void; + } + + interface FeatureFormViewModelConstructor { + /** + * Provides the logic for the [FeatureForm](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html) widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html) + */ + + new(properties?: FeatureFormViewModelProperties): FeatureFormViewModel; + } + + export const FeatureFormViewModel: FeatureFormViewModelConstructor; + + interface FeatureFormViewModelProperties { + /** + * The associated feature containing the editable attributes. A common way to access this is via the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest) or [SceneView's](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#hitTest) `hitTest()` method. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#feature) + */ + feature?: GraphicProperties; + /** + * Array of field configuration objects. This is where you specify what fields to display and how you wish to display them. + * > When not set, all fields except for `editor`, `globalID`, and `objectID` fields will be included, otherwise it is up to the developer to set the right field(s) to override and display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#fieldConfig) + */ + fieldConfig?: FieldConfigProperties[]; + /** + * Layer containing the editable feature attributes. If this layer is not specified, it is the same as the [graphic's layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#layer). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FeatureFormViewModel.html#layer) + */ + layer?: FeatureLayerProperties; + } + + interface FieldConfig extends Accessor { + /** + * The field name. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldConfig.html#name) + */ + name: string; + /** + * The field options. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldConfig.html#options) + */ + options: FieldOptions; + } + + interface FieldConfigConstructor { + + + new(properties?: FieldConfigProperties): FieldConfig; + } + + export const FieldConfig: FieldConfigConstructor; + + interface FieldConfigProperties { + /** + * The field name. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldConfig.html#name) + */ + name?: string; + /** + * The field options. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldConfig.html#options) + */ + options?: FieldOptionsProperties; + } + + interface FieldOptions extends Accessor { + /** + * The field's description. The description is shown below the field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#description) + */ + description: string; + /** + * The field's domain. This is used to constrain the allowable values of the layer. + * > This only applies to relevant field types. For example, [RangeDomain](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RangeDomain.html) only applies to `numeric` and `date` field types. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#domain) + */ + domain: CodedValueDomain | RangeDomain; + /** + * Indicates whether the field is editable. + * > This does not change the underlying service's field and whether it is editable. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#editable) + * + * @default true + */ + editable: boolean; + /** + * The type of editor to use for `string` field types. Possible values are in the table below. + * + * Value | Description + * ------|------------ + * text-box | An HTML textbox will be used to capture input. + * text-area | An HTML textarea will be used to capture input. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#editorType) + * + * @default "text-box" + */ + editorType: string; + /** + * This property is rendered as a tooltip in the [FeatureForm](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html) widget. It displays a hint for the attribute field's value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#hint) + */ + hint: string; + /** + * The field's label. The label is shown above the field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#label) + */ + label: string; + /** + * Restricts the input length. + * > This only applies to `numeric` and `text` field types. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#maxLength) + * + * @default -1 + */ + maxLength: number; + /** + * Indicates whether the field is required. + * > This cannot change the underlying service's field requirements. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#required) + * + * @default false + */ + required: boolean; + /** + * When `true`, the field is displayed. Otherwise, it is hidden. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#visible) + * + * @default true + */ + visible: boolean; + } + + interface FieldOptionsConstructor { + + + new(properties?: FieldOptionsProperties): FieldOptions; + } + + export const FieldOptions: FieldOptionsConstructor; + + interface FieldOptionsProperties { + /** + * The field's description. The description is shown below the field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#description) + */ + description?: string; + /** + * The field's domain. This is used to constrain the allowable values of the layer. + * > This only applies to relevant field types. For example, [RangeDomain](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-RangeDomain.html) only applies to `numeric` and `date` field types. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#domain) + */ + domain?: CodedValueDomainProperties | RangeDomainProperties; + /** + * Indicates whether the field is editable. + * > This does not change the underlying service's field and whether it is editable. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#editable) + * + * @default true + */ + editable?: boolean; + /** + * The type of editor to use for `string` field types. Possible values are in the table below. + * + * Value | Description + * ------|------------ + * text-box | An HTML textbox will be used to capture input. + * text-area | An HTML textarea will be used to capture input. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#editorType) + * + * @default "text-box" + */ + editorType?: string; + /** + * This property is rendered as a tooltip in the [FeatureForm](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm.html) widget. It displays a hint for the attribute field's value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#hint) + */ + hint?: string; + /** + * The field's label. The label is shown above the field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#label) + */ + label?: string; + /** + * Restricts the input length. + * > This only applies to `numeric` and `text` field types. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#maxLength) + * + * @default -1 + */ + maxLength?: number; + /** + * Indicates whether the field is required. + * > This cannot change the underlying service's field requirements. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#required) + * + * @default false + */ + required?: boolean; + /** + * When `true`, the field is displayed. Otherwise, it is hidden. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldOptions.html#visible) + * + * @default true + */ + visible?: boolean; + } + + interface InputField extends Accessor { + /** + * The field's description. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#description) + */ + readonly description: string; + /** + * The input value's domain. This is used to constrain the allowable values of the layer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#domain) + */ + readonly domain: CodedValueDomain | RangeDomain; + /** + * When true, the field is editable. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#editable) + */ + readonly editable: boolean; + /** + * The type of editor used when working with `string` fields. Possible values are in the table below. + * + * Value | Description + * ------|------------ + * text-box | An HTML textbox used to capture input. + * text-area | An HTML textarea used to capture input. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#editorType) + * + * @default "text-box" + */ + readonly editorType: string; + /** + * If the input field's value is invalid, this property returns validation error code. Otherwise, it is `null`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#error) + */ + readonly error: string; + /** + * A user-friendly formatted error message based on the [validation error code](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#error). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#errorMessage) + */ + readonly errorMessage: string; + /** + * A hint for the field's value. This property is rendered as a tooltip. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#hint) + */ + readonly hint: string; + /** + * The field's label. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#label) + */ + readonly label: string; + /** + * Restricts the input length. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#maxLength) + */ + readonly maxLength: number; + /** + * The associated field name. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#name) + */ + readonly name: string; + /** + * Indicates whether the field is required. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#required) + */ + readonly required: boolean; + /** + * The type of input field. Possible values are listed below. + * + * Value | Description + * ------|------------ + * number | Input represents a number. + * text | Input represents text. + * date | Input represents a date. + * unsupported | The field represents an unsupported value. A `blob` field type is an example of this. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#type) + */ + readonly type: string; + /** + * When `true`, the input value is invalid. Otherwise, it is valid. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#valid) + */ + readonly valid: boolean; + /** + * The input's value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#value) + */ + readonly value: number | string | any; + /** + * When `true`, the field is displayed. Otherwise, it is hidden. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-InputField.html#visible) + */ + readonly visible: boolean; + } + + interface InputFieldConstructor { + + + new(properties?: InputFieldProperties): InputField; + } + + export const InputField: InputFieldConstructor; + + interface InputFieldProperties { + + } + interface Fullscreen extends Widget { /** * The [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) to present in fullscreen mode. @@ -48270,6 +51421,14 @@ declare namespace __esri { */ viewpoint: Viewpoint; + /** + * This function provides the ability to interrupt and cancel the process of navigating the view back to the view's initial extent. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Home.html#cancelGo) + * + * + */ + cancelGo(): void; /** * Animates the view to the initial Viewpoint of the view or the value of [viewpoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Home.html#viewpoint). * @@ -48351,6 +51510,14 @@ declare namespace __esri { */ viewpoint: Viewpoint; + /** + * This function provides the ability to interrupt and cancel the process of navigating the view back to the view's initial extent. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Home-HomeViewModel.html#cancelGo) + * + * + */ + cancelGo(): void; /** * Animates the view to the initial [Viewpoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-Viewpoint.html) of the view or the value of [viewpoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Home-HomeViewModel.html#viewpoint). * @@ -48413,7 +51580,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#operationalItems) */ - operationalItems: Collection; + readonly operationalItems: Collection; /** * Option for enabling status indicators, which indicate whether or not each layer is loading resources. * @@ -48470,12 +51637,6 @@ declare namespace __esri { * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#listItemCreatedFunction) */ listItemCreatedFunction?: ListItemCreatedHandler; - /** - * A collection of [ListItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList-ListItem.html)s representing operational layers. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html#operationalItems) - */ - operationalItems?: CollectionProperties; /** * Option for enabling status indicators, which indicate whether or not each layer is loading resources. * @@ -48702,7 +51863,7 @@ declare namespace __esri { */ content: Widget | HTMLElement | string | any[]; /** - * The URL or data URI of an image used to represent the panel. This property will be used as a background image for the node. If neither `image` nor `className` are specified, a default icon ![default icon](https://developers.arcgis.com/javascript/latest/assets/img/guide/whats-new/41/default-action.png) will display. + * The URL or data URI of an image used to represent the panel. This property will be used as a background image for the node. If neither `image` nor `className` are specified, a default icon ![default icon](https://developers.arcgis.com/javascript/assets/img/guide/whats-new/41/default-action.png) will display. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList-ListItemPanel.html#image) */ @@ -48772,19 +51933,13 @@ declare namespace __esri { */ layerInfos: LegendLayerInfos[]; /** - * Indicates the style of the legend. The style determines the legend's layout and behavior. See the table below for a list of possible values. - * - * Value | Description - * ------|------------ - * classic | The legend has a portrait orientation. The user can scroll vertically when many elements are included in the legend's content. - * card | In wide views, the legend has a landscape orientation that allows users to scroll horizontally to view all legend elements. This style is responsive, making it ideal for mobile web apps. In smaller views, the legend collapses to occupy less space. One element is shown at a time in a card-style layout, which the user can navigate horizontally. - * + * Indicates the style of the legend. The style determines the legend's layout and behavior. You can either specify a string or an object to indicate the style. The known string values are the same values listed in the table within the `type` property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html#style) * * @default classic */ - style: string; + style: string | LegendStyle; /** * A reference to the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). Set this to link the widget to a specific view. * @@ -48822,19 +51977,13 @@ declare namespace __esri { */ layerInfos?: LegendLayerInfos[]; /** - * Indicates the style of the legend. The style determines the legend's layout and behavior. See the table below for a list of possible values. - * - * Value | Description - * ------|------------ - * classic | The legend has a portrait orientation. The user can scroll vertically when many elements are included in the legend's content. - * card | In wide views, the legend has a landscape orientation that allows users to scroll horizontally to view all legend elements. This style is responsive, making it ideal for mobile web apps. In smaller views, the legend collapses to occupy less space. One element is shown at a time in a card-style layout, which the user can navigate horizontally. - * + * Indicates the style of the legend. The style determines the legend's layout and behavior. You can either specify a string or an object to indicate the style. The known string values are the same values listed in the table within the `type` property. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html#style) * * @default classic */ - style?: string; + style?: string | LegendStyle; /** * A reference to the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). Set this to link the widget to a specific view. * @@ -48859,6 +52008,37 @@ declare namespace __esri { layer: Layer; } + + export interface LegendStyle extends Object { + /** + * Specifies the style of the legend. There are two possible values listed in the table below: + * + * Value | Description + * ------|------------ + * classic | The legend has a portrait orientation. The user can scroll vertically when many elements are included in the legend's content. + * card | In wide views, the legend has a landscape orientation that allows users to scroll horizontally to view all legend elements. This style can be responsive, making it ideal for mobile web apps. In smaller views, the legend collapses to occupy less space. One element is shown at a time in a card-style layout, which the user can navigate horizontally. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html#style) + */ + type: string; + /** + * When a `card` type is specified, you can specify one of the following layout options. + * + * Value | Description + * ------|------------ + * auto | This layout is responsive so that in wide views the legend has a `side-by-side` layout, and a `stack` layout in smaller (mobile) views. + * side-by-side | The legend has a landscape orientation that allows users to scroll horizontally to view multiple legend cards at a time. + * stack | The legend cards are stacked, which conserves space, but restricts the user to seeing only one card at a time. + * + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Legend.html#style) + * + * @default stack + */ + layout?: string; + } + interface Locate extends Widget, GoTo { /** * The HTML5 Geolocation Position options for locating. Refer to [Geolocation API Specification](http://www.w3.org/TR/geolocation-API/#position-options) for details. @@ -48923,6 +52103,14 @@ declare namespace __esri { */ viewModel: LocateViewModel; + /** + * This function provides the ability to interrupt and cancel the process of programmatically obtaining the location of the user's device. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Locate.html#cancelLocate) + * + * + */ + cancelLocate(): void; /** * Animates the view to the user's location. * @@ -49022,6 +52210,14 @@ declare namespace __esri { */ readonly state: string; + /** + * This function provides the ability to interrupt and cancel the process of programmatically obtaining the location of the user's device. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Locate-LocateViewModel.html#cancelLocate) + * + * + */ + cancelLocate(): void; /** * Animates the view to the user's location. * @@ -49066,8 +52262,8 @@ declare namespace __esri { * * Possible Value | Example * ---------------|-------- - * vertical | ![navigation-toggle](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/navigation-toggle.png) - * horizontal | ![navigation-toggle-horizontal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/navigation-toggle-horizontal.png) + * vertical | ![navigation-toggle](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/navigation-toggle.png) + * horizontal | ![navigation-toggle-horizontal](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/navigation-toggle-horizontal.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-NavigationToggle.html#layout) @@ -49124,8 +52320,8 @@ declare namespace __esri { * * Possible Value | Example * ---------------|-------- - * vertical | ![navigation-toggle](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/navigation-toggle.png) - * horizontal | ![navigation-toggle-horizontal](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/navigation-toggle-horizontal.png) + * vertical | ![navigation-toggle](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/navigation-toggle.png) + * horizontal | ![navigation-toggle-horizontal](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/navigation-toggle-horizontal.png) * * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-NavigationToggle.html#layout) @@ -49224,7 +52420,7 @@ declare namespace __esri { interface Popup extends Widget, GoTo, Evented { /** - * Defines actions that may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the `actions` array or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the array. The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) classes. + * Defines actions that may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the `actions` array or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the array. The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) classes. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#actions) */ @@ -49296,7 +52492,7 @@ declare namespace __esri { */ readonly featureCount: number; /** - * Shows pagination for the popup if available. This allows the user to scroll through various [selected features](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#features) using either arrows ![popup-pagination-arrows](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popup-pagination-arrows.png) or a menu. ![popup-feature-menu](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popup-pagination-menu.png) + * Shows pagination for the popup if available. This allows the user to scroll through various [selected features](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#features) using either arrows ![popup-pagination-arrows](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popup-pagination-arrows.png) or a menu. ![popup-feature-menu](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popup-pagination-menu.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#featureNavigationEnabled) */ @@ -49308,8 +52504,7 @@ declare namespace __esri { */ features: Graphic[]; /** - * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). - * > **Known Limitation** Only [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) rendered with [WebGL](esri-layers-FeatureLayer.html#webgl-rendering) support highlight. + * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#highlightEnabled) * @@ -49477,7 +52672,7 @@ declare namespace __esri { interface PopupProperties extends WidgetProperties, GoToProperties { /** - * Defines actions that may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the `actions` array or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the array. The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) classes. + * Defines actions that may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the `actions` array or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the array. The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) classes. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#actions) */ @@ -49535,7 +52730,7 @@ declare namespace __esri { */ dockOptions?: PopupDockOptions; /** - * Shows pagination for the popup if available. This allows the user to scroll through various [selected features](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#features) using either arrows ![popup-pagination-arrows](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popup-pagination-arrows.png) or a menu. ![popup-feature-menu](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popup-pagination-menu.png) + * Shows pagination for the popup if available. This allows the user to scroll through various [selected features](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#features) using either arrows ![popup-pagination-arrows](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popup-pagination-arrows.png) or a menu. ![popup-feature-menu](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popup-pagination-menu.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#featureNavigationEnabled) */ @@ -49547,8 +52742,7 @@ declare namespace __esri { */ features?: GraphicProperties[]; /** - * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). - * > **Known Limitation** Only [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) rendered with [WebGL](esri-layers-FeatureLayer.html#webgl-rendering) support highlight. + * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#highlightEnabled) * @@ -49607,7 +52801,7 @@ declare namespace __esri { interface PopupViewModel extends Accessor, Evented, GoTo { /** - * [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each action may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. + * [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each action may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#actions) */ @@ -49647,8 +52841,7 @@ declare namespace __esri { */ features: Graphic[]; /** - * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). - * > **Known Limitation** Only [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) rendered with [WebGL](esri-layers-FeatureLayer.html#webgl-rendering) support highlight. + * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#highlightEnabled) * @@ -49774,7 +52967,7 @@ declare namespace __esri { interface PopupViewModelProperties extends GoToProperties { /** - * [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each action may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. + * [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [action](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [action toggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) objects. Each action may be executed by clicking the icon or image symbolizing them in the popup. By default, every popup has a `zoom-to` action styled with a magnifying glass icon ![popupTemplate-zoom-action](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/popuptemplate-zoom-action.png). When this icon is clicked, the view zooms in four LODs and centers on the selected feature. You may override this action by removing it from the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) or by setting the [overwriteActions](esri-PopupTemplate.html#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html). The order of each action in the popup is the order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html). The [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event fires each time an action in the popup is clicked. This event should be used to execute custom code for each action clicked. For example, if you would like to add a `zoom-out` action to the popup that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom `zoom-out` function in the [trigger-action](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#event:trigger-action) event handler. See the sample code snippet below for more details on how this works. Actions are defined with the properties listed in the [ActionButton](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionButton.html) or [ActionToggle](https://developers.arcgis.com/javascript/latest/api-reference/esri-support-actions-ActionToggle.html) class. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#actions) */ @@ -49800,8 +52993,7 @@ declare namespace __esri { */ features?: GraphicProperties[]; /** - * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). - * > **Known Limitation** Only [FeatureLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) rendered with [WebGL](esri-layers-FeatureLayer.html#webgl-rendering) support highlight. + * Highlight the selected popup feature using the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions) set on the [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or the [highlightOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#highlightOptions) set on the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html#highlightEnabled) * @@ -50436,13 +53628,13 @@ declare namespace __esri { interface widgetsSearch extends Widget, GoTo { /** - * The [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources) object currently selected. Can be either a [feature layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or a [locator task](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html). + * The [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources) object currently selected. Can be either a [FeatureLayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html) or a module:esri/widget/Search/LocatorSearchSource. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#activeSource) * * @default null */ - readonly activeSource: FeatureLayer | Locator; + readonly activeSource: FeatureLayerSearchSource | LocatorSearchSource; /** * The selected source's index. This value is `-1` when all sources are selected. * @@ -50452,7 +53644,7 @@ declare namespace __esri { */ activeSourceIndex: number; /** - * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-allplaceholder.png) + * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-allplaceholder.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#allPlaceholder) * @@ -50488,7 +53680,7 @@ declare namespace __esri { */ readonly label: string; /** - * Enables location services within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-locationEnabled.png) + * Enables location services within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-locationEnabled.png) * > The use of this property is only supported on secure origins. To use it, switch your application to a secure origin, such as HTTPS. Note that localhost is considered "potentially secure" and can be used for easy testing in browsers that supports [Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext#Browser_compatibility) (currently Chrome and Firefox). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#locationEnabled) @@ -50521,21 +53713,13 @@ declare namespace __esri { */ minSuggestCharacters: number; /** - * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). This is not the same as using [popupOpenOnSelect](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#popupOpenOnSelect) which opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but it is not opened by default. + * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#popupEnabled) * * @default true */ popupEnabled: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. Using `popupOpenOnSelect` opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but not opened by default. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#popupOpenOnSelect) - * - * @default true - */ - popupOpenOnSelect: boolean; /** * A customized PopupTemplate for the selected feature. Note that specifying a wildcard {*} for the popupTemplate will return all fields in addition to search-specific fields. * @@ -50551,7 +53735,8 @@ declare namespace __esri { */ portal: Portal; /** - * The graphic used to highlight the resulting feature or location. + * The graphic used to highlight the resulting feature or location. + * A graphic will be placed in the View's [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#graphics) for [layer views](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) that do not support the `highlight` method. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#resultGraphic) */ @@ -50571,7 +53756,7 @@ declare namespace __esri { */ readonly results: any[]; /** - * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-false](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-false.png) + * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-false](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-false.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#searchAllEnabled) * @@ -50592,23 +53777,23 @@ declare namespace __esri { readonly selectedResult: SearchResult; /** * The Search widget may be used to search features in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or geocode locations with a [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html). The `sources` property defines the sources from which to search for the [view](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#view) specified by the Search widget instance. There are two types of sources: - * * [LocatorSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - * * [FeatureLayerSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) + * * [FeatureLayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html) + * * [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html) * * - * Any combination of one or more [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) and [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) sources may be used together in the same instance of the Search widget. + * Any combination of these sources may be used together in the same instance of the Search widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources) */ - sources: Collection; + sources: Collection; /** - * An array of results from the [suggest method](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggest). This is available if working with a 10.3 geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e. `supportsPagination = true`. + * An array of results from the [suggest method](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggest). This is available if working with a 10.3 or greater geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggestions) */ readonly suggestions: SuggestResult[]; /** - * Enable suggestions for the widget. This is only available if working with a 10.3 geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e. `supportsPagination = true`. + * Enable suggestions for the widget. This is only available if working with a 10.3 or greater geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggestionsEnabled) * @@ -50670,7 +53855,7 @@ declare namespace __esri { */ search(searchTerm?: string | Geometry | SuggestResult | number[][]): IPromise; /** - * Performs a suggest() request on the active Locator. It also uses the current value of the widget or one that is passed in. Suggestions are available if working with a 10.3 geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e. `supportsPagination = true`. + * Performs a suggest() request on the active Locator. It also uses the current value of the widget or one that is passed in. Suggestions are available if working with a 10.3 or greater geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggest) * @@ -50702,7 +53887,7 @@ declare namespace __esri { */ activeSourceIndex?: number; /** - * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-allplaceholder.png) + * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-allplaceholder.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#allPlaceholder) * @@ -50726,7 +53911,7 @@ declare namespace __esri { */ includeDefaultSources?: boolean | Function; /** - * Enables location services within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-locationEnabled.png) + * Enables location services within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-locationEnabled.png) * > The use of this property is only supported on secure origins. To use it, switch your application to a secure origin, such as HTTPS. Note that localhost is considered "potentially secure" and can be used for easy testing in browsers that supports [Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext#Browser_compatibility) (currently Chrome and Firefox). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#locationEnabled) @@ -50759,21 +53944,13 @@ declare namespace __esri { */ minSuggestCharacters?: number; /** - * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). This is not the same as using [popupOpenOnSelect](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#popupOpenOnSelect) which opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but it is not opened by default. + * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#popupEnabled) * * @default true */ popupEnabled?: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. Using `popupOpenOnSelect` opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but not opened by default. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#popupOpenOnSelect) - * - * @default true - */ - popupOpenOnSelect?: boolean; /** * A customized PopupTemplate for the selected feature. Note that specifying a wildcard {*} for the popupTemplate will return all fields in addition to search-specific fields. * @@ -50797,7 +53974,7 @@ declare namespace __esri { */ resultGraphicEnabled?: boolean; /** - * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-false](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-false.png) + * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-false](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-false.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#searchAllEnabled) * @@ -50812,17 +53989,17 @@ declare namespace __esri { searchTerm?: string; /** * The Search widget may be used to search features in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or geocode locations with a [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html). The `sources` property defines the sources from which to search for the [view](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#view) specified by the Search widget instance. There are two types of sources: - * * [LocatorSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - * * [FeatureLayerSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) + * * [FeatureLayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html) + * * [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html) * * - * Any combination of one or more [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) and [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) sources may be used together in the same instance of the Search widget. + * Any combination of these sources may be used together in the same instance of the Search widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources) */ - sources?: CollectionProperties; + sources?: CollectionProperties; /** - * Enable suggestions for the widget. This is only available if working with a 10.3 geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e. `supportsPagination = true`. + * Enable suggestions for the widget. This is only available if working with a 10.3 or greater geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#suggestionsEnabled) * @@ -50843,13 +54020,517 @@ declare namespace __esri { viewModel?: SearchViewModelProperties; } + interface FeatureLayerSearchSource extends SearchSource, JSONSupport { + /** + * The results are displayed using this field. Defaults to the layer's `displayField` or the first string field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#displayField) + */ + displayField: string; + /** + * Indicates to only return results that match the search value exactly. This property only applies to `string` field searches. `exactMatch` is always `true` when searching fields of type `number`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#exactMatch) + * + * @default false + */ + exactMatch: boolean; + /** + * The feature layer queried in the search. This is **required**. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#featureLayer) + */ + featureLayer: FeatureLayer; + /** + * The name of the source for display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#name) + */ + name: string; + /** + * An array of string values representing the names of fields in the feature layer to search. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#searchFields) + */ + searchFields: string[]; + /** + * A template string used to display multiple fields in a defined order when results are displayed. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#searchTemplate) + */ + searchTemplate: string; + /** + * A template string used to display multiple fields in a defined order when suggestions are displayed. This takes precedence over `displayField`. Field names in the template must have the following format: `{FieldName}`. An example suggestionTemplate could look something like: `Name: {OWNER}, Parcel: {PARCEL_ID}`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#suggestionTemplate) + */ + suggestionTemplate: string; + + /** + * Creates a deep clone of this object. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#clone) + * + * + */ + clone(): FeatureLayerSearchSource; + } + + interface FeatureLayerSearchSourceConstructor { + + + new(properties?: FeatureLayerSearchSourceProperties): FeatureLayerSearchSource; + + fromJSON(json: any): FeatureLayerSearchSource; + } + + export const FeatureLayerSearchSource: FeatureLayerSearchSourceConstructor; + + interface FeatureLayerSearchSourceProperties extends SearchSourceProperties { + /** + * The results are displayed using this field. Defaults to the layer's `displayField` or the first string field. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#displayField) + */ + displayField?: string; + /** + * Indicates to only return results that match the search value exactly. This property only applies to `string` field searches. `exactMatch` is always `true` when searching fields of type `number`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#exactMatch) + * + * @default false + */ + exactMatch?: boolean; + /** + * The feature layer queried in the search. This is **required**. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#featureLayer) + */ + featureLayer?: FeatureLayerProperties; + /** + * The name of the source for display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#name) + */ + name?: string; + /** + * An array of string values representing the names of fields in the feature layer to search. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#searchFields) + */ + searchFields?: string[]; + /** + * A template string used to display multiple fields in a defined order when results are displayed. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#searchTemplate) + */ + searchTemplate?: string; + /** + * A template string used to display multiple fields in a defined order when suggestions are displayed. This takes precedence over `displayField`. Field names in the template must have the following format: `{FieldName}`. An example suggestionTemplate could look something like: `Name: {OWNER}, Parcel: {PARCEL_ID}`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html#suggestionTemplate) + */ + suggestionTemplate?: string; + } + + interface LocatorSearchSource extends SearchSource, JSONSupport { + /** + * A string array which limits the results to one or more categories. For example, `Populated Place` or `airport`. Only applicable when using the World Geocode Service. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#categories) + */ + categories: string[]; + /** + * Constricts search results to a specified country code. For example, `US` for United States or `SE` for Sweden. Only applies to the World Geocode Service. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#countryCode) + */ + countryCode: string; + /** + * Sets the sources for local `distance` and `minScale` for searching. See the object specification table below for details. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#localSearchOptions) + */ + localSearchOptions: LocatorSearchSourceLocalSearchOptions; + /** + * When reverse geocoding a result, use this distance in meters. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#locationToAddressDistance) + * + * @default 1500 + */ + locationToAddressDistance: number; + /** + * The locator task used to search. This is **required** and defaults to the [World Geocoding Service](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#locator) + */ + locator: Locator; + /** + * The name of the source for display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#name) + */ + name: string; + /** + * A template string used to display multiple fields in a defined order when results are displayed. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#searchTemplate) + */ + searchTemplate: string; + /** + * The field name of the Single Line Address Field in the REST services directory for the locator service. Common values are `SingleLine` and `SingleLineFieldName`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#singleLineFieldName) + */ + singleLineFieldName: string; + + /** + * Creates a deep clone of this object. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#clone) + * + * + */ + clone(): LocatorSearchSource; + } + + interface LocatorSearchSourceConstructor { + + + new(properties?: LocatorSearchSourceProperties): LocatorSearchSource; + + fromJSON(json: any): LocatorSearchSource; + } + + export const LocatorSearchSource: LocatorSearchSourceConstructor; + + interface LocatorSearchSourceProperties extends SearchSourceProperties { + /** + * A string array which limits the results to one or more categories. For example, `Populated Place` or `airport`. Only applicable when using the World Geocode Service. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#categories) + */ + categories?: string[]; + /** + * Constricts search results to a specified country code. For example, `US` for United States or `SE` for Sweden. Only applies to the World Geocode Service. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#countryCode) + */ + countryCode?: string; + /** + * Sets the sources for local `distance` and `minScale` for searching. See the object specification table below for details. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#localSearchOptions) + */ + localSearchOptions?: LocatorSearchSourceLocalSearchOptions; + /** + * When reverse geocoding a result, use this distance in meters. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#locationToAddressDistance) + * + * @default 1500 + */ + locationToAddressDistance?: number; + /** + * The locator task used to search. This is **required** and defaults to the [World Geocoding Service](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#locator) + */ + locator?: LocatorProperties; + /** + * The name of the source for display. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#name) + */ + name?: string; + /** + * A template string used to display multiple fields in a defined order when results are displayed. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#searchTemplate) + */ + searchTemplate?: string; + /** + * The field name of the Single Line Address Field in the REST services directory for the locator service. Common values are `SingleLine` and `SingleLineFieldName`. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#singleLineFieldName) + */ + singleLineFieldName?: string; + } + + + export interface LocatorSearchSourceLocalSearchOptions extends Object { + /** + * The distance to search. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#localSearchOptions) + */ + distance?: number; + /** + * The minimum scale used to search locally. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html#localSearchOptions) + */ + minScale?: number; + } + + interface SearchSource extends JSONSupport { + /** + * Indicates whether to automatically navigate to the selected result once selected. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#autoNavigate) + * + * @default true + */ + autoNavigate: boolean; + /** + * This property replaces the now deprecated `searchQueryParams`, `suggestQueryParams`, and `searchExtent` properties. Please see the object specification table below for details. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#filter) + */ + filter: SearchSourceFilter; + /** + * Indicates the maximum number of search results to return. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#maxResults) + * + * @default 6 + */ + maxResults: number; + /** + * Indicates the maximum number of suggestions to return for the widget's input. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#maxSuggestions) + * + * @default 6 + */ + maxSuggestions: number; + /** + * Indicates the minimum number of characters required before querying for a suggestion. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#minSuggestCharacters) + * + * @default 1 + */ + minSuggestCharacters: number; + /** + * Specifies the fields returned with the search results. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#outFields) + */ + outFields: string[]; + /** + * Used as a hint for the source input text. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#placeholder) + */ + placeholder: string; + /** + * Indicates whether to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a selected result is clicked. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#popupEnabled) + */ + popupEnabled: boolean; + /** + * The popup template used to display search results. If no popup is needed, set the source's popupTemplate to `null`. + * > This property should be set in instances where there is no existing [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html) configured. For example, [feature sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html) will default to any existing [popupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#popupTemplate) configured on the layer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#popupTemplate) + */ + popupTemplate: PopupTemplate; + /** + * Specify this to prefix the user's input of the search text. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#prefix) + */ + prefix: string; + /** + * Indicates whether to show a graphic on the map for the selected source using the [resultSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultSymbol). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultGraphicEnabled) + */ + resultGraphicEnabled: boolean; + /** + * The symbol used to display the result. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultSymbol) + */ + resultSymbol: Symbol; + /** + * Specify this to add a suffix to the user's input for the search value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#suffix) + */ + suffix: string; + /** + * Indicates whether to display suggestions as the user enters input text in the widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#suggestionsEnabled) + * + * @default true + */ + suggestionsEnabled: boolean; + /** + * Indicates whether to constrain the search results to the view's extent. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#withinViewEnabled) + * + * @default false + */ + withinViewEnabled: boolean; + /** + * The set zoom scale for the resulting search result. This scale is automatically honored. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#zoomScale) + */ + zoomScale: number; + } + + interface SearchSourceConstructor { + + + new(properties?: SearchSourceProperties): SearchSource; + + fromJSON(json: any): SearchSource; + } + + export const SearchSource: SearchSourceConstructor; + + interface SearchSourceProperties { + /** + * Indicates whether to automatically navigate to the selected result once selected. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#autoNavigate) + * + * @default true + */ + autoNavigate?: boolean; + /** + * This property replaces the now deprecated `searchQueryParams`, `suggestQueryParams`, and `searchExtent` properties. Please see the object specification table below for details. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#filter) + */ + filter?: SearchSourceFilter; + /** + * Indicates the maximum number of search results to return. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#maxResults) + * + * @default 6 + */ + maxResults?: number; + /** + * Indicates the maximum number of suggestions to return for the widget's input. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#maxSuggestions) + * + * @default 6 + */ + maxSuggestions?: number; + /** + * Indicates the minimum number of characters required before querying for a suggestion. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#minSuggestCharacters) + * + * @default 1 + */ + minSuggestCharacters?: number; + /** + * Specifies the fields returned with the search results. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#outFields) + */ + outFields?: string[]; + /** + * Used as a hint for the source input text. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#placeholder) + */ + placeholder?: string; + /** + * Indicates whether to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a selected result is clicked. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#popupEnabled) + */ + popupEnabled?: boolean; + /** + * The popup template used to display search results. If no popup is needed, set the source's popupTemplate to `null`. + * > This property should be set in instances where there is no existing [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html) configured. For example, [feature sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html) will default to any existing [popupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#popupTemplate) configured on the layer. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#popupTemplate) + */ + popupTemplate?: PopupTemplateProperties; + /** + * Specify this to prefix the user's input of the search text. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#prefix) + */ + prefix?: string; + /** + * Indicates whether to show a graphic on the map for the selected source using the [resultSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultSymbol). + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultGraphicEnabled) + */ + resultGraphicEnabled?: boolean; + /** + * The symbol used to display the result. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultSymbol) + */ + resultSymbol?: SymbolProperties; + /** + * Specify this to add a suffix to the user's input for the search value. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#suffix) + */ + suffix?: string; + /** + * Indicates whether to display suggestions as the user enters input text in the widget. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#suggestionsEnabled) + * + * @default true + */ + suggestionsEnabled?: boolean; + /** + * Indicates whether to constrain the search results to the view's extent. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#withinViewEnabled) + * + * @default false + */ + withinViewEnabled?: boolean; + /** + * The set zoom scale for the resulting search result. This scale is automatically honored. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#zoomScale) + */ + zoomScale?: number; + } + + + export interface SearchSourceFilter extends Object { + /** + * The where clause specified for filtering suggests or search results. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#filter) + */ + where?: string; + /** + * The filter geometry for suggests or search results. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#filter) + */ + geometry?: Geometry; + } + interface SearchViewModel extends Accessor, Evented, GoTo { /** * The [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) object currently selected. Can be either a [feature layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or a [locator task](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#activeSource) */ - readonly activeSource: FeatureLayer | Locator; + readonly activeSource: FeatureLayerSearchSource | LocatorSearchSource; /** * The selected source's index. This value is `-1` when all sources are selected. * @@ -50859,7 +54540,7 @@ declare namespace __esri { */ activeSourceIndex: number; /** - * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-allplaceholder.png) + * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-allplaceholder.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#allPlaceholder) * @@ -50871,7 +54552,7 @@ declare namespace __esri { * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#allSources) */ - readonly allSources: Collection; + readonly allSources: Collection; /** * Indicates whether to automatically select and zoom to the first geocoded result. If `false`, the [findAddressCandidates](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm) operation will still geocode the input string, but the top result will not be selected. To work with the geocoded results, you can set up a [search-complete](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#event:search-complete) event handler and get the results through the event object. * @@ -50881,11 +54562,11 @@ declare namespace __esri { */ autoSelect: boolean; /** - * A read-only property that is a [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of [FeaturelayerSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) and/or [LocatorSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource). This property may contain [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/) [locators](http://enterprise.arcgis.com/en/server/latest/publish-services/windows/geocode-services.htm) and any web map or web scene [configurable search sources](http://doc.arcgis.com/en/arcgis-online/create-maps/configure-feature-search.htm). This property is used to populate the Search UI if the [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) property is not set. + * A read-only property that is a [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html) of module:esri/widgets/Search/FeaturelayerSource and/or [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html). This property may contain [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/) [locators](http://enterprise.arcgis.com/en/server/latest/publish-services/windows/geocode-services.htm) and any web map or web scene [configurable search sources](http://doc.arcgis.com/en/arcgis-online/create-maps/configure-feature-search.htm). This property is used to populate the Search UI if the [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) property is not set. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#defaultSources) */ - readonly defaultSources: Collection; + readonly defaultSources: Collection; /** * The default [symbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html) for the search result. * @@ -50903,7 +54584,7 @@ declare namespace __esri { */ includeDefaultSources: boolean | Function; /** - * Indicates whether location services are enabled within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-locationEnabled.png) + * Indicates whether location services are enabled within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-locationEnabled.png) * > The use of this property is only supported on secure origins. To use it, switch your application to a secure origin, such as HTTPS. Note that localhost is considered "potentially secure" and can be used for easy testing in browsers that supports [Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext#Browser_compatibility) (currently Chrome and Firefox). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#locationEnabled) @@ -50948,21 +54629,13 @@ declare namespace __esri { */ readonly placeholder: string; /** - * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). This is not the same as using [popupOpenOnSelect](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#popupOpenOnSelect) which opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but it is not opened by default. + * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#popupEnabled) * * @default true */ popupEnabled: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. Using `popupOpenOnSelect` opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but not opened by default. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#popupOpenOnSelect) - * - * @default true - */ - popupOpenOnSelect: boolean; /** * A customized PopupTemplate for the selected feature. Note that specifying a wildcard {*} for the popupTemplate will return all fields in addition to search-specific fields. * @@ -50986,7 +54659,8 @@ declare namespace __esri { */ readonly resultGraphic: Graphic; /** - * Indicates if the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphic) will display at the location of the selected feature. + * Indicates if the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphic) will display at the location of the selected feature. + * A graphic will be placed in the View's [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#graphics) for [layer views](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) that do not support the `highlight` method. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphicEnabled) * @@ -51002,7 +54676,7 @@ declare namespace __esri { */ readonly results: any[]; /** - * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-true-false](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-false.png) + * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-true-false](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-false.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#searchAllEnabled) * @@ -51033,15 +54707,15 @@ declare namespace __esri { readonly selectedSuggestion: Geometry | SearchViewModelSuggestResult; /** * The Search widget may be used to search features in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or geocode locations with a [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html). The `sources` property defines the sources from which to search for the [view](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#view) specified by the Search widget instance. There are two types of sources: - * * [LocatorSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - * * [FeatureLayerSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) + * * [FeatureLayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html) + * * [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html) * * - * Any combination of one or more [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) and [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) sources may be used together in the same instance of the Search widget. + * Any combination of these sources may be used together in the same instance of the Search widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) */ - sources: Collection; + sources: Collection; /** * The current state of the widget. This property was removed from [Search](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html) and should now be accessed within the [SearchViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html). **Possible Values:** ready | disabled | searching * @@ -51059,7 +54733,7 @@ declare namespace __esri { */ suggestionDelay: number; /** - * An array of results from the [suggest method](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggest). This is available if working with a 10.3 geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e. `supportsPagination = true`. + * An array of results from the [suggest method](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggest). This is available if working with a 10.3 or greater geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggestions) * @@ -51067,7 +54741,7 @@ declare namespace __esri { */ readonly suggestions: SearchViewModelSuggestResult[]; /** - * Enable suggestions for the widget. This is only available if working with a 10.3 geocoding service that has [suggest capability loaded] (https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e. `supportsPagination = true`. + * Enable suggestions for the widget. This is only available if working with a 10.3 or greater geocoding service that has [suggest capability loaded] (https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggestionsEnabled) * @@ -51109,7 +54783,7 @@ declare namespace __esri { */ searchNearby(): IPromise; /** - * Performs a suggest() request on the active Locator. It also uses the current value of the widget or one that is passed in. Suggestions are available if working with a 10.3 geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e.`supportsPagination = true`. + * Performs a suggest() request on the active Locator. It also uses the current value of the widget or one that is passed in. Suggestions are available if working with a 10.3 or greater geocoding service that has [suggest capability loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e.`supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggest) * @@ -51150,7 +54824,7 @@ declare namespace __esri { */ activeSourceIndex?: number; /** - * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-allplaceholder.png) + * String value used as a hint for input text when searching on multiple sources. See the image below to view the location and style of this text in the context of the widget. ![search-allPlaceholder](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-allplaceholder.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#allPlaceholder) * @@ -51182,7 +54856,7 @@ declare namespace __esri { */ includeDefaultSources?: boolean | Function; /** - * Indicates whether location services are enabled within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-locationEnabled.png) + * Indicates whether location services are enabled within the widget. ![locationEnabled](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-locationEnabled.png) * > The use of this property is only supported on secure origins. To use it, switch your application to a secure origin, such as HTTPS. Note that localhost is considered "potentially secure" and can be used for easy testing in browsers that supports [Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext#Browser_compatibility) (currently Chrome and Firefox). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#locationEnabled) @@ -51221,21 +54895,13 @@ declare namespace __esri { */ minSuggestCharacters?: number; /** - * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). This is not the same as using [popupOpenOnSelect](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#popupOpenOnSelect) which opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but it is not opened by default. + * Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#popupEnabled) * * @default true */ popupEnabled?: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. Using `popupOpenOnSelect` opens the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) any time a search is performed. It is possible to have `popupOpenOnSelect=false` but `popupEnabled=true` so the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) can be opened by someone but not opened by default. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#popupOpenOnSelect) - * - * @default true - */ - popupOpenOnSelect?: boolean; /** * A customized PopupTemplate for the selected feature. Note that specifying a wildcard {*} for the popupTemplate will return all fields in addition to search-specific fields. * @@ -51251,7 +54917,8 @@ declare namespace __esri { */ portal?: PortalProperties; /** - * Indicates if the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphic) will display at the location of the selected feature. + * Indicates if the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphic) will display at the location of the selected feature. + * A graphic will be placed in the View's [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#graphics) for [layer views](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html) that do not support the `highlight` method. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphicEnabled) * @@ -51259,7 +54926,7 @@ declare namespace __esri { */ resultGraphicEnabled?: boolean; /** - * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-true-false](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/search-enablesearchingall-false.png) + * Indicates whether to display the option to search all sources. When `true`, the "All" option is displayed by default: ![search-searchAllEnabled-true](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-true.png) When `false`, no option to search all sources at once is available: ![search-searchAllEnabled-true-false](https://developers.arcgis.com/javascript/assets/img/apiref/widgets/search-enablesearchingall-false.png) * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#searchAllEnabled) * @@ -51274,15 +54941,15 @@ declare namespace __esri { searchTerm?: string; /** * The Search widget may be used to search features in a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or geocode locations with a [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html). The `sources` property defines the sources from which to search for the [view](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#view) specified by the Search widget instance. There are two types of sources: - * * [LocatorSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - * * [FeatureLayerSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) + * * [FeatureLayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-FeatureLayerSearchSource.html) + * * [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html) * * - * Any combination of one or more [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) and [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) sources may be used together in the same instance of the Search widget. + * Any combination of these sources may be used together in the same instance of the Search widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) */ - sources?: CollectionProperties; + sources?: CollectionProperties; /** * The millisecond delay after keyup and before making a [suggest](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggest) network request. * @@ -51292,7 +54959,7 @@ declare namespace __esri { */ suggestionDelay?: number; /** - * Enable suggestions for the widget. This is only available if working with a 10.3 geocoding service that has [suggest capability loaded] (https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 feature layer that supports pagination, i.e. `supportsPagination = true`. + * Enable suggestions for the widget. This is only available if working with a 10.3 or greater geocoding service that has [suggest capability loaded] (https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#suggestionsEnabled) * @@ -51309,310 +54976,6 @@ declare namespace __esri { view?: MapViewProperties | SceneViewProperties; } - /** - * The following properties define a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html)-based [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) whose features may be searched by the Search widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - export interface SearchViewModelFeatureLayerSource extends Object { - /** - * The Popup instance used for the selected result. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - popup: Popup; - /** - * Indicates whether to automatically navigate to the selected result once selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - autoNavigate?: boolean; - /** - * Indicates to only return results that match the search value exactly. This property only applies to `string` field searches. `exactMatch` is always `true` when searching fields of type `number`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - exactMatch?: boolean; - /** - * The feature layer queried in the search. This is **required**. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - featureLayer: FeatureLayer; - /** - * As of version 4.4, this property replaces the now deprecated `searchQueryParams`, `suggestQueryParams`, and `searchExtent` properties. Please see the object specification table below for details. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - filter: SearchViewModelFeatureLayerSourceFilter; - /** - * Indicates the maximum number of search results to return. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - maxResults?: number; - /** - * Indicates the maximum number of suggestions to return for the widget's input. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - maxSuggestions?: number; - /** - * Indicates the minimum number of characters required before querying for a suggestion. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - minSuggestCharacters?: number; - /** - * The name of the source for display. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - name: string; - /** - * Specifies the fields returned with the search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - outFields: string[]; - /** - * Used as a hint for the source input text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - placeholder: string; - /** - * The results are displayed using this field. Defaults to the layer's `displayField` or the first string field. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - displayField: string; - /** - * Indicates whether to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a selected result is clicked. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - popupEnabled?: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - popupOpenOnSelect?: boolean; - /** - * Specify this to prefix the input for the search text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - prefix: string; - /** - * Indicates whether to show a graphic on the map for the selected source using the [resultSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultSymbol). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - resultGraphicEnabled?: boolean; - /** - * The symbol used for the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphic). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - resultSymbol: Symbol; - /** - * An array of string values representing the names of fields in the feature layer to search. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - searchFields: string[]; - /** - * Specify this to suffix the input for the search value. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - suffix: string; - /** - * Indicates whether to display suggestions as the user enters input text in the widget. The default value is `true`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - suggestionsEnabled: boolean; - /** - * A template string used to display multiple fields in a defined order when suggestions are displayed. This takes precedence over `displayField`. Field names in the template must have the following format: `{FieldName}`. An example suggestionTemplate could look something like: `Name: {OWNER}, Parcel: {PARCEL_ID}`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - suggestionTemplate: string; - /** - * Indicates whether to constrain the search results to the view's extent. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - withinViewEnabled: boolean; - /** - * Applicable to the specified source. If the result does not have an associated extent, specify this number to use as the zoom scale for the result. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - zoomScale: number; - } - - /** - * The following properties define a [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) pointing to a [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html) that may be used to geocode locations with the Search widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - export interface SearchViewModelLocatorSource extends Object { - /** - * Used as a hint for the source input text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - placeholder: string; - /** - * Indicates whether to automatically navigate to the selected result once selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - autoNavigate?: boolean; - /** - * Constricts search results to a specified country code. For example, `US` for United States or `SE` for Sweden. Only applies to the World Geocode Service. View the [World Geocoding Service documentation](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm) for more information. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - countryCode: string; - /** - * As of version 4.4, this property replaces the now deprecated `searchQueryParams`, `suggestQueryParams`, and `searchExtent` properties. Please see the object specification table below for details. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - filter: SearchViewModelLocatorSourceFilter; - /** - * Sets the sources for local `distance` and `minScale` for searching. See the object specification table below for details. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - localSearchOptions: SearchViewModelLocatorSourceLocalSearchOptions; - /** - * When reverse geocoding a result, use this distance in meters. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - locationToAddressDistance?: number; - /** - * The locator task used to search. This is **required** and defaults to the [World Geocoding Service](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - locator: Locator; - /** - * Indicates the maximum number of search results to return. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - maxResults?: number; - /** - * Indicates the maximum number of suggestions to return for the widget's input. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - maxSuggestions?: number; - /** - * Indicates the minimum number of characters required before querying for a suggestion. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - minSuggestCharacters?: number; - /** - * The name of the source for display. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - name: string; - /** - * Specifies the fields returned with the search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - outFields: string[]; - /** - * A string array which limits the results to one or more categories. For example "Populated Place" or "airport". Only applicable when using the World Geocode Service. View the [World Geocoding Service documentation](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm) for more information. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - categories: string[]; - /** - * The Popup instance used for the selected result. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - popup: Popup; - /** - * Indicates whether to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a selected result is clicked. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - popupEnabled?: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - popupOpenOnSelect?: boolean; - /** - * Specify this to prefix the input for the search text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - prefix: string; - /** - * Indicates whether to show a graphic on the map for the selected source using the [resultSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultSymbol). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - resultGraphicEnabled?: boolean; - /** - * The symbol used for the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#resultGraphic). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - resultSymbol: Symbol; - /** - * A template string used to display multiple fields in a defined order when results are displayed, e.g. `"{Street}, {City}, {ZIP}"`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - searchTemplate: string; - /** - * The field name of the Single Line Address Field in the REST services directory for the locator service. Common values are `SingleLine` and `SingleLineFieldName`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - singleLineFieldName: string; - /** - * Indicates whether to display suggestions as the user enters input text in the widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - suggestionsEnabled?: boolean; - /** - * Specify this to suffix the input for the search value. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - suffix: string; - /** - * Indicates whether to constrain the search results to the view's extent. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - withinViewEnabled: boolean; - /** - * Applicable to the specified source. If the result does not have an associated extent, specify this number to use as the zoom scale for the result. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - zoomScale: number; - } - export interface SearchViewModelSearchClearEvent { } @@ -51786,54 +55149,6 @@ declare namespace __esri { } - export interface SearchViewModelFeatureLayerSourceFilter extends Object { - /** - * The where clause specified for filtering suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - where: string; - /** - * The filter geometry for suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#FeatureLayerSource) - */ - geometry: Geometry; - } - - - export interface SearchViewModelLocatorSourceFilter extends Object { - /** - * The where clause specified for filtering suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - where: string; - /** - * The filter geometry for suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - geometry: Geometry; - } - - - export interface SearchViewModelLocatorSourceLocalSearchOptions extends Object { - /** - * The distance to search. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - distance: number; - /** - * The minimum scale used to search locally. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#LocatorSource) - */ - minScale: number; - } - - export interface SearchViewModelSearchCompleteEventResults extends Object { results: SearchResult[]; @@ -51907,310 +55222,6 @@ declare namespace __esri { source: any; } - /** - * The following properties define a [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html)-based [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources) whose features may be searched by the Search widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - export interface FeatureLayerSource extends Object { - /** - * The Popup instance used for the selected result. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - popup: Popup; - /** - * Indicates whether to automatically navigate to the selected result once selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - autoNavigate?: boolean; - /** - * Indicates to only return results that match the search value exactly. This property only applies to `string` field searches. `exactMatch` is always `true` when searching fields of type `number`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - exactMatch?: boolean; - /** - * The feature layer queried in the search. This is **required**. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - featureLayer: FeatureLayer; - /** - * As of version 4.4, this property replaces the now deprecated `searchQueryParams`, `suggestQueryParams`, and `searchExtent` properties. Please see the object specification table below for details. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - filter: FeatureLayerSourceFilter; - /** - * Indicates the maximum number of search results to return. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - maxResults?: number; - /** - * Indicates the maximum number of suggestions to return for the widget's input. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - maxSuggestions?: number; - /** - * Indicates the minimum number of characters required before querying for a suggestion. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - minSuggestCharacters?: number; - /** - * The name of the source for display. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - name: string; - /** - * Specifies the fields returned with the search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - outFields: string[]; - /** - * Used as a hint for the source input text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - placeholder: string; - /** - * The results are displayed using this field. Defaults to the layer's `displayField` or the first string field. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - displayField: string; - /** - * Indicates whether to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a selected result is clicked. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - popupEnabled?: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - popupOpenOnSelect?: boolean; - /** - * Specify this to prefix the input for the search text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - prefix: string; - /** - * Indicates whether to show a graphic on the map for the selected source using the [resultSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#resultSymbol). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - resultGraphicEnabled?: boolean; - /** - * The symbol used for the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#resultGraphic). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - resultSymbol: Symbol; - /** - * An array of string values representing the names of fields in the feature layer to search. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - searchFields: string[]; - /** - * Specify this to suffix the input for the search value. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - suffix: string; - /** - * Indicates whether to display suggestions as the user enters input text in the widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - suggestionsEnabled?: boolean; - /** - * A template string used to display multiple fields in a defined order when suggestions are displayed. This takes precedence over `displayField`. Field names in the template must have the following format: `{FieldName}`. An example suggestionTemplate could look something like: `Name: {OWNER}, Parcel: {PARCEL_ID}`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - suggestionTemplate: string; - /** - * Indicates whether to constrain the search results to the view's extent. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - withinViewEnabled: boolean; - /** - * The set zoom scale for the resulting search result. This scale is automatically honored. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - zoomScale: number; - } - - /** - * The following properties define a [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources) pointing to a [Locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html) that may be used to geocode locations with the Search widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - export interface LocatorSource extends Object { - /** - * Used as a hint for the source input text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - placeholder: string; - /** - * Indicates whether to automatically navigate to the selected result once selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - autoNavigate?: boolean; - /** - * Constricts search results to a specified country code. For example, `US` for United States or `SE` for Sweden. Only applies to the World Geocode Service. View the [World Geocoding Service documentation](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm) for more information. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - countryCode: string; - /** - * As of version 4.4, this property replaces the now deprecated `searchQueryParams`, `suggestQueryParams`, and `searchExtent` properties. Please see the object specification table below for details. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - filter: LocatorSourceFilter; - /** - * Sets the sources for local `distance` and `minScale` for searching. See the object specification table below for details. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - localSearchOptions: LocatorSourceLocalSearchOptions; - /** - * When reverse geocoding a result, use this distance in meters. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - locationToAddressDistance?: number; - /** - * The locator task used to search. This is **required** and defaults to the [World Geocoding Service](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - locator: Locator; - /** - * Indicates the maximum number of search results to return. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - maxResults?: number; - /** - * Indicates the maximum number of suggestions to return for the widget's input. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - maxSuggestions?: number; - /** - * Indicates the minimum number of characters required before querying for a suggestion. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - minSuggestCharacters?: number; - /** - * The name of the source for display. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - name: string; - /** - * Specifies the fields returned with the search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - outFields: string[]; - /** - * A string array which limits the results to one or more categories. For example "Populated Place" or "airport". Only applicable when using the World Geocode Service. View the [World Geocoding Service documentation](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-category-filtering.htm) for more information. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - categories: string[]; - /** - * The Popup instance used for the selected result. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - popup: Popup; - /** - * Indicates whether to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a selected result is clicked. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - popupEnabled?: boolean; - /** - * Indicates whether to show the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) when a result is selected. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - popupOpenOnSelect?: boolean; - /** - * Specify this to prefix the input for the search text. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - prefix: string; - /** - * Indicates whether to show a graphic on the map for the selected source using the [resultSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#resultSymbol). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - resultGraphicEnabled?: boolean; - /** - * The symbol used for the [resultGraphic](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#resultGraphic). - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - resultSymbol?: Symbol; - /** - * A template string used to display multiple fields in a defined order when results are displayed, e.g. `"{Street}, {City}, {ZIP}"`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - searchTemplate?: string; - /** - * The field name of the Single Line Address Field in the REST services directory for the locator service. Common values are `SingleLine` and `SingleLineFieldName`. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - singleLineFieldName: string; - /** - * Indicates whether to display suggestions as the user enters input text in the widget. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - suggestionsEnabled?: boolean; - /** - * Specify this to suffix the input for the search value. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - suffix?: string; - /** - * Indicates whether to constrain the search results to the view's extent. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - withinViewEnabled?: boolean; - /** - * The set zoom scale for the resulting search result. This scale is automatically honored. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - zoomScale?: number; - } - /** * When resolved, returns this response after calling [search](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#search). * @@ -52340,54 +55351,6 @@ declare namespace __esri { } - export interface FeatureLayerSourceFilter extends Object { - /** - * The where clause specified for filtering suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - where: string; - /** - * The filter geometry for suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#FeatureLayerSource) - */ - geometry: Geometry; - } - - - export interface LocatorSourceFilter extends Object { - /** - * The where clause specified for filtering suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - where: string; - /** - * The filter geometry for suggests or search results. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - geometry: Geometry; - } - - - export interface LocatorSourceLocalSearchOptions extends Object { - /** - * The distance to search. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - distance: number; - /** - * The minimum scale used to search locally. - * - * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#LocatorSource) - */ - minScale: number; - } - - export interface SearchResponseResults extends Object { /** * An array of search results. @@ -52659,7 +55622,7 @@ declare namespace __esri { interface SketchViewModel extends Accessor, Evented { /** - * Graphic representing the sketch that is being drawn on the view. + * Graphic representing the sketch that is being drawn or updated on the view. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#graphic) */ @@ -52731,7 +55694,7 @@ declare namespace __esri { view: MapView; /** - * Completes the active drawing and fires the [create-complete](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#event:create-complete) event. If called mid-drawing, `complete()` finishes the active drawing and keeps the valid geometry. + * Completes the active drawing and fires the [create-complete](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#event:create-complete) or [update-complete](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#event:update-complete) event depending on the draw operation. If called mid-drawing, `complete()` finishes the active drawing and keeps the valid geometry. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#complete) * @@ -52756,6 +55719,14 @@ declare namespace __esri { * */ create(drawAction: string, drawOptions?: SketchViewModelCreateDrawOptions): void; + /** + * Incrementally redo actions recorded in the stack. Calling this method will fire the [redo](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#event:redo) event. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#redo) + * + * + */ + redo(): void; /** * Resets SketchViewModel to prepare for another create operation. Reset discards the current drawing, if called mid drawing. * @@ -52764,6 +55735,14 @@ declare namespace __esri { * */ reset(): void; + /** + * Incrementally undo actions recorded in the stack. Calling this method will fire the [undo](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#event:undo) event. + * + * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#undo) + * + * + */ + undo(): void; /** * Initializes an update operation for the selected geometry and fires [update-init](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#event:update-init) event. * @@ -53528,7 +56507,7 @@ declare namespace __esri { /** * A utility method used for building the value for a widget's `class` property. This aids in simplifying CSS class setup. - * > Prior to version 4.7, there were various approaches towards setting CSS classes. These were dependant upon variables, such as whether the classes were: + * > Prior to version 4.7, there were various approaches towards setting CSS classes. These were dependent upon variables, such as whether the classes were: * * a single static class, * * multiple static classes, or * * dynamic classes. @@ -54024,6 +57003,11 @@ declare module "esri/core/HandleOwner" { export = HandleOwner; } +declare module "esri/core/workers/Connection" { + import Connection = __esri.Connection; + export = Connection; +} + declare module "esri/geometry/Circle" { import Circle = __esri.Circle; export = Circle; @@ -54724,6 +57708,11 @@ declare module "esri/tasks/support/AreasAndLengthsParameters" { export = AreasAndLengthsParameters; } +declare module "esri/tasks/support/AttachmentQuery" { + import AttachmentQuery = __esri.AttachmentQuery; + export = AttachmentQuery; +} + declare module "esri/tasks/support/BufferParameters" { import BufferParameters = __esri.BufferParameters; export = BufferParameters; @@ -54969,6 +57958,31 @@ declare module "esri/views/ViewAnimation" { export = ViewAnimation; } +declare module "esri/views/input/Input" { + import Input = __esri.Input; + export = Input; +} + +declare module "esri/views/input/gamepad/GamepadInputDevice" { + import GamepadInputDevice = __esri.GamepadInputDevice; + export = GamepadInputDevice; +} + +declare module "esri/views/input/gamepad/GamepadSettings" { + import GamepadSettings = __esri.GamepadSettings; + export = GamepadSettings; +} + +declare module "esri/views/navigation/Navigation" { + import Navigation = __esri.Navigation; + export = Navigation; +} + +declare module "esri/views/navigation/gamepad/GamepadSettings" { + import gamepadGamepadSettings = __esri.gamepadGamepadSettings; + export = gamepadGamepadSettings; +} + declare module "esri/views/layers/LayerView" { import LayerView = __esri.LayerView; export = LayerView; @@ -55064,6 +58078,11 @@ declare module "esri/views/2d/layers/BaseLayerView2D" { export = BaseLayerView2D; } +declare module "esri/webmap/Bookmark" { + import Bookmark = __esri.Bookmark; + export = Bookmark; +} + declare module "esri/webmap/InitialViewProperties" { import InitialViewProperties = __esri.InitialViewProperties; export = InitialViewProperties; @@ -55189,6 +58208,11 @@ declare module "esri/widgets/Feature" { export = Feature; } +declare module "esri/widgets/FeatureForm" { + import FeatureForm = __esri.FeatureForm; + export = FeatureForm; +} + declare module "esri/widgets/Fullscreen" { import Fullscreen = __esri.Fullscreen; export = Fullscreen; @@ -55299,11 +58323,6 @@ declare module "esri/widgets/BasemapToggle/BasemapToggleViewModel" { export = BasemapToggleViewModel; } -declare module "esri/widgets/Bookmarks/Bookmark" { - import Bookmark = __esri.Bookmark; - export = Bookmark; -} - declare module "esri/widgets/Bookmarks/BookmarksViewModel" { import BookmarksViewModel = __esri.BookmarksViewModel; export = BookmarksViewModel; @@ -55339,6 +58358,26 @@ declare module "esri/widgets/Feature/FeatureViewModel" { export = FeatureViewModel; } +declare module "esri/widgets/FeatureForm/FeatureFormViewModel" { + import FeatureFormViewModel = __esri.FeatureFormViewModel; + export = FeatureFormViewModel; +} + +declare module "esri/widgets/FeatureForm/FieldConfig" { + import FieldConfig = __esri.FieldConfig; + export = FieldConfig; +} + +declare module "esri/widgets/FeatureForm/FieldOptions" { + import FieldOptions = __esri.FieldOptions; + export = FieldOptions; +} + +declare module "esri/widgets/FeatureForm/InputField" { + import InputField = __esri.InputField; + export = InputField; +} + declare module "esri/widgets/Fullscreen/FullscreenViewModel" { import FullscreenViewModel = __esri.FullscreenViewModel; export = FullscreenViewModel; @@ -55394,6 +58433,21 @@ declare module "esri/widgets/ScaleBar/ScaleBarViewModel" { export = ScaleBarViewModel; } +declare module "esri/widgets/Search/FeatureLayerSearchSource" { + import FeatureLayerSearchSource = __esri.FeatureLayerSearchSource; + export = FeatureLayerSearchSource; +} + +declare module "esri/widgets/Search/LocatorSearchSource" { + import LocatorSearchSource = __esri.LocatorSearchSource; + export = LocatorSearchSource; +} + +declare module "esri/widgets/Search/SearchSource" { + import SearchSource = __esri.SearchSource; + export = SearchSource; +} + declare module "esri/widgets/Search/SearchViewModel" { import SearchViewModel = __esri.SearchViewModel; export = SearchViewModel; @@ -55479,6 +58533,11 @@ declare module "esri/layers/mixins/SceneService" { export = SceneService; } +declare module "esri/layers/mixins/SublayersOwner" { + import SublayersOwner = __esri.SublayersOwner; + export = SublayersOwner; +} + declare module "esri/renderers/VisualVariablesMixin" { import VisualVariablesMixin = __esri.VisualVariablesMixin; export = VisualVariablesMixin; @@ -55574,11 +58633,6 @@ declare module "esri/core/workers" { export = workers; } -declare module "esri/core/workers/Connection" { - import Connection = __esri.Connection; - export = Connection; -} - declare module "esri/core/accessorSupport/decorators" { import decorators = __esri.decorators; export = decorators; @@ -55639,6 +58693,16 @@ declare module "esri/renderers/smartMapping/creators/opacity" { export = opacity; } +declare module "esri/renderers/smartMapping/creators/predominance" { + import predominance = __esri.predominance; + export = predominance; +} + +declare module "esri/renderers/smartMapping/creators/relationship" { + import relationship = __esri.relationship; + export = relationship; +} + declare module "esri/renderers/smartMapping/creators/size" { import size = __esri.size; export = size; @@ -55684,6 +58748,16 @@ declare module "esri/renderers/smartMapping/symbology/location" { export = symbologyLocation; } +declare module "esri/renderers/smartMapping/symbology/predominance" { + import symbologyPredominance = __esri.symbologyPredominance; + export = symbologyPredominance; +} + +declare module "esri/renderers/smartMapping/symbology/relationship" { + import symbologyRelationship = __esri.symbologyRelationship; + export = symbologyRelationship; +} + declare module "esri/renderers/smartMapping/symbology/size" { import symbologySize = __esri.symbologySize; export = symbologySize; diff --git a/types/arcgis-js-api/v3/index.d.ts b/types/arcgis-js-api/v3/index.d.ts index 5ce4cfa06c..a42c651068 100644 --- a/types/arcgis-js-api/v3/index.d.ts +++ b/types/arcgis-js-api/v3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript 3.25 +// Type definitions for ArcGIS API for JavaScript 3.26 // Project: https://developers.arcgis.com/javascript/3/ // Definitions by: Esri // Bjorn Svensson @@ -1897,6 +1897,8 @@ declare module "esri" { export interface ReportPlayerOptions { /** Indicates whether left and right arrows key can be used to paginate when viewMode is set to PlayerViewModes.PANELS_IN_SLIDES. */ allowKeyboardNavigation?: boolean; + /** As of version 3.26 Configuration to specify the location of the JavaScript API to use when exporting an Infographic to Dynamic HTML. */ + config?: any; /** Specifies which export options are available for the report. */ dataProvider?: DataProviderGE; /** Specifies how the ReportPlayer should zoom by default. */ @@ -3506,7 +3508,7 @@ declare module "esri/dijit/Attribution" { /** * Creates a new Attribution object. * @param options An object that defines the attribution options. - * @param srcNodeRef HTML element where the time slider should be rendered. + * @param srcNodeRef HTML element where the attribution widget should be rendered. */ constructor(options: esri.AttributionOptions, srcNodeRef: Node | string); /** Destroy the attribution widget. */ @@ -7584,6 +7586,8 @@ declare module "esri/dijit/geoenrichment/ReportPlayer/ReportPlayer" { class ReportPlayer { /** Indicates whether left and right arrows key can be used to paginate when viewMode is set to PlayerViewModes.PANELS_IN_SLIDES. */ allowKeyboardNavigation: boolean; + /** Configuration to specify the location of the JavaScript API to use when exporting an Infographic to Dynamic HTML. */ + config: any; /** Data Provider for the ReportPlayer which allows you to specify which export options are available when running the report. */ dataProvider: DataProviderGE; /** Specifies how the ReportPlayer should zoom by default. */ @@ -7607,7 +7611,7 @@ declare module "esri/dijit/geoenrichment/ReportPlayer/ReportPlayer" { * @param params Various parameters that can be used to configure the ReportPlayer. * @param srcNode Reference or id of the HTML element where the widget should be rendered. */ - constructor(params: esri.ReportPlayerOptions, srcNode?: Node | string); + constructor(params?: esri.ReportPlayerOptions, srcNode?: Node | string); /** * Generates the report for the supplied parameters. * @param dataProviderParams See the object specifications table below for the structure of the dataProviderParams object. diff --git a/types/argparse/index.d.ts b/types/argparse/index.d.ts index cf4d1f648e..3330055b1f 100644 --- a/types/argparse/index.d.ts +++ b/types/argparse/index.d.ts @@ -69,6 +69,7 @@ export interface ArgumentParserOptions { prog?: string; usage?: string; version?: string; + debug?: boolean; } export interface ArgumentGroupOptions { diff --git a/types/array.prototype.flatmap/array.prototype.flatmap-tests.ts b/types/array.prototype.flatmap/array.prototype.flatmap-tests.ts new file mode 100644 index 0000000000..5236a352ca --- /dev/null +++ b/types/array.prototype.flatmap/array.prototype.flatmap-tests.ts @@ -0,0 +1,47 @@ +import flatMap = require("array.prototype.flatmap"); +import "array.prototype.flatmap/auto"; +import flatMapImpl = require("array.prototype.flatmap/implementation"); +import getPolyfill = require("array.prototype.flatmap/polyfill"); +import shim = require("array.prototype.flatmap/shim"); + +// infers type of the output array from the return type of the callback +flatMap(["foo"], word => word.split("")); // $ExpectType string[] +flatMapImpl(["foo"], word => word.split("")); // $ExpectType string[] +["foo"].flatMap(word => word.split("")); // $ExpectType string[] + +// infers the type of the value argument to the callback +flatMap([1, 2], word => word.split("")); // $ExpectError +flatMapImpl([1, 2], word => word.split("")); // $ExpectError +[1, 2].flatMap(word => word.split("")); // $ExpectError + +// the callback must return an array +flatMap([1, 2], word => word); // $ExpectError +flatMapImpl([1, 2], word => word); // $ExpectError +[1, 2].flatMap(word => word); // $ExpectError + +// the callback accepts an index argument +flatMap(["foo"], (_, index) => [index]); // $ExpectType number[] +flatMapImpl(["foo"], (_, index) => [index]); // $ExpectType number[] +["foo"].flatMap((_, index) => [index]); // $ExpectType number[] + +// the callback accepts an argument that refers to the original array +flatMap(["foo"], (_, __, input) => input); // $ExpectType string[] +flatMapImpl(["foo"], (_, __, input) => input); // $ExpectType string[] +["foo"].flatMap((_, __, input) => input); // $ExpectType string[] + +// the third argument is used as the calling context for the callback +flatMap(["foo"], function() { return this.foo; }, { foo: [1, 2] }); // $ExpectType number[] +flatMapImpl(["foo"], function() { return this.foo; }, { foo: [1, 2] }); // $ExpectType number[] +["foo"].flatMap(function() { return this.foo; }, { foo: [1, 2] }); // $ExpectType number[] + +// assumes that value of `this` in callback is `undefined` by default (this is +// accurate in strict mode) +flatMap([1], function() { return [this]; }); // $ExpectType undefined[] +flatMapImpl([1], function() { return [this]; }); // $ExpectType undefined[] +[1].flatMap(function() { return [this]; }); // $ExpectType undefined[] + +// `getPolyfill` returns a flatMap implementation +getPolyfill()(["foo"], word => word.split("")); // $ExpectType string[] + +// `shim` installs a flatMap implementation in `Array` prototype and returns it +shim()(["foo"], word => word.split("")); // $ExpectType string[] diff --git a/types/array.prototype.flatmap/auto.d.ts b/types/array.prototype.flatmap/auto.d.ts new file mode 100644 index 0000000000..43177fb3ad --- /dev/null +++ b/types/array.prototype.flatmap/auto.d.ts @@ -0,0 +1,6 @@ +interface Array { + flatMap( + fn: (this: R, x: T, index: number, array: this) => U[], + thisArg?: R + ): U[]; +} diff --git a/types/array.prototype.flatmap/implementation.d.ts b/types/array.prototype.flatmap/implementation.d.ts new file mode 100644 index 0000000000..80ad9f39d0 --- /dev/null +++ b/types/array.prototype.flatmap/implementation.d.ts @@ -0,0 +1,7 @@ +// This is the same type as the callable signature in `FlatMap` in `index.d.ts`. +declare function flatMap( + xs: ReadonlyArray, + fn: (this: T, x: A, index: number, array: A[]) => B[], + thisArg?: T +): B[]; +export = flatMap; diff --git a/types/array.prototype.flatmap/index.d.ts b/types/array.prototype.flatmap/index.d.ts new file mode 100644 index 0000000000..6bcc29f8b5 --- /dev/null +++ b/types/array.prototype.flatmap/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for array.prototype.flatmap 1.2 +// Project: https://github.com/es-shims/Array.prototype.flatMap#readme +// Definitions by: Jesse Hallett +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import flatMapImpl = require("./implementation"); + +interface FlatMap { + ( + xs: ReadonlyArray, + fn: (this: T, x: A, index: number, array: A[]) => B[], + thisArg?: T + ): B[]; + getPolyfill(): typeof flatMapImpl; + implementation: typeof flatMapImpl; + shim(): typeof flatMapImpl; +} + +declare const flatMap: FlatMap; +export = flatMap; diff --git a/types/array.prototype.flatmap/polyfill.d.ts b/types/array.prototype.flatmap/polyfill.d.ts new file mode 100644 index 0000000000..ad228b4065 --- /dev/null +++ b/types/array.prototype.flatmap/polyfill.d.ts @@ -0,0 +1,4 @@ +import flatMap = require("./implementation"); + +declare function getPolyfill(): typeof flatMap; +export = getPolyfill; diff --git a/types/array.prototype.flatmap/shim.d.ts b/types/array.prototype.flatmap/shim.d.ts new file mode 100644 index 0000000000..9f75c3a88a --- /dev/null +++ b/types/array.prototype.flatmap/shim.d.ts @@ -0,0 +1,4 @@ +import flatMap = require("./implementation"); + +declare function shim(): typeof flatMap; +export = shim; diff --git a/types/array.prototype.flatmap/tsconfig.json b/types/array.prototype.flatmap/tsconfig.json new file mode 100644 index 0000000000..8a046f1837 --- /dev/null +++ b/types/array.prototype.flatmap/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "array.prototype.flatmap-tests.ts", + "auto.d.ts", + "implementation.d.ts", + "index.d.ts", + "polyfill.d.ts", + "shim.d.ts" + ] +} diff --git a/types/deepmerge/tslint.json b/types/array.prototype.flatmap/tslint.json similarity index 100% rename from types/deepmerge/tslint.json rename to types/array.prototype.flatmap/tslint.json diff --git a/types/ascii-art/ascii-art-tests.ts b/types/ascii-art/ascii-art-tests.ts new file mode 100644 index 0000000000..d5a2d567f8 --- /dev/null +++ b/types/ascii-art/ascii-art-tests.ts @@ -0,0 +1,193 @@ +import art from 'ascii-art'; + +art.font('test', 'doom').toPromise(); + +art.font('my text', 'Doom', (rendered: string) => { + rendered.big(); +}); + +art.font('my text', 'Doom', '', (rendered) => { + rendered.big(); +}); + +art.artwork({ + artwork: 'textfiles.com/art/st-char.asc' +}).lines(31, 45, (rendered: string) => { + // cleanup non-unix terminators + rendered = rendered.replace(/\r/g, ''); + art.image({ + filepath : '~/Images/earth_in_space.jpg', + alphabet : 'ultra-wide' + }).overlay(rendered, { + x: 0, + y: -1, + style: 'red+blink', + transparent: '&' + }, (_final: any) => {}); +}); + +art.font('Ghost Wire BBS', 'Doom', (logo) => { + art.font('No place like home', 'rusted', (subtext) => { + art.table({ + verticalBar : ' ', + horizontalBar : ' ', + intersection : ' ', + data: [ + {name: art.style('current users', 'red'), value: '203'}, + {name: 'operator', value: 'vince.vega'}, + {name: 'dial-in', value: '(917)555-4202'}, + ] + }).lines(2, (table: any) => { + art.image({ + filepath : '~/Images/starburst_red.jpg', + alphabet : 'ultra-wide' + }).lines(2, 30).overlay(logo, { + x: 0, + y: 0, + style: 'blue', + }).overlay(subtext, { + x: 19, + y: 8, + style: 'yellow', + }).overlay(table, { + x: -1, + y: -1, + style: 'green', + }, (_final: any) => { + }); + }); + }); +}); + +art.image({ + width : 40, + filepath : '/Images/initech.png', + alphabet : 'wide' +}).font('INITECH', 'Doom', 'cyan', (_ascii) => { +}); + +art.table({ + data: [ + {text: ' .\'ANDRE. '}, + {text: ' ..THE.GIANT\'. '}, + {text: '.With.Bobby."The.Brain"'}, + {text: '.Heenan.'} + ], + verticalBar : ' ', + horizontalBar : ' ', + intersection : ' ' +}).lines(2, (table: any) => { + art.strings([ + 'ANDRE', + 'the', + 'GIANT', + 'POSSE', + '7\'4"', + '520 LB' + ], 'rusted', (andre: any, the: any, giant: any, posse: any, height: any, weight: any) => { + art.strings([ 'has', 'a'], 'twopoint', (has: any, a: any) => { + art.image({ + filepath : '/Images/andre_has_a_posse.jpeg', + alphabet : 'ultra-wide' + }).overlay(andre, { + x: 8, y: 4, + style: 'white' + }).overlay(the, { + x: 10, y: 7, + style: 'white', + transparent : true + }).overlay(giant, { + x: 8, y: 10, + style: 'white', + transparent : true + }).overlay(has, { + x: 10, y: 14, + style: 'white' + }).overlay(a, { + x: 13, y: 17, + style: 'white' + }).overlay(posse, { + x: 5, y: 20, + style: 'bright_black', + transparent: true + }).overlay(height, { + x: 59, y: 3, + style: 'bright_black', + transparent: true + }).overlay(weight, { + x: 59, y: 8, + style: 'bright_black', + transparent: true + }).overlay(table, { + x: 6, y: -6, + style: 'bright_black', + transparent: true + }, (_final: any) => { + }); + }); + }); +}); + +art.Figlet.fontPath = 'Fonts'; + +const image = new art.Image({ + filepath: '~/Images/metropolis.jpg', + alphabet: 'variant4' +}); +image.write((_err: any, _rendered: string) => { +}); + +art.font('Prompt', 'Basic', 'red').font('v1', 'Doom', 'magenta', (_rendered) => { +}); + +art.image({ + width : 40, + filepath : '/Images/initech.png', + alphabet : 'wide' +}).font('INITECH', 'Doom', 'cyan', (_ascii) => { +}); + +art.style('my text', 'red+underline'); + +art.table({ + width : 80, + data : [ /* ... */ ], + verticalBar : ' ', + horizontalBar : ' ', + intersection : ' ', + columns : [ + { + value : 'Product', + style : 'black+gray_bg' + }, { + value : 'Maker', + style : 'white' + }, { + value : 'Location', + style : 'white' + } + ] +}, (_rendered) => { + // use rendered text +}); + +art.table({ + width : 80, + data : [ /* ... */ ], + bars : { + ul_corner: '┏', + ur_corner: '┓', + lr_corner: '┛', + ll_corner: '┗', + bottom_t: '┻', + top_t: '┳', + right_t: '┫', + left_t: '┣', + intersection: '╋', + vertical: '┃', + horizontal: '━', + }, + borderColor : 'bright_white', +}, (_rendered) => { + // use rendered text +}); diff --git a/types/ascii-art/index.d.ts b/types/ascii-art/index.d.ts new file mode 100644 index 0000000000..3a753a183b --- /dev/null +++ b/types/ascii-art/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for ascii-art 1.4 +// Project: https://github.com/khrome/ascii-art +// Definitions by: Lukas Elmer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export type StyleType = (text: string, style?: string, close?: boolean) => Art; +export type FontType = ((text: string, font?: string, styleOrCallback?: string | Cb, callback?: Cb) => Art); +export type ImageType = (options: object, callback?: Cb) => Art; +export type TableType = (options: object, callback?: Cb) => Art; +export type ArtworkType = (options: object, callback?: Cb) => Art; +export type LinesType = (...options: any[]) => Art; +export type OverlayType = (...options: any[]) => Art; +export type JoinType = (...options: any[]) => Art; +export type StringsType = (...options: any[]) => Art; + +export const style: StyleType; +export const font: FontType; +export const image: ImageType; +export const table: TableType; +export const artwork: ArtworkType; +export const lines: LinesType; +export const overlay: OverlayType; +export const join: JoinType; +export const strings: StringsType; +export const Figlet: any; +export const Image: any; + +export interface Art { + style: StyleType; + font: FontType; + image: ImageType; + table: TableType; + artwork: ArtworkType; + lines: LinesType; + overlay: OverlayType; + join: JoinType; + working: boolean; + + toPromise: (() => Promise); +} + +export type Cb = (result: string) => void; diff --git a/types/ascii-art/tsconfig.json b/types/ascii-art/tsconfig.json new file mode 100644 index 0000000000..1f9759cc1f --- /dev/null +++ b/types/ascii-art/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "allowSyntheticDefaultImports": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ascii-art-tests.ts" + ] +} diff --git a/types/ascii-art/tslint.json b/types/ascii-art/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/ascii-art/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/ascii2mathml/index.d.ts b/types/ascii2mathml/index.d.ts index dcb9f7bb98..0ff3b1d10e 100644 --- a/types/ascii2mathml/index.d.ts +++ b/types/ascii2mathml/index.d.ts @@ -7,29 +7,31 @@ export = A2MML; declare var A2MML: ascii2mathml; -interface Options { - decimalMark?: string; - colSep?: string; - rowSep?: string; - display?: 'inline' | 'block'; - dir?: 'ltr' | 'rtl'; - bare?: boolean; - standalone?: boolean; - annotate?: boolean; -} - interface ascii2mathml { /** * Generates a function with default options set to convert * ASCIIMath expression to MathML markup. * @param options Options */ - (options: Options): ascii2mathml; + (options: A2MML.Options): ascii2mathml; /** * Converts ASCIIMath expression to MathML markup. * @param asciimath ASCIIMath expression * @param options Options */ - (asciimath: string, options?: Options): string; + (asciimath: string, options?: A2MML.Options): string; +} + +declare namespace A2MML { + interface Options { + decimalMark?: string; + colSep?: string; + rowSep?: string; + display?: 'inline' | 'block'; + dir?: 'ltr' | 'rtl'; + bare?: boolean; + standalone?: boolean; + annotate?: boolean; + } } diff --git a/types/assert/assert-tests.ts b/types/assert/assert-tests.ts new file mode 100644 index 0000000000..22248c18bd --- /dev/null +++ b/types/assert/assert-tests.ts @@ -0,0 +1,10 @@ +import * as assert from 'assert'; + +assert(true, "it's working"); + +assert.ok(true, "inner functions work as well"); + +assert.throws(() => {}); +assert.throws(() => {}, () => {}, "works wonderfully"); + +assert['fail'](true, true, "works like a charm"); diff --git a/types/assert/index.d.ts b/types/assert/index.d.ts new file mode 100644 index 0000000000..d79805f5af --- /dev/null +++ b/types/assert/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for commonjs-assert 1.4 +// Project: https://github.com/browserify/commonjs-assert +// Definitions by: Nico Gallinal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function assert(value: any, message?: string): void; + +declare namespace assert { + function fail(actual?: any, expected?: any, message?: string, operator?: string): void; + + function ok(value: any, message?: string): void; + + function equal(actual: any, expected: any, message?: string): void; + + function notEqual(actual: any, expected: any, message?: string): void; + + function deepEqual(actual: any, expected: any, message?: string): void; + + function notDeepEqual(acutal: any, expected: any, message?: string): void; + + function strictEqual(actual: any, expected: any, message?: string): void; + + function notStrictEqual(actual: any, expected: any, message?: string): void; + + function throws(block: () => void, message?: string): void; + function throws(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void; + + function doesNotThrow(block: () => void, message?: string): void; + function doesNotThrow(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void; + + function ifError(value: any): void; + + class AssertionError implements Error { + name: string; + message: string; + actual: any; + expected: any; + operator: string; + generatedMessage: boolean; + + constructor(options?: { message?: string; actual?: any; expected?: any; operator?: string; stackStartFunction?: () => void }); + } +} + +export = assert; diff --git a/types/assert/tsconfig.json b/types/assert/tsconfig.json new file mode 100644 index 0000000000..5ab217b2ab --- /dev/null +++ b/types/assert/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "assert-tests.ts" + ] +} diff --git a/types/assert/tslint.json b/types/assert/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/assert/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/astring/index.d.ts b/types/astring/index.d.ts new file mode 100644 index 0000000000..c2768e7d5f --- /dev/null +++ b/types/astring/index.d.ts @@ -0,0 +1,50 @@ +// Type definitions for astring 1.3 +// Project: https://github.com/davidbonnet/astring +// Definitions by: Nikolaj Kappler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as ESTree from 'estree'; +import 'node'; +import { Stream } from 'stream'; + +export interface Options { + /** string to use for indentation (defaults to " ") */ + indent?: string; + /** string to use for line endings (defaults to "\n") */ + lineEnd?: string; + /** indent level to start from (defaults to 0) */ + startingIndentLevel?: number; + /** generate comments if true (defaults to false) */ + comments?: boolean; + /** custom code generator (defaults to astring.baseGenerator) */ + generator?: object; + /** source map generator (defaults to null), see https://github.com/mozilla/source-map#sourcemapgenerator */ + sourceMap?: any; +} + +/** Returns a string representing the rendered code of the provided AST `node`. However, if an `output` stream is provided in the options, it writes to that stream and returns it. */ +export function generate(node: ESTree.Node, options?: Options): string; +/** Returns a string representing the rendered code of the provided AST `node`. However, if an `output` stream is provided in the options, it writes to that stream and returns it. */ +export function generate(node: ESTree.Node, options: Options & { + /** output stream to write the rendered code to (defaults to null) */ + output: Stream; +}): Stream; + +/** + * A code generator consists of a mapping of node names and functions that take two arguments: `node` and `state`. + * The `node` points to the node from which to generate the code and the `state` exposes the `write` method that takes generated code strings. + */ +export type Generator = { [key in ESTree.Node["type"]]: (node: Extract, state: { write(s: string): void }) => void }; + +/** Base generator that can be used to extend Astring. See https://github.com/davidbonnet/astring#extending */ +export const baseGenerator: Generator; + +declare global { + interface astring { + generate: typeof generate; + /** Base generator that can be used to extend Astring. See https://github.com/davidbonnet/astring#extending */ + baseGenerator: Generator; + } + const astring: astring; +} diff --git a/types/astring/test/astring-global.test.ts b/types/astring/test/astring-global.test.ts new file mode 100644 index 0000000000..c756c9c60e --- /dev/null +++ b/types/astring/test/astring-global.test.ts @@ -0,0 +1,5 @@ +// global scope function +astring.generate(null); + +// global scope function +astring.baseGenerator.Program(null, { write(s: string) { return; } }); diff --git a/types/astring/test/astring.test.ts b/types/astring/test/astring.test.ts new file mode 100644 index 0000000000..782af01017 --- /dev/null +++ b/types/astring/test/astring.test.ts @@ -0,0 +1,32 @@ +import { baseGenerator, generate } from "astring"; +import { FunctionExpression, MemberExpression, Program } from "estree"; +import { Stream } from "stream"; + +const ast: Program = null; +const functionE: FunctionExpression = null; +const memberE: MemberExpression = null; + +// should accept different nodes +generate(ast); +generate(functionE); +generate(memberE); + +// options without output option should generate string +const string: string = generate(ast, { + comments: true, + generator: baseGenerator, + indent: "\t", + lineEnd: "\n", + startingIndentLevel: 42, + sourceMap: null +}); + +// options with output option should return Stream +const stream: Stream = generate(ast, { + output: new Stream() +}); + +// Generator should map node types to functions whose first parameter is same node type +baseGenerator.Program(ast, { write(s: string) { return; } }); +baseGenerator.FunctionExpression(functionE, { write(s: string) { return; } }); +baseGenerator.MemberExpression(memberE, { write(s: string) { return; } }); diff --git a/types/astring/tsconfig.json b/types/astring/tsconfig.json new file mode 100644 index 0000000000..b00d44f643 --- /dev/null +++ b/types/astring/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/astring.test.ts", + "test/astring-global.test.ts" + ] +} \ No newline at end of file diff --git a/types/astring/tslint.json b/types/astring/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/astring/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/async/index.d.ts b/types/async/index.d.ts index 961dd73ebb..e6cfd3bcaa 100644 --- a/types/async/index.d.ts +++ b/types/async/index.d.ts @@ -2,34 +2,34 @@ // Project: https://github.com/caolan/async // Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman , Angus Fenying , Pascal Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 export as namespace async; export interface Dictionary { [key: string]: T; } export type IterableCollection = T[] | IterableIterator | Dictionary -export interface ErrorCallback { (err?: T): void; } -export interface AsyncBooleanResultCallback { (err?: E, truthValue?: boolean): void; } -export interface AsyncResultCallback { (err?: E, result?: T): void; } -export interface AsyncResultArrayCallback { (err?: E, results?: Array): void; } -export interface AsyncResultObjectCallback { (err: E | undefined, results: Dictionary): void; } +export interface ErrorCallback { (err?: E | null): void; } +export interface AsyncBooleanResultCallback { (err?: E | null, truthValue?: boolean): void; } +export interface AsyncResultCallback { (err?: E | null, result?: T): void; } +export interface AsyncResultArrayCallback { (err?: E | null, results?: Array): void; } +export interface AsyncResultObjectCallback { (err: E | undefined, results: Dictionary): void; } -export interface AsyncFunction { (callback: (err?: E, result?: T) => void): void; } -export interface AsyncFunctionEx { (callback: (err?: E, ...results: T[]) => void): void; } -export interface AsyncIterator { (item: T, callback: ErrorCallback): void; } -export interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; } -export interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } -export interface AsyncMemoIterator { (memo: R | undefined, item: T, callback: AsyncResultCallback): void; } -export interface AsyncBooleanIterator { (item: T, callback: AsyncBooleanResultCallback): void; } +export interface AsyncFunction { (callback: (err?: E | null, result?: T) => void): void; } +export interface AsyncFunctionEx { (callback: (err?: E | null, ...results: T[]) => void): void; } +export interface AsyncIterator { (item: T, callback: ErrorCallback): void; } +export interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; } +export interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } +export interface AsyncMemoIterator { (memo: R | undefined, item: T, callback: AsyncResultCallback): void; } +export interface AsyncBooleanIterator { (item: T, callback: AsyncBooleanResultCallback): void; } -export interface AsyncWorker { (task: T, callback: ErrorCallback): void; } -export interface AsyncVoidFunction { (callback: ErrorCallback): void; } +export interface AsyncWorker { (task: T, callback: ErrorCallback): void; } +export interface AsyncVoidFunction { (callback: ErrorCallback): void; } export type AsyncAutoTasks, E> = { [K in keyof R]: AsyncAutoTask } export type AsyncAutoTask, E> = AsyncAutoTaskFunctionWithoutDependencies | (keyof R | AsyncAutoTaskFunction)[]; -export interface AsyncAutoTaskFunctionWithoutDependencies { (cb: AsyncResultCallback | ErrorCallback): void; } -export interface AsyncAutoTaskFunction, E> { (results: R, cb: AsyncResultCallback | ErrorCallback): void; } +export interface AsyncAutoTaskFunctionWithoutDependencies { (cb: AsyncResultCallback | ErrorCallback): void; } +export interface AsyncAutoTaskFunction, E = Error> { (results: R, cb: AsyncResultCallback | ErrorCallback): void; } export interface AsyncQueue { length(): number; @@ -37,9 +37,8 @@ export interface AsyncQueue { running(): number; idle(): boolean; concurrency: number; - push(task: T | T[], callback?: ErrorCallback): void; - push(task: T, callback?: AsyncResultCallback): void; - unshift(task: T | T[], callback?: ErrorCallback): void; + push(task: T | T[], callback?: AsyncResultCallback): void; + unshift(task: T | T[], callback?: ErrorCallback): void; saturated: () => any; empty: () => any; drain: () => any; @@ -61,7 +60,7 @@ export interface AsyncPriorityQueue { concurrency: number; started: boolean; paused: boolean; - push(task: T | T[], priority: number, callback?: AsyncResultArrayCallback): void; + push(task: T | T[], priority: number, callback?: AsyncResultArrayCallback): void; saturated: () => any; empty: () => any; drain: () => any; @@ -94,112 +93,113 @@ export interface AsyncCargo { } // Collections -export function each(arr: IterableCollection, iterator: AsyncIterator, callback?: ErrorCallback): void; +export function each(arr: IterableCollection, iterator: AsyncIterator, callback?: ErrorCallback): void; export const eachSeries: typeof each; -export function eachLimit(arr: IterableCollection, limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; +export function eachLimit(arr: IterableCollection, limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; export const forEach: typeof each; export const forEachSeries: typeof each; export const forEachLimit: typeof eachLimit; -export function forEachOf(obj: IterableCollection, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; +export function forEachOf(obj: IterableCollection, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; export const forEachOfSeries: typeof forEachOf; -export function forEachOfLimit(obj: IterableCollection, limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; +export function forEachOfLimit(obj: IterableCollection, limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; export const eachOf: typeof forEachOf; export const eachOfSeries: typeof forEachOf; export const eachOfLimit: typeof forEachOfLimit; -export function map(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; -export function map(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function map(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function map(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; export const mapSeries: typeof map; -export function mapLimit(arr: IterableCollection, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; -export function mapValuesLimit(obj: Dictionary, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; -export function mapValues(obj: Dictionary, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; +export function mapLimit(arr: IterableCollection, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function mapValuesLimit(obj: Dictionary, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; +export function mapValues(obj: Dictionary, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; export const mapValuesSeries: typeof mapValues; -export function filter(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; +export function filter(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; export const filterSeries: typeof filter; -export function filterLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; +export function filterLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; export const select: typeof filter; export const selectSeries: typeof filter; export const selectLimit: typeof filterLimit; export const reject: typeof filter; export const rejectSeries: typeof filter; export const rejectLimit: typeof filterLimit; -export function reduce(arr: T[] | IterableIterator, memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): void; +export function reduce(arr: T[] | IterableIterator, memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): void; export const inject: typeof reduce; export const foldl: typeof reduce; export const reduceRight: typeof reduce; export const foldr: typeof reduce; -export function detect(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; +export function detect(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; export const detectSeries: typeof detect; -export function detectLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; +export function detectLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; export const find: typeof detect; export const findSeries: typeof detect; export const findLimit: typeof detectLimit; -export function sortBy(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; -export function some(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; +export function sortBy(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function some(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; export const someSeries: typeof some; -export function someLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; +export function someLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; export const any: typeof some; export const anySeries: typeof someSeries; export const anyLimit: typeof someLimit; -export function every(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; +export function every(arr: IterableCollection, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; export const everySeries: typeof every; -export function everyLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; +export function everyLimit(arr: IterableCollection, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; export const all: typeof every; export const allSeries: typeof every; export const allLimit: typeof everyLimit; -export function concat(arr: IterableCollection, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; -export function concatLimit(arr: IterableCollection, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function concat(arr: IterableCollection, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function concatLimit(arr: IterableCollection, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; export const concatSeries: typeof concat; // Control Flow -export function series(tasks: AsyncFunction[], callback?: AsyncResultArrayCallback): void; -export function series(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; -export function parallel(tasks: Array>, callback?: AsyncResultArrayCallback): void; -export function parallel(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; -export function parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; -export function parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; -export function whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doWhilst(fn: AsyncFunctionEx, test: (...results: T[]) => boolean, callback: ErrorCallback): void; -export function until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doUntil(fn: AsyncFunctionEx, test: (...results: T[]) => boolean, callback: ErrorCallback): void; -export function during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; -export function forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; -export function waterfall(tasks: Function[], callback?: AsyncResultCallback): void; +export function series(tasks: AsyncFunction[], callback?: AsyncResultArrayCallback): void; +export function series(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; +export function parallel(tasks: Array>, callback?: AsyncResultArrayCallback): void; +export function parallel(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; +export function parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; +export function parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; +export function whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; +export function doWhilst(fn: AsyncFunctionEx, test: (...results: T[]) => boolean, callback: ErrorCallback): void; +export function until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; +export function doUntil(fn: AsyncFunctionEx, test: (...results: T[]) => boolean, callback: ErrorCallback): void; +export function during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; +export function doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; +export function forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; +export function waterfall(tasks: Function[], callback?: AsyncResultCallback): void; export function compose(...fns: Function[]): Function; export function seq(...fns: Function[]): Function; export function applyEach(fns: Function[], ...argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional. export function applyEachSeries(fns: Function[], ...argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional. -export function queue(worker: AsyncWorker, concurrency?: number): AsyncQueue; -export function queue(worker: AsyncResultIterator, concurrency?: number): AsyncQueue; -export function priorityQueue(worker: AsyncWorker, concurrency: number): AsyncPriorityQueue; -export function cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; -export function auto, E>(tasks: AsyncAutoTasks, concurrency?: number, callback?: AsyncResultCallback): void; -export function autoInject(tasks: any, callback?: AsyncResultCallback): void; -export function retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: AsyncResultCallback): void; -export function retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: AsyncResultCallback): void; -export function retryable(opts: number | {times: number, interval: number}, task: AsyncFunction): AsyncFunction; -export function apply(fn: Function, ...args: any[]): AsyncFunction; +export function queue(worker: AsyncWorker, concurrency?: number): AsyncQueue; +export function queue(worker: AsyncResultIterator, concurrency?: number): AsyncQueue; +export function priorityQueue(worker: AsyncWorker, concurrency: number): AsyncPriorityQueue; +export function cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; +export function auto, E = Error>(tasks: AsyncAutoTasks, concurrency?: number, callback?: AsyncResultCallback): void; +export function auto, E = Error>(tasks: AsyncAutoTasks, callback?: AsyncResultCallback): void; +export function autoInject(tasks: any, callback?: AsyncResultCallback): void; +export function retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: AsyncResultCallback): void; +export function retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: AsyncResultCallback): void; +export function retryable(opts: number | {times: number, interval: number}, task: AsyncFunction): AsyncFunction; +export function apply(fn: Function, ...args: any[]): AsyncFunction; export function nextTick(callback: Function, ...args: any[]): void; export const setImmediate: typeof nextTick; -export function reflect(fn: AsyncFunction) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void; -export function reflectAll(tasks: AsyncFunction[]): ((callback: (err: null, result: {error?: E, value?: T}) => void) => void)[]; +export function reflect(fn: AsyncFunction) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void; +export function reflectAll(tasks: AsyncFunction[]): ((callback: (err: null, result: {error?: E, value?: T}) => void) => void)[]; -export function timeout(fn: AsyncFunction, milliseconds: number, info?: any): AsyncFunction; -export function timeout(fn: AsyncResultIterator, milliseconds: number, info?: any): AsyncResultIterator; +export function timeout(fn: AsyncFunction, milliseconds: number, info?: any): AsyncFunction; +export function timeout(fn: AsyncResultIterator, milliseconds: number, info?: any): AsyncResultIterator; export function times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; -export function timesSeries(n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; -export function timesLimit(n: number, limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; +export function timesSeries(n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; +export function timesLimit(n: number, limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; -export function transform(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback): void; -export function transform(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback): void; +export function transform(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback): void; +export function transform(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback): void; -export function transform(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback): void; -export function transform(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback): void; +export function transform(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback): void; +export function transform(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback): void; -export function race(tasks: (AsyncFunction)[], callback: AsyncResultCallback) : void; +export function race(tasks: (AsyncFunction)[], callback: AsyncResultCallback) : void; // Utils export function memoize(fn: Function, hasher?: Function): Function; diff --git a/types/async/test/index.ts b/types/async/test/index.ts index 3c6c2f5dfe..574a5ed8b9 100644 --- a/types/async/test/index.ts +++ b/types/async/test/index.ts @@ -114,7 +114,7 @@ async.series([ ], function (err, results) { }); -async.series([ +async.series([ function (callback) { callback(undefined, 'one'); }, @@ -138,7 +138,7 @@ async.series({ }, function (err, results) { }); -async.series({ +async.series({ one: function (callback) { setTimeout(function () { callback(undefined, 1); @@ -178,7 +178,7 @@ async.parallel([ ], function (err, results) { }); -async.parallel([ +async.parallel([ function (callback) { setTimeout(function () { callback(undefined, 'one'); @@ -207,7 +207,7 @@ async.parallel({ }, function (err, results) { }); -async.parallel({ +async.parallel({ one: function (callback) { setTimeout(function () { callback(undefined, 1); @@ -273,7 +273,7 @@ async.waterfall([ ], function (err, result) { }); -var q = async.queue(function (task: any, callback: (err?:Error,msg?:string) => void) { +var q = async.queue(function (task: any, callback: (err?:Error,msg?:string) => void) { console.log('hello ' + task.name); callback(undefined,'a message.'); }, 2); @@ -293,7 +293,7 @@ q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { console.log('finished processing bar'); }); -q.push({name: 'foo'}, function (err,msg) { +q.push({name: 'foo'}, function (err, msg) { console.log('foo finished with a message "'+ msg! + '"'); }); @@ -330,7 +330,7 @@ q.resume(); q.kill(); // tests for strongly typed tasks -var q2 = async.queue(function (task: string, callback: () => void) { +var q2 = async.queue(function (task: string, callback: () => void) { console.log('Task: ' + task); callback(); }, 1); @@ -356,7 +356,7 @@ q2.unshift(['task3', 'task4', 'task5'], function (error) { }); -var aq = async.queue(function (level: number, callback: (error?: Error, newLevel?: number) => void) { +var aq = async.queue(function (level: number, callback: (error?: Error, newLevel?: number) => void) { console.log('hello ' + level); callback(undefined, level+1); }); @@ -387,14 +387,47 @@ cargo.push({ name: 'baz' }, function (err: Error) { var filename = ''; async.auto({ - get_data: function (callback: any) { }, - make_folder: function (callback: any) { }, + get_data: function (callback: AsyncResultCallback) { }, + make_folder: function (callback: AsyncResultCallback) { }, //arrays with different types are not accepted by TypeScript. - write_file: ['get_data', 'make_folder', function (callback: any) { + write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { callback(null, filename); - }], + } as any], //arrays with different types are not accepted by TypeScript. - email_link: ['write_file', function (callback: any, results: any) { }] + email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { } as any] +}); + +async.auto({ + get_data: function (callback: AsyncResultCallback) { }, + make_folder: function (callback: AsyncResultCallback) { }, + //arrays with different types are not accepted by TypeScript. + write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { + callback(null, filename); + } as any], + //arrays with different types are not accepted by TypeScript. + email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { } as any] +}, function (err, results) { + console.log('finished auto'); +}); + +interface A { + get_data: any; + make_folder: any; + write_file: any; + email_link: any; +} + +async.auto({ + get_data: function (callback: AsyncResultCallback) { }, + make_folder: function (callback: AsyncResultCallback) { }, + //arrays with different types are not accepted by TypeScript. + write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { + callback(null, filename); + } as any], + //arrays with different types are not accepted by TypeScript. + email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { } as any] +}, 1, function (err, results) { + console.log('finished auto'); }); async.retry(3, function (callback, results) { }, function (err, result) { }); @@ -459,10 +492,10 @@ async.dir(function (name: string, callback: any) { // each -async.each({ +async.each({ "a": 1, "b": 2 -}, function(val: number, next: ErrorCallback): void { +}, function(val: number, next: ErrorCallback): void { setTimeout(function(): void { @@ -478,10 +511,10 @@ async.each({ }); -async.eachSeries({ +async.eachSeries({ "a": 1, "b": 2 -}, function(val: number, next: ErrorCallback): void { +}, function(val: number, next: ErrorCallback): void { setTimeout(function(): void { @@ -497,14 +530,14 @@ async.eachSeries({ }); -async.eachLimit({ +async.eachLimit({ "a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6 -}, 2, function(val: number, next: ErrorCallback): void { +}, 2, function(val: number, next: ErrorCallback): void { setTimeout(function(): void { @@ -522,10 +555,10 @@ async.eachLimit({ // forEachOf/eachOf -async.eachOf({ +async.eachOf({ "a": 1, "b": 2 -}, function(val: number, key: string, next: ErrorCallback): void { +}, function(val: number, key: string, next: ErrorCallback): void { setTimeout(function(): void { @@ -541,10 +574,10 @@ async.eachOf({ }); -async.forEachOfSeries({ +async.forEachOfSeries({ "a": 1, "b": 2 -}, function(val: number, key: string, next: ErrorCallback): void { +}, function(val: number, key: string, next: ErrorCallback): void { setTimeout(function(): void { @@ -560,14 +593,14 @@ async.forEachOfSeries({ }); -async.forEachOfLimit({ +async.forEachOfLimit({ "a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6 -}, 2, function(val: number, key: string, next: ErrorCallback): void { +}, 2, function(val: number, key: string, next: ErrorCallback): void { setTimeout(function(): void { @@ -585,11 +618,11 @@ async.forEachOfLimit({ // map -async.map({ +async.map({ "a": 1, "b": 2, "c": 3 -}, function(val: number, next: AsyncResultCallback): void { +}, function(val: number, next: AsyncResultCallback): void { setTimeout(function(): void { @@ -605,11 +638,11 @@ async.map({ }); -async.mapSeries({ +async.mapSeries({ "a": 1, "b": 2, "c": 3 -}, function(val: number, next: AsyncResultCallback): void { +}, function(val: number, next: AsyncResultCallback): void { setTimeout(function(): void { @@ -625,14 +658,14 @@ async.mapSeries({ }); -async.mapLimit({ +async.mapLimit({ "a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6 -}, 2, function(val: number, next: AsyncResultCallback): void { +}, 2, function(val: number, next: AsyncResultCallback): void { setTimeout(function(): void { @@ -650,11 +683,11 @@ async.mapLimit({ // mapValues -async.mapValues({ +async.mapValues({ "a": 1, "b": 2, "c": 3 -}, function(val: number, key: string, next: AsyncResultCallback): void { +}, function(val: number, key: string, next: AsyncResultCallback): void { setTimeout(function(): void { @@ -670,11 +703,11 @@ async.mapValues({ }); -async.mapValuesSeries({ +async.mapValuesSeries({ "a": 1, "b": 2, "c": 3 -}, function(val: number, key: string, next: AsyncResultCallback): void { +}, function(val: number, key: string, next: AsyncResultCallback): void { setTimeout(function(): void { @@ -692,11 +725,11 @@ async.mapValuesSeries({ // filter/select/reject -async.filter({ +async.filter({ "a": 1, "b": 2, "c": 3 -}, function(val: number, next: AsyncBooleanResultCallback): void { +}, function(val: number, next: AsyncBooleanResultCallback): void { setTimeout(function(): void { @@ -712,11 +745,11 @@ async.filter({ }); -async.reject({ +async.reject({ "a": 1, "b": 2, "c": 3 -}, function(val: number, next: AsyncBooleanResultCallback): void { +}, function(val: number, next: AsyncBooleanResultCallback): void { setTimeout(function(): void { @@ -734,11 +767,11 @@ async.reject({ // concat -async.concat({ +async.concat({ "a": "1", "b": "2", "c": "3" -}, function(item: string, next: AsyncResultCallback): void { +}, function(item: string, next: AsyncResultCallback): void { console.log(`async.concat: ${item}`); @@ -752,11 +785,11 @@ async.concat({ // detect/find -async.detect({ +async.detect({ "a": 1, "b": 2, "c": 3 -}, function(item: number, next: AsyncBooleanResultCallback): void { +}, function(item: number, next: AsyncBooleanResultCallback): void { console.log(`async.detect/find: ${item}`); @@ -777,11 +810,11 @@ async.detect({ // every/all -async.every({ +async.every({ "a": 1, "b": 2, "c": 3 -}, function(item: number, next: AsyncBooleanResultCallback): void { +}, function(item: number, next: AsyncBooleanResultCallback): void { console.log(`async.every/all: ${item}`); @@ -795,11 +828,11 @@ async.every({ // some/any -async.some({ +async.some({ "a": 1, "b": 2, "c": 3 -}, function(item: number, next: AsyncBooleanResultCallback): void { +}, function(item: number, next: AsyncBooleanResultCallback): void { console.log(`async.some/any: ${item}`); diff --git a/types/asynciterator/tslint.json b/types/asynciterator/tslint.json index 3db14f85ea..1c36270d47 100644 --- a/types/asynciterator/tslint.json +++ b/types/asynciterator/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-angle-bracket-type-assertion": false + } +} diff --git a/types/athenajs/index.d.ts b/types/athenajs/index.d.ts new file mode 100644 index 0000000000..08c828679e --- /dev/null +++ b/types/athenajs/index.d.ts @@ -0,0 +1,784 @@ +// Type definitions for athenajs 0.1 +// Project: https://github.com/AthenaJS/athenajs +// Definitions by: Nicolas Ramz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace AthenaJS; + +export function Dom(sel?: string | HTMLElement): _Dom; + +export class Scene { + constructor(options?: SceneOptions); + map: Map; + hudScene: Scene | null; + running: boolean; + opacity: number; + addObject(object: Drawable | Drawable[], layer?: number): Scene; + animate(fxName: string, options: EffectOptions): Promise; + bindEvents(eventList: string): void; + debug(bool?: boolean): void; + fadeIn(duration: number): Promise; + fadeOut(duration: number): Promise; + fadeInAndOut(inDuration: number, delay: number, outDuration: number): Promise; + getOpacity(): number; + getPlayTime(): number; + load(type: string, src: string, id?: string): void; + loadAudio(src: string, id?: string): void; + loadImage(src: string, id?: string): void; + loadMap(src: string, id?: string): void; + notify(name: string, data?: JSObject): void; + removeObject(obj: Drawable): void; + setBackgroundImage(image: string|HTMLImageElement): void; + setLayerPriority(layer: number, background: boolean): void; + setMap(map: Map | JSObject, x?: number, y?: number): void; + setOpacity(opacity: number): void; + setup(): void; + start(): void; + stop(): void; +} +export class Game { + constructor(options: GameOptions); + bindEvents(eventList: string): void; + setScene(scene: Scene): void; + toggleFullscreen(): void; + toggleSound(bool: boolean): void; + toggleTileInspector(bool: boolean): void; + togglePause(): void; + scene: Scene; + sound: boolean; +} +export class Drawable { + constructor(type: string, options: DrawableOptions); + addChild(child: Drawable): void; + animate(name: string, options: JSObject): Promise; + center(): Drawable; + destroy(data?: any): void; + moveTo(x: number, y: number, duration?: number): Drawable; + notify(id: string, data?: JSObject): void; + onCollision(object: Drawable): void; + onEvent(eventType: string, data?: JSObject): void; + playSound(id: string, options?: { pan?: boolean, loop?: false }): void; + setBehavior(behavior: string | { new(sprite: Drawable, options?: JSObject): Behavior }, options?: JSObject): void; + setScale(scale: number): void; + getCurrentWidth(): number; + getCurrentHeight(): number; + getProperty(prop: string): any; + setProperty(prop: string, value: any): void; + setMask(mask: MaskOptions | null, exclude?: boolean): void; + stopAnimate(endValue?: number): void; + reset(): void; + show(): void; + hide(): void; + type: string; + width: number; + height: number; + x: number; + y: number; + vx: number; + vy: number; + canCollide: boolean; + currentMovement: string; + running: boolean; + movable: boolean; + behavior: Behavior; + currentMap: Map; + data: JSObject; + visible: boolean; +} + +export interface MaskOptions { + x: number; + y: number; + width: number; + height: number; +} + +export interface MenuItem { + text: string; + selectable: boolean; + visible: boolean; + active?: boolean; +} + +export interface MenuOptions { + title: string; + color: string; + menuItems: MenuItem[]; +} + +export class Menu extends Drawable { + constructor(id: string, options: MenuOptions); + nextItem(): void; + getSelectedItemIndex(): number; +} + +export class SimpleText extends Drawable { + constructor(type: string, simpleTextOptions: SimpleTextOptions); + getCurrentOffsetX(): number; + getCurrentOffsetY(): number; + setColor(color: string): void; + setSize(width: number, height: number): void; + setText(text: string): void; +} +export class Paint extends Drawable { + constructor(type: string, paintOptions: PaintOptions); + arc(cx: number, cy: number, r: number, starteAngle: number, endAngle: number, fillStyle: string, borderSize: number): void; + fill(color?: string): void; + circle(cx: number, cy: number, r: number, fillStyle?: string, borderWidth?: number, borderStyle?: string): void; + rect(x: number, y: number, width: number, height: number, color: string): void; + name: string; + color: string; +} + +export class BitmapText extends Drawable { + constructor(type: string, textOptions: BitmapTextOptions); + setText(text: string): void; +} + +export class Sprite extends Drawable { + constructor(type: string, spriteOptions: SpriteOptions); + addAnimation(name: string, imgPath: string, options: AnimOptions): void; + setAnimation(name: string, fn?: Callback, frameNum?: number, revert?: boolean): void; + clearMove(): void; +} + +export interface pixelPos { + x: number; + y: number; +} + +export class Map { + constructor(options: MapOptions); + addObject(obj: Drawable, layerIndex?: number): void; + addTileSet(tiles: TileDesc[]): void; + checkMatrixForCollision(buffer: number[], matrixWidth: number, x: number, y: number, behavior: number): boolean; + clear(tileNum?: number, behavior?: number): void; + getTileBehaviorAtIndex(col: number, row: number): number; + getTileIndexFromPixel(x: number, y: number): pixelPos; + moveTo(x: number, y: number): void; + respawn(): void; + setData(map: Uint8Array, behaviors: Uint8Array): void; + setEasing(easing: string): void; + shift(startLine: number, height: number): void; + updateTile(col: number, row: number, tileNum?: number, behavior?: number): void; + duration: number; + numRows: number; + numCols: number; + width: number; + height: number; + tileWidth: number; + tileHeight: number; +} + +export class Tile { + constructor(options: JSObject); + static TYPE: { + AIR: 1; + WALL: 2; + LADDER: 3; + }; + offsetX: number; + offsetY: number; + width: number; + height: number; + + inertia: number; + upCollide: boolean; + downCollide: boolean; +} + +export interface TileDesc { + offsetX: number; + offsetY: number; + width: number; + height: number; +} + +export interface MapOptions { + src: string; + tileWidth: number; + tileHeight: number; + width: number; + height: number; + viewportW?: number; + viewportH?: number; + buffer?: ArrayBuffer; +} + +export interface FXInstance { + addFX(fxName: string, FxClass: { new(options: EffectOptions, display: Display): Effect }): void; +} + +export const FX: FXInstance; + +export class _FX { + /** + * Creates the FX class, adding the linear easing + */ + constructor(); + + /** + * Add a new Effect + */ + addFX(fxName: string, FxClass: { new(): Effect }): void; + + /** + * Retrieve an effect Class by its name + * + */ + getEffect(fxName: string): Effect; + + /** + * Add a new easing function for other objects to use + * + */ + addEasing(easingName: string, easingFn: (x?: number, t?: number, b?: number, c?: number, d?: number) => void): void; + + /** + * Retrieves an easing function + * + */ + getEasing(easingName: string): (x?: number, t?: number, b?: number, c?: number, d?: number) => void; +} + +export interface EffectOptions { + easing?: string; + when?: string; + startValue?: number; + endValue?: number; + duration?: number; +} + +export class Effect { + width: number; + height: number; + buffer: RenderingContext; + animProgress: number; + startValue: number; + ended: boolean; + /** + * This the class constructor. Default options are: + * + */ + constructor(options: EffectOptions, display: Display); + + /** + * Changes the easing function used for the ffect + * + */ + setEasing(easing: (x?: number, t?: number, b?: number, c?: number, d?: number) => void): void; + + /** + * Called when the ffect is started. + * + * This method can be overriden but the super should always be called + */ + start(): Promise; + + /** + * called when the effect is stopped + */ + stop(object: any, setEndValue: any): void; + + /** + * Calculates current animation process + * + * This method can be overridden but the super should always be calle first + */ + process(ctx: RenderingContext, fxCtx?: RenderingContext, obj?: any): boolean; +} + +// why do we need this ? +export type RenderingContext = CanvasRenderingContext2D; + +export interface DisplayOptions { + width: number; + height: number; + type: string; + layers?: boolean[]; + name: string; +} + +export class Display { + /** + * Creates a new Display instance + * + */ + constructor(options: DisplayOptions, target: string | HTMLElement); + + /** + * Creates a new (offscreen) drawing buffer + * + */ + getBuffer(width: number, height: number): RenderingContext; + + /** + * Toggles fullscreen display scaling + */ + toggleFullscreen(): void; + + /** + * Changes the zIndex property of the specified layer canvas + * + */ + setLayerZIndex(layer: number, zIndex: number): void; + + /** + * Clears a canvas display buffer + * + */ + clearScreen(ctx: RenderingContext): void; + + /** + * Clears every rendering buffer, including the special fxCtx one + */ + clearAllScreens(): void; + + /** + * Changes the (CSS) opacity of a canvas + * + */ + setCanvasOpacity(canvas: HTMLElement, opacity: number): void; + + /** + * Renders the specified scene + * + */ + renderScene(scene: Scene): void; + + /** + * Prepares the canvas before rendering images. + * + * Explanation: during development, I noticed that the very first time + * the ctx.drawImage() was used to draw onto a canvas, it took a very long time, + * like at least 10ms for a very small 32x32 pixels drawImage. + * + * Subsequent calls do not have this problem and are instant. + * Maybe some ColorFormat conversion happens. + * + * This method makes sure that when the game starts rendering, we don't have + * any of these delays that can impact gameplay and alter the gameplay experience + * in a negative way. + */ + prepareCanvas(resources: JSObject[]): void; + + /** + * Starts an animation on the display + * + */ + animate(fxName: string, options: EffectOptions, context: RenderingContext): Promise; + + /** + * stops current animation + * + * TODO + */ + stopAnimate(fxName?: string): void; + + /** + * Executes an effect on a frame at a given time + * + */ + executeFx(ctx: RenderingContext, fxCtx: RenderingContext, obj: Drawable, time: number, when: string): void; + + /** + * Clears every display layer and clears fx queues + */ + clearDisplay(): void; +} + +export const InputManager: _InputManager; + +export class MapEvent { + /** + * Creates a new MapEvent + * + */ + constructor(map: Map); + + /** + * Resets the MapEvent switches, events and items + */ + reset(): void; + + /** + * Adds a new [`Drawable`]{#item} onto the map + * + */ + addItem(id: string, item: Drawable): void; + + /** + * Returns an item + * + */ + getItem(id: string): Drawable | undefined; + + // TODO: ability to trigger an event once a switch has been modified + setSwitch(id: string, bool: boolean): void; + + toggleSwitch(id: string): void; + + /** + * Retrieves a switch from the map using its id + * + */ + getSwitch(id: string): any; + + /** + * checks of conditions of specified trigger are valid + * + */ + checkConditions(trigger: JSObject): boolean; + + handleAction(options: JSObject): void; + + handleEvent(options: JSObject): boolean; + + /** + * Schedule adding a new object to the map + */ + scheduleSprite(spriteId: string, spriteOptions: JSObject, delay: number): Drawable; + + /** + * Add a new wave of objects to the map + * Used for example when the player triggers apparition of several enemies or bonuses + * + * @related {Wave} + */ + handleWave(options: JSObject): boolean; + + endWave(): void; + + triggerEvent(id: string): void; + + isEventTriggered(id: string): boolean; +} + +export class Behavior { + vx: number; + vy: number; + gravity: number; + sprite: Drawable; + constructor(sprite: Drawable, options?: JSObject); + onUpdate(timestamp: number): void; + onVXChange?(vx: number): void; + onVYChange?(vy: number): void; + + /** + * Returns current mapEvent + * + */ + getMapEvent(): MapEvent; + reset(): void; +} + +export interface _AudioManager { + audioCache: JSObject; + enabled: boolean; + /** + * Adds a new sound element to the audio cache. + * *Note* if a sound with the same id has already been added, it will be replaced + * by the new one. + * + */ + addSound(id: string, element: HTMLAudioElement): void; +/** + * Toggles global sound playback + * + */ + toggleSound(bool: boolean): void; +/** + * Plays the specified sound with `id`. + * + */ + play(id: string, loop?: boolean, volume?: number, panning?: number): any; +/** + * Stops playing the sound id + * + */ + stop(id: string, instanceId: any): void; +} + +export const AudioManager: _AudioManager; + +export interface Res { + id: string; + type: string; + src: string; +} + +export type Callback = (...args: any[]) => void; + +export interface _NotificationManager { + notify(name: string, data?: JSObject): void; +} + +export const NotificationManager: _NotificationManager; + +export interface _ResourceManager { + addResources(resource: Res, group?: string): Promise; + getCanvasFromImage(image: HTMLImageElement): HTMLCanvasElement; + getResourceById(id: string, group?: string, fullObject?: boolean): any; + loadResources(group: string, progressCb?: Callback, errorCb?: Callback): void; + loadImage(res: Res, group?: string): Promise; + loadAudio(res: Res, group?: string): Promise; + newResourceFromPool(id: string): any; + registerScript(id: string, elt: any, poolSize?: number): void; +} + +export const ResourceManager: _ResourceManager; + +export interface _InputManager { +/** + * A list of common keyCodes + */ +KEYS: { + 'UP': 38, + 'DOWN': 40, + 'LEFT': 37, + 'RIGHT': 39, + 'SPACE': 32, + 'ENTER': 13, + 'ESCAPE': 27, + 'CTRL': 17 +}; +/** + * List of common pad buttons + */ +PAD_BUTTONS: { + 32: 1, // Face (main) buttons + FACE_0: 1, + FACE_3: 2, + FACE_4: 3, + LEFT_SHOULDER: 4, // Top shoulder buttons + RIGHT_SHOULDER: 5, + LEFT_SHOULDER_BOTTOM: 6, // Bottom shoulder buttons + RIGHT_SHOULDER_BOTTOM: 7, + SELECT: 8, + START: 9, + LEFT_ANALOGUE_STICK: 10, // Analogue sticks (if depressible) + RIGHT_ANALOGUE_STICK: 11, + 38: 12, // Directional (discrete) pad + 40: 13, + 37: 14, + 39: 15 +}; +axes: JSObject; +newGamepadPollDelay: number; +gamepadSupport: boolean; +recording: boolean; +playingEvents: boolean; +playingPos: number; +/*recordedEvents: Array,*/ +pad: null; +latches: JSObject; +keyPressed: JSObject; +padPressed: JSObject; +keyCb: JSObject; +enabled: boolean; +inputMode: string; +// virtual joystick instance +dPadJoystick: null; +jPollInterval: number; +/** + * Initializes the InputManager with a reference to the game. + * + * This method prepares the InputManager by reseting keyboard states/handlers and + * set current inputMode + * + */ + init(): void; +/** + * Starts recording input events. They are stored into `InputManager.recordedEvents` + */ +startRecordingEvents(): void; +/** + * Stops recording events. + */ +stopRecordingEvents(): void; +/** + * After events have been reccorded they can be played back using this method. + */ +playRecordedEvents(): void; +/** + * Sets next key states using recorded events + * + * TODO: add an optional callback to be called at the end of the playback + * so that demo can be looped. + */ +nextRecordedEvents(): void; +/** + * Saves current event state onto the recordedEvents stack + */ +/** + * Changes input mode + * + */ +setInputMode(mode: string): void; + /** + * Returns an object with the state of all keys + */ + getAllKeysStatus(): JSObject; + getKeyStatus(key: string, latch: boolean): boolean; + isKeyDown(key: string|number, latch?: boolean): boolean; + /** + * Install callback that gets called when a key is pressed/released + * + */ + installKeyCallback(key: string, event: string, callback: (key: string, event: string) => void): void; + removeKeyCallback(key: string, event: string, callback: () => void): void; + clearEvents(): void; +} + +export interface Promise { + then(val?: () => any): Promise; + catch(val?: () => any): Promise; +} + +/* Deferred */ +export class Deferred { + constructor(); + /** + * Creates and immediately resolves a new deferred. + * + */ + static resolve(val?: any): Promise; + promise: Promise; + reject(val: any): void; + resolve(val: any): void; +} + +/* Dom support */ +export interface _Dom extends Iterable { + [key: number]: TElement; + length: number; + css(prop: string, val: string): _Dom; + css(prop: JSObject): _Dom; + css(prop: string): string|null; + find(selector: string): _Dom; + appendTo(selector: string | _Dom | HTMLElement): _Dom; + attr(att: string, val: string): _Dom; + attr(att: JSObject): _Dom; + addClass(classes: string): _Dom; + removeClass(classes: string): _Dom; + html(str: string): _Dom; + show(): _Dom; + hide(): _Dom; +} + +/* Game Support */ +export interface GameOptions { + name: string; + showFps: boolean; + width: number; + height: number; + debug: boolean; + scene?: Scene; + target?: string | HTMLElement; + sound?: boolean; +} + +export interface SceneOptions { + name?: string; + resources?: Res[]; + opacity?: number; + layers?: number; + hudScene?: Scene; +} + +export interface DrawableOptions { + x?: number; + y?: number; + behavior?: { new(sprite: Drawable, options?: JSObject): Behavior }; + canCollide?: boolean; + canCollideFriendBullet?: boolean; + collideGroup?: number; + objectId?: string; + layer?: number; + map?: Map; + visible?: boolean; + pool?: number; +} + +export interface SimpleTextOptions extends DrawableOptions { + text?: string; + width?: number; + height?: number; + fontFace?: string; + fontSize?: string; + fontStyle?: string; + fontWeight?: string; + align?: string; + color?: string; +} + +export interface PaintOptions extends DrawableOptions { + width?: number; + height?: number; + color?: string; + lineHeight?: number; +} + +export interface BitmapTextOptions extends DrawableOptions { + width?: number; + height?: number; + offsetX: number; + startY: number; + charWidth: number; + charHeight: number; + imageId?: string; + imageSrc?: string; + scrollOffsetX?: number; + scrollOffsetY?: number; + text?: string; + size?: string; +} + +export interface SpriteOptions extends DrawableOptions { + easing?: string; + imageId?: string; + animations?: Animations; + data?: JSObject; +} + +export interface AnimOptions { + numFrames: number; + frameWidth: number; + frameHeight: number; + frameDuration: number; + offsetX?: number; + offsetY?: number; + frameSpacing?: number; +} + +export interface AnimationObject { + frameDuration?: number; + frames: Array<{ + offsetX: number; + offsetY: number; + width: number; + height: number; + hitBox?: { + x: number; + y: number; + x2: number; + y2: number; + }, + plane?: number; + }>; + loop?: number; + speed?: number; +} + +export interface JSObject { + [key: string]: any; +} + +export interface Animations { + [key: string]: AnimationObject; +} + +export interface GameEvent { + type: string; + data: JSObject; +} diff --git a/types/athenajs/test/bitmaptext.ts b/types/athenajs/test/bitmaptext.ts new file mode 100644 index 0000000000..b32a0d2541 --- /dev/null +++ b/types/athenajs/test/bitmaptext.ts @@ -0,0 +1,18 @@ +import { BitmapText } from 'athenajs'; + +const bitmap: BitmapText = new BitmapText('myBitmap', { + size: 'big', + width: 180, + height: 32, + visible: false, + scrollOffsetX: 0, + scrollOffsetY: 0, + text: 'pause', + offsetX: 34, + startY: 36, + charWidth: 18, + charHeight: 18, + imageId: 'font' +}); + +bitmap.center(); diff --git a/types/athenajs/test/deferred.ts b/types/athenajs/test/deferred.ts new file mode 100644 index 0000000000..5cdc077a19 --- /dev/null +++ b/types/athenajs/test/deferred.ts @@ -0,0 +1,28 @@ +import { Deferred } from 'athenajs'; + +let def: Deferred; + +// static Deferred.resolve +Deferred.resolve(true).then(() => { + console.log('resolved'); +}) + .then(() => { + console.log('resolved'); + }); + +def = new Deferred(); + +// resolve/reject +def.resolve(10); + +def = new Deferred(); +def.reject(false); +def.promise.then(() => { + console.log('done'); +}) + .then(() => { + console.log('real done'); + }) + .catch(() => { + console.log('oops'); + }); diff --git a/types/athenajs/test/dom.ts b/types/athenajs/test/dom.ts new file mode 100644 index 0000000000..c3a0df08c0 --- /dev/null +++ b/types/athenajs/test/dom.ts @@ -0,0 +1,33 @@ +import { Dom } from 'athenajs'; + +const div = Dom('div'); +const body = Dom(document.body); +const domElt: HTMLElement = body[0]; + +// Dom.appendTo +div.appendTo(body).show().hide(); +div.appendTo(domElt); + +const str: string | null = body.css('display'); +const i: number = body.length; + +// Dom.css +body.css('display', ' block'); +body.css({ display: 'none' }); +body.css('display', 'block'); + +// Dom.find +body.find('div').appendTo('body'); + +// Dom.attr +body.attr('data-test', 'hi'); +body.attr({ 'data-test2': 'foo' }); + +// Dom.addClass/Dom.removeClass +body.addClass('foo').removeClass('foo'); + +// Dom.show/hide +body.show().hide(); + +// Dom.html +body.html('
foo
'); diff --git a/types/athenajs/test/drawable.ts b/types/athenajs/test/drawable.ts new file mode 100644 index 0000000000..7caaccaf8d --- /dev/null +++ b/types/athenajs/test/drawable.ts @@ -0,0 +1,36 @@ +import { Behavior, Drawable, Map } from 'athenajs'; + +const sprite = new Drawable('mySprite', { + objectId: 'my Rocking Sprite', + layer: 0 +}); +const sprite2 = new Drawable('mySprite2', {}); + +sprite.addChild(sprite2); +sprite.animate('Fade', { + duration: 100 +}); +sprite.moveTo(0, 0).notify('yo!'); + +sprite.onCollision(sprite2); +sprite.onEvent('boom'); +sprite.playSound('explosion', { + pan: true +}); +sprite.setBehavior('stupid'); +sprite.setBehavior(Behavior); +sprite.setScale(1.0); + +const str: string = sprite.getProperty('strProp'); +sprite.setProperty('strProp', str); + +sprite.setMask({ + x: 0, + y: 0, + width: 100, + height: 100 +}); + +sprite.setMask(null); + +sprite.stopAnimate(10); diff --git a/types/athenajs/test/game.ts b/types/athenajs/test/game.ts new file mode 100644 index 0000000000..b6505251f8 --- /dev/null +++ b/types/athenajs/test/game.ts @@ -0,0 +1,23 @@ +import { Game, Scene } from 'athenajs'; + +let myScene: Scene = new Scene(); +let sound: boolean; + +const game: Game = new Game({ + name: 'myGame', + showFps: true, + width: 320, + height: 200, + debug: true, + scene: myScene, + target: 'body', + sound: true +}); + +game.setScene(myScene); +game.toggleSound(false); +game.toggleTileInspector(true); +game.toggleFullscreen(); +game.togglePause(); +myScene = game.scene; +sound = game.sound; diff --git a/types/athenajs/test/map.ts b/types/athenajs/test/map.ts new file mode 100644 index 0000000000..a2d21ab7f0 --- /dev/null +++ b/types/athenajs/test/map.ts @@ -0,0 +1,29 @@ +import { Map, TileDesc } from 'athenajs'; + +const map = new Map({ + src: "tiles", + tileWidth: 32, + tileHeight: 32, + width: 29 * 32, + height: 8 * 32, + viewportW: 320, + viewportH: 200 +}); +const tiles: TileDesc[] = []; +const mapContent: Uint8Array = new Uint8Array(10); +const behaviors: Uint8Array = new Uint8Array(10); + +for (let row = 0; row < 8; row++) { + for (let col = 0; col < 29; col++) { + tiles.push({ + offsetX: col * 32, + offsetY: row * 32, + width: 32, + height: 32 + }); + } +} + +map.addTileSet(tiles); + +map.setData(mapContent, behaviors); diff --git a/types/athenajs/test/paint.ts b/types/athenajs/test/paint.ts new file mode 100644 index 0000000000..3b6d60b705 --- /dev/null +++ b/types/athenajs/test/paint.ts @@ -0,0 +1,12 @@ +import { Paint } from 'athenajs'; + +const paint: Paint = new Paint('brush', { + width: 300, + height: 200, + color: 'red' +}); + +paint.color = 'red'; +paint.circle(0, 0, 150); +paint.circle(0, 0, 100, 'green'); +paint.circle(0, 0, 50, 'green', 2, 'blue'); diff --git a/types/athenajs/test/scene.ts b/types/athenajs/test/scene.ts new file mode 100644 index 0000000000..c39e85f1d0 --- /dev/null +++ b/types/athenajs/test/scene.ts @@ -0,0 +1,58 @@ +import { Game, Scene, Drawable, Map } from 'athenajs'; + +let num: number; + +const hudScene = new Scene(); +const myScene: Scene = new Scene({ + name: 'myScene', + resources: [{ + id: 'myRes', + src: 'src', + type: 'image' + }], + opacity: 1, + layers: 0, + hudScene +}); + +num = myScene.getOpacity(); +myScene.setOpacity(10); + +const sprite = new Drawable('mySprite', {}); + +myScene.debug(false); +myScene.bindEvents('gameover'); +myScene.addObject(sprite); +myScene.animate('Fade', { + easing: 'linear' +}).then(() => { + console.log('effect ended'); + }); +myScene.fadeIn(1000).then(() => { + myScene.fadeOut(2000); + myScene.fadeInAndOut(2000, 1000, 1000); + console.log(myScene.getPlayTime()); +}); + +myScene.load('image', 'img/foo.png'); +myScene.load('image', 'img/background.png', 'bg'); +myScene.loadAudio('sound/yeah.mp3'); +myScene.loadImage('img/bar.gif'); +myScene.loadAudio('sound/yeah.mp3'); +myScene.loadAudio('maps/map.json'); + +myScene.setBackgroundImage(new Image()); +myScene.setLayerPriority(10, true); + +myScene.notify('ready'); + +myScene.removeObject(sprite); + +myScene.setMap({}); +myScene.setMap(new Map({ + src: 'img/tiles.png', + tileWidth: 24, + tileHeight: 32, + width: 240, + height: 320 +})); diff --git a/types/athenajs/test/simpletext.ts b/types/athenajs/test/simpletext.ts new file mode 100644 index 0000000000..2599d366c4 --- /dev/null +++ b/types/athenajs/test/simpletext.ts @@ -0,0 +1,17 @@ +import { SimpleText } from 'athenajs'; + +const myText: SimpleText = new SimpleText('MyText', { + text: 'yop', + width: 100, + height: 200, + fontFace: 'Arial', + fontSize: '20px', + fontStyle: 'italic', + fontWeight: '300', + align: 'center', + color: 'white' +}); + +myText.setSize(100, 200); +myText.setText('Hi!'); +myText.setColor('rgba(0,0,0,.4'); diff --git a/types/athenajs/test/sprite.ts b/types/athenajs/test/sprite.ts new file mode 100644 index 0000000000..bc2106c4ce --- /dev/null +++ b/types/athenajs/test/sprite.ts @@ -0,0 +1,28 @@ +import { Sprite } from 'athenajs'; + +const sprite: Sprite = new Sprite('mySprite', { + imageId: 'tiles', + animations: { + anim1: { + frameDuration: 1, + frames: [{ + offsetX: 396, + offsetY: 2, + width: 64, + height: 96, + hitBox: { + x: 1, + y: 4, + x2: 62, + y2: 95 + }, + plane: 0 + }], + loop: 0 + } + } +}); + +sprite.setAnimation('anim1', () => { + sprite.setAnimation('anim1', () => { console.log('the end!'); }, 0, true); +}); diff --git a/types/athenajs/test/tetris/flash_lines.ts b/types/athenajs/test/tetris/flash_lines.ts new file mode 100644 index 0000000000..668d2c1f33 --- /dev/null +++ b/types/athenajs/test/tetris/flash_lines.ts @@ -0,0 +1,35 @@ +import { Paint, PaintOptions } from 'athenajs'; + +interface FlashOptions extends PaintOptions { + lineHeight: number; + x: number; + y: number; + width: number; +} + +export default class FlashLines extends Paint { + lines: number[]; + lineHeight: number; + + constructor(name: string, options: FlashOptions) { + super('flashlines', options); + + this.lines = []; + this.lineHeight = options.lineHeight; + } + + flash() { + return this.animate('Fade', { + startValue: 1, + endValue: 0, + duration: 400, + loop: 2 + }); + } + + render() { + for (const line of this.lines) { + this.rect(0, line * this.lineHeight, this.width, this.lineHeight, 'white'); + } + } +} diff --git a/types/athenajs/test/tetris/grid.ts b/types/athenajs/test/tetris/grid.ts new file mode 100644 index 0000000000..ed6d96a2d0 --- /dev/null +++ b/types/athenajs/test/tetris/grid.ts @@ -0,0 +1,469 @@ +import { Scene, Map, Tile, Dom, SimpleText, AudioManager as AM, Deferred } from "athenajs"; +import Shape from "./shape"; +import FlashLines from "./flash_lines"; + +// size constants +const MAP_ROWS = 22; +const MAP_COLS = 12; +const TILE_WIDTH = 20; +const TILE_HEIGHT = 20; +// tile offsets in the spritesheet +const MAP_TILES_OFFSET_Y = 440; +const WALL_TILE_OFFSET_X = 140; +const BACK_TILE_OFFSET_X = 160; +// wall tile number +const WALL_TILE = 8; +// game width +const TOTAL_WIDTH = 800; +const TOTAL_HEIGHT = 600; +// speed (drop delay) at start +const START_TIMING = 1200; +// speed increase at each level +const LEVEL_TIMING = 55; + +class Grid extends Scene { + // game parameters + score: number; + level: number; + timing: number; + lines: number; + scoreTable: number[]; + + // game sprites + // current tetris shape + shape: Shape; + // next tetris shape + nextShape: Shape; + // next tetris string + nextString: SimpleText; + // score + scoreString: SimpleText; + // "line:" + linesString: SimpleText; + // "level:" + levelString: SimpleText; + // "pause:" + pauseString: SimpleText; + // flashing lines + flashLines: FlashLines; + // ->, <- + controls: SimpleText; + + constructor() { + super({ + resources: [ + { + id: "tiles", + type: "image", + src: "img/tetris_tiles.png" + }, + { + id: "gameover", + type: "audio", + src: "sound/gameover.mp3" + }, + { + id: "ground", + type: "audio", + src: "sound/ground.mp3" + }, + { + id: "level", + type: "audio", + src: "sound/level.mp3" + }, + { + id: "lines", + type: "audio", + src: "sound/lines.mp3" + }, + { + id: "lines_tetris", + type: "audio", + src: "sound/lines_tetris.mp3" + }, + { + id: "move", + type: "audio", + src: "sound/move.mp3" + }, + { + id: "pause", + type: "audio", + src: "sound/pause.mp3" + }, + { + id: "rotate", + type: "audio", + src: "sound/rotate.mp3" + } + ] + }); + + // here we keep game-related properties + this.score = 0; + this.level = 0; + this.lines = 0; + this.timing = START_TIMING; + this.scoreTable = [40, 100, 300, 1200]; + + // we only need to catch the 'ground' event from the 'shape' element + this.bindEvents("shape:ground"); + } + + /** + * Generate tileset for the tetris map, mostly hardcoded stuff + * + */ + generateTileSet() { + // create the list of all tiles for the map + const tiles = [ + { + offsetX: WALL_TILE_OFFSET_X, + offsetY: MAP_TILES_OFFSET_Y, + width: TILE_WIDTH, + height: TILE_HEIGHT + } + ]; + + // add a tile for each color + for (let i = 0, offset = 0; i < 7; ++i, offset += TILE_WIDTH) { + tiles.push({ + offsetX: offset, + offsetY: MAP_TILES_OFFSET_Y, + width: TILE_WIDTH, + height: TILE_HEIGHT + }); + } + + tiles.push({ + offsetX: BACK_TILE_OFFSET_X, + offsetY: MAP_TILES_OFFSET_Y, + width: TILE_WIDTH, + height: TILE_HEIGHT + }); + + return tiles; + } + + /** + * Generates the map of the game, adding walls around the playground + */ + createMap() { + // first create the map with an empty buffer + const map = new Map({ + src: "tiles", + tileWidth: TILE_WIDTH, + tileHeight: TILE_WIDTH, + width: TILE_WIDTH * MAP_COLS, + height: TILE_HEIGHT * MAP_ROWS, + buffer: new ArrayBuffer(MAP_COLS * MAP_ROWS * 2) + }); + + // finally add the tileset + map.addTileSet(this.generateTileSet()); + + return map; + } + + resetMap() { + const map = this.map; + + map.clear(0, Tile.TYPE.AIR); + + // set map tiles around the playground as wall tiles + for (let i = 0; i < map.numRows; ++i) { + map.updateTile(0, i, WALL_TILE, Tile.TYPE.WALL); + map.updateTile(map.numCols - 1, i, WALL_TILE, Tile.TYPE.WALL); + } + + for (let i = 0; i < map.numCols; ++i) { + map.updateTile(i, map.numRows - 1, WALL_TILE, Tile.TYPE.WALL); + } + } + + /** + * Generates the tile sprite that will be moved by the player + */ + createShapes() { + this.shape = new Shape("shape", { + data: { + speed: this.timing + } + }); + + this.nextShape = new Shape("nextShape", { + x: 610, + y: 110 + }); + + this.nextShape.movable = false; + this.nextString = new SimpleText("nextString", { + text: "Next", + x: 620, + y: 70 + }); + + this.scoreString = new SimpleText("scoreString", { + text: "Score: 0", + x: 50, + y: 70 + }); + + this.linesString = new SimpleText("linesString", { + text: "Lines: 0", + x: 50, + y: 120 + }); + + this.levelString = new SimpleText("levelString", { + text: "Level: 0", + x: 50, + y: 170 + }); + + this.pauseString = new SimpleText("pauseString", { + text: "Pause", + x: 380, + y: 550, + visible: false + }); + + this.controls = new SimpleText("controlsString", { + text: "Controls:\narrow keys", + x: 50, + y: 220 + }); + + this.flashLines = new FlashLines("flash", { + x: (TOTAL_WIDTH - TILE_WIDTH * MAP_COLS) / 2 + TILE_WIDTH, + y: (TOTAL_HEIGHT - TILE_HEIGHT * MAP_ROWS) / 2, + width: TILE_WIDTH * (MAP_COLS - 2), + lineHeight: TILE_HEIGHT + }); + } + + /** + * Called when the scene is ready: generates the map and adds the player's shape + * sprite onto the screen + */ + setup() { + this.createShapes(); + + this.map = this.createMap(); + } + + start() { + const map = this.map; + + this.setBackgroundImage("img/background.png"); + + // center map + this.setMap( + map, + (TOTAL_WIDTH - map.width) / 2, + (TOTAL_HEIGHT - map.height) / 2 + ); + + map.addObject(this.shape); + + this.addObject([ + this.nextShape, + this.nextString, + this.linesString, + this.scoreString, + this.levelString, + this.pauseString, + this.flashLines, + this.controls + ]); + + this.reset(); + } + + reset() { + this.score = 0; + this.level = 0; + this.lines = 0; + this.timing = START_TIMING; + this.resetMap(); + this.shape.moveToTop(); + + this.shape.setRandomShape(); + this.nextShape.setRandomShape(); + this.linesString.setText("Lines: " + this.lines); + this.scoreString.setText("Score: " + this.score); + this.levelString.setText("Level: " + this.level); + + this.shape.movable = true; + this.shape.behavior.reset(); + } + + /** + * Called on game over, simply displays the score in an alert box and restarts the game + */ + gameover() { + AM.play("gameover"); + alert("game over!" + this.score); + this.reset(); + } + + /** + * This method is called whenever an event that has been registered is received + * + */ + onEvent(event: any) { + const nextShape = this.nextShape; + const shape = this.shape; + + switch (event.type) { + case "shape:ground": + // update the map with the new shape + this.updateMap(); + // check for lines to remove + this.removeLinesFromMap( + event.data.startLine, + event.data.numRows + ).then(() => { + shape.setShape(nextShape.shapeName, nextShape.rotation); + nextShape.setRandomShape(); + + this.shape.moveToTop(); + + // we may have a game over here: if the shape collides with another one + if (!this.shape.snapTile(0, 0, false)) { + this.gameover(); + } else { + this.shape.movable = true; + } + }); + break; + } + } + + /** + * This method is called when a shape has reached the ground: in this case + * we simply update the map using the shape's matrix + */ + updateMap() { + const shape = this.shape; + const data = this.shape.shape; + const map = this.map; + const pos = map.getTileIndexFromPixel(shape.x, shape.y); + const buffer = shape.getMatrix(); + const rows = data.height / map.tileHeight; + const cols = data.width / map.tileWidth; + + for (let j = 0; j < rows; ++j) { + for (let i = 0; i < cols; ++i) { + if (buffer[j * cols + i]) { + map.updateTile(pos.x + i, pos.y + j, data.color, Tile.TYPE.WALL); + } + } + } + } + + /** + * returns the number of lines that contains no hole, starting from + * startLine up to startLine + height + * + */ + getLinesToRemove(startLine: number, height: number): number[] { + console.log("[Grid] getLinesToRemove()"); + const map = this.map; + const lines: number[] = []; + let lastLine = startLine + height - 1; + + // avoid bottom ground + if (lastLine > map.numRows - 2) lastLine = map.numRows - 2; + + for (let j = lastLine; j >= startLine; --j) { + let hole = false; + for (let i = 1; i < map.numCols - 1; ++i) { + hole = hole || map.getTileBehaviorAtIndex(i, j) !== Tile.TYPE.WALL; + } + if (!hole) { + lines.push(j); + } + } + + return lines; + } + + /** + * Updates level + level object's text + */ + updateLevel() { + const oldLevel = this.level; + this.level = Math.floor(this.lines / 10); + this.levelString.setText("Level: " + this.level); + this.timing = START_TIMING - this.level * LEVEL_TIMING; + this.shape.data['speed'] = this.timing; + oldLevel !== this.level && AM.play("level"); + } + + /** + * Updates the player's score using line number & current level + * + */ + increaseScore(lines: number) { + this.score += + this.scoreTable[lines - 1] + this.level * this.scoreTable[lines - 1]; + this.lines += lines; + this.linesString.setText("Lines: " + this.lines); + this.scoreString.setText("Score: " + this.score); + + if (lines === 4) { + AM.play("lines_tetris"); + } else { + AM.play("lines"); + } + } + + /** + * Removes lines from the map, shifting the map as needed, and adding + * empty tiles at the top + * + */ + removeLinesFromMap(startLine: number, height: number) { + const map = this.map; + const lines = this.getLinesToRemove(startLine, height); + + // no full lines detected + if (!lines.length) { + return Deferred.resolve(true); + } + + this.flashLines.lines = lines; + return this.flashLines.flash().then(() => { + // shift the map for each line to remove + for (let i = 0; i < lines.length; ++i) { + map.shift(lines[i] + i, 1); + } + + // add wall at each side of the new lines + for (let i = 0; i < height; ++i) { + for (let j = 0; j < map.numCols; ++j) { + map.updateTile(j, i, 0, Tile.TYPE.AIR); + } + map.updateTile(0, i, 8, Tile.TYPE.WALL); + map.updateTile(map.numCols - 1, i, 8, Tile.TYPE.WALL); + } + + Dom('.athena-game').addClass('shake-vertical shake-constant'); + setTimeout(() => { + Dom('.athena-game').removeClass('shake-vertical shake-constant'); + }, 300); + + this.increaseScore(lines.length); + this.updateLevel(); + }); + } + + pause(isRunning: boolean) { + this.pauseString.visible = !isRunning; + AM.play("pause"); + } +} + +export default Grid; diff --git a/types/athenajs/test/tetris/shape.ts b/types/athenajs/test/tetris/shape.ts new file mode 100644 index 0000000000..4d8ed9c64b --- /dev/null +++ b/types/athenajs/test/tetris/shape.ts @@ -0,0 +1,256 @@ +import { Sprite, Tile, AudioManager as AM, JSObject } from 'athenajs'; +import ShapeBehavior from './shape_behavior'; + +interface shapeDescription { + name: string; + width: number; + height: number; + color: number; + rotations: number[][]; +} + +class Shape extends Sprite { + shapes: shapeDescription[]; + // current shape + shape: shapeDescription; + shapeName: string; + // current shape rotation + rotation: number; + + constructor(name: string, options = {}) { + super(name, { + imageId: 'tiles', + easing: 'linear', + // behavior: ShapeBehavior, + // ...options + }); + + /** + * Hardcoded tetris shapes. In addition to its width/height, color and + * name, each shape contains a rotation a matrix for each rotation + * that looks like: + * + * --- + * |J + * |JJJ + * | + * --- + * + * Matrix: [1, 0, 0, + * 1, 1, 1 + * 0, 0, 0] + * + * Each shape contains four different rotations + */ + this.shapes = [ + { + name: 'I', width: 80, height: 80, color: 7, rotations: [ + [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0] + ] + }, + { + name: 'J', width: 60, height: 60, color: 6, rotations: [ + [1, 0, 0, 1, 1, 1, 0, 0, 0], + [0, 1, 1, 0, 1, 0, 0, 1, 0], + [0, 0, 0, 1, 1, 1, 0, 0, 1], + [0, 1, 0, 0, 1, 0, 1, 1, 0] + ] + }, + { + name: 'L', width: 60, height: 60, color: 5, rotations: [ + [0, 0, 1, 1, 1, 1, 0, 0, 0], + [0, 1, 0, 0, 1, 0, 0, 1, 1], + [0, 0, 0, 1, 1, 1, 1, 0, 0], + [1, 1, 0, 0, 1, 0, 0, 1, 0] + ] + }, + { + name: 'O', width: 80, height: 60, color: 4, rotations: [ + [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], + [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], + [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0], + [0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0] + ] + }, + { + name: 'S', width: 60, height: 60, color: 3, rotations: [ + [0, 1, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 0, 0, 1, 1, 0, 0, 1], + [0, 0, 0, 0, 1, 1, 1, 1, 0], + [1, 0, 0, 1, 1, 0, 0, 1, 0] + ] + }, + { + name: 'Z', width: 60, height: 60, color: 2, rotations: [ + [1, 1, 0, 0, 1, 1, 0, 0, 0], + [0, 0, 1, 0, 1, 1, 0, 1, 0], + [0, 0, 0, 1, 1, 0, 0, 1, 1], + [0, 1, 0, 1, 1, 0, 1, 0, 0] + ] + }, + { + name: 'T', width: 60, height: 60, color: 1, rotations: [ + [0, 1, 0, 1, 1, 1, 0, 0, 0], + [0, 1, 0, 0, 1, 1, 0, 1, 0], + [0, 0, 0, 1, 1, 1, 0, 1, 0], + [0, 1, 0, 1, 1, 0, 0, 1, 0] + ] + } + ]; + + this.addAnimations(); + this.setShape('S', 0); + } + + /** + * Moves the shape at the top center of the map + */ + moveToTop(): void { + if (this.shape) { + const map = this.currentMap; + const col = Math.floor(((map.width - this.shape.width) / 2) / map.tileWidth); + + this.moveTo(col * map.tileWidth, 0); + } + } + + /** + * Changes the sprite's shape and rotation + * + */ + setShape(name: string, rotation: number): void { + this.shapeName = name; + this.rotation = rotation; + this.shape = this.shapes.find((shape) => shape.name === this.shapeName) || this.shapes[0]; + this.setAnimation(`${name}${rotation}`); + } + + /** + * Pick a new random shape + */ + setRandomShape(): void { + const shapeName = this.shapes[Math.random() * 7 | 0].name; + const rotation = Math.random() * 4 | 0; + + console.log(`[Shape] setRandomShape() - ${shapeName}`); + + if (!this.movable) { + this.animate('Fade', { + duration: 200, + startValue: 1, + endValue: 0 + }).then(() => { + this.setShape(shapeName, rotation); + this.animate('Fade', { + duration: 200, + startValue: 0, + endValue: 1 + }); + }); + } else { + this.setShape(shapeName, rotation); + } + } + + /** + * Returns current matrix for the shape + * + */ + getMatrix(rotation = -1): number[] { + return this.shape.rotations[rotation === -1 ? this.rotation : rotation]; + } + + /** + * Move the shape on the map by a certain number of tiles, optionnaly sending an event + * of a collision is detected + * + */ + snapTile(horizontal = 0, vertical = 0, notify = true, noSound = false): boolean { + const map = this.currentMap; + const buffer = this.getMatrix(); + const tilePos = map.getTileIndexFromPixel(this.x, this.y); + const newX = tilePos.x + horizontal; + const newY = tilePos.y + vertical; + + // first check there is no collision with walls + if (!map.checkMatrixForCollision(buffer, this.shape.width, newX, newY, Tile.TYPE.WALL)) { + this.x += horizontal * map.tileWidth; + this.y += vertical * map.tileHeight; + + return true; + } else { + // if a collision was detected and vertical == 1 it means the shape reached + // the ground: in this case we send a notification for the grid + // and make the shape stop responding to user input or timer + if (vertical === 1) { + this.movable = false; + if (notify) { + AM.play('ground'); + this.notify('ground', { + startLine: tilePos.y, + numRows: this.shape.height / map.tileHeight + }); + } + } + return false; + } + } + + /** + * Switches to the next shape's rotation, if no collision found onto the map + */ + nextRotation(): void { + let matrix: number[]; + let newRotation = this.rotation + 1; + + const map = this.currentMap; + const tilePos = map.getTileIndexFromPixel(this.x, this.y); + + // cycles if last position reached + if (newRotation > 3) { + newRotation = 0; + } + + // get current shape + position matrix + matrix = this.getMatrix(newRotation); + + if (!map.checkMatrixForCollision(matrix, this.shape.width, tilePos.x, tilePos.y, Tile.TYPE.WALL)) { + // change shape rotation if no collision detected + this.setShape(this.shapeName, newRotation); + AM.play('rotate'); + } else { + console.log('rotation not possible'); + } + } + + /** + * We add a new Sprite animation for each combination of rotation + shapeType: + * { + * 'J0', // first rotation of the J Shape + * .... + * 'J3', // last rotation of the J Shape + * 'L0', // first rotation of the L shape + * ... + * } + */ + addAnimations(): void { + // shape sprite images start at the top of the image file + let offsetY = 0; + + this.shapes.forEach((shape) => { + let offsetX = 0; + for (let i = 0; i < 4; ++i) { + this.addAnimation(`${shape.name}${i}`, 'tiles', { + offsetY, offsetX, frameWidth: shape.width, frameHeight: shape.height, frameDuration: 1, numFrames: 1 + }); + offsetX += shape.width; + } + offsetY += shape.height; + }); + } +} + +export default Shape; diff --git a/types/athenajs/test/tetris/shape_behavior.ts b/types/athenajs/test/tetris/shape_behavior.ts new file mode 100644 index 0000000000..7804696454 --- /dev/null +++ b/types/athenajs/test/tetris/shape_behavior.ts @@ -0,0 +1,140 @@ +import { Behavior, InputManager as IM, AudioManager as AM, Sprite, Drawable } from 'athenajs'; +import Shape from './shape'; + +/** + * Simple Behavior for the tetris shape that moves the shape on cursor key press + * and when timer is reached + * + * + * @see {Behavior} + */ +class ShapeBehavior extends Behavior { + state: number; + lastRotation: number; + ts: number; + LONG_DELAY: number; + SMALL_DELAY: number; + delay: number; + key: number; + timerEnabled: boolean; + startTime: number; + + constructor(sprite: Shape, options?: any) { + super(sprite as Drawable, options); + + // current behavior state: moving right, left, top, bottom + this.state = 0; + // when lastRotation happened + this.lastRotation = 0; + this.ts = 0; + // long delay before starting to move quickly + this.LONG_DELAY = 250; + // repeat-delay once the long delay has been reached + this.SMALL_DELAY = 70; + + this.reset(); + } + + reset() { + IM.clearEvents(); + + // current delay before repeating a key + this.delay = this.LONG_DELAY; + this.key = 0; + this.timerEnabled = true; + } + + /** + * When the player keeps a key down, we wait for a long delay before + * quickly moving the picece: we don't want to miss interpret his move. + * + * If he quickly releases the key and quickly presses it, we have to + * react though + * + */ + ready(state: number, timestamp: number): boolean { + // if the player pressed a different key + // we react immediately but have to wait a long_delay + // before repeating the key if he keeps pressing it + if (this.state !== state) { + this.ts = timestamp; + this.state = state; + this.delay = this.LONG_DELAY; + return true; + } else if (timestamp - this.ts > this.delay) { + // player keeps pressing the key for a long delay + // we react and set delay to a smaller one to quickly + // repeat the action + this.ts = timestamp; + this.delay = this.SMALL_DELAY; + return true; + } else { + // repeat delay not reached + return false; + } + } + + /** + * Checks tetris timer + * + */ + timer(timestamp: number): boolean { + const sprite = this.sprite; + if (!this.startTime) { + this.startTime = timestamp; + } else { + if (timestamp - this.startTime > sprite.data['speed']) { + // timer reached + this.startTime = timestamp; + return true; + } + } + return false; + } + + checkKeyDelay(key: number, timestamp: number, x: number, y: number): void { + const sprite = this.sprite as Shape; + if (this.ready(key, timestamp)) { + sprite.snapTile(x, y) && AM.play('move'); + } + } + + /** + * This method is called when updating the shape's position + * and updates its position when cursor keys are pressed or + * the timer happened + */ + onUpdate(timestamp: number) { + const sprite = this.sprite as Shape; + + // debug: stop the timer when t key is pressed + if (IM.isKeyDown(84)) { + this.timerEnabled = !this.timerEnabled; + return; + } + + // first check timer + if (this.timerEnabled && this.timer(timestamp)) { + // timer reached: move the sprite down + sprite.snapTile(0, 1); + return; + } + + // Then checks cursor keys + if (IM.isKeyDown('DOWN')) { + this.checkKeyDelay(1, timestamp, 0, 1); + } else if (IM.isKeyDown('LEFT')) { + this.checkKeyDelay(2, timestamp, -1, 0); + } else if (IM.isKeyDown('RIGHT')) { + this.checkKeyDelay(3, timestamp, 1, 0); + } else if ((IM.isKeyDown('UP') || IM.isKeyDown('SPACE')) && (timestamp - this.lastRotation > 150)) { + this.lastRotation = timestamp; + sprite.nextRotation(); + } else if (this.state) { + // key released + this.ready(0, timestamp); + } + } +} + +export default ShapeBehavior; diff --git a/types/athenajs/test/tetris/tetris.ts b/types/athenajs/test/tetris/tetris.ts new file mode 100644 index 0000000000..05434a2249 --- /dev/null +++ b/types/athenajs/test/tetris/tetris.ts @@ -0,0 +1,11 @@ +import { Game } from 'athenajs'; +import Grid from './grid'; + +const tetris = new Game({ + name: 'athena-tetris', + showFps: true, + debug: true, + width: 800, + height: 600, + scene: new Grid() +}); diff --git a/types/athenajs/tsconfig.json b/types/athenajs/tsconfig.json new file mode 100644 index 0000000000..54a31f17a7 --- /dev/null +++ b/types/athenajs/tsconfig.json @@ -0,0 +1,40 @@ +{ + "compilerOptions": { + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "noEmit": true, + "types": [], + "lib": [ + "es5", + "es6", + "es2015.iterable", + "dom" + ], + "module": "commonjs", + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/dom.ts", + "test/deferred.ts", + "test/game.ts", + "test/scene.ts", + "test/drawable.ts", + "test/simpletext.ts", + "test/paint.ts", + "test/bitmaptext.ts", + "test/sprite.ts", + "test/map.ts", + "test/tetris/tetris.ts", + "test/tetris/shape.ts", + "test/tetris/grid.ts", + "test/tetris/shape_behavior.ts", + "test/tetris/flash_lines.ts" + ] +} \ No newline at end of file diff --git a/types/athenajs/tslint.json b/types/athenajs/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/athenajs/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/atlassian-crowd-client/lib/models/session.d.ts b/types/atlassian-crowd-client/lib/models/session.d.ts index 2ef16a0814..2369f976bc 100644 --- a/types/atlassian-crowd-client/lib/models/session.d.ts +++ b/types/atlassian-crowd-client/lib/models/session.d.ts @@ -3,7 +3,7 @@ declare class Session { readonly token: string; readonly createdAt: Date; readonly expiresAt: Date; - + constructor(token: string, createdAt: Date, expiresAt: Date); toCrowd(): SessionObj; static fromCrowd(obj: SessionObj): Session; diff --git a/types/atlassian-crowd-client/settings.d.ts b/types/atlassian-crowd-client/settings.d.ts index 755c26038a..4c56a85e06 100644 --- a/types/atlassian-crowd-client/settings.d.ts +++ b/types/atlassian-crowd-client/settings.d.ts @@ -3,7 +3,7 @@ export interface Settings { readonly application: { readonly name: string; readonly password: string; - } + }; readonly nesting?: boolean; readonly sessionTimeout?: number; readonly debug?: boolean; diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 9d01e194a9..9a04b9c7b6 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -557,8 +557,8 @@ function testDesializerManager() { } function isStorableClass(o: object): o is StorableClass { - if (typeof o === "object" && ( o).name && - ( o).name === "test") { + if (typeof o === "object" && (o as StorableClass).name && + (o as StorableClass).name === "test") { return true; } else { return false; @@ -1748,6 +1748,14 @@ function testProject() { // Accessing the git repository repositories = project.getRepositories(); + subscription = project.observeRepositories(gitRepo => { + const repo: Atom.GitRepository = gitRepo; + }); + + subscription = project.onDidAddRepository(gitRepo => { + const repo: Atom.GitRepository = gitRepo; + }); + async function getDirectoryRepo() { const potentialRepo = await project.repositoryForDirectory(dir); if (potentialRepo) repository = potentialRepo; @@ -3041,6 +3049,25 @@ function testTextEditor() { editor.addGutter({ name: "Test", priority: 42 }); editor.addGutter({ name: "Test", visible: true }); editor.addGutter({ name: "Test", priority: 42, visible: true }); + editor.addGutter({ name: "Test", type: 'decorated' }); + editor.addGutter({ name: "Test", type: 'line-number' }); + editor.addGutter({ name: "Test", class: 'someClass' }); + editor.addGutter({ name: "Test", labelFn(lineData) { + num = lineData.bufferRow; + num = lineData.screenRow; + num = lineData.maxDigits; + bool = lineData.foldable; + bool = lineData.softWrapped; + return 'label'; + }}); + editor.addGutter({ name: "Test", onMouseDown(lineData) { + num = lineData.bufferRow; + num = lineData.screenRow; + } }); + editor.addGutter({ name: "Test", onMouseMove(lineData) { + num = lineData.bufferRow; + num = lineData.screenRow; + } }); gutters = editor.getGutters(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index c403569ab2..d77663c460 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Atom 1.28 +// Type definitions for Atom 1.31 // Project: https://github.com/atom/atom // Definitions by: GlenCFL // smhxx @@ -7,7 +7,7 @@ // TypeScript Version: 2.3 // NOTE: only those classes exported within this file should be retain that status below. -// https://github.com/atom/atom/blob/v1.28.0/exports/atom.js +// https://github.com/atom/atom/blob/v1.31.0/exports/atom.js /// @@ -2415,11 +2415,7 @@ export class TextEditor { // Gutters /** Add a custom Gutter. */ - addGutter(options: { - name: string, - priority?: number, - visible?: boolean, - }): Gutter; + addGutter(options: GutterOptions): Gutter; /** Get this editor's gutters. */ getGutters(): Gutter[]; @@ -2459,6 +2455,74 @@ export class TextEditor { tokenForBufferPosition(pos: PointCompatible): {value: string, scopes: string[]}; } +export interface GutterOptions { + /** (required) A unique String to identify this gutter. */ + name: string; + + /** + * A Number that determines stacking order between gutters. + * Lower priority items are forced closer to the edges of the window. (default: -100) + */ + priority?: number; + + /** + * Boolean specifying whether the gutter is visible initially after being created. + * (default: true) + */ + visible?: boolean; + + /** + * String specifying the type of gutter to create. + * 'decorated' gutters are useful as a destination for decorations created with + * Gutter::decorateMarker. + * 'line-number' gutters. + */ + type?: 'decorated' | 'line-number'; + + /** String added to the CSS classnames of the gutter's root DOM element. */ + class?: string; + + /** + * Function called by a 'line-number' gutter to generate the label for each + * line number element. Should return a String that will be used to label the + * corresponding line. + */ + labelFn?: (lineData: LineDataExtended) => string; + + /** + * Function to be called when a mousedown event is received by a line-number + * element within this type: 'line-number' Gutter. If unspecified, the default + * behavior is to select the clicked buffer row. + */ + onMouseDown?: (lineData: LineData) => void; + + /** + * Function to be called when a mousemove event occurs on a line-number + * element within within this type: 'line-number' Gutter. + */ + onMouseMove?: (lineData: LineData) => void; +} + +export interface LineData { + /** Number indicating the zero-indexed buffer index of a line. */ + bufferRow: number; + + /** Number indicating the zero-indexed screen index. */ + screenRow: number; +} + +/** Object containing information about each line to label. */ +export interface LineDataExtended extends LineData { + /** Boolean that is true if a fold may be created here. */ + foldable: boolean; + + /** Boolean if this screen row is the soft-wrapped continuation of the same buffer row. */ + softWrapped: boolean; + + /** Number the maximum number of digits necessary to represent any known screen row. */ + maxDigits: number; +} + export interface PixelPosition { left: number; top: number; @@ -4497,6 +4561,12 @@ export interface Project { */ getRepositories(): GitRepository[]; + /** Invoke the given callback with all current and future repositories in the project. */ + observeRepositories(callback: (repository: GitRepository) => void): Disposable; + + /** Invoke the given callback when a repository is added to the project. */ + onDidAddRepository(callback: (repository: GitRepository) => void): Disposable; + /** Get the repository for a given directory asynchronously. */ repositoryForDirectory(directory: Directory): Promise; @@ -5844,7 +5914,7 @@ export interface TextEditorObservedEvent { // information under certain contexts. // NOTE: the config schema with these defaults can be found here: -// https://github.com/atom/atom/blob/v1.28.0/src/config-schema.js +// https://github.com/atom/atom/blob/v1.31.0/src/config-schema.js /** * Allows you to strongly type Atom configuration variables. Additional key:value * pairings merged into this interface will result in configuration values under diff --git a/types/atom/tslint.json b/types/atom/tslint.json index 4c3e6e9036..3811d3257c 100644 --- a/types/atom/tslint.json +++ b/types/atom/tslint.json @@ -4,6 +4,9 @@ "await-promise": [true, "CancellablePromise"], "indent": [true, "spaces", 4], "max-line-length": [true, 100], - "no-any": true + "no-any": true, + + // TODOs + "no-declare-current-package": false } } diff --git a/types/auth-header/auth-header-tests.ts b/types/auth-header/auth-header-tests.ts new file mode 100644 index 0000000000..e8b510531c --- /dev/null +++ b/types/auth-header/auth-header-tests.ts @@ -0,0 +1,6 @@ +import * as auth from 'auth-header'; + +const basic: string = auth.format('Basic'); +const basic2: string = auth.format({scheme: 'Basic'}); + +const parsed: {scheme: string, token: null | string | string[]} = auth.parse(''); diff --git a/types/auth-header/index.d.ts b/types/auth-header/index.d.ts new file mode 100644 index 0000000000..fab462be9e --- /dev/null +++ b/types/auth-header/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for auth-header 1.0 +// Project: https://github.com/izaakschroeder/auth-header +// Definitions by: ForbesLindesay +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +type Params = + | Array<[string, string | ReadonlyArray]> + | {[key: string]: string | ReadonlyArray}; +export {Params}; + +export interface TokenOptions { + scheme: string; + token?: string; + params?: Params; +} + +export interface Token { + scheme: string; + params: {[key: string]: string | string[]}; + token: null | string | string[]; +} + +export function format(token: TokenOptions): string; +export function format(scheme: string, token?: string, params?: Params): string; + +export function parse(header: string): Token; diff --git a/types/auth-header/tsconfig.json b/types/auth-header/tsconfig.json new file mode 100644 index 0000000000..58c6fad6d7 --- /dev/null +++ b/types/auth-header/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "auth-header-tests.ts" + ] +} diff --git a/types/fast-diff/tslint.json b/types/auth-header/tslint.json similarity index 100% rename from types/fast-diff/tslint.json rename to types/auth-header/tslint.json diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index f13599ebae..6d21de4ed3 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -11,6 +11,7 @@ webAuth.authorize({ responseType: 'token', redirectUri: 'https://example.com/auth/callback', language: 'en', + login_hint: "email@email.com", prompt: 'login', }); diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 033a4bcbde..7ca266e6ce 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -4,6 +4,7 @@ // Matt Durrant // Peter Blazejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 export as namespace auth0; @@ -172,7 +173,7 @@ export class WebAuth { * * @param callback: any(err, token_payload) */ - parseHash(callback: Auth0Callback): void; + parseHash(callback: Auth0Callback): void; /** * Parse the url hash and extract the returned tokens depending on the transaction. @@ -183,7 +184,7 @@ export class WebAuth { * * @param callback: any(err, token_payload) */ - parseHash(options: ParseHashOptions, callback: Auth0Callback): void; + parseHash(options: ParseHashOptions, callback: Auth0Callback): void; /** * Decodes the id_token and verifies the nonce. @@ -482,7 +483,7 @@ export class CrossOriginAuthentication { callback(): void; } -export type Auth0Callback = (error: null | Auth0Error, result: T) => void; +export type Auth0Callback = (error: null | E, result: T) => void; export interface TokenProvider { enableCache?: boolean; @@ -522,18 +523,51 @@ export interface PasswordlessAuthOptions { email: string; } +/** + * These are error codes defined by the auth0-js lib. + */ +export type LibErrorCodes = 'timeout' | 'request_error' | 'invalid_token'; + +/** + * The user was not logged in at Auth0, so silent authentication is not possible. + */ +export type LoginRequiredErrorCode = 'login_required'; + +/** + * The user was logged in at Auth0 and has authorized the application, but needs to + * be redirected elsewhere before authentication can be completed; for example, when + * using a redirect rule. + */ +export type InteractionRequiredErrorCode = 'interaction_required'; + +/** + * The user was logged in at Auth0, but needs to give consent to authorize the application. + */ +export type ConsentRequiredErrorCode = 'consent_required'; + +/** + * These are error codes defined by the OpenID Connect specification. + */ +export type SpecErrorCodes = + LoginRequiredErrorCode | + InteractionRequiredErrorCode | + ConsentRequiredErrorCode | + 'account_selection_required' | + 'invalid_request_uri' | + 'invalid_request_object' | + 'request_not_supported' | + 'request_uri_not_supported' | + 'registration_not_supported'; + export interface Auth0Error { - error?: any; - errorDescription?: string; - code?: string; - description?: string; - name?: string; - policy?: string; - original?: any; - statusCode?: number; - statusText?: string; + error: LibErrorCodes | SpecErrorCodes | string; + errorDescription: string; } +export type Auth0ParseHashError = Auth0Error & { + state?: string; +}; + /** * The contents of the authResult object returned by {@link WebAuth#parseHash } */ @@ -761,6 +795,7 @@ export interface AuthorizeOptions { scope?: string; audience?: string; language?: string; + login_hint?: string; prompt?: string; mode?: "login" | "signUp"; } diff --git a/types/auth0-lock/auth0-lock-tests.ts b/types/auth0-lock/auth0-lock-tests.ts index 4b5c60e716..6e23e81d5e 100644 --- a/types/auth0-lock/auth0-lock-tests.ts +++ b/types/auth0-lock/auth0-lock-tests.ts @@ -140,12 +140,17 @@ new Auth0Lock(CLIENT_ID, DOMAIN, otherOptions); const multiVariantOptions : Auth0LockConstructorOptions = { container: "myContainer", closable: false, + language: "en", languageDictionary: { signUpTerms: "I agree to the
terms of service ...", title: "My Company", }, + autoclose: true, autofocus: false, + allowAutocomplete: false, + scrollGlobalMessagesIntoView: false, allowShowPassword: true, + allowPasswordAutocomplete: false, }; new Auth0Lock(CLIENT_ID, DOMAIN, multiVariantOptions); diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index 622ac3d36c..2916ec58c8 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -5,6 +5,7 @@ // Larry Faudree // Will Caulfield // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 /// @@ -98,6 +99,7 @@ interface Auth0LockAuthOptions { params?: Auth0LockAuthParamsOptions; redirect?: boolean; redirectUrl?: string; + responseMode?: string; responseType?: string; sso?: boolean; audience?: string; @@ -113,8 +115,10 @@ interface Auth0LockPopupOptions { interface Auth0LockConstructorOptions { additionalSignUpFields?: Auth0LockAdditionalSignUpField[]; allowedConnections?: string[]; + allowAutocomplete?: boolean; allowForgotPassword?: boolean; allowLogin?: boolean; + allowPasswordAutocomplete?: boolean; allowSignUp?: boolean; allowShowPassword?: boolean; assetsUrl?: string; @@ -129,6 +133,7 @@ interface Auth0LockConstructorOptions { defaultADUsernameFromEmailPrefix?: string; defaultDatabaseConnection?: string; defaultEnterpriseConnection?: string; + flashMessage?: Auth0LockFlashMessageOptions; forgotPasswordLink?: string; hashCleanup?: boolean; initialScreen?: "login" | "signUp" | "forgotPassword"; @@ -142,6 +147,7 @@ interface Auth0LockConstructorOptions { popupOptions?: Auth0LockPopupOptions; prefill?: { email?: string, username?: string}; rememberLastLogin?: boolean; + scrollGlobalMessagesIntoView?: boolean; signupLink?: string; socialButtonStyle?: "big" | "small"; theme?: Auth0LockThemeOptions; diff --git a/types/auth0/auth0-tests.ts b/types/auth0/auth0-tests.ts index f4251364d2..60bbf86823 100644 --- a/types/auth0/auth0-tests.ts +++ b/types/auth0/auth0-tests.ts @@ -203,3 +203,26 @@ management.linkUsers('primaryId', { user_id: 'secondaryId' }) management.linkUsers('primaryId', { user_id: 'secondaryId' }, (err: Error, result: any) => {}); +// Get all clients (with promise) +management.getClients() + .then((clients: auth0.Client[]) => { + console.log(clients); + }) + .catch((err) => { + // Handle the error + }); + +//Get all clients (with callback) +management.getClients((err: Error, clients: auth0.Client[]) => {}); + +// Get all clients with params (with promise) +management.getClients({fields:['name','client_metadata'], include_fields:true}) + .then((clients: auth0.Client[]) => { + console.log(clients); + }) + .catch((err) => { + // Handle the error + }); + +// Get all cients with params (with callback) +management.getClients({fields:['name','client_metadata'], include_fields:true}, (err:Error, clients:auth0.Client[]) => {}); diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index e03ad5aa06..39d9d36fd7 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -1,11 +1,9 @@ // Type definitions for auth0 2.9.2 // Project: https://github.com/auth0/node-auth0 -// Definitions by: Wilson Hobbs , Seth Westphal , Amiram Korach +// Definitions by: Seth Westphal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import * as Promise from 'bluebird'; - export interface ManagementClientOptions { token?: string; domain: string; @@ -588,7 +586,19 @@ export interface ImpersonateSettingOptions { clientId?: string; } - +export type ClientAppType = 'native' | 'spa' | 'regular_web' | 'non_interactive' | 'rms' | 'box' | + 'cloudbees' | 'concur' | 'dropbox' | 'mscrm' | 'echosign' | 'egnyte' | 'newrelic' | 'office365' | + 'salesforce' | 'sentry' | 'sharepoint' | 'slack' | 'springcm' | 'zendesk' | 'zoom'; +export interface GetClientsOptions { + fields?: string[]; + include_fields?: boolean; + page?: number; + per_page?: number; + include_totals?: boolean; + is_global?: boolean; + is_first_party?: boolean; + app_type?: ClientAppType[]; +} export class AuthenticationClient { @@ -661,8 +671,9 @@ export class ManagementClient { // Clients - getClients(): Promise; - getClients(cb: (err: Error, clients: Client[]) => void): void; + getClients(params?: GetClientsOptions): Promise; + getClients(cb: (err: Error, clients: Client[]) => void ): void; + getClients(params: GetClientsOptions, cb: (err: Error, clients: Client[]) => void ): void; getClient(params: ClientParams): Promise; getClient(params: ClientParams, cb: (err: Error, client: Client) => void): void; diff --git a/types/autobahn/index.d.ts b/types/autobahn/index.d.ts index 59bb2c404d..c62f6115af 100644 --- a/types/autobahn/index.d.ts +++ b/types/autobahn/index.d.ts @@ -190,6 +190,8 @@ declare namespace autobahn { export class Connection { constructor(options?: IConnectionOptions); + isOpen: boolean; + open(): void; close(reason?: string, message?: string): void; diff --git a/types/autoprefixer/autoprefixer-tests.ts b/types/autoprefixer/autoprefixer-tests.ts index 47ef1cbc08..21940ac008 100644 --- a/types/autoprefixer/autoprefixer-tests.ts +++ b/types/autoprefixer/autoprefixer-tests.ts @@ -1,17 +1,17 @@ -import * as autopref from 'autoprefixer'; +import autoprefixer = require("autoprefixer"); +import { Transformer } from 'postcss'; -const ap: autopref.Transformer = autopref({ - browsers: ['> 5%', 'last 2 versions'], - env: '', - cascade: true, - add: true, - remove: true, - supports: true, - flexbox: true, - grid: true, - stats: {}, +const ap1: Transformer = autoprefixer(); + +const ap2: Transformer = autoprefixer({ + browsers: [], + env: "test", + cascade: false, + add: false, + remove: false, + supports: false, + flexbox: false, + grid: false, + stats: {}, + ignoreUnknownVersions: false, }); -const ap2: autopref.Transformer = autopref({ - flexbox: 'no-2009', -}); -const info: string = ap.info(); diff --git a/types/autoprefixer/index.d.ts b/types/autoprefixer/index.d.ts index 1957632053..faf11371db 100644 --- a/types/autoprefixer/index.d.ts +++ b/types/autoprefixer/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for autoprefixer 6.7 +// Type definitions for autoprefixer 9.1 // Project: https://github.com/postcss/autoprefixer -// Definitions by: Armando Meziat +// Definitions by: Armando Meziat , murt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import { Plugin, Transformer as PostcssTransformer } from 'postcss'; +import { Plugin } from "postcss"; declare namespace autoprefixer { interface Options { @@ -16,15 +17,10 @@ declare namespace autoprefixer { flexbox?: boolean | 'no-2009'; grid?: boolean; stats?: any; + ignoreUnknownVersions?: boolean; } - interface Transformer extends PostcssTransformer { - info(): string; - } - - interface Autoprefixer extends Plugin { - (opts?: Options): Transformer; - } + type Autoprefixer = Plugin; } declare const autoprefixer: autoprefixer.Autoprefixer; diff --git a/types/autoprefixer/package.json b/types/autoprefixer/package.json index c4c2b4c357..1e1a719545 100644 --- a/types/autoprefixer/package.json +++ b/types/autoprefixer/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "postcss": "^5.2.15" + "postcss": "7.x.x" } } diff --git a/types/await-timeout/await-timeout-tests.ts b/types/await-timeout/await-timeout-tests.ts new file mode 100644 index 0000000000..96dcdefdee --- /dev/null +++ b/types/await-timeout/await-timeout-tests.ts @@ -0,0 +1,131 @@ +import Timeout from "await-timeout"; + +/** + * This test is just a TS-friendly version of the await-timeout README: + * https://github.com/vitalets/await-timeout/blob/v0.3.0/README.md + * + * How to generate this file: + * 1. Paste the source code of README.md + * 2. Replace every code fence with async () => {} + * 3. Comment out all other lines + * 4. Add and remove import statements and repeated statements + * 5. Declare required globals + */ + +// -- Globals -- +declare const fetch: (url: string) => Promise; +declare const console: any; +declare const MyTimeoutError: any; + +// --- README --- + +// ## Usage +// 1. Just wait some time: +async () => { + // wait 1000 ms and resolve + await Timeout.set(1000); + + // wait 1000 ms and reject with 'Error' + await Timeout.set(1000, 'Error'); +}; + +// 2. Use `Timeout` instance inside `try...finally` block to make proper cleanup: +async () => { + const timer = new Timeout(); + try { + await Promise.race([ + fetch('https://example.com'), + timer.set(1000) + .then(() => Promise.reject('Timeout')) + ]); + } finally { + timer.clear(); + } +}; + +// ## API +// ### new Timeout() +// Constructs new timeout instance. It does not start timer but creates variable for timer manipulation. +async () => { + const timer = new Timeout(); +}; +// > Note : having separate variable is useful for clearing timeout in `finally` block + +// ### .set(ms, [message]) ⇒ `Promise` +// Starts new timer like `setTimeout()` and returns promise. The promise will be resolved after `ms` milliseconds: +async () => { + const timer = new Timeout(); + timer.set(1000) + .then(() => console.log('1000 ms passed.')); +}; + +// If you need to reject after timeout: +async () => { + const timer = new Timeout(); + timer.set(1000) + .then(() => {throw new Error('Timeout'); }); +}; + +// Or reject with custom error: +async () => { + const timer = new Timeout(); + timer.set(1000) + .then(() => {throw new MyTimeoutError(); }); +}; +// The second parameter `message` is just convenient way to reject with `new Error(message)`: +async () => { + const timer = new Timeout(); + timer.set(1000, 'Timeout'); + // is equivalent to + timer.set(1000).then(() => {throw new Error('Timeout'); }); +}; + +// If you need to just wait some time - use static version of `.set()` : +async () => { + Timeout.set(1000).then(/*...*/); +}; + +// ### .wrap(promise, ms, [message]) ⇒ `Promise` +// Wraps existing promise with timeout: +// * promise automatically rejected after timeout +// * timeout automatically cleared if promise fulfills first +async () => { + const promise = fetch('https://example.com'); + + const timeoutedPromise = Timeout.wrap(promise, 1000, 'Timeout'); +}; +// Actually it is a shortcut for : +async () => { + const promise = fetch('https://example.com'); + + const timer = new Timeout(); + try { + const timeoutedPromise = await Promise.race([ + promise, + timer.set(1000, 'Timeout') + ]); + } finally { + timer.clear(); + } +}; + +// ### .clear() +// Clears existing timeout like `clearTimeout()`. +async () => { + const timer = new Timeout(); + timer.set(1000) + .then(() => console.log('This will never be called, because timeout is cleared on the next line')); + timer.clear(); +}; + +// With [ES7 async / await ] `.clear()` can be used in `finally` block: +async () => { + async function foo() { + const timer = new Timeout(); + try { + // some async stuff + } finally { + timer.clear(); + } + } +}; diff --git a/types/await-timeout/index.d.ts b/types/await-timeout/index.d.ts new file mode 100644 index 0000000000..ce202c6024 --- /dev/null +++ b/types/await-timeout/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for await-timeout 0.3 +// Project: https://github.com/vitalets/await-timeout +// Definitions by: Sean Zhu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export default Timeout; + +declare class Timeout { + static set(delay: number): Promise; + static set(delay: number, message: string): Promise; + + static wrap(promise: Promise, delay: number, error?: string): Promise; + + set(delay: number): Promise; + set(delay: number, message: string): Promise; + clear(): void; +} diff --git a/types/await-timeout/tsconfig.json b/types/await-timeout/tsconfig.json new file mode 100644 index 0000000000..2ecb27e688 --- /dev/null +++ b/types/await-timeout/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "await-timeout-tests.ts" + ] +} diff --git a/types/gitlab/tslint.json b/types/await-timeout/tslint.json similarity index 100% rename from types/gitlab/tslint.json rename to types/await-timeout/tslint.json diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 5fa225eafd..00b71132e9 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -8,6 +8,7 @@ declare let error: Error; declare let bool: boolean; declare let boolOrUndefined: boolean | undefined; declare let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; +declare let apiGwEvtReqCtxOpt: AWSLambda.APIGatewayEventRequestContext | null | undefined; declare let apiGwEvt: AWSLambda.APIGatewayEvent; declare let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; declare let clientCtx: AWSLambda.ClientContext; @@ -102,11 +103,13 @@ str = apiGwEvtReqCtx.resourcePath; /* API Gateway Event */ strOrNull = apiGwEvt.body; str = apiGwEvt.headers["example"]; +str = apiGwEvt.multiValueHeaders["example"][0]; str = apiGwEvt.httpMethod; bool = apiGwEvt.isBase64Encoded; str = apiGwEvt.path; str = apiGwEvt.pathParameters!["example"]; str = apiGwEvt.queryStringParameters!["example"]; +str = apiGwEvt.multiValueQueryStringParameters!["example"][0]; str = apiGwEvt.stageVariables!["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; str = apiGwEvt.resource; @@ -115,10 +118,12 @@ str = apiGwEvt.resource; str = customAuthorizerEvt.type; str = customAuthorizerEvt.methodArn; strOrUndefined = customAuthorizerEvt.authorizationToken; -str = apiGwEvt.pathParameters!["example"]; -str = apiGwEvt.queryStringParameters!["example"]; -str = apiGwEvt.stageVariables!["example"]; -apiGwEvtReqCtx = apiGwEvt.requestContext; +str = customAuthorizerEvt.headers!["example"]; +str = customAuthorizerEvt.multiValueHeaders!["example"][0]; +str = customAuthorizerEvt.pathParameters!["example"]; +str = customAuthorizerEvt.queryStringParameters!["example"]; +str = customAuthorizerEvt.multiValueQueryStringParameters!["example"][0]; +apiGwEvtReqCtxOpt = customAuthorizerEvt.requestContext; /* DynamoDB Stream Event */ const dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { @@ -245,6 +250,9 @@ num = proxyResult.statusCode; proxyResult.headers!["example"] = str; proxyResult.headers!["example"] = bool; proxyResult.headers!["example"] = num; +proxyResult.multiValueHeaders!["example"][0] = str; +proxyResult.multiValueHeaders!["example"][0] = bool; +proxyResult.multiValueHeaders!["example"][0] = num; boolOrUndefined = proxyResult.isBase64Encoded; str = proxyResult.body; @@ -383,6 +391,8 @@ cognitoUserPoolEvent.triggerSource === "TokenGeneration_Authentication"; cognitoUserPoolEvent.triggerSource === "TokenGeneration_NewPasswordChallenge"; cognitoUserPoolEvent.triggerSource === "TokenGeneration_AuthenticateDevice"; cognitoUserPoolEvent.triggerSource === "TokenGeneration_RefreshTokens"; +cognitoUserPoolEvent.triggerSource === "UserMigration_Authentication"; +cognitoUserPoolEvent.triggerSource === "UserMigration_ForgotPassword"; str = cognitoUserPoolEvent.region; str = cognitoUserPoolEvent.userPoolId; strOrUndefined = cognitoUserPoolEvent.userName; @@ -404,6 +414,7 @@ strOrUndefined = cognitoUserPoolEvent.request.session![0].challengeMetadata; strOrUndefined = cognitoUserPoolEvent.request.challengeName; str = cognitoUserPoolEvent.request.privateChallengeParameters!["answer"]; str = cognitoUserPoolEvent.request.challengeAnswer!; +strOrUndefined = cognitoUserPoolEvent.request.password; boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect; strOrUndefined = cognitoUserPoolEvent.response.smsMessage; strOrUndefined = cognitoUserPoolEvent.response.emailMessage; @@ -415,6 +426,14 @@ str = cognitoUserPoolEvent.response.publicChallengeParameters!["captchaUrl"]; str = cognitoUserPoolEvent.response.privateChallengeParameters!["answer"]; strOrUndefined = cognitoUserPoolEvent.response.challengeMetadata; boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect; +str = cognitoUserPoolEvent.response.userAttributes!["username"]; +cognitoUserPoolEvent.response.finalUserStatus === "CONFIRMED"; +cognitoUserPoolEvent.response.finalUserStatus === "RESET_REQUIRED"; +cognitoUserPoolEvent.response.messageAction === "SUPPRESS"; +cognitoUserPoolEvent.response.desiredDeliveryMediums === ["EMAIL"]; +cognitoUserPoolEvent.response.desiredDeliveryMediums === ["SMS"]; +cognitoUserPoolEvent.response.desiredDeliveryMediums === ["SMS", "EMAIL"]; +boolOrUndefined = cognitoUserPoolEvent.response.forceAliasCreation; // CloudFormation Custom Resource switch (cloudformationCustomResourceEvent.RequestType) { diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index cce721e68c..d9d22f8c65 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -22,6 +22,8 @@ // Louis Larry // Daniel Papukchiev // Oliver Hookins +// Trevor Leach +// James Gregory // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -58,11 +60,13 @@ export interface APIGatewayEventRequestContext { export interface APIGatewayProxyEvent { body: string | null; headers: { [name: string]: string }; + multiValueHeaders: { [name: string]: string[] }; httpMethod: string; isBase64Encoded: boolean; path: string; pathParameters: { [name: string]: string } | null; queryStringParameters: { [name: string]: string } | null; + multiValueQueryStringParameters: { [name: string]: string[] } | null; stageVariables: { [name: string]: string } | null; requestContext: APIGatewayEventRequestContext; resource: string; @@ -75,8 +79,10 @@ export interface CustomAuthorizerEvent { methodArn: string; authorizationToken?: string; headers?: { [name: string]: string }; + multiValueHeaders?: { [name: string]: string[] }; pathParameters?: { [name: string]: string } | null; queryStringParameters?: { [name: string]: string } | null; + multiValueQueryStringParameters?: { [name: string]: string[] } | null; requestContext?: APIGatewayEventRequestContext; } @@ -234,7 +240,9 @@ export interface CognitoUserPoolTriggerEvent { | "TokenGeneration_Authentication" | "TokenGeneration_NewPasswordChallenge" | "TokenGeneration_AuthenticateDevice" - | "TokenGeneration_RefreshTokens"; + | "TokenGeneration_RefreshTokens" + | "UserMigration_Authentication" + | "UserMigration_ForgotPassword"; region: string; userPoolId: string; userName?: string; @@ -256,6 +264,7 @@ export interface CognitoUserPoolTriggerEvent { challengeName?: string; privateChallengeParameters?: { [key: string]: string }; challengeAnswer?: string; + password?: string; }; response: { autoConfirmUser?: boolean; @@ -269,6 +278,11 @@ export interface CognitoUserPoolTriggerEvent { privateChallengeParameters?: { [key: string]: string }; challengeMetadata?: string; answerCorrect?: boolean; + userAttributes?: { [key: string]: string }; + finalUserStatus?: "CONFIRMED" | "RESET_REQUIRED"; + messageAction?: "SUPPRESS"; + desiredDeliveryMediums?: Array<"EMAIL" | "SMS">; + forceAliasCreation?: boolean; }; } export type CognitoUserPoolEvent = CognitoUserPoolTriggerEvent; @@ -433,6 +447,9 @@ export interface APIGatewayProxyResult { headers?: { [header: string]: boolean | number | string; }; + multiValueHeaders?: { + [header: string]: Array; + }; body: string; isBase64Encoded?: boolean; } diff --git a/types/axe-webdriverjs/tsconfig.json b/types/axe-webdriverjs/tsconfig.json index d8637d03e4..4eaf433c1c 100644 --- a/types/axe-webdriverjs/tsconfig.json +++ b/types/axe-webdriverjs/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/axios-token-interceptor/index.d.ts b/types/axios-token-interceptor/index.d.ts index 85121f8165..a09fb7591b 100644 --- a/types/axios-token-interceptor/index.d.ts +++ b/types/axios-token-interceptor/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sandrinodimattia/axios-token-interceptor#readme // Definitions by: Mike Dodge // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import { AxiosRequestConfig } from 'axios'; diff --git a/types/azure-sb/index.d.ts b/types/azure-sb/index.d.ts index 9f9d07d3dc..bd62e100ab 100644 --- a/types/azure-sb/index.d.ts +++ b/types/azure-sb/index.d.ts @@ -75,7 +75,7 @@ export namespace Azure.ServiceBus { DefaultMessageTimeToLive: string; DuplicateDetectionHistoryTimeWindow: string; EnablePartitioning: boolean; - MaxSizeInMegaBytes: number; + MaxSizeInMegabytes: number; RequiresDuplicateDetection: boolean; } diff --git a/types/azure/index.d.ts b/types/azure/index.d.ts index 8e7a321713..d35729d385 100644 --- a/types/azure/index.d.ts +++ b/types/azure/index.d.ts @@ -159,13 +159,13 @@ export declare class BlobService extends StorageServiceClient { //#region Service Methods /** - * Gets the properties of a storage account�s Blob service, including Azure Storage Analytics. + * Gets the properties of a storage account's Blob service, including Azure Storage Analytics. */ getServiceProperties(callback: StorageServicePropertiesCallback): void; getServiceProperties(options: TimeoutIntervalOptions, callback: StorageServicePropertiesCallback): void; /** - * Sets the properties of a storage account�s Blob service, including Azure Storage Analytics. + * Sets the properties of a storage account's Blob service, including Azure Storage Analytics. * You can also use this operation to set the default request version for all incoming requests that do not have a version specified. */ setServiceProperties(serviceProperties: StorageServiceProperties, callback: StorageCallbackVoid): void; @@ -256,7 +256,7 @@ export declare class BlobService extends StorageServiceClient { setBlobProperties(container: string, blob: string, options: SetBlobPropertiesOptions, callback: StorageCallback): void; /** - * Sets user-defined metadata for the specified blob or snapshot as one or more name-value pairs + * Sets user-defined metadata for the specified blob or snapshot as one or more name-value pairs * It does not return or modify the content of the blob. */ setBlobMetadata(container: string, blob: string, metadata: StorageMetadata, callback: StorageCallback): void; @@ -288,9 +288,9 @@ export declare class BlobService extends StorageServiceClient { /** * Marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. - * If a blob has snapshots, you must delete them when deleting the blob. Using the deleteSnapshots option, you can choose either to delete both the blob and its snapshots, + * If a blob has snapshots, you must delete them when deleting the blob. Using the deleteSnapshots option, you can choose either to delete both the blob and its snapshots, * or to delete only the snapshots but not the blob itself. If the blob has snapshots, you must include the deleteSnapshots option or the blob service will return an error - * and nothing will be deleted. + * and nothing will be deleted. * If you are deleting a specific snapshot using the snapshotId option, the deleteSnapshots option must NOT be included. */ deleteBlob(container: string, blob: string, callback: StorageCallback): void; @@ -445,8 +445,8 @@ export declare class BlobService extends StorageServiceClient { //#region Lease Methods /** - * Acquires a new lease. - * If container and blob are specified, acquires a blob lease. + * Acquires a new lease. + * If container and blob are specified, acquires a blob lease. * Otherwise, if only container is specified and blob is null, acquires a container lease. */ acquireLease(container: string, blob: string, callback: StorageCallback): void; @@ -521,13 +521,13 @@ export declare class QueueService extends StorageServiceClient { //#region Service Methods /** - * Gets the properties of a storage account�s Blob service, including Azure Storage Analytics. + * Gets the properties of a storage account's Blob service, including Azure Storage Analytics. */ getServiceProperties(callback: StorageServicePropertiesCallback): void; getServiceProperties(options: TimeoutIntervalOptions, callback: StorageServicePropertiesCallback): void; /** - * Sets the properties of a storage account�s Blob service, including Azure Storage Analytics. + * Sets the properties of a storage account's Blob service, including Azure Storage Analytics. * You can also use this operation to set the default request version for all incoming requests that do not have a version specified. */ setServiceProperties(serviceProperties: StorageServiceProperties, callback: StorageCallbackVoid): void; @@ -684,7 +684,7 @@ interface RoleEnvironmentInterface extends events.EventEmitter { /** * Indicates whether the role instance is running in the Microsoft Azure - * environment. It is good practice to enclose any code that uses + * environment. It is good practice to enclose any code that uses * service runtime in the isAvailable callback. */ isAvailable(callback: SimpleCallback): void; @@ -702,7 +702,7 @@ interface RoleEnvironmentInterface extends events.EventEmitter { /** * Retrieves the settings in the service configuration file. - * + * * A role's configuration settings are defined in the service definition file. * Values for configuration settings are set in the service configuration file. * For more information on configuration settings, see the [Service Definition Schema](http://msdn.microsoft.com/en-us/library/windowsazure/ee758711.aspx) @@ -719,10 +719,10 @@ interface RoleEnvironmentInterface extends events.EventEmitter { /** * Requests that the current role instance be stopped and restarted. - * + * * Before the role instance is recycled, the Microsoft Azure load balancer takes the role instance out of rotation. * This ensures that no new requests are routed to the instance while it is restarting. - * + * * A call to `RequestRecycle` initiates the normal shutdown cycle. Microsoft Azure raises the * `Stopping` event and calls the `OnStop` method so that you can run the necessary code to * prepare the instance to be recycled. @@ -731,7 +731,7 @@ interface RoleEnvironmentInterface extends events.EventEmitter { /** * Sets the status of the role instance. - * + * * An instance may indicate that it is in one of two states: Ready or Busy. If an instance's state is Ready, it is * prepared to receive requests from the load balancer. If the instance's state is Busy, it will not receive * requests from the load balancer. diff --git a/types/babel__core/index.d.ts b/types/babel__core/index.d.ts index 277228341b..85a89392af 100644 --- a/types/babel__core/index.d.ts +++ b/types/babel__core/index.d.ts @@ -4,16 +4,16 @@ // Marvin Hagemeister // Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 import { GeneratorOptions } from "@babel/generator"; import traverse, { Visitor, NodePath } from "@babel/traverse"; import template from "@babel/template"; import * as t from "@babel/types"; -import { ParseOptions } from "@babel/parser"; +import { ParserOptions } from "@babel/parser"; export { - ParseOptions, + ParserOptions, GeneratorOptions, t as types, template, @@ -217,7 +217,7 @@ export interface TransformOptions { * * Default: `{}` */ - parserOpts?: ParseOptions | null; + parserOpts?: ParserOptions | null; /** * List of plugins to load and use diff --git a/types/babel__core/package.json b/types/babel__core/package.json index c2ca8a8f9b..582285d229 100644 --- a/types/babel__core/package.json +++ b/types/babel__core/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "@babel/types": "^7.0.0-beta.54" + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" } } diff --git a/types/babel__core/tsconfig.json b/types/babel__core/tsconfig.json index 2f96e019cb..22eb208383 100644 --- a/types/babel__core/tsconfig.json +++ b/types/babel__core/tsconfig.json @@ -22,9 +22,6 @@ "@babel/generator": [ "babel__generator" ], - "@babel/parser": [ - "babel__parser" - ], "@babel/template": [ "babel__template" ], diff --git a/types/babel__generator/babel__generator-tests.ts b/types/babel__generator/babel__generator-tests.ts index 90a668ad55..728638c868 100644 --- a/types/babel__generator/babel__generator-tests.ts +++ b/types/babel__generator/babel__generator-tests.ts @@ -1,9 +1,9 @@ // Example from https://github.com/babel/babel/tree/master/packages/babel-generator import generate from "@babel/generator"; -import { parse } from "@babel/parser"; +import * as t from "@babel/types"; const code = "class Example {}"; -const ast = parse(code); +declare const ast: t.Node; ast.type; ast.loc!.start; diff --git a/types/babel__generator/index.d.ts b/types/babel__generator/index.d.ts index 03fcf2765a..9b6a9fbc1c 100644 --- a/types/babel__generator/index.d.ts +++ b/types/babel__generator/index.d.ts @@ -4,7 +4,7 @@ // Johnny Estilles // Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 import * as t from "@babel/types"; diff --git a/types/babel__generator/package.json b/types/babel__generator/package.json index c2ca8a8f9b..2442a952db 100644 --- a/types/babel__generator/package.json +++ b/types/babel__generator/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "@babel/types": "^7.0.0-beta.54" + "@babel/types": "^7.0.0" } } diff --git a/types/babel__generator/tsconfig.json b/types/babel__generator/tsconfig.json index be65e3da1f..01acda5d38 100644 --- a/types/babel__generator/tsconfig.json +++ b/types/babel__generator/tsconfig.json @@ -18,9 +18,6 @@ "paths": { "@babel/generator": [ "babel__generator" - ], - "@babel/parser": [ - "babel__parser" ] } }, diff --git a/types/babel__parser/babel__parser-tests.ts b/types/babel__parser/babel__parser-tests.ts deleted file mode 100644 index 1c9873e5e8..0000000000 --- a/types/babel__parser/babel__parser-tests.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { parse, parseExpression } from "@babel/parser"; - -declare function assert(expr: boolean): void; - -const code = `function square(n) { - return n * n; -}`; - -const node = parse(code); -assert(node.type === "File"); -assert(node.start === 0); -assert(node.end === 38); -assert(!!node.loc && node.loc.start > node.loc.end); - -parse(code, { - sourceType: "module", // default: "script" - plugins: ["jsx"] // default: [] -}); diff --git a/types/babel__parser/index.d.ts b/types/babel__parser/index.d.ts deleted file mode 100644 index bf383ffa0c..0000000000 --- a/types/babel__parser/index.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -// Type definitions for @babel/parser 7.0 -// Project: https://github.com/babel/babel/tree/master/packages/babel-parser -// Definitions by: Troy Gerwien -// Marvin Hagemeister -// Melvin Groenhoff -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 - -import { File, Expression } from "@babel/types"; - -export function parse(code: string, opts?: ParseOptions): File; - -export function parseExpression(input: string, options?: ParseOptions): Expression; - -export interface ParseOptions { - /** - * By default, import and export declarations can only appear at a program's top level. - * Setting this option to true allows them anywhere where a statement is allowed. - */ - allowImportExportEverywhere?: boolean; - - /** - * By default, await use is not allowed outside of an async function. Set this to true to accept such code. - */ - allowAwaitOutsideFunction?: boolean; - - /** - * By default, a return statement at the top level raises an error. Set this to true to accept such code. - */ - allowReturnOutsideFunction?: boolean; - - allowSuperOutsideMethod?: boolean; - - /** - * Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". - * Defaults to "script". "unambiguous" will make @babel/parser attempt to guess, based on the presence of ES6 import or export - * statements. Files with ES6 imports and exports are considered "module" and are otherwise "script". - */ - sourceType?: "script" | "module" | "unambiguous"; - - /** - * Correlate output AST nodes with their source filename. Useful when - * generating code and source maps from the ASTs of multiple input files. - */ - sourceFilename?: string; - - /** - * By default, the first line of code parsed is treated as line 1. You can provide a line number to alternatively start with. Useful - * for integration with other source tools. - */ - startLine?: number; - - /** - * Array containing the plugins that you want to enable. - */ - plugins?: PluginList; - - strictMode?: boolean; - - /** - * Adds a `ranges` property to each node: `[node.start, node.end]` - */ - ranges?: boolean; - - /** - * Adds all parsed tokens to a `tokens` property on the `File` node - */ - tokens?: boolean; -} - -export type PluginList = Array; - -export type PluginName = - "asyncGenerators" | - "bigInt" | - "classPrivateMethods" | - "classPrivateProperties" | - "classProperties" | - "decorators" | - "doExpressions" | - "dynamicImport" | - "estree" | - "exportDefaultFrom" | - "exportNamespaceFrom" | - "flow" | - "flowComments" | - "functionBind" | - "functionSent" | - "importMeta" | - "jsx" | - "nullishCoalescingOperator" | - "numericSeparator" | - "objectRestSpread" | - "optionalCatchBinding" | - "optionalChaining" | - "pipelineOperator" | - "throwExpressions" | - "typescript"; - -export interface PluginOptions { - decorators?: { - decoratorsBeforeExport?: boolean; - }; - flow?: { - all?: boolean; - }; -} diff --git a/types/babel__template/index.d.ts b/types/babel__template/index.d.ts index 5f3bc18bc3..8750e52d8e 100644 --- a/types/babel__template/index.d.ts +++ b/types/babel__template/index.d.ts @@ -4,12 +4,12 @@ // Marvin Hagemeister // Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 -import { ParseOptions } from "@babel/parser"; +import { ParserOptions } from "@babel/parser"; import { Expression, File, Program, Statement } from "@babel/types"; -export interface TemplateBuilderOptions extends ParseOptions { +export interface TemplateBuilderOptions extends ParserOptions { /** * A set of placeholder names to automatically accept. Items in this list do not need to match the given placeholder pattern. */ diff --git a/types/babel__template/package.json b/types/babel__template/package.json index c2ca8a8f9b..582285d229 100644 --- a/types/babel__template/package.json +++ b/types/babel__template/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "@babel/types": "^7.0.0-beta.54" + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" } } diff --git a/types/babel__template/tsconfig.json b/types/babel__template/tsconfig.json index 386236c02f..50fce77ad8 100644 --- a/types/babel__template/tsconfig.json +++ b/types/babel__template/tsconfig.json @@ -20,9 +20,6 @@ "@babel/generator": [ "babel__generator" ], - "@babel/parser": [ - "babel__parser" - ], "@babel/template": [ "babel__template" ] diff --git a/types/babel__traverse/babel__traverse-tests.ts b/types/babel__traverse/babel__traverse-tests.ts index 2fc7b07a8a..5b4fbbef5f 100644 --- a/types/babel__traverse/babel__traverse-tests.ts +++ b/types/babel__traverse/babel__traverse-tests.ts @@ -1,4 +1,3 @@ -import { parse } from "@babel/parser"; import traverse, { Visitor } from "@babel/traverse"; import * as t from "@babel/types"; @@ -21,11 +20,7 @@ const MyVisitor2: Visitor = { }; // Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-traverse -const code = `function square(n) { - return n * n; -}`; - -const ast = parse(code); +declare const ast: t.Node; traverse(ast, { enter(path) { diff --git a/types/babel__traverse/index.d.ts b/types/babel__traverse/index.d.ts index 475ca9fb14..465a60464f 100644 --- a/types/babel__traverse/index.d.ts +++ b/types/babel__traverse/index.d.ts @@ -5,7 +5,7 @@ // Ryan Petrich // Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 import * as t from "@babel/types"; diff --git a/types/babel__traverse/package.json b/types/babel__traverse/package.json index c2ca8a8f9b..2442a952db 100644 --- a/types/babel__traverse/package.json +++ b/types/babel__traverse/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "@babel/types": "^7.0.0-beta.54" + "@babel/types": "^7.0.0" } } diff --git a/types/babel__traverse/tsconfig.json b/types/babel__traverse/tsconfig.json index 898675d222..b6c30190af 100644 --- a/types/babel__traverse/tsconfig.json +++ b/types/babel__traverse/tsconfig.json @@ -17,9 +17,6 @@ "noEmit": true, "forceConsistentCasingInFileNames": true, "paths": { - "@babel/parser": [ - "babel__parser" - ], "@babel/traverse": [ "babel__traverse" ] diff --git a/types/babylon/index.d.ts b/types/babylon/index.d.ts index 07eb74bb32..b179f6f357 100644 --- a/types/babylon/index.d.ts +++ b/types/babylon/index.d.ts @@ -46,6 +46,7 @@ export type PluginName = 'estree' | 'jsx' | 'flow' | + 'typescript' | 'classConstructorCall' | 'doExpressions' | 'objectRestSpread' | diff --git a/types/backbone-fetch-cache/backbone-fetch-cache-tests.ts b/types/backbone-fetch-cache/backbone-fetch-cache-tests.ts index 072e3c29ce..6c2d852961 100644 --- a/types/backbone-fetch-cache/backbone-fetch-cache-tests.ts +++ b/types/backbone-fetch-cache/backbone-fetch-cache-tests.ts @@ -64,7 +64,7 @@ const modelOpts: Backbone.ModelFetchWithCacheOptions = { context: {}, }; -const hoge = new Backbone.Model; +const hoge = new Backbone.Model() as Backbone.ModelWithCache; hoge.fetch(modelOpts); const collectionOpts: Backbone.CollectionFetchWithCacheOptions = { @@ -76,5 +76,5 @@ const collectionOpts: Backbone.CollectionFetchWithCacheOptions = { prefillSuccess: (self: any) => { }, }; -const fuga = new Backbone.Collection; +const fuga = new Backbone.Collection() as Backbone.CollectionWithCache; fuga.fetch(collectionOpts); diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index a1c8c3eefb..403759ac97 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -122,7 +122,19 @@ declare module 'backbone' { } - export class Store extends Events { + export class Store implements Events { + on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; + on(eventMap: EventsHash): any; + on(eventName: any, callback?: any, context?: any): any; + off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + trigger(eventName: string, ...args: any[]): any; + bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; + unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + once(events: string, callback: (...args: any[]) => void, context?: any): any; + listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; + initializeRelation(model, relation, options); addModelScope(scope:any):void; diff --git a/types/backbone.layoutmanager/tslint.json b/types/backbone.layoutmanager/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/backbone.layoutmanager/tslint.json +++ b/types/backbone.layoutmanager/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index bacd045ba1..4edaba87b7 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -4,13 +4,15 @@ // Natan Vivo , // Sven Tschui , // Volker Nauruhn , -// Ard Timmerman +// Ard Timmerman , +// J. Joe Koullas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import * as Backbone from 'backbone'; import * as JQuery from 'jquery'; import * as Radio from 'backbone.radio'; +import * as _ from 'underscore'; export as namespace Marionette; @@ -179,6 +181,131 @@ export class Container { * Find a view by it's cid. */ remove(view: TView): void; + + /** + * @see _.forEach + */ + forEach(iterator: _.ListIterator, context?: any): Container; + + /** + * @see _.each + */ + each(iterator: _.ListIterator, context?: any): Container; + + /** + * @see _.map + */ + map(iterator: _.ListIterator, context?: any): TResult[]; + + /** + * @see _.find + */ + find(iterator: _.ListIterator, context?: any): Container | undefined; + + /** + * @see _.detect + */ + detect(iterator: _.ListIterator, context?: any): Container | undefined; + + /** + * @see _.filter + */ + filter(iterator: _.ListIterator, context?: any): TView[]; + + /** + * @see _.select + */ + select(iterator: _.ListIterator, context?: any): TView[]; + + /** + * @see _.reject + */ + reject(iterator: _.ListIterator, context?: any): TView[]; + + /** + * @see _.every + */ + every(iterator: _.ListIterator, context?: any): boolean; + + /** + * @see _.all + */ + all(iterator: _.ListIterator, context?: any): boolean; + + /** + * @see _.some + */ + some(iterator: _.ListIterator, context?: any): boolean; + + /** + * @see _.any + */ + any(iterator: _.ListIterator, context?: any): boolean; + + /** + * @see _.include + */ + include(value: TView, fromIndex?: number): boolean; + + /** + * @see _.contains + */ + contains(value: TView, fromIndex?: number): boolean; + + /** + * @see _.invoke + */ + invoke(methodName: string, ...args: any[]): any; + + /** + * @see _.toArray + */ + toArray(): TView[]; + + /** + * @see _.first + */ + first(): TView | undefined; + + /** + * @see _.initial + */ + initial(n?: number): TView[]; + + /** + * @see _.rest + */ + rest(n?: number): TView[]; + + /** + * @see _.last + */ + last(n: number): TView[]; + + /** + * @see _.without + */ + without(...values: TView[]): TView[]; + + /** + * @see _.isEmpty + */ + isEmpty(): boolean; + + /** + * @see _.pluck + */ + pluck(propertyName: string): any[]; + + /** + * @see _.reduce + */ + reduce(iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; + + /** + * @see _.partition + */ + partition(iterator: _.ListIterator, context?: any): TView[][]; } /** @@ -280,9 +407,21 @@ export interface ObjectOptions extends RadioMixinOptions { * A base class which other classes can extend from. Object incorporates many * backbone conventions and utilities like initialize and Backbone.Events. */ -export class Object extends Backbone.Events implements CommonMixin, RadioMixin { +export class Object implements CommonMixin, RadioMixin, Backbone.Events { constructor(options?: ObjectOptions); + on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; + on(eventMap: EventsHash): any; + on(eventName: any, callback?: any, context?: any): any; + off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + trigger(eventName: string, ...args: any[]): any; + bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; + unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + once(events: string, callback: (...args: any[]) => void, context?: any): any; + listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; + /** * Receives a hash of event names and functions and/or function names, * and returns the same hash with the function names replaced with the @@ -1154,7 +1293,7 @@ export class View extends Backbone.View i export interface CollectionViewOptions< TModel extends Backbone.Model, TCollection extends Backbone.Collection = Backbone.Collection -> extends Backbone.ViewOptions, ViewMixinOptions { + > extends Backbone.ViewOptions, ViewMixinOptions { /** * Specify a child view to use. */ diff --git a/types/backbone.paginator/backbone.paginator-tests.ts b/types/backbone.paginator/backbone.paginator-tests.ts index f24e2855f5..0c1b0cf9a8 100644 --- a/types/backbone.paginator/backbone.paginator-tests.ts +++ b/types/backbone.paginator/backbone.paginator-tests.ts @@ -70,8 +70,8 @@ namespace InitializingWithOptions { }); var testCollection6 = new TestCollection([ - {}, - {}, + {} as TestModel, + {} as TestModel, ]); } diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index 12fc6d384f..ac953aa00b 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -71,7 +71,18 @@ declare module "backbone" { stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests; } - class Channel extends Backbone.Events implements Commands, Requests { + class Channel implements Commands, Requests, Backbone.Events { + on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; + on(eventMap: EventsHash): any; + on(eventName: any, callback?: any, context?: any): any; + off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + trigger(eventName: string, ...args: any[]): any; + bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; + unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + once(events: string, callback: (...args: any[]) => void, context?: any): any; + listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; channelName: string; reset(): Channel; diff --git a/types/backbone/backbone-tests.ts b/types/backbone/backbone-tests.ts index 65a1463978..563c21634c 100644 --- a/types/backbone/backbone-tests.ts +++ b/types/backbone/backbone-tests.ts @@ -1,6 +1,6 @@ function test_events() { - var object = new Backbone.Events(); + var object = Backbone.Events; object.on("alert", (eventName: string) => alert("Triggered " + eventName)); object.trigger("alert", "an event"); diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 81bce43606..ca36541735 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Boris Yankov // Natan Vivo // kenjiru +// jjoekoullas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -94,21 +95,34 @@ declare namespace Backbone { [selector: string]: string | {(eventObject: JQueryEventObject): void}; } - class Events { - on(eventName: string, callback?: Function, context?: any): any; + export const Events: Events; + interface Events { + on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; on(eventMap: EventsHash): any; - off(eventName?: string, callback?: Function, context?: any): any; + off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: Function, context?: any): any; - unbind(eventName?: string, callback?: Function, context?: any): any; + bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; + unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: Function, context?: any): any; - listenTo(object: any, events: string, callback: Function): any; - listenToOnce(object: any, events: string, callback: Function): any; - stopListening(object?: any, events?: string, callback?: Function): any; + once(events: string, callback: (...args: any[]) => void, context?: any): any; + listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; } - class ModelBase extends Events { + class ModelBase implements Events { + on(eventName: string, callback?: Function, context?: any): any; + on(eventMap: EventsHash): any; + on(eventName: any, callback?: any, context?: any): any + off(eventName?: string, callback?: Function, context?: any): any + trigger(eventName: string, ...args: any[]): any + bind(eventName: string, callback: Function, context?: any): any + unbind(eventName?: string, callback?: Function, context?: any): any + once(events: string, callback: Function, context?: any): any + listenTo(object: any, events: string, callback: Function):any + listenToOnce(object: any, events: string, callback: Function): any + stopListening(object?: any, events?: string, callback?: Function): any + parse(response: any, options?: any): any; toJSON(options?: any): any; sync(...arg: any[]): JQueryXHR; @@ -353,7 +367,7 @@ declare namespace Backbone { without(...values: TModel[]): TModel[]; } - class Router extends Events { + class Router extends EventSignatures { /** * Do not use, prefer TypeScript's extend functionality. @@ -382,7 +396,7 @@ declare namespace Backbone { var history: History; - class History extends Events { + class History extends EventSignatures { handlers: any[]; interval: number; @@ -419,7 +433,7 @@ declare namespace Backbone { attributes?: {[id: string]: any}; } - class View extends Events { + class View extends EventSignatures { /** * Do not use, prefer TypeScript's extend functionality. @@ -471,3 +485,21 @@ declare namespace Backbone { function noConflict(): typeof Backbone; var $: JQueryStatic; } + +/** + * This is not for external use and is only here as a convenient way to + * specify signatures for internal implementers of Backbone.Events + */ +declare abstract class EventSignatures implements Backbone.Events { + on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; + on(eventMap: Backbone.EventsHash): any; + off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + trigger(eventName: string, ...args: any[]): any; + bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; + unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; + + once(events: string, callback: (...args: any[]) => void, context?: any): any; + listenTo(object: any, events: string, callback: (...args: any[]) => void): any; + listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; + stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; +} \ No newline at end of file diff --git a/types/backbone/tslint.json b/types/backbone/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/backbone/tslint.json +++ b/types/backbone/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/baconjs/baconjs-tests.ts b/types/baconjs/baconjs-tests.ts index 2755bec595..b7d6db4c0f 100644 --- a/types/baconjs/baconjs-tests.ts +++ b/types/baconjs/baconjs-tests.ts @@ -120,7 +120,7 @@ function CommonMethodsInEventStreamsAndProperties() { Bacon.fromArray([1, 2, 3]).withStateMachine(0, (sum, event) => { if (event.hasValue()) { // had to cast to `number` because event:Bacon.Next|Bacon.Error<{}> - return [sum + event.value(), []]; + return [sum + (event.value() as number), []]; } else if (event.isEnd()) { return [undefined, [new Bacon.Next(sum), event]]; @@ -140,8 +140,8 @@ function CommonMethodsInEventStreamsAndProperties() { { // This is handy for keeping track whether we are currently awaiting an AJAX response: - var ajaxRequest = >{}, - ajaxResponse = >{}, + var ajaxRequest = {} as Bacon.Observable, + ajaxResponse = {} as Bacon.Observable, showAjaxIndicator = ajaxRequest.awaiting(ajaxResponse); } diff --git a/types/baidumap-web-sdk/tslint.json b/types/baidumap-web-sdk/tslint.json index aab43caa1d..eccb336643 100644 --- a/types/baidumap-web-sdk/tslint.json +++ b/types/baidumap-web-sdk/tslint.json @@ -2,14 +2,21 @@ "extends": "dtslint/dt.json", "rules": { // All are TODOs - "eofline": false, + "adjacent-overload-signatures": false, + "array-type": false, + "ban-types": false, "comment-format": false, "dt-header": false, + "eofline": false, "max-line-length": false, "member-access": false, + "no-consecutive-blank-lines": false, + "no-empty-interface": false, "no-namespace": false, + "no-unnecessary-class": false, "no-useless-files": false, "no-var": false, - "semicolon": false + "semicolon": false, + "space-before-function-paren": false } } diff --git a/types/basicauth-middleware/basicauth-middleware-tests.ts b/types/basicauth-middleware/basicauth-middleware-tests.ts new file mode 100644 index 0000000000..258f382807 --- /dev/null +++ b/types/basicauth-middleware/basicauth-middleware-tests.ts @@ -0,0 +1,21 @@ +import express = require('express'); +import basicAuth = require('basicauth-middleware'); + +const app = express(); + +app.use(basicAuth("username", "password", "realm")); +app.use(basicAuth([["username", "password"]])); + +function checkSync(username: string, password: string): boolean { + return username === "user" && password === "pass"; +} +function checkCallback(username: string, password: string, callback: (err: Error|null, authorized: boolean) => void): void { + callback(null, username === "user" && password === "pass"); +} +function checkPromise(username: string, password: string): Promise { + return Promise.resolve(true); +} + +app.use(basicAuth(checkSync)); +app.use(basicAuth(checkCallback)); +app.use(basicAuth(checkPromise)); diff --git a/types/basicauth-middleware/index.d.ts b/types/basicauth-middleware/index.d.ts new file mode 100644 index 0000000000..21e3a27ad8 --- /dev/null +++ b/types/basicauth-middleware/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for basicauth-middleware 3.1 +// Project: https://github.com/nchaulet/basicauth-middleware +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { RequestHandler } from "express"; +type checkFunctionSync = (username: string, password: string) => boolean; +type checkFunctionCallback = (username: string, password: string, callback: (err: Error|null, authorized: boolean) => void) => void; +type checkFunctionPromise = (username: string, password: string) => PromiseLike; +type CheckFunction = checkFunctionSync | checkFunctionPromise | checkFunctionCallback; + +declare function basicAuth(checkFnOrUsers: Array<[string, string]>|CheckFunction, realm?: string): RequestHandler; +declare function basicAuth(username: string, password: string, realm?: string): RequestHandler; + +export = basicAuth; diff --git a/types/basicauth-middleware/tsconfig.json b/types/basicauth-middleware/tsconfig.json new file mode 100644 index 0000000000..e31e940e70 --- /dev/null +++ b/types/basicauth-middleware/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + + }, + "files": [ + "index.d.ts", + "basicauth-middleware-tests.ts" + ] +} diff --git a/types/grid-styled/tslint.json b/types/basicauth-middleware/tslint.json similarity index 100% rename from types/grid-styled/tslint.json rename to types/basicauth-middleware/tslint.json diff --git a/types/bcrypt/index.d.ts b/types/bcrypt/index.d.ts index 3cf57ca562..674a65bba5 100644 --- a/types/bcrypt/index.d.ts +++ b/types/bcrypt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bcrypt 2.0 +// Type definitions for bcrypt 3.0 // Project: https://www.npmjs.org/package/bcrypt // Definitions by: Peter Harris // Ayman Nedjmeddine diff --git a/types/bell/bell-tests.ts b/types/bell/bell-tests.ts index bcd3a3d40c..26a29670a0 100644 --- a/types/bell/bell-tests.ts +++ b/types/bell/bell-tests.ts @@ -16,7 +16,7 @@ async function run() { clientSecret: '', scope(request) { const scopes = ['public_profile', 'email']; - if (( request.query).wantsSharePermission) { + if ((request.query as RequestQuery).wantsSharePermission) { scopes.push('publish_actions'); } return scopes; @@ -105,5 +105,53 @@ async function run() { clientId: '', clientSecret: '', scope: ['user_read', 'channel_read'] + }, + { + provider: { + auth: 'http://test.com/auth', + token: 'http://test.com/auth', + name: 'custom', + protocol: 'oauth', + temporary: 'wat', + async profile(credentials, params, get) { + console.log(credentials.provider); + console.log(credentials.query); + console.log(credentials.secret); + console.log(this.clientId); + credentials.profile = await get('http://test.com/profile', { + a: 'test', + }); + }, + }, + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + location: () => '', + }, + { + provider: { + auth: 'http://test.com/auth', + token: 'http://test.com/auth', + name: 'custom', + protocol: 'oauth2', + scope: ['a', 's', 'd', 'f'], + scopeSeparator: '~~~', + async profile(credentials, params, get) { + console.log(credentials.provider); + console.log(credentials.query); + console.log(credentials.token); + console.log(credentials.refreshToken); + console.log(this.clientId); + credentials.profile = await get('http://test.com/profile', { + a: 'test', + }); + }, + }, + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + location: () => '', }]; } diff --git a/types/bell/index.d.ts b/types/bell/index.d.ts index cf6a6866e1..4b56a239a3 100644 --- a/types/bell/index.d.ts +++ b/types/bell/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/hapijs/bell // Definitions by: Simon Schick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.7 +// TypeScript Version: 2.8 import { Server, Request, Plugin, AuthCredentials } from 'hapi'; @@ -22,45 +22,45 @@ export interface StringLikeMap { [key: string]: string | number; } export type Provider = - 'arcgisonline' | - 'auth0' | - 'azuread' | - 'bitbucket' | - 'digitalocean' | - 'discord' | - 'dropbox' | - 'dropboxV2' | - 'facebook' | - 'fitbit' | - 'foursquare' | - 'github' | - 'gitlab' | - 'google' | - 'googleplus' | - 'instagram' | - 'linkedin' | - 'live' | - 'medium' | - 'meetup' | - 'mixer' | - 'nest' | - 'office365' | - 'okta' | - 'phabricator' | - 'pingfed' | - 'pinterest' | - 'reddit' | - 'salesforce' | - 'slack' | - 'spotify' | - 'stripe' | - 'trakt' | - 'tumblr' | - 'twitch' | - 'twitter' | - 'vk' | - 'wordpress' | - 'yahoo'; + 'arcgisonline' | + 'auth0' | + 'azuread' | + 'bitbucket' | + 'digitalocean' | + 'discord' | + 'dropbox' | + 'dropboxV2' | + 'facebook' | + 'fitbit' | + 'foursquare' | + 'github' | + 'gitlab' | + 'google' | + 'googleplus' | + 'instagram' | + 'linkedin' | + 'live' | + 'medium' | + 'meetup' | + 'mixer' | + 'nest' | + 'office365' | + 'okta' | + 'phabricator' | + 'pingfed' | + 'pinterest' | + 'reddit' | + 'salesforce' | + 'slack' | + 'spotify' | + 'stripe' | + 'trakt' | + 'tumblr' | + 'twitch' | + 'twitter' | + 'vk' | + 'wordpress' | + 'yahoo'; export type RequestPassThrough = (request: Request) => PromiseLike | AuthCredentials; @@ -188,29 +188,33 @@ export interface KnownProviderOptions extends RequiredProviderOptions, OptionalO * @param uri the requested resource URI (bell will add the token or authentication header as needed). * @param params any URI query parameters (cannot include them in the URI due to signature requirements). */ -export type AuthedRequest = (uri: string, params: { [key: string]: string } | null) => Promise; +export type AuthedRequest = (uri: string, params?: { [key: string]: string }) => Promise; + +export interface Credentials { + provider: Provider | 'custom'; + token: string; + query: StringLikeMap; + /** + * Varying data depending on provider. + */ + profile?: object; +} + +export interface Credentials1 extends Credentials { + secret: string; +} + +export interface Credentials2 extends Credentials { + refreshToken?: string; + expiresIn?: number; +} export interface CustomProtocol { /** - * the authorization protocol used. + * The name of the protocol. + * @default custom */ - protocol: 'oauth' | 'oauth2'; - /** - * the OAuth signature method (OAuth 1.0a only). Must be one of: - * * 'HMAC-SHA1' - default - * * 'RSA-SHA1' - in that case, the clientSecret is your RSA private key - */ - signatureMethod?: 'HMAC-SHA1' | 'RSA-SHA1'; - /** - * the temporary credentials (request token) endpoint (OAuth 1.0a only). - */ - temporary?: string; - /** - * boolean that determines if OAuth client id and client secret will be sent - * as parameters as opposed to an Authorization header (OAuth 2.0 only). - * Defaults to false. - */ - useParamsAuth?: boolean; + name?: string; /** * the authorization endpoint URI. */ @@ -219,18 +223,6 @@ export interface CustomProtocol { * the access token endpoint URI. */ token: string; - /** - * the OAuth version. - */ - version?: string; - /** - * an array of scope strings (OAuth 2.0 only). - */ - scope?: string[] | ((query: StringLikeMap) => string[]); - /** - * the scope separator character (OAuth 2.0 only). Only required when a provider has a broken OAuth 2.0 implementation. Defaults to space (Facebook and GitHub default to comma). - */ - scopeSeparator?: string; /** * a headers object with additional headers required by the provider * (e.g. GitHub required the 'User-Agent' header which is set by default). @@ -238,23 +230,68 @@ export interface CustomProtocol { headers?: { [key: string]: string; }; +} + +/** + * a function used to obtain user profile information and normalize it. + * @param credentials the credentials object. + * Change the object directly within the function (profile information is typically stored under credentials.profile). + * @param params the parsed information received from the provider (e.g. token, secret, and other custom fields). + * @param get an OAuth helper function to make authenticated requests using the credentials received. + */ +export type ProfileGetter = (this: CustomProviderOptions, credentials: C, params: { [key: string]: string }, get: AuthedRequest) => Promise; + +export interface CustomProtocol1 extends CustomProtocol { /** - * a function used to obtain user profile information and normalize it. - * @param credentials the credentials object. - * Change the object directly within the function (profile information is typically stored under credentials.profile). - * @param params the parsed information received from the provider (e.g. token, secret, and other custom fields). - * @param get an OAuth helper function to make authenticated requests using the credentials received. + * the authorization protocol used. */ - profile(credentials: any, params: { [key: string]: string }, get: AuthedRequest): Promise; + protocol: 'oauth'; + + /** + * the OAuth signature method. Must be one of: + * * 'HMAC-SHA1' - default + * * 'RSA-SHA1' - in that case, the clientSecret is your RSA private key + */ + signatureMethod?: 'HMAC-SHA1' | 'RSA-SHA1'; + /** + * the temporary credentials (request token) endpoint). + */ + temporary?: string; + + profile: ProfileGetter; +} + +export interface CustomProtocol2 extends CustomProtocol { + /** + * the authorization protocol used. + */ + protocol: 'oauth2'; + /** + * an array of scope strings. + */ + scope?: string[] | ((query: StringLikeMap) => string[]); + /** + * boolean that determines if OAuth client id and client secret will be sent + * as parameters as opposed to an Authorization header. + * Defaults to false. + */ + useParamsAuth?: boolean; + + /** + * the scope separator character. Only required when a provider has a broken OAuth 2.0 implementation. Defaults to space (Facebook and GitHub default to comma). + */ + scopeSeparator?: string; + + profile: ProfileGetter; } export interface CustomProviderOptions extends RequiredProviderOptions, OptionalOptions { - provider: CustomProtocol; + provider: CustomProtocol1 | CustomProtocol2; } export type BellOptions = CustomProviderOptions | KnownProviderOptions; -export const plugin: Plugin; +export const plugin: Plugin; /** * Enables simulation mode. */ diff --git a/types/better-scroll/index.d.ts b/types/better-scroll/index.d.ts index 326dd2c3a0..91e5710805 100644 --- a/types/better-scroll/index.d.ts +++ b/types/better-scroll/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for better-scroll 1.12 // Project: https://github.com/ustbhuangyi/better-scroll // Definitions by: cloudstone +// jack // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -42,6 +43,24 @@ export interface PullUpOption { threshold: number; } +export interface MouseWheelOption { + speed: number; + invert: boolean; + easeTime: number; +} + +export interface ZoomOption { + start: number; + min: number; + max: number; +} + +export interface InfinityOption { + fetch: (count: number) => void; + render: (item: any, div: Element) => Element; + createTombstone: () => Element; +} + export interface BounceObjectOption { top?: boolean; bottom?: boolean; @@ -49,6 +68,10 @@ export interface BounceObjectOption { right?: boolean; } +export interface DoubleClick { + delay: number; +} + export interface EaseOption { swipe?: { style: string; @@ -73,6 +96,7 @@ export interface BsOption { directionLockThreshold: number; eventPassthrough: string | boolean; click: boolean; + dblclick: boolean | DoubleClick; tap: boolean; bounce: boolean | BounceObjectOption; bounceTime: number; @@ -140,6 +164,23 @@ export interface BsOption { * } */ pullUpLoad: Partial | boolean; + + // mouseWheel: { + // speed: 20, + // invert: false, + // easeTime: 300 + // } + mouseWheel: Partial | boolean; + + // zoom: { + // start: 1, + // min: 1, + // max: 4 + // } + zoom: Partial | boolean; + + // https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/options-advanced.html + infinity: Partial | boolean; } export interface Position { diff --git a/types/better-sqlite3/better-sqlite3-tests.ts b/types/better-sqlite3/better-sqlite3-tests.ts index 34ee6808c3..7272d88f7e 100644 --- a/types/better-sqlite3/better-sqlite3-tests.ts +++ b/types/better-sqlite3/better-sqlite3-tests.ts @@ -2,24 +2,32 @@ import Database = require('better-sqlite3'); const integer = Database.Integer(1); const err = new Database.SqliteError('ok', 'ok'); +const result: Database.RunResult = { changes: 1, lastInsertRowid: 1 }; +const options: Database.Options = { fileMustExist: true, memory: true, readonly: true }; +const registrationOptions: Database.RegistrationOptions = { + deterministic: true, + name: '', + safeIntegers: true, + varargs: true +}; let db = Database('.'); -db = new Database('.', {memory: true}); +db = new Database('.', { memory: true }); db.exec('CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL);'); db.exec('INSERT INTO test(name) VALUES("name");'); db.pragma('data_version', true); db.checkpoint(); db.checkpoint('main'); -db.register(() => {}); -db.register({name: 'noop', deterministic: true, varargs: true}, () => {}); +db.register(() => { }); +db.register({ name: 'noop', deterministic: true, varargs: true }, () => { }); db.defaultSafeIntegers(); db.defaultSafeIntegers(true); const stmt = db.prepare('SELECT * FROM test WHERE name == ?;'); stmt.get(['name']); -stmt.all({name: 'name'}); -stmt.each('name', (row: {name: string}) => {}); -stmt.each((row: {name: string}) => {}); +stmt.all({ name: 'name' }); +stmt.each('name', (row: { name: string }) => { }); +stmt.each((row: { name: string }) => { }); stmt.pluck(); stmt.pluck(true); stmt.bind('name'); diff --git a/types/better-sqlite3/index.d.ts b/types/better-sqlite3/index.d.ts index 899a85a2e2..5a4859e21f 100644 --- a/types/better-sqlite3/index.d.ts +++ b/types/better-sqlite3/index.d.ts @@ -1,88 +1,94 @@ -// Type definitions for better-sqlite3 3.1 +// Type definitions for better-sqlite3 5.0 // Project: http://github.com/JoshuaWise/better-sqlite3 // Definitions by: Ben Davies // Mathew Rumsey +// Santiago Aguilar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import Integer = require('integer'); - -interface RunResult { - changes: number; - lastInsertROWID: Integer.IntLike; -} +import Integer = require("integer"); declare class Statement { - database: Database; - source: string; - returnsData: boolean; - constructor(db: Database, sources: string[]); + database: Database; + source: string; + returnsData: boolean; + constructor(db: Database, sources: string[]); - run(...params: any[]): RunResult; - get(...params: any[]): any; - all(...params: any[]): any[]; - each(params: any, cb: (row: any) => void): void; - each(cb: (row: any) => void): void; - each(...params: any[]): void; - pluck(toggleState?: boolean): this; - bind(...params: any[]): this; - safeIntegers(toggleState?: boolean): this; + run(...params: any[]): Database.RunResult; + get(...params: any[]): any; + all(...params: any[]): any[]; + each(params: any, cb: (row: any) => void): void; + each(cb: (row: any) => void): void; + each(...params: any[]): void; + pluck(toggleState?: boolean): this; + bind(...params: any[]): this; + safeIntegers(toggleState?: boolean): this; } declare class Transaction { - database: Database; - source: string; - constructor(db: Database, sources: string[]); + database: Database; + source: string; + constructor(db: Database, sources: string[]); - run(...params: any[]): RunResult; - bind(...params: any[]): this; - safeIntegers(toggleState?: boolean): this; -} - -interface DatabaseOptions { - memory?: boolean; - readonly?: boolean; - fileMustExist?: boolean; -} - -interface RegistrationOptions { - name?: string; - varargs?: boolean; - deterministic?: boolean; - safeIntegers?: boolean; + run(...params: any[]): Database.RunResult; + bind(...params: any[]): this; + safeIntegers(toggleState?: boolean): this; } interface Database { - memory: boolean; - readonly: boolean; - name: string; - open: boolean; - inTransaction: boolean; + memory: boolean; + readonly: boolean; + name: string; + open: boolean; + inTransaction: boolean; - prepare(source: string): Statement; - transaction(sources: string[]): Transaction; - exec(source: string): this; - pragma(source: string, simplify?: boolean): any; - checkpoint(databaseName?: string): this; - register(cb: (...params: any[]) => any): this; - register(options: RegistrationOptions, cb: (...params: any[]) => any): this; - close(): this; - defaultSafeIntegers(toggleState?: boolean): this; + prepare(source: string): Statement; + transaction(sources: string[]): Transaction; + exec(source: string): this; + pragma(source: string, simplify?: boolean): any; + checkpoint(databaseName?: string): this; + register(cb: (...params: any[]) => any): this; + register( + options: Database.RegistrationOptions, + cb: (...params: any[]) => any + ): this; + close(): this; + defaultSafeIntegers(toggleState?: boolean): this; } declare class SqliteError implements Error { - name: string; - message: string; - code: string; - constructor(message: string, code: string); + name: string; + message: string; + code: string; + constructor(message: string, code: string); } interface DatabaseConstructor { - new(filename: string, options?: DatabaseOptions): Database; - (filename: string, options?: DatabaseOptions): Database; - prototype: Database; + new (filename: string, options?: Database.Options): Database; + (filename: string, options?: Database.Options): Database; + prototype: Database; - Integer: typeof Integer; - SqliteError: typeof SqliteError; + Integer: typeof Integer; + SqliteError: typeof SqliteError; +} + +declare namespace Database { + interface RunResult { + changes: number; + lastInsertRowid: Integer.IntLike; + } + + interface Options { + memory?: boolean; + readonly?: boolean; + fileMustExist?: boolean; + } + + interface RegistrationOptions { + name?: string; + varargs?: boolean; + deterministic?: boolean; + safeIntegers?: boolean; + } } declare const Database: DatabaseConstructor; diff --git a/types/bezier-js/bezier-js-tests.ts b/types/bezier-js/bezier-js-tests.ts index 003b6e1c45..9bcada8474 100644 --- a/types/bezier-js/bezier-js-tests.ts +++ b/types/bezier-js/bezier-js-tests.ts @@ -21,6 +21,11 @@ function test() { startcap: cap, endcap: cap, forward: bezier, back: bezier, bbox: bbox, intersections: function (shape) { return [[0]]; } }; var split: BezierJs.Split = { left: bezier, right: bezier, span: [point] }; + var quadratic: BezierJs.Bezier = BezierJs.Bezier.quadraticFromPoints({ x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 2 }, 0.5); + var quadratic: BezierJs.Bezier = BezierJs.Bezier.quadraticFromPoints({ x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 2 }); + var cubic: BezierJs.Bezier = BezierJs.Bezier.cubicFromPoints({ x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 2 }, 0.5, 2); + var cubic: BezierJs.Bezier = BezierJs.Bezier.cubicFromPoints({ x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 2 }, 0.5); + var cubic: BezierJs.Bezier = BezierJs.Bezier.cubicFromPoints({ x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 2 }); bezier.arcs(); bezier.clockwise; diff --git a/types/bezier-js/index.d.ts b/types/bezier-js/index.d.ts index b44b027dc2..ffd74f5d46 100644 --- a/types/bezier-js/index.d.ts +++ b/types/bezier-js/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Bezier.js // Project: https://github.com/Pomax/bezierjs // Definitions by: Dan Marshall +// Simon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace BezierJs { @@ -96,8 +97,8 @@ declare namespace BezierJs { constructor(p1: Point, p2: Point, p3: Point, p4?: Point); static fromSVG(svgString: string): Bezier; static getABC(n: number, S: Point, B: Point, E: Point, t: number): ABC; - static quadraticFromPoints(p1: Point, p2: Point, p3: Point, t: number): Bezier; - static cubicFromPoints(S: Point, B: Point, E: Point, t: number, d1: number): Bezier; + static quadraticFromPoints(p1: Point, p2: Point, p3: Point, t?: number): Bezier; + static cubicFromPoints(S: Point, B: Point, E: Point, t?: number, d1?: number): Bezier; static getUtils(): typeof utils; getUtils(): typeof utils; valueOf(): string; diff --git a/types/bl/bl-tests.ts b/types/bl/bl-tests.ts index 084cf1925a..68fbc79279 100644 --- a/types/bl/bl-tests.ts +++ b/types/bl/bl-tests.ts @@ -9,16 +9,27 @@ var str: string; var noAssert: boolean; bl = new BufferList(); +bl = new BufferList(bl); +bl = new BufferList([bl]); +bl = new BufferList(Buffer.from('asdf')); +bl = new BufferList([Buffer.from('asdf')]); +bl = new BufferList('hi'); bl = new BufferList((err:Error, buffer:Buffer) => { - + if (err) { + throw err; + } + console.log(buffer.toString()); }); bl.append(buffer); +num = bl.length; + num = bl.get(num); buffer = bl.slice(num, num); buffer = bl.slice(num); buffer = bl.slice(); +bl.shallowSlice(0, 1).shallowSlice(); bl.copy(buffer, num, num, num); bl.copy(buffer, num, num); @@ -34,8 +45,11 @@ str = bl.toString(str, num, num); str = bl.toString(str, num); str = bl.toString(str); str = bl.toString(); - -num = bl.length; +bl.indexOf('foo', 0, 'hex') === 1; +bl.indexOf(Buffer.from('foo')) === 1; +bl.indexOf(4) === 1; +bl.indexOf(bl) === 1; +bl.indexOf(new Uint8Array([1,3,4])) === 2; num = bl.readDoubleBE(offset, noAssert); num = bl.readDoubleBE(offset); diff --git a/types/bl/index.d.ts b/types/bl/index.d.ts index 8ad01671fd..8bd9e96aac 100644 --- a/types/bl/index.d.ts +++ b/types/bl/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for BufferList v0.8.0 +// Type definitions for BufferList v2.1.0 // Project: https://github.com/rvagg/bl // Definitions by: Bart van der Schoor +// Francis Gulotta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -9,17 +10,18 @@ import stream = require('stream'); declare class BufferList extends stream.Duplex { - constructor(callback?: (err: Error, buffer: Buffer) => void); + constructor(callbackOrData?: ((err: Error, buffer: Buffer) => void) | Buffer | Buffer[] | BufferList | BufferList[] | string); + length: number; append(buffer: Buffer | Buffer[] | BufferList | BufferList[] | string): void; get(index: number): number; slice(start?: number, end?: number): Buffer; + shallowSlice(start?: number, end?: number): BufferList; copy(dest: Buffer, destStart?: number, srcStart?: number, srcEnd?: number): void; duplicate(): BufferList; consume(bytes?: number): void; toString(encoding?: string, start?: number, end?: number): string; - length: number; - + indexOf(value: string | number | Uint8Array | BufferList | Buffer, byteOffset?: number, encoding?: string): number; readDoubleBE(offset: number, noAssert?: boolean): number; readDoubleLE(offset: number, noAssert?: boolean): number; readFloatBE(offset: number, noAssert?: boolean): number; diff --git a/types/bn.js/index.d.ts b/types/bn.js/index.d.ts index 8c0bc8dd5f..db4c9f8b9e 100644 --- a/types/bn.js/index.d.ts +++ b/types/bn.js/index.d.ts @@ -45,7 +45,7 @@ interface ReductionContext { declare class BN { constructor( number: number | string | number[] | Buffer | BN, - base?: number, + base?: number | 'hex', endian?: Endianness ); constructor( diff --git a/types/bookshelf/tslint.json b/types/bookshelf/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/bookshelf/tslint.json +++ b/types/bookshelf/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/boom/boom-tests.ts b/types/boom/boom-tests.ts index 5ffd808de4..2cae1aec29 100644 --- a/types/boom/boom-tests.ts +++ b/types/boom/boom-tests.ts @@ -144,12 +144,12 @@ const boomifiedError = Boom.boomify(new Error('test'), { statusCode: 400, messag // isBoom -const isBoomError = new Boom('test') +const isBoomError = new Boom('test'); Boom.isBoom(isBoomError); -const maybeBoom = new Boom('test'); -if(Boom.isBoom(maybeBoom)) { +const maybeBoom = new Boom('test'); +if (Boom.isBoom(maybeBoom)) { // isBoom is a type guard that allows accessing these properties: maybeBoom.output.headers; } @@ -183,7 +183,8 @@ interface CustomPayload extends Boom.Payload { /** * Test assignment of custom error data: */ -const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: 'Custom1', isCustom: true } as CustomData1); +// tslint:disable-next-line:no-object-literal-type-assertion +const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: 'Custom1', isCustom: true }); const errorWithNoExplicitDataType: Boom = errorWithData; // can assign to error without explicit data type const errorWithExplicitType: Boom = errorWithData; // can assign to union data type const errorWithConcreteCustomData: Boom = errorWithData; // can assign to concrete data type diff --git a/types/boom/index.d.ts b/types/boom/index.d.ts index b38dafe038..71a738a009 100644 --- a/types/boom/index.d.ts +++ b/types/boom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for boom 7.2.0 +// Type definitions for boom 7.2 // Project: https://github.com/hapijs/boom // Definitions by: Igor Rogatty // AJP @@ -10,28 +10,31 @@ export = Boom; /** - * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: - * @see {@link https://github.com/hapijs/boom#boom} - */ + * boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: + * @see {@link https://github.com/hapijs/boom#boom} + */ declare class Boom extends Error { - - /** Creates a new Boom object using the provided message and then calling boomify() to decorate the error with the Boom properties. */ - constructor(message?: string | Error, options?: Boom.Options); - /** isBoom - if true, indicates this is a Boom object instance. */ - isBoom: boolean; - /** isServer - convenience bool indicating status code >= 500. */ - isServer: boolean; - /** message - the error message. */ - message: string; - /** output - the formatted response. Can be directly manipulated after object construction to return a custom error response. Allowed root keys: */ - output: Boom.Output; - /** reformat() - rebuilds error.output using the other object properties. */ - reformat: () => string; - /** "If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object." mentioned in @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */ - isMissing?: boolean; - /** https://github.com/hapijs/boom#createstatuscode-message-data and https://github.com/hapijs/boom/blob/v4.3.0/lib/index.js#L99 */ - data: Data; - } + /** Creates a new Boom object using the provided message and then calling boomify() to decorate the error with the Boom properties. */ + constructor(message?: string | Error, options?: Boom.Options); + /** isBoom - if true, indicates this is a Boom object instance. */ + isBoom: boolean; + /** isServer - convenience bool indicating status code >= 500. */ + isServer: boolean; + /** message - the error message. */ + message: string; + /** output - the formatted response. Can be directly manipulated after object construction to return a custom error response. Allowed root keys: */ + output: Boom.Output; + /** reformat() - rebuilds error.output using the other object properties. */ + reformat(): string; + /** + * "If message is unset, the 'error' segment of the header will not be present and + * isMissing will be true on the error object." mentioned in + * @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} + */ + isMissing?: boolean; + /** https://github.com/hapijs/boom#createstatuscode-message-data and https://github.com/hapijs/boom/blob/v4.3.0/lib/index.js#L99 */ + data: Data; +} declare namespace Boom { interface Options { /** statusCode - the HTTP status code. Defaults to 500 if no status code is already set. */ @@ -44,20 +47,32 @@ declare namespace Boom { ctor?: any; /** message - error message string. If the error already has a message, the provided message is added as a prefix. Defaults to no message. */ message?: string; - /** override - if false, the err provided is a Boom object, and a statusCode or message are provided, the values are ignored. Defaults to true (apply the provided statusCode and message options to the error regardless of its type, Error or Boom object). */ + /** + * override - if false, the err provided is a Boom object, and a statusCode or message are + * provided, the values are ignored. Defaults to true (apply the provided statusCode and + * message options to the error regardless of its type, Error or Boom object). + */ override?: boolean; } interface Output { /** statusCode - the HTTP status code (typically 4xx or 5xx). */ statusCode: number; - /** headers - an object containing any HTTP headers where each key is a header name and value is the header content. (Limited value type to string https://github.com/hapijs/boom/issues/151 ) */ + /** + * headers - an object containing any HTTP headers where each key is a header name and + * value is the header content. (Limited value type to string + * https://github.com/hapijs/boom/issues/151 ) + */ headers: {[index: string]: string}; - /** payload - the formatted object used as the response payload (stringified). Can be directly manipulated but any changes will be lost if reformat() is called. Any content allowed and by default includes the following content: */ + /** + * payload - the formatted object used as the response payload (stringified). + * Can be directly manipulated but any changes will be lost if reformat() is called. + * Any content allowed and by default includes the following content: + */ payload: Payload; } - interface Payload { + interface Payload { /** statusCode - the HTTP status code, derived from error.output.statusCode. */ statusCode: number; /** error - the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */ @@ -79,13 +94,13 @@ declare namespace Boom { * @param options optional additional options * @see {@link https://github.com/hapijs/boom#boomifyerror-options} */ - function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): Boom; + function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): Boom; /** * Identifies whether an error is a Boom object. Same as calling instanceof Boom. * @param error the error object to identify. */ - function isBoom(error: Error): error is Boom + function isBoom(error: Error): error is Boom; // 4xx /** @@ -94,7 +109,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadrequestmessage-data} */ - function badRequest(message?: string, data?: Data): Boom; + function badRequest(message?: string, data?: Data): Boom; /** * Returns a 401 Unauthorized error @@ -102,13 +117,21 @@ declare namespace Boom { * @param scheme can be one of the following: * * an authentication scheme name * * an array of string values. These values will be separated by ', ' and set to the 'WWW-Authenticate' header. - * @param attributes an object of values to use while setting the 'WWW-Authenticate' header. This value is only used when scheme is a string, otherwise it is ignored. Every key/value pair will be included in the 'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the attributes key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null. null and undefined will be replaced with an empty string. If attributes is set, message will be used as the 'error' segment of the 'WWW-Authenticate' header. If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object. + * @param attributes an object of values to use while setting the 'WWW-Authenticate' header. + * This value is only used when scheme is a string, otherwise it is ignored. + * Every key/value pair will be included in the 'WWW-Authenticate' in the format of + * 'key="value"' as well as in the response payload under the attributes key. + * Alternatively value can be a string which is use to set the value of the scheme, + * for example setting the token value for negotiate header. + * If string is used message parameter must be null. + * null and undefined will be replaced with an empty string. If attributes is set, + * message will be used as the 'error' segment of the 'WWW-Authenticate' header. + * If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object. * @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */ - function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): Boom; - function unauthorized(message?: string, scheme?: string[]): Boom; - function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): Boom; - function unauthorized(message?: null, scheme?: string[]): Boom; + function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): Boom; + function unauthorized(message?: string, scheme?: string[]): Boom; + function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): Boom; /** * Returns a 402 Payment Required error @@ -116,7 +139,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompaymentrequiredmessage-data} */ - function paymentRequired(message?: string, data?: Data): Boom; + function paymentRequired(message?: string, data?: Data): Boom; /** * Returns a 403 Forbidden error @@ -124,7 +147,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomforbiddenmessage-data} */ - function forbidden(message?: string, data?: Data): Boom; + function forbidden(message?: string, data?: Data): Boom; /** * Returns a 404 Not Found error @@ -132,7 +155,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotfoundmessage-data} */ - function notFound(message?: string, data?: Data): Boom; + function notFound(message?: string, data?: Data): Boom; /** * Returns a 405 Method Not Allowed error @@ -141,7 +164,7 @@ declare namespace Boom { * @param allow optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header. * @see {@link https://github.com/hapijs/boom#boommethodnotallowedmessage-data-allow} */ - function methodNotAllowed(message?: string, data?: Data, allow?: string | string[]): Boom; + function methodNotAllowed(message?: string, data?: Data, allow?: string | string[]): Boom; /** * Returns a 406 Not Acceptable error @@ -149,7 +172,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotacceptablemessage-data} */ - function notAcceptable(message?: string, data?: Data): Boom; + function notAcceptable(message?: string, data?: Data): Boom; /** * Returns a 407 Proxy Authentication Required error @@ -157,7 +180,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomproxyauthrequiredmessage-data} */ - function proxyAuthRequired(message?: string, data?: Data): Boom; + function proxyAuthRequired(message?: string, data?: Data): Boom; /** * Returns a 408 Request Time-out error @@ -165,7 +188,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomclienttimeoutmessage-data} */ - function clientTimeout(message?: string, data?: Data): Boom; + function clientTimeout(message?: string, data?: Data): Boom; /** * Returns a 409 Conflict error @@ -173,7 +196,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomconflictmessage-data} */ - function conflict(message?: string, data?: Data): Boom; + function conflict(message?: string, data?: Data): Boom; /** * Returns a 410 Gone error @@ -181,7 +204,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomresourcegonemessage-data} */ - function resourceGone(message?: string, data?: Data): Boom; + function resourceGone(message?: string, data?: Data): Boom; /** * Returns a 411 Length Required error @@ -189,7 +212,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomlengthrequiredmessage-data} */ - function lengthRequired(message?: string, data?: Data): Boom; + function lengthRequired(message?: string, data?: Data): Boom; /** * Returns a 412 Precondition Failed error @@ -197,7 +220,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompreconditionfailedmessage-data} */ - function preconditionFailed(message?: string, data?: Data): Boom; + function preconditionFailed(message?: string, data?: Data): Boom; /** * Returns a 413 Request Entity Too Large error @@ -205,7 +228,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomentitytoolargemessage-data} */ - function entityTooLarge(message?: string, data?: Data): Boom; + function entityTooLarge(message?: string, data?: Data): Boom; /** * Returns a 414 Request-URI Too Large error @@ -213,7 +236,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomuritoolongmessage-data} */ - function uriTooLong(message?: string, data?: Data): Boom; + function uriTooLong(message?: string, data?: Data): Boom; /** * Returns a 415 Unsupported Media Type error @@ -221,7 +244,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomunsupportedmediatypemessage-data} */ - function unsupportedMediaType(message?: string, data?: Data): Boom; + function unsupportedMediaType(message?: string, data?: Data): Boom; /** * Returns a 416 Requested Range Not Satisfiable error @@ -229,7 +252,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomrangenotsatisfiablemessage-data} */ - function rangeNotSatisfiable(message?: string, data?: Data): Boom; + function rangeNotSatisfiable(message?: string, data?: Data): Boom; /** * Returns a 417 Expectation Failed error @@ -237,7 +260,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomexpectationfailedmessage-data} */ - function expectationFailed(message?: string, data?: Data): Boom; + function expectationFailed(message?: string, data?: Data): Boom; /** * Returns a 418 I'm a Teapot error @@ -245,7 +268,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomteapotmessage-data} */ - function teapot(message?: string, data?: Data): Boom; + function teapot(message?: string, data?: Data): Boom; /** * Returns a 422 Unprocessable Entity error @@ -253,7 +276,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombaddatamessage-data} */ - function badData(message?: string, data?: Data): Boom; + function badData(message?: string, data?: Data): Boom; /** * Returns a 423 Locked error @@ -261,7 +284,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomlockedmessage-data} */ - function locked(message?: string, data?: Data): Boom; + function locked(message?: string, data?: Data): Boom; /** * Returns a 424 Failed Dependency error @@ -269,7 +292,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomfaileddependencymessage-data} */ - function failedDependency(message?: string, data?: Data): Boom; + function failedDependency(message?: string, data?: Data): Boom; /** * Returns a 428 Precondition Required error @@ -277,7 +300,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boompreconditionrequiredmessage-data} */ - function preconditionRequired(message?: string, data?: Data): Boom; + function preconditionRequired(message?: string, data?: Data): Boom; /** * Returns a 429 Too Many Requests error @@ -285,7 +308,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomtoomanyrequestsmessage-data} */ - function tooManyRequests(message?: string, data?: Data): Boom; + function tooManyRequests(message?: string, data?: Data): Boom; /** * Returns a 451 Unavailable For Legal Reasons error @@ -293,7 +316,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomillegalmessage-data} */ - function illegal(message?: string, data?: Data): Boom; + function illegal(message?: string, data?: Data): Boom; // 5xx /** @@ -303,7 +326,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} */ - function badImplementation(message?: string, data?: Data): Boom; + function badImplementation(message?: string, data?: Data): Boom; /** * Returns a 500 Internal Server Error error @@ -312,7 +335,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal} */ - function internal(message?: string, data?: Data): Boom; + function internal(message?: string, data?: Data): Boom; /** * Returns a 501 Not Implemented error with your error message to the user @@ -320,7 +343,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomnotimplementedmessage-data} */ - function notImplemented(message?: string, data?: Data): Boom; + function notImplemented(message?: string, data?: Data): Boom; /** * Returns a 502 Bad Gateway error with your error message to the user @@ -328,7 +351,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boombadgatewaymessage-data} */ - function badGateway(message?: string, data?: Data): Boom; + function badGateway(message?: string, data?: Data): Boom; /** * Returns a 503 Service Unavailable error with your error message to the user @@ -336,7 +359,7 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomserverunavailablemessage-data} */ - function serverUnavailable(message?: string, data?: Data): Boom; + function serverUnavailable(message?: string, data?: Data): Boom; /** * Returns a 504 Gateway Time-out error with your error message to the user @@ -344,5 +367,5 @@ declare namespace Boom { * @param data optional additional error data. * @see {@link https://github.com/hapijs/boom#boomgatewaytimeoutmessage-data} */ - function gatewayTimeout(message?: string, data?: Data): Boom; + function gatewayTimeout(message?: string, data?: Data): Boom; } diff --git a/types/boom/tslint.json b/types/boom/tslint.json index a41bf5d19a..1c36270d47 100644 --- a/types/boom/tslint.json +++ b/types/boom/tslint.json @@ -1,79 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "no-angle-bracket-type-assertion": false } } diff --git a/types/boom/v4/boom-tests.ts b/types/boom/v4/boom-tests.ts index 33e86699e8..ee2a8eefb8 100644 --- a/types/boom/v4/boom-tests.ts +++ b/types/boom/v4/boom-tests.ts @@ -1,5 +1,4 @@ import Boom = require('boom'); -import * as Hapi from 'hapi'; // 4xx and data type diff --git a/types/boom/v4/tsconfig.json b/types/boom/v4/tsconfig.json index f8f2968c34..58f1109eee 100644 --- a/types/boom/v4/tsconfig.json +++ b/types/boom/v4/tsconfig.json @@ -25,4 +25,4 @@ "index.d.ts", "boom-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/bootpag/index.d.ts b/types/bootpag/index.d.ts index af47cc3219..bf7c134e35 100644 --- a/types/bootpag/index.d.ts +++ b/types/bootpag/index.d.ts @@ -32,12 +32,12 @@ declare namespace JqueryBootpag { leaps?: boolean; /** - * next button text (default "�") + * next button text (default ???) */ next?: string; /** - * prev button text (default "�") + * prev button text (default ???) */ prev?: string; diff --git a/types/bootstrap-maxlength/index.d.ts b/types/bootstrap-maxlength/index.d.ts index e1fd71deb8..0a92539850 100644 --- a/types/bootstrap-maxlength/index.d.ts +++ b/types/bootstrap-maxlength/index.d.ts @@ -113,7 +113,7 @@ declare namespace BootstrapMaxlength { */ message?: string | ((currentText : string, maxLength: Number) => string), /** - * If true the input will count using utf8 bytesize/encoding. For example: the '�' character is counted as two characters. + * If true the input will count using utf8 bytesize/encoding. For example: the '¢' character is counted as two characters. * @default false */ utf8?: boolean, diff --git a/types/bootstrap-toggle/bootstrap-toggle-tests.ts b/types/bootstrap-toggle/bootstrap-toggle-tests.ts new file mode 100644 index 0000000000..764415a048 --- /dev/null +++ b/types/bootstrap-toggle/bootstrap-toggle-tests.ts @@ -0,0 +1,38 @@ +import 'bootstrap-toggle'; + +const $elem = $("#toggle"); + +// Test Initialise Cases +$elem.bootstrapToggle(); + +$elem.bootstrapToggle({}); + +$elem.bootstrapToggle({ + // Defaults from source project + on: 'On', + off: 'Off', + onstyle: 'primary', + offstyle: 'default', + size: 'normal', + style: '', + width: null, + height: null +}); + +$elem.bootstrapToggle({ + width: 100, + height: 100 +}); + +$elem.bootstrapToggle({ + width: "100%", + height: "100%" +}); + +// Methods +$elem.bootstrapToggle("destroy"); +$elem.bootstrapToggle("on"); +$elem.bootstrapToggle("off"); +$elem.bootstrapToggle("toggle"); +$elem.bootstrapToggle("enable"); +$elem.bootstrapToggle("disable"); diff --git a/types/bootstrap-toggle/index.d.ts b/types/bootstrap-toggle/index.d.ts new file mode 100644 index 0000000000..51dcec9446 --- /dev/null +++ b/types/bootstrap-toggle/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for bootstrap-toggle 2.2 +// Project: https://github.com/minhur/bootstrap-toggle +// Definitions by: Mitchell Grice +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +interface BootstrapToggleOptions { + on?: string; + off?: string; + size?: string; + onstyle?: string; + offstyle?: string; + style?: string; + width?: number | string | null; + height?: number | string | null; +} + +interface JQuery { + bootstrapToggle(options?: BootstrapToggleOptions): JQuery; + bootstrapToggle(command: "destroy" | "on" | "off" | "toggle" | "enable" | "disable"): JQuery; +} diff --git a/types/bootstrap-toggle/tsconfig.json b/types/bootstrap-toggle/tsconfig.json new file mode 100644 index 0000000000..b3d28afbde --- /dev/null +++ b/types/bootstrap-toggle/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bootstrap-toggle-tests.ts" + ] +} diff --git a/types/react-i18next/tslint.json b/types/bootstrap-toggle/tslint.json similarity index 100% rename from types/react-i18next/tslint.json rename to types/bootstrap-toggle/tslint.json diff --git a/types/bootstrap/v3/bootstrap-tests.ts b/types/bootstrap/v3/bootstrap-tests.ts index cd786b41a7..00a8fa44fd 100644 --- a/types/bootstrap/v3/bootstrap-tests.ts +++ b/types/bootstrap/v3/bootstrap-tests.ts @@ -1,48 +1,267 @@ -$('body').off('.data-api'); -$('body').off('.alert.data-api'); +// -------------------------------------------------------------------------------------- +// Modal +// -------------------------------------------------------------------------------------- -$(".btn.danger").button("toggle").addClass("fat"); -$("#myModal").modal(); -$("#myModal").modal({ keyboard: false }); -$("#myModal").modal('show'); +$(".modal").modal(); -$('#myModal').on('show', (e) => e.preventDefault()); +$(".modal").modal("show"); -$('#myModal').modal({ keyboard: false }); -$('#myModal').modal('toggle'); +$(".modal").modal("toggle"); -$('.dropdown-toggle').dropdown(); +$(".modal").modal("handleUpdate"); -$('#navbar').scrollspy(); -$('body').scrollspy({ target: '#navbar-example' }); +$(".modal").modal({ + backdrop: "static", + keyboard: false, + show: true, + remote: "remote.html", +}); -$('#element').tooltip('show'); +$(".modal").modal({ + backdrop: false, +}); -$('#element').popover('show'); +// -------------------------------------------------------------------------------------- +// Dropdown +// -------------------------------------------------------------------------------------- + +$(".dropdown").dropdown(); + +$(".dropdown").dropdown("toggle"); + +// -------------------------------------------------------------------------------------- +// Scrollspy +// -------------------------------------------------------------------------------------- + +$(".navbar").scrollspy(); + +$(".navbar").scrollspy("refresh"); + +$(".navbar").scrollspy({ + target: "#navbar-example", + offset: 10, +}); + +// -------------------------------------------------------------------------------------- +// Tooltip +// -------------------------------------------------------------------------------------- + +$("#element").tooltip(); + +$("#element").tooltip("show"); + +$("#element").tooltip({ + animation: true, + container: false, + delay: 0, + html: false, + placement: "top", + selector: ".selector", + template: '', + title: "", + trigger: "hover focus", + viewport: { selector: "body", padding: 0 }, +}); + +$("#element").tooltip({ + container: "body", +}); + +$("#element").tooltip({ + delay: { show: 500, hide: 100 }, +}); + +$("#element").tooltip({ + placement() { return "top"; }, +}); + +$("#element").tooltip({ + placement(tooltip: HTMLElement, trigger: Element) { + console.log(this.options.delay); + return "top"; + }, +}); + +$("#element").tooltip({ + placement(tooltip: HTMLElement, trigger: Element) { + // $ExpectError + console.log(this.options.content); // only for PopoverOption, not TooltipOption + return "top"; + }, +}); + +$("#element").tooltip({ + title() { return this.id; }, +}); + +$("#element").tooltip({ + viewport: "body", +}); + +// -------------------------------------------------------------------------------------- +// Popover +// -------------------------------------------------------------------------------------- + +$("#element").popover(); + +$("#element").popover("show"); + +$("#element").popover({ + animation: true, + container: false, + content: "content", + delay: 0, + html: false, + placement: "top", + selector: ".selector", + template: '', + title: "", + trigger: "hover focus", + viewport: { selector: "body", padding: 0 }, +}); + +$("#element").popover({ + container: "body", +}); + +$("#element").popover({ + content() { return `Elem id: ${this.id}`; }, +}); + +$("#element").popover({ + delay: { show: 500, hide: 100 }, +}); + +$("#element").popover({ + placement() { return "top"; }, +}); + +$("#element").popover({ + placement(tooltip: HTMLElement, trigger: Element) { + console.log(this.options.content); + return "top"; + }, +}); + +$("#element").popover({ + title() { return `Elem id: ${this.id}`; }, +}); + +$("#element").popover({ + viewport: "body", +}); + +// -------------------------------------------------------------------------------------- +// Alert +// -------------------------------------------------------------------------------------- $(".alert").alert(); -$(".alert").alert('close'); -$('.nav-tabs').button(); -$().button('toggle'); +$(".alert").alert("close"); + +// -------------------------------------------------------------------------------------- +// Button +// -------------------------------------------------------------------------------------- + +$(".btn").button(); + +$(".btn").button("toggle"); + +$(".btn").button("reset"); + +$(".btn").button("Swaps text to any data defined text state."); + +// -------------------------------------------------------------------------------------- +// Collapse +// -------------------------------------------------------------------------------------- $(".collapse").collapse(); -$('#myCollapsible').collapse({ toggle: false }); +$(".collapse").collapse("toggle"); -$('.carousel').carousel(); -$('.carousel').carousel({ interval: 2000 }); - -$('.typeahead').typeahead({ - matcher: item => true, - sorter: (items: any[]) => items, - updater: item => item, - highlighter: item => "" +$(".collapse").collapse({ + parent: "#selector", + toggle: false, }); -$('#navbar').affix(); +// -------------------------------------------------------------------------------------- +// Carousel +// -------------------------------------------------------------------------------------- -$('.item').emulateTransitionEnd(2000); +$(".carousel").carousel(); + +$(".carousel").carousel("cycle"); + +$(".carousel").carousel(200); + +$(".carousel").carousel({ + interval: 2000, + pause: "hover", + wrap: true, + keyboard: false, +}); + +$(".carousel").carousel({ + interval: false, +}); + +$(".carousel").carousel({ + pause: null, +}); + +// -------------------------------------------------------------------------------------- +// Affix +// -------------------------------------------------------------------------------------- + +$(".affix").affix(); + +$(".affix").affix("checkPosition"); + +$(".affix").affix({ + offset: 10, + target: window, +}); + +$(".affix").affix({ + offset: { top: 10, bottom: 5 }, +}); + +$(".affix").affix({ + offset: { top: 10 }, +}); + +$(".affix").affix({ + offset: { bottom: () => 10 }, +}); + +$(".affix").affix({ + offset: { + top: 100, + bottom() { + const that = this as BootstrapOffset; + return (that.bottom = $(".footer").outerHeight(true)!); + }, + } +}); + +$(".affix").affix({ + target: ".selector", +}); + +$(".affix").affix({ + target: document.getElementById("id")!, +}); + +$(".affix").affix({ + target: $("#id"), +}); + +// -------------------------------------------------------------------------------------- +// Transition +// -------------------------------------------------------------------------------------- + +$(".item").emulateTransitionEnd(2000); $.support.transition = false; -console.log(($.support.transition as any as TransitionEventNames).end === "transitionend"); + +console.log(($.support.transition as TransitionEventNames).end === "transitionend"); diff --git a/types/bootstrap/v3/index.d.ts b/types/bootstrap/v3/index.d.ts index 06142cc1d1..a6ddbeb1f8 100644 --- a/types/bootstrap/v3/index.d.ts +++ b/types/bootstrap/v3/index.d.ts @@ -1,21 +1,49 @@ -// Type definitions for Bootstrap 3.3.5 +// Type definitions for Bootstrap 3.3 // Project: http://twitter.github.com/bootstrap/ // Definitions by: Boris Yankov +// denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 - /// -interface ModalOptions { - backdrop?: boolean|string; - keyboard?: boolean; - show?: boolean; - remote?: string; +// -------------------------------------------------------------------------- +// Some Types and Interfaces +// -------------------------------------------------------------------------- + +type BootstrapPlacement = "auto" | "top" | "bottom" | "left" | "right"; + +type BootstrapTrigger = "click" | "hover" | "focus" | "manual" | + "click hover" | "click focus" | "hover focus" | + "click hover focus"; + +type BootstrapDynamicOffset = (elem: JQuery) => number; + +interface BootstrapDelay { + show?: number; + hide?: number; } -interface ModalOptionsBackdropString { - backdrop?: string; // for "static" +interface BootstrapOffset { + top?: number | BootstrapDynamicOffset; + bottom?: number | BootstrapDynamicOffset; +} + +interface BootstrapViewport { + padding?: number; + selector: string; +} + +interface TooltipInstance { + options: T; +} + +// -------------------------------------------------------------------------------------- +// Options Interfaces +// -------------------------------------------------------------------------------------- + +interface ModalOptions { + backdrop?: boolean | "static"; keyboard?: boolean; show?: boolean; remote?: string; @@ -28,103 +56,83 @@ interface ScrollSpyOptions { interface TooltipOptions { animation?: boolean; + container?: string | false; + delay?: number | BootstrapDelay; html?: boolean; - placement?: string | Function; + placement?: BootstrapPlacement | ((this: TooltipInstance, tooltip: HTMLElement, trigger: Element) => BootstrapPlacement); selector?: string; - title?: string | Function; - trigger?: string; template?: string; - delay?: number | Object; - container?: string | boolean; - viewport?: string | Function | Object; + title?: string | ((this: Element) => string); + trigger?: BootstrapTrigger; + viewport?: string | BootstrapViewport; } -interface PopoverOptions { - animation?: boolean; - html?: boolean; - placement?: string | Function; - selector?: string; - trigger?: string; - title?: string | Function; - template?: string; - content?: any; - delay?: number | Object; - container?: string | boolean; - viewport?: string | Function | Object; +interface PopoverOptions extends TooltipOptions { + content?: string | ((this: Element) => string); } interface CollapseOptions { - parent?: any; + parent?: string | false; toggle?: boolean; } interface CarouselOptions { - interval?: number; - pause?: string; + interval?: number | false; + pause?: "hover" | null; wrap?: boolean; keyboard?: boolean; } -interface TypeaheadOptions { - source?: any; - items?: number; - minLength?: number; - matcher?: (item: any) => boolean; - sorter?: (items: any[]) => any[]; - updater?: (item: any) => any; - highlighter?: (item: any) => string; +interface AffixOptions { + offset?: number | BootstrapOffset; + target?: string | Node | JQuery | Window; } -interface AffixOptions { - offset?: number | Function | Object; - target?: any; +// -------------------------------------------------------------------------------------- +// jQuery +// -------------------------------------------------------------------------------------- + +interface JQuery { + modal(action?: "toggle" | "show" | "hide" | "handleUpdate"): JQuery; + modal(options: ModalOptions): JQuery; + + dropdown(action?: "toggle"): JQuery; + + scrollspy(action?: "refresh"): JQuery; + scrollspy(options: ScrollSpyOptions): JQuery; + + tab(action?: "show"): JQuery; + + tooltip(action?: "show" | "hide" | "toggle" | "destroy"): JQuery; + tooltip(options: TooltipOptions): JQuery; + + popover(action?: "show" | "hide" | "toggle" | "destroy"): JQuery; + popover(options: PopoverOptions): JQuery; + + alert(action?: "close"): JQuery; + + button(action?: "toggle" | "reset" | string): JQuery; + + collapse(action?: "toggle" | "show" | "hide"): JQuery; + collapse(options: CollapseOptions): JQuery; + + carousel(action?: "cycle" | "pause" | number | "prev" | "next"): JQuery; + carousel(options: CarouselOptions): JQuery; + + affix(action?: "checkPosition"): JQuery; + affix(options: AffixOptions): JQuery; + + emulateTransitionEnd(duration: number): JQuery; } +// -------------------------------------------------------------------------------------- +// Other +// -------------------------------------------------------------------------------------- + interface TransitionEventNames { end: string; } -interface JQuery { - modal(options?: ModalOptions): JQuery; - modal(options?: ModalOptionsBackdropString): JQuery; - modal(command: string, relatedTarget?: Element): JQuery; - - dropdown(): JQuery; - dropdown(command: string): JQuery; - - scrollspy(command: string): JQuery; - scrollspy(options?: ScrollSpyOptions): JQuery; - - tab(): JQuery; - tab(command: string): JQuery; - - tooltip(options?: TooltipOptions): JQuery; - tooltip(command: string): JQuery; - - popover(options?: PopoverOptions): JQuery; - popover(command: string): JQuery; - - alert(): JQuery; - alert(command: string): JQuery; - - button(): JQuery; - button(command: string): JQuery; - - collapse(options?: CollapseOptions): JQuery; - collapse(command: string): JQuery; - - carousel(options?: CarouselOptions): JQuery; - carousel(command: string): JQuery; - carousel(index: number): JQuery; - - typeahead(options?: TypeaheadOptions): JQuery; - - affix(options?: AffixOptions): JQuery; - affix(command: string): JQuery; - - emulateTransitionEnd(duration: number): JQuery; -} - interface JQuerySupport { transition: boolean | TransitionEventNames; } diff --git a/types/bootstrap/v3/tsconfig.json b/types/bootstrap/v3/tsconfig.json index 585af4f8b2..38477cd68e 100644 --- a/types/bootstrap/v3/tsconfig.json +++ b/types/bootstrap/v3/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../../", "typeRoots": [ diff --git a/types/bootstrap/v3/tslint.json b/types/bootstrap/v3/tslint.json index a41bf5d19a..075fa88707 100644 --- a/types/bootstrap/v3/tslint.json +++ b/types/bootstrap/v3/tslint.json @@ -1,79 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "no-single-declare-module": false } } diff --git a/types/bootstrap3-dialog/tsconfig.json b/types/bootstrap3-dialog/tsconfig.json index cdf93479b7..774e895668 100644 --- a/types/bootstrap3-dialog/tsconfig.json +++ b/types/bootstrap3-dialog/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/broccoli-plugin/broccoli-plugin-tests.ts b/types/broccoli-plugin/broccoli-plugin-tests.ts new file mode 100644 index 0000000000..4434fce10c --- /dev/null +++ b/types/broccoli-plugin/broccoli-plugin-tests.ts @@ -0,0 +1,46 @@ +import Plugin = require('broccoli-plugin'); + +declare function copySync(src: string, dest: string): void; +declare function setTimeout(callback: () => void, duration: number): void; + +class SlowItDown extends Plugin { + constructor(private readonly waitInMS: number) { + super([], { + annotation: `${waitInMS} ms`, + needsCache: false + }); + } + + async build() { + await new Promise(resolve => setTimeout(resolve, this.waitInMS)); + } +} + +class FileCopier extends Plugin { + constructor(inputNodes: Plugin.BroccoliNode[]) { + super(inputNodes, { + name: 'CopyFiles', + persistentOutput: true + }); + } + + build() { + for (const input of this.inputPaths) { + copySync(input, this.outputPath); + } + } + + getCallbackObject() { + return this; + } +} + +new FileCopier([ + new SlowItDown(5000), + 'src', + 'assets' +]); + +new Plugin(); // $ExpectError +new Plugin([{}]); // $ExpectError +new Plugin([], { foo: 'bar' }); // $ExpectError diff --git a/types/broccoli-plugin/index.d.ts b/types/broccoli-plugin/index.d.ts new file mode 100644 index 0000000000..36b1da65e2 --- /dev/null +++ b/types/broccoli-plugin/index.d.ts @@ -0,0 +1,78 @@ +// Type definitions for broccoli-plugin 1.3 +// Project: https://github.com/broccolijs/broccoli-plugin +// Definitions by: Dan Freeman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export = BroccoliPlugin; + +declare namespace BroccoliPlugin { + type BroccoliNode = BroccoliPlugin | string; + + interface BroccoliPluginOptions { + /** + * The name of this plugin. Defaults to `this.constructor.name`. + */ + name?: string; + + /** + * A descriptive annotation. Useful for debugging, to tell multiple + * instances of the same plugin apart. + */ + annotation?: string; + + /** + * If `true`, the output directory is not automatically emptied between + * builds. Defaults to `false`. + */ + persistentOutput?: boolean; + + /** + * If `true`, a cache directory is created automatically and the path is + * set at `cachePath`. If `false`, a cache directory is not created and + * `this.cachePath` is `undefined`. Defaults to `true`. + */ + needsCache?: boolean; + } +} + +declare class BroccoliPlugin { + constructor(inputNodes: BroccoliPlugin.BroccoliNode[], options?: BroccoliPlugin.BroccoliPluginOptions); + + /** + * An array of paths on disk corresponding to each node in `inputNodes`. + * Your plugin will read files from these paths. + */ + readonly inputPaths: ReadonlyArray; + + /** + * The path on disk corresponding to this plugin instance (this node). + * Your plugin will write files to this path. This directory is emptied by + * Broccoli before each build, unless the `persistentOutput` options is + * `true`. + */ + readonly outputPath: string; + + /** + * The path on disk to an auxiliary cache directory. Use this to store + * files that you want preserved between builds. This directory will + * only be deleted when Broccoli exits. If a cache directory is not + * needed, set `needsCache` to false when calling `broccoli-plugin` + * constructor. + */ + readonly cachePath?: string; + + /** + * Override this method in your subclass. It will be called on each + * (re-)build. All paths stay the same between builds. + * To perform asynchronous work, return a promise. + */ + build(): void | Promise; + + /** + * Advanced usage only. + * Return the object on which Broccoli will call `obj.build()`. Called + * once after instantiation. By default, returns `this`. + */ + getCallbackObject(): { build(): void | Promise }; +} diff --git a/types/broccoli-plugin/tsconfig.json b/types/broccoli-plugin/tsconfig.json new file mode 100644 index 0000000000..0f36813dc1 --- /dev/null +++ b/types/broccoli-plugin/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "broccoli-plugin-tests.ts" + ] +} diff --git a/types/react-i18next/v4/tslint.json b/types/broccoli-plugin/tslint.json similarity index 100% rename from types/react-i18next/v4/tslint.json rename to types/broccoli-plugin/tslint.json diff --git a/types/browserslist/browserslist-tests.ts b/types/browserslist/browserslist-tests.ts new file mode 100644 index 0000000000..d5e88e5b5d --- /dev/null +++ b/types/browserslist/browserslist-tests.ts @@ -0,0 +1,22 @@ +import browserslist from "browserslist"; + +browserslist(); // $ExpectType string[] +browserslist(""); // $ExpectType string[] +browserslist([""]); // $ExpectType string[] + +const opts: browserslist.Options[] = [ + {}, + { path: "" }, + { env: "" }, + { stats: { "": { "": 0 } } }, + { config: "" }, + { ignoreUnknownVersions: false }, + { dangerousExtend: false } +]; +for (const opt of opts) { + browserslist("", opt); // $ExpectType string[] + browserslist([""], opt); // $ExpectType string[] +} + +browserslist.coverage([""]); // $ExpectType number +browserslist.coverage([""], { "": { "": 0 } }); // $ExpectType number diff --git a/types/browserslist/index.d.ts b/types/browserslist/index.d.ts new file mode 100644 index 0000000000..7c4a0add0c --- /dev/null +++ b/types/browserslist/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for browserslist 4.3 +// Project: https://github.com/browserslist/browserslist#readme +// Definitions by: Dave Cardwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +declare namespace browserslist { + interface Browserslist { + (queries?: string | ReadonlyArray, opts?: Options): string[]; + + coverage: (browsers: ReadonlyArray, stats?: Stats) => number; + + clearCaches: () => void; + } + + interface Stats { + [browser: string]: { + [version: string]: number; + }; + } + + interface Options { + path?: string; + env?: string; + stats?: Stats; + config?: string; + ignoreUnknownVersions?: boolean; + dangerousExtend?: boolean; + } +} + +declare var browserslist: browserslist.Browserslist; + +export = browserslist; diff --git a/types/browserslist/tsconfig.json b/types/browserslist/tsconfig.json new file mode 100644 index 0000000000..cf68d8bf64 --- /dev/null +++ b/types/browserslist/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": ["index.d.ts", "browserslist-tests.ts"] +} diff --git a/types/browserslist/tslint.json b/types/browserslist/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/browserslist/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index a8c7f403a7..dd484ce1d1 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -125,6 +125,7 @@ videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 }) pdfQueue .on('error', (err: Error) => undefined) .on('active', (job: Queue.Job, jobPromise: Queue.JobPromise) => jobPromise.cancel()) +.on('waiting', (jobId: Queue.JobId) => undefined) .on('active', (job: Queue.Job) => undefined) .on('stalled', (job: Queue.Job) => undefined) .on('progress', (job: Queue.Job) => undefined) @@ -132,4 +133,53 @@ pdfQueue .on('failed', (job: Queue.Job) => undefined) .on('paused', () => undefined) .on('resumed', () => undefined) -.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatus) => undefined); +.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatusClean) => undefined) +.on('drained', () => undefined) +.on('removed', (job: Queue.Job) => undefined); + +// test different process methods + +const profileQueue = new Queue('profile'); +// Max concurrency for requestProfile is 100 +profileQueue.process('requestProfile', 100, () => {}); +profileQueue.process(100, () => {}); + +// other tests +const myQueue = new Queue('myQueue', { + settings: { + drainDelay: 5 + }, + defaultJobOptions: { + stackTraceLimit: 1, + } +}); + +myQueue.on('active', (job: Queue.Job) => { + job.moveToCompleted(); + job.moveToCompleted('done'); + job.moveToCompleted('done', true); + job.moveToCompleted('done', true).then(val => { + if (val) { + const nextJobData: any = val[0]; + const nextJobId: Queue.JobId = val[1]; + } + }); + + job.moveToFailed({ message: "Call to external service failed!" }, true); + job.moveToFailed(new Error('test error'), true); + job.moveToFailed(new Error('test error'), true).then(val => { + if (val) { + const nextJobData: any = val[0]; + const nextJobId: Queue.JobId = val[1]; + } + }); + + job.discard(); +}); + +// test all constructor options: + +new Queue('profile'); +new Queue('profile', 'url'); +new Queue('profile', { prefix: 'test' }); +new Queue('profile', 'url', { prefix: 'test' }); diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index ac820290f2..6096d98145 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bull 3.3 +// Type definitions for bull 3.4 // Project: https://github.com/OptimalBits/bull // Definitions by: Bruno Grieder // Cameron Crothers @@ -10,6 +10,8 @@ // Bond Akinmade // Wuha Team // Alec Brunelle +// Dan Manastireanu +// Kjell-Morten Bratsberg Thorsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -23,9 +25,9 @@ import * as Promise from "bluebird"; */ declare const Bull: { (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - (queueName: string, url?: string): Bull.Queue; // tslint:disable-line unified-signatures + (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - new (queueName: string, url?: string): Bull.Queue; // tslint:disable-line unified-signatures + new (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures }; declare namespace Bull { @@ -92,6 +94,12 @@ declare namespace Bull { backoffStrategies?: { [key: string]: (attemptsMade: number, err: typeof Error) => number; }; + + /** + * A timeout for when the queue is in `drained` state (empty waiting for jobs). + * It is used when calling `queue.getNextJob()`, which will pass it to `.brpoplpush` on the Redis client. + */ + drainDelay?: number; } type DoneCallback = (error?: Error | null, value?: any) => void; @@ -141,6 +149,11 @@ declare namespace Bull { */ retry(): Promise; + /** + * Ensure this job is never ran again even if attemptsMade is less than job.attempts. + */ + discard(): Promise; + /** * Returns a promise that resolves to the returned data when the job has been finished. * TODO: Add a watchdog to check if the job has finished periodically. @@ -148,6 +161,18 @@ declare namespace Bull { */ finished(): Promise; + /** + * Moves a job to the `completed` queue. Pulls a job from 'waiting' to 'active' + * and returns a tuple containing the next jobs data and id. If no job is in the `waiting` queue, returns null. + */ + moveToCompleted(returnValue?: string, ignoreLock?: boolean): Promise<[any, JobId] | null>; + + /** + * Moves a job to the `failed` queue. Pulls a job from 'waiting' to 'active' + * and returns a tuple containing the next jobs data and id. If no job is in the `waiting` queue, returns null. + */ + moveToFailed(errorInfo: { message: string; }, ignoreLock?: boolean): Promise<[any, JobId] | null>; + /** * Promotes a job that is currently "delayed" to the "waiting" state and executed as soon as possible. */ @@ -170,6 +195,7 @@ declare namespace Bull { } type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed'; + type JobStatusClean = 'completed' | 'wait' | 'active' | 'delayed' | 'failed'; interface BackoffOptions { /** @@ -205,6 +231,11 @@ declare namespace Bull { * Cron pattern specifying when the job should execute */ cron: string; + + /** + * Start date when the repeat job should start repeating (only with cron). + */ + startDate?: Date | string | number; } interface EveryRepeatOptions extends RepeatOptions { @@ -273,6 +304,11 @@ declare namespace Bull { * Default behavior is to keep the job in the completed set. */ removeOnFail?: boolean; + + /** + * Limits the amount of stack trace lines that will be recorded in the stacktrace. + */ + stackTraceLimit?: number; } interface JobCounts { @@ -601,12 +637,12 @@ declare namespace Bull { /** * Tells the queue remove all jobs created outside of a grace period in milliseconds. - * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. + * You can clean the jobs with the following states: completed, wait (typo for waiting), active, delayed, and failed. * @param grace Grace period in milliseconds. * @param status Status of the job to clean. Values are completed, wait, active, delayed, and failed. Defaults to completed. * @param limit Maximum amount of jobs to clean per call. If not provided will clean all matching jobs. */ - clean(grace: number, status?: JobStatus, limit?: number): Promise>>; + clean(grace: number, status?: JobStatusClean, limit?: number): Promise>>; /** * Listens to queue events @@ -618,6 +654,11 @@ declare namespace Bull { */ on(event: 'error', callback: ErrorEventCallback): this; + /** + * A Job is waiting to be processed as soon as a worker is idling. + */ + on(event: 'waiting', callback: WaitingEventCallback): this; + /** * A job has started. You can use `jobPromise.cancel()` to abort it */ @@ -654,6 +695,11 @@ declare namespace Bull { */ on(event: 'resumed', callback: EventCallback): this; // tslint:disable-line unified-signatures + /** + * A job successfully removed. + */ + on(event: 'removed', callback: RemovedEventCallback): this; + /** * Old jobs have been cleaned from the queue. * `jobs` is an array of jobs that were removed, and `type` is the type of those jobs. @@ -661,6 +707,12 @@ declare namespace Bull { * @see Queue#clean() for details */ on(event: 'cleaned', callback: CleanedEventCallback): this; + + /** + * Emitted every time the queue has processed all the waiting jobs + * (even if there can be some delayed jobs not yet processed) + */ + on(event: 'drained', callback: EventCallback): this; // tslint:disable-line unified-signatures } type EventCallback = () => void; @@ -684,7 +736,11 @@ declare namespace Bull { type FailedEventCallback = (job: Job, error: Error) => void; - type CleanedEventCallback = (jobs: Array>, status: JobStatus) => void; + type CleanedEventCallback = (jobs: Array>, status: JobStatusClean) => void; + + type RemovedEventCallback = (job: Job) => void; + + type WaitingEventCallback = (jobId: JobId) => void; } export = Bull; diff --git a/types/bunyan-winston-adapter/index.d.ts b/types/bunyan-winston-adapter/index.d.ts index 718c9804e1..1ce6ae0a8b 100644 --- a/types/bunyan-winston-adapter/index.d.ts +++ b/types/bunyan-winston-adapter/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gluwer/bunyan-winston-adapter // Definitions by: Steve Hipwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 import * as bunyan from "bunyan"; import { Logger } from "winston"; diff --git a/types/bunyan/bunyan-tests.ts b/types/bunyan/bunyan-tests.ts index e1d1861049..1072ec2031 100644 --- a/types/bunyan/bunyan-tests.ts +++ b/types/bunyan/bunyan-tests.ts @@ -6,6 +6,14 @@ const ringBufferOptions: Logger.RingBufferOptions = { const ringBuffer: Logger.RingBuffer = new Logger.RingBuffer(ringBufferOptions); ringBuffer.write("hello"); +const rotatingFileStreamOptions: Logger.RotatingFileStreamOptions = { + period: "1d", + count: 10, + path: "path" +}; +const rotatingFileStream: Logger.RotatingFileStream = new Logger.RotatingFileStream(rotatingFileStreamOptions); +rotatingFileStream.write("hello"); + let level: number; level = Logger.resolveLevel("trace"); level = Logger.resolveLevel("debug"); @@ -49,6 +57,11 @@ const options: Logger.LoggerOptions = { stream: ringBuffer, level: Logger.ERROR, reemitErrorEvents: true + }, { + type: 'raw', + stream: rotatingFileStream, + level: Logger.ERROR, + reemitErrorEvents: true }] }; diff --git a/types/bunyan/index.d.ts b/types/bunyan/index.d.ts index 4ee972d29c..f6f0b287aa 100644 --- a/types/bunyan/index.d.ts +++ b/types/bunyan/index.d.ts @@ -270,6 +270,29 @@ declare namespace Logger { destroy(): void; destroySoon(): void; } + + interface RotatingFileStreamOptions { + path: string; + count?: number; + period?: string; + } + + class RotatingFileStream extends EventEmitter implements NodeJS.WritableStream { + constructor(options: RotatingFileStreamOptions); + + writable: boolean; + periodNum: number; + periodScope: string; + stream: any; + rotQueue: any[]; + rotating: boolean; + + write(record: any): boolean; + end(record?: any): void; + destroy(): void; + destroySoon(): void; + rotate(): void; + } } export = Logger; diff --git a/types/business-rules-engine/Validation.d.ts b/types/business-rules-engine/Validation.d.ts index 7f61f517be..bff7bf6243 100644 --- a/types/business-rules-engine/Validation.d.ts +++ b/types/business-rules-engine/Validation.d.ts @@ -1,239 +1 @@ -// Type definitions for business-rules-engine - v1.0.20 -// Project: https://github.com/rsamec/form -// Definitions by: Roman Samec -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace Validation { - interface IErrorCustomMessage { - (config: any, args: any): string; - } - interface IPropertyValidator { - isAcceptable(s: any): boolean; - customMessage?: IErrorCustomMessage; - tagName?: string; - } - interface IStringValidator extends IPropertyValidator { - isAcceptable(s: string): boolean; - } - interface IAsyncPropertyValidator { - isAcceptable(s: any): Q.Promise; - customMessage?: IErrorCustomMessage; - isAsync: boolean; - tagName?: string; - } - interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator { - isAcceptable(s: string): Q.Promise; - } - enum CompareOperator { - LessThan = 0, - LessThanEqual = 1, - Equal = 2, - NotEqual = 3, - GreaterThanEqual = 4, - GreaterThan = 5, - } - interface IError { - HasError: boolean; - ErrorMessage: string; - TranslateArgs?: IErrorTranslateArgs; - } - interface IErrorTranslateArgs { - TranslateId: string; - MessageArgs: any; - CustomMessage?: IErrorCustomMessage; - } - interface IOptional { - (): boolean; - } - interface IValidationFailure extends IError { - IsAsync: boolean; - Error: IError; - } - interface IValidationResult { - Name: string; - Add(validationResult: IValidationResult): void; - Remove(index: number): void; - Children: IValidationResult[]; - HasErrors: boolean; - HasErrorsDirty: boolean; - ErrorMessage: string; - ErrorCount: number; - Optional?: IOptional; - TranslateArgs?: IErrorTranslateArgs[]; - } - interface IValidate { - (args: IError): void; - } - interface IAsyncValidate { - (args: IError): Q.Promise; - } - interface IValidatorFce { - Name: string; - ValidationFce?: IValidate; - AsyncValidationFce?: IAsyncValidate; - } - interface IValidator { - Validate(context: any): IValidationFailure; - ValidateAsync(context: any): Q.Promise; - Error: IError; - } - interface IAbstractValidator { - RuleFor(prop: string, validator: IPropertyValidator): any; - ValidationFor(prop: string, validatorFce: IValidatorFce): any; - Validation(validatorFce: IValidatorFce): any; - ValidatorFor(prop: string, validator: IAbstractValidator): any; - CreateRule(name: string): IAbstractValidationRule; - CreateAbstractRule(name: string): IAbstractValidationRule; - CreateAbstractListRule(name: string): IAbstractValidationRule; - ForList: boolean; - } - interface IAbstractValidationRule { - Validate(context: T): IValidationResult; - ValidateAsync(context: T): Q.Promise; - ValidateAll(context: T): Q.Promise; - ValidateProperty(context: T, propName: string): void; - ValidationResult: IValidationResult; - Rules: { - [name: string]: IPropertyValidationRule; - }; - Validators: { - [name: string]: IValidator; - }; - Children: { - [name: string]: IAbstractValidationRule; - }; - } - interface IPropertyValidationRule { - Validators: { - [name: string]: any; - }; - Validate(context: IValidationContext): IValidationFailure[]; - ValidateAsync(context: IValidationContext): Q.Promise; - } - interface IValidationContext { - Value: string; - Key: string; - Data: T; - } - class Error implements IError { - public HasError: boolean; - public ErrorMessage: string; - constructor(); - } - class ValidationFailure implements IError { - public Error: IError; - public IsAsync: boolean; - constructor(Error: IError, IsAsync: boolean); - public HasError : boolean; - public ErrorMessage : string; - public TranslateArgs : IErrorTranslateArgs; - } - class ValidationResult implements IValidationResult { - public Name: string; - constructor(Name: string); - public IsDirty: boolean; - public Children : IValidationResult[]; - public Add(error: IValidationResult): void; - public Remove(index: number): void; - public Optional: IOptional; - public TranslateArgs: IErrorTranslateArgs[]; - public HasErrorsDirty : boolean; - public HasErrors : boolean; - public ErrorCount : number; - public ErrorMessage : string; - } - class CompositeValidationResult implements IValidationResult { - public Name: string; - public Children: IValidationResult[]; - constructor(Name: string); - public Optional: IOptional; - public AddFirst(error: IValidationResult): void; - public Add(error: IValidationResult): void; - public Remove(index: number): void; - public HasErrorsDirty : boolean; - public HasErrors : boolean; - public ErrorCount : number; - public ErrorMessage : string; - public TranslateArgs : IErrorTranslateArgs[]; - public LogErrors(headerMessage?: string): void; - public Errors : { - [name: string]: IValidationResult; - }; - private FlattenErros; - public SetDirty(): void; - public SetPristine(): void; - private SetDirtyEx(node, dirty); - private flattenErrors(node, errorCollection); - private traverse(node, indent); - } - class AbstractValidator implements IAbstractValidator { - public Validators: { - [name: string]: IPropertyValidator[]; - }; - public AbstractValidators: { - [name: string]: IAbstractValidator; - }; - public ValidationFunctions: { - [name: string]: IValidatorFce[]; - }; - public RuleFor(prop: string, validator: IPropertyValidator): void; - public ValidationFor(prop: string, fce: IValidatorFce): void; - public Validation(fce: IValidatorFce): void; - public ValidatorFor(prop: string, validator: IAbstractValidator, forList?: boolean): void; - public CreateAbstractRule(name: string): IAbstractValidationRule; - public CreateAbstractListRule(name: string): IAbstractValidationRule; - public CreateRule(name: string): IAbstractValidationRule; - public ForList: boolean; - } - class MessageLocalization { - static customMsg: string; - static defaultMessages: { - "required": string; - "remote": string; - "email": string; - "url": string; - "date": string; - "dateISO": string; - "number": string; - "digits": string; - "signedDigits": string; - "creditcard": string; - "equalTo": string; - "maxlength": string; - "minlength": string; - "rangelength": string; - "range": string; - "max": string; - "min": string; - "step": string; - "contains": string; - "mask": string; - "custom": string; - }; - static ValidationMessages: { - "required": string; - "remote": string; - "email": string; - "url": string; - "date": string; - "dateISO": string; - "number": string; - "digits": string; - "signedDigits": string; - "creditcard": string; - "equalTo": string; - "maxlength": string; - "minlength": string; - "rangelength": string; - "range": string; - "max": string; - "min": string; - "step": string; - "contains": string; - "mask": string; - "custom": string; - }; - static GetValidationMessage(validator: any): string; - } -} declare module "node-validation" {export = Validation;} diff --git a/types/business-rules-engine/index.d.ts b/types/business-rules-engine/index.d.ts index d85cd49c81..593eb92f51 100644 --- a/types/business-rules-engine/index.d.ts +++ b/types/business-rules-engine/index.d.ts @@ -4,242 +4,237 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -// Source: typings/business-rules-engine/Validation.d.ts - import * as Q from "q"; -declare namespace Validation { - interface IErrorCustomMessage { - (config: any, args: any): string; - } - interface IPropertyValidator { - isAcceptable(s: any): boolean; - customMessage?: IErrorCustomMessage; - tagName?: string; - } - interface IStringValidator extends IPropertyValidator { - isAcceptable(s: string): boolean; - } - interface IAsyncPropertyValidator { - isAcceptable(s: any): Q.Promise; - customMessage?: IErrorCustomMessage; - isAsync: boolean; - tagName?: string; - } - interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator { - isAcceptable(s: string): Q.Promise; - } - enum CompareOperator { - LessThan = 0, - LessThanEqual = 1, - Equal = 2, - NotEqual = 3, - GreaterThanEqual = 4, - GreaterThan = 5, - } - interface IError { - HasError: boolean; - ErrorMessage: string; - TranslateArgs?: IErrorTranslateArgs; - } - interface IErrorTranslateArgs { - TranslateId: string; - MessageArgs: any; - CustomMessage?: IErrorCustomMessage; - } - interface IOptional { - (): boolean; - } - interface IValidationFailure extends IError { - IsAsync: boolean; - Error: IError; - } - interface IValidationResult { - Name: string; - Add(validationResult: IValidationResult): void; - Remove(index: number): void; - Children: IValidationResult[]; - HasErrors: boolean; - HasErrorsDirty: boolean; - ErrorMessage: string; - ErrorCount: number; - Optional?: IOptional; - TranslateArgs?: IErrorTranslateArgs[]; - } - interface IValidate { - (args: IError): void; - } - interface IAsyncValidate { - (args: IError): Q.Promise; - } - interface IValidatorFce { - Name: string; - ValidationFce?: IValidate; - AsyncValidationFce?: IAsyncValidate; - } - interface IValidator { - Validate(context: any): IValidationFailure; - ValidateAsync(context: any): Q.Promise; - Error: IError; - } - interface IAbstractValidator { - RuleFor(prop: string, validator: IPropertyValidator): any; - ValidationFor(prop: string, validatorFce: IValidatorFce): any; - Validation(validatorFce: IValidatorFce): any; - ValidatorFor(prop: string, validator: IAbstractValidator): any; - CreateRule(name: string): IAbstractValidationRule; - CreateAbstractRule(name: string): IAbstractValidationRule; - CreateAbstractListRule(name: string): IAbstractValidationRule; - ForList: boolean; - } - interface IAbstractValidationRule { - Validate(context: T): IValidationResult; - ValidateAsync(context: T): Q.Promise; - ValidateAll(context: T): Q.Promise; - ValidateProperty(context: T, propName: string): void; - ValidationResult: IValidationResult; - Rules: { - [name: string]: IPropertyValidationRule; - }; - Validators: { - [name: string]: IValidator; - }; - Children: { - [name: string]: IAbstractValidationRule; - }; - } - interface IPropertyValidationRule { - Validators: { - [name: string]: any; - }; - Validate(context: IValidationContext): IValidationFailure[]; - ValidateAsync(context: IValidationContext): Q.Promise; - } - interface IValidationContext { - Value: string; - Key: string; - Data: T; - } - class Error implements IError { - public HasError: boolean; - public ErrorMessage: string; - constructor(); - } - class ValidationFailure implements IError { - public Error: IError; - public IsAsync: boolean; - constructor(Error: IError, IsAsync: boolean); - public HasError : boolean; - public ErrorMessage : string; - public TranslateArgs : IErrorTranslateArgs; - } - class ValidationResult implements IValidationResult { - public Name: string; - constructor(Name: string); - public IsDirty: boolean; - public Children : IValidationResult[]; - public Add(error: IValidationResult): void; - public Remove(index: number): void; - public Optional: IOptional; - public TranslateArgs: IErrorTranslateArgs[]; - public HasErrorsDirty : boolean; - public HasErrors : boolean; - public ErrorCount : number; - public ErrorMessage : string; - } - class CompositeValidationResult implements IValidationResult { - public Name: string; - public Children: IValidationResult[]; - constructor(Name: string); - public Optional: IOptional; - public AddFirst(error: IValidationResult): void; - public Add(error: IValidationResult): void; - public Remove(index: number): void; - public HasErrorsDirty : boolean; - public HasErrors : boolean; - public ErrorCount : number; - public ErrorMessage : string; - public TranslateArgs : IErrorTranslateArgs[]; - public LogErrors(headerMessage?: string): void; - public Errors : { - [name: string]: IValidationResult; - }; - private FlattenErros; - public SetDirty(): void; - public SetPristine(): void; - private SetDirtyEx(node, dirty); - private flattenErrors(node, errorCollection); - private traverse(node, indent); - } - class AbstractValidator implements IAbstractValidator { - public Validators: { - [name: string]: IPropertyValidator[]; - }; - public AbstractValidators: { - [name: string]: IAbstractValidator; - }; - public ValidationFunctions: { - [name: string]: IValidatorFce[]; - }; - public RuleFor(prop: string, validator: IPropertyValidator): void; - public ValidationFor(prop: string, fce: IValidatorFce): void; - public Validation(fce: IValidatorFce): void; - public ValidatorFor(prop: string, validator: IAbstractValidator, forList?: boolean): void; - public CreateAbstractRule(name: string): IAbstractValidationRule; - public CreateAbstractListRule(name: string): IAbstractValidationRule; - public CreateRule(name: string): IAbstractValidationRule; - public ForList: boolean; - } - class MessageLocalization { - static customMsg: string; - static defaultMessages: { - "required": string; - "remote": string; - "email": string; - "url": string; - "date": string; - "dateISO": string; - "number": string; - "digits": string; - "signedDigits": string; - "creditcard": string; - "equalTo": string; - "maxlength": string; - "minlength": string; - "rangelength": string; - "range": string; - "max": string; - "min": string; - "step": string; - "contains": string; - "mask": string; - "custom": string; - }; - static ValidationMessages: { - "required": string; - "remote": string; - "email": string; - "url": string; - "date": string; - "dateISO": string; - "number": string; - "digits": string; - "signedDigits": string; - "creditcard": string; - "equalTo": string; - "maxlength": string; - "minlength": string; - "rangelength": string; - "range": string; - "max": string; - "min": string; - "step": string; - "contains": string; - "mask": string; - "custom": string; - }; - static GetValidationMessage(validator: any): string; - } +export interface IErrorCustomMessage { + (config: any, args: any): string; +} +export interface IPropertyValidator { + isAcceptable(s: any): boolean; + customMessage?: IErrorCustomMessage; + tagName?: string; +} +export interface IStringValidator extends IPropertyValidator { + isAcceptable(s: string): boolean; +} +export interface IAsyncPropertyValidator { + isAcceptable(s: any): Q.Promise; + customMessage?: IErrorCustomMessage; + isAsync: boolean; + tagName?: string; +} +export interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator { + isAcceptable(s: string): Q.Promise; +} +export enum CompareOperator { + LessThan = 0, + LessThanEqual = 1, + Equal = 2, + NotEqual = 3, + GreaterThanEqual = 4, + GreaterThan = 5, +} +export interface IError { + HasError: boolean; + ErrorMessage: string; + TranslateArgs?: IErrorTranslateArgs; +} +export interface IErrorTranslateArgs { + TranslateId: string; + MessageArgs: any; + CustomMessage?: IErrorCustomMessage; +} +export interface IOptional { + (): boolean; +} +export interface IValidationFailure extends IError { + IsAsync: boolean; + Error: IError; +} +export interface IValidationResult { + Name: string; + Add(validationResult: IValidationResult): void; + Remove(index: number): void; + Children: IValidationResult[]; + HasErrors: boolean; + HasErrorsDirty: boolean; + ErrorMessage: string; + ErrorCount: number; + Optional?: IOptional; + TranslateArgs?: IErrorTranslateArgs[]; +} +export interface IValidate { + (args: IError): void; +} +export interface IAsyncValidate { + (args: IError): Q.Promise; +} +export interface IValidatorFce { + Name: string; + ValidationFce?: IValidate; + AsyncValidationFce?: IAsyncValidate; +} +export interface IValidator { + Validate(context: any): IValidationFailure; + ValidateAsync(context: any): Q.Promise; + Error: IError; +} +export interface IAbstractValidator { + RuleFor(prop: string, validator: IPropertyValidator): any; + ValidationFor(prop: string, validatorFce: IValidatorFce): any; + Validation(validatorFce: IValidatorFce): any; + ValidatorFor(prop: string, validator: IAbstractValidator): any; + CreateRule(name: string): IAbstractValidationRule; + CreateAbstractRule(name: string): IAbstractValidationRule; + CreateAbstractListRule(name: string): IAbstractValidationRule; + ForList: boolean; +} +export interface IAbstractValidationRule { + Validate(context: T): IValidationResult; + ValidateAsync(context: T): Q.Promise; + ValidateAll(context: T): Q.Promise; + ValidateProperty(context: T, propName: string): void; + ValidationResult: IValidationResult; + Rules: { + [name: string]: IPropertyValidationRule; + }; + Validators: { + [name: string]: IValidator; + }; + Children: { + [name: string]: IAbstractValidationRule; + }; +} +export interface IPropertyValidationRule { + Validators: { + [name: string]: any; + }; + Validate(context: IValidationContext): IValidationFailure[]; + ValidateAsync(context: IValidationContext): Q.Promise; +} +export interface IValidationContext { + Value: string; + Key: string; + Data: T; +} +export class Error implements IError { + public HasError: boolean; + public ErrorMessage: string; + constructor(); +} +export class ValidationFailure implements IError { + public Error: IError; + public IsAsync: boolean; + constructor(Error: IError, IsAsync: boolean); + public HasError : boolean; + public ErrorMessage : string; + public TranslateArgs : IErrorTranslateArgs; +} +export class ValidationResult implements IValidationResult { + public Name: string; + constructor(Name: string); + public IsDirty: boolean; + public Children : IValidationResult[]; + public Add(error: IValidationResult): void; + public Remove(index: number): void; + public Optional: IOptional; + public TranslateArgs: IErrorTranslateArgs[]; + public HasErrorsDirty : boolean; + public HasErrors : boolean; + public ErrorCount : number; + public ErrorMessage : string; +} +export class CompositeValidationResult implements IValidationResult { + public Name: string; + public Children: IValidationResult[]; + constructor(Name: string); + public Optional: IOptional; + public AddFirst(error: IValidationResult): void; + public Add(error: IValidationResult): void; + public Remove(index: number): void; + public HasErrorsDirty : boolean; + public HasErrors : boolean; + public ErrorCount : number; + public ErrorMessage : string; + public TranslateArgs : IErrorTranslateArgs[]; + public LogErrors(headerMessage?: string): void; + public Errors : { + [name: string]: IValidationResult; + }; + private FlattenErros; + public SetDirty(): void; + public SetPristine(): void; + private SetDirtyEx(node, dirty); + private flattenErrors(node, errorCollection); + private traverse(node, indent); +} +export class AbstractValidator implements IAbstractValidator { + public Validators: { + [name: string]: IPropertyValidator[]; + }; + public AbstractValidators: { + [name: string]: IAbstractValidator; + }; + public ValidationFunctions: { + [name: string]: IValidatorFce[]; + }; + public RuleFor(prop: string, validator: IPropertyValidator): void; + public ValidationFor(prop: string, fce: IValidatorFce): void; + public Validation(fce: IValidatorFce): void; + public ValidatorFor(prop: string, validator: IAbstractValidator, forList?: boolean): void; + public CreateAbstractRule(name: string): IAbstractValidationRule; + public CreateAbstractListRule(name: string): IAbstractValidationRule; + public CreateRule(name: string): IAbstractValidationRule; + public ForList: boolean; +} +export class MessageLocalization { + static customMsg: string; + static defaultMessages: { + "required": string; + "remote": string; + "email": string; + "url": string; + "date": string; + "dateISO": string; + "number": string; + "digits": string; + "signedDigits": string; + "creditcard": string; + "equalTo": string; + "maxlength": string; + "minlength": string; + "rangelength": string; + "range": string; + "max": string; + "min": string; + "step": string; + "contains": string; + "mask": string; + "custom": string; + }; + static ValidationMessages: { + "required": string; + "remote": string; + "email": string; + "url": string; + "date": string; + "dateISO": string; + "number": string; + "digits": string; + "signedDigits": string; + "creditcard": string; + "equalTo": string; + "maxlength": string; + "minlength": string; + "rangelength": string; + "range": string; + "max": string; + "min": string; + "step": string; + "contains": string; + "mask": string; + "custom": string; + }; + static GetValidationMessage(validator: any): string; } -export = Validation; export as namespace Validation; diff --git a/types/caller/caller-tests.ts b/types/caller/caller-tests.ts new file mode 100644 index 0000000000..81d8d64606 --- /dev/null +++ b/types/caller/caller-tests.ts @@ -0,0 +1,4 @@ +import caller = require('caller'); + +const callerFile: string = caller(); +const callerFile2: string = caller(1); diff --git a/types/caller/index.d.ts b/types/caller/index.d.ts new file mode 100644 index 0000000000..f09b6f129b --- /dev/null +++ b/types/caller/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for caller 1.0 +// Project: https://github.com/totherik/caller +// Definitions by: Ignocide +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function caller(depth?: number): string; + +export = caller; diff --git a/types/gitlab/tsconfig.json b/types/caller/tsconfig.json similarity index 94% rename from types/gitlab/tsconfig.json rename to types/caller/tsconfig.json index f1297faf67..80ae4b956e 100644 --- a/types/gitlab/tsconfig.json +++ b/types/caller/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "gitlab-tests.ts" + "caller-tests.ts" ] } diff --git a/types/caller/tslint.json b/types/caller/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/caller/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/caniuse-api/caniuse-api-tests.ts b/types/caniuse-api/caniuse-api-tests.ts new file mode 100644 index 0000000000..46b6a1eec4 --- /dev/null +++ b/types/caniuse-api/caniuse-api-tests.ts @@ -0,0 +1,17 @@ +import * as caniuse from "caniuse-api"; + +caniuse.features; // $ExpectType string[] + +caniuse.getSupport(""); // $ExpectType BrowserSupport + +caniuse.isSupported("", ""); // $ExpectType boolean +caniuse.isSupported("", [""]); // $ExpectType boolean + +caniuse.find(""); // $ExpectType string[] + +caniuse.getLatestStableBrowsers(); // $ExpectType string[] + +caniuse.setBrowserScope(""); // $ExpectType void +caniuse.setBrowserScope([""]); // $ExpectType void + +caniuse.getBrowserScope(); // $ExpectType string[] diff --git a/types/caniuse-api/index.d.ts b/types/caniuse-api/index.d.ts new file mode 100644 index 0000000000..ce6dac23ec --- /dev/null +++ b/types/caniuse-api/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for caniuse-api 3.0 +// Project: https://github.com/nyalab/caniuse-api#readme +// Definitions by: Dave Cardwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const features: string[]; + +export interface BrowserSupport { + [browser: string]: { + y?: number; + n?: number; + a?: number; + x?: number; + }; +} + +export function getSupport(feature: string): BrowserSupport; + +export function isSupported( + feature: string, + browsers: string | ReadonlyArray +): boolean; + +export function find(query: string): string[]; + +export function getLatestStableBrowsers(): string[]; + +export function setBrowserScope( + browserscope: string | ReadonlyArray +): void; + +export function getBrowserScope(): string[]; diff --git a/types/caniuse-api/tsconfig.json b/types/caniuse-api/tsconfig.json new file mode 100644 index 0000000000..2e43754f9e --- /dev/null +++ b/types/caniuse-api/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "caniuse-api-tests.ts"] +} diff --git a/types/caniuse-api/tslint.json b/types/caniuse-api/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/caniuse-api/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/cassandra-driver/index.d.ts b/types/cassandra-driver/index.d.ts index 33a9f5988f..f57f203a03 100644 --- a/types/cassandra-driver/index.d.ts +++ b/types/cassandra-driver/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cassandra-driver v3.4.1 +// Type definitions for cassandra-driver v3.5.0 // Project: https://github.com/datastax/nodejs-driver // Definitions by: Marc Fisher // Christian D @@ -413,7 +413,7 @@ export namespace types { pageState: string; nextPage: Function; - first(): Row; + first(): Row | null; getPageState(): string; getColumns(): Array<{ [key: string]: string; }>; wasApplied(): boolean; @@ -526,7 +526,8 @@ export interface ClientOptions { protocolOptions?: { port?: number, maxSchemaAgreementWaitSeconds?: number, - maxVersion?: number + maxVersion?: number, + noCompact?: boolean }, socketOptions?: { connectTimeout?: number, diff --git a/types/catbox-memory/catbox-memory-tests.ts b/types/catbox-memory/catbox-memory-tests.ts new file mode 100644 index 0000000000..9c4c1bcdfe --- /dev/null +++ b/types/catbox-memory/catbox-memory-tests.ts @@ -0,0 +1,8 @@ +import * as CatboxMemory from 'catbox-memory'; + +const client = new CatboxMemory({ + allowMixedContent: true, + cloneBuffersOnGet: false, + maxByteSize: 1024, + minCleanupIntervalMsec: 1000, +}); diff --git a/types/catbox-memory/index.d.ts b/types/catbox-memory/index.d.ts new file mode 100644 index 0000000000..b615d6c45d --- /dev/null +++ b/types/catbox-memory/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for catbox-memory 4.0 +// Project: https://github.com/hapijs/catbox-memory#readme +// Definitions by: Simon Schick +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { ClientApi } from 'catbox'; + +interface CatboxMemory extends ClientApi {} + +// tslint:disable-next-line:no-unnecessary-class +declare class CatboxMemory implements ClientApi { + constructor(options?: CatboxMemory.Options); +} + +declare namespace CatboxMemory { + interface Options { + /** + * Sets an upper limit on the number of bytes that can be stored in the cache. + * Once this limit is reached no additional items will be added to the cache until some expire. + * The utilized memory calculation is a rough approximation and must not be relied on. + * @default 104857600 (100MB). + */ + maxByteSize?: number; + /** + * The minimum number of milliseconds in between each cache cleanup. + * @default 1000 (1 second) + */ + minCleanupIntervalMsec?: number; + /** + * by default, all data is cached as JSON strings, and converted to an object using JSON.parse() on retrieval. + * By setting this option to true, Buffer data can be stored alongside the stringified data. + * Buffers are not stringified, and are copied before storage to prevent the value from changing while in the cache. + * @default false + */ + allowMixedContent?: boolean; + /** + * by default, buffers stored in the cache with allowMixedContent set to true are copied when they are set but not when they are retrieved. + * This means a change to the buffer returned by a get() will change the value in the cache. To prevent this, + * set cloneBuffersOnGet to true to always return a copy of the cached buffer. + * @default false + */ + cloneBuffersOnGet?: boolean; + } +} + +export = CatboxMemory; diff --git a/types/catbox-memory/tsconfig.json b/types/catbox-memory/tsconfig.json new file mode 100644 index 0000000000..c52e660d39 --- /dev/null +++ b/types/catbox-memory/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "catbox-memory-tests.ts" + ] +} diff --git a/types/catbox-memory/tslint.json b/types/catbox-memory/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/catbox-memory/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/catbox-redis/catbox-redis-tests.ts b/types/catbox-redis/catbox-redis-tests.ts index d7fb5eb701..91d86445b7 100644 --- a/types/catbox-redis/catbox-redis-tests.ts +++ b/types/catbox-redis/catbox-redis-tests.ts @@ -1,6 +1,6 @@ import * as CatbotRedis from 'catbox-redis'; -const cache = new CatbotRedis({ +const cache = new CatbotRedis({ host: 'localhost', partition: 'test', port: 2018, @@ -10,3 +10,8 @@ cache.get({ segment: 'test', id: 'test', }); + +cache.set({ + segment: 'test', + id: 'test', +}, 'test', 123); diff --git a/types/catbox-redis/index.d.ts b/types/catbox-redis/index.d.ts index a0d3590953..18972c6493 100644 --- a/types/catbox-redis/index.d.ts +++ b/types/catbox-redis/index.d.ts @@ -53,7 +53,7 @@ declare module 'catbox-redis' { sentinelName?: string; } } - class CatboxRedis extends Client { + class CatboxRedis extends Client { constructor(options: CatboxRedis.CatboxRedisOptions); } export = CatboxRedis; diff --git a/types/catbox/catbox-tests.ts b/types/catbox/catbox-tests.ts index 25d4826d25..e86d2a94af 100644 --- a/types/catbox/catbox-tests.ts +++ b/types/catbox/catbox-tests.ts @@ -1,16 +1,22 @@ -import { CacheItem, Client, Policy, EnginePrototypeOrObject } from "catbox"; +import { Client, Policy, EnginePrototypeOrObject, DecoratedResult, CachedObject } from "catbox"; const Memory: EnginePrototypeOrObject = { async start(): Promise {}, stop(): void {}, - async get(): Promise {}, + async get(): Promise> { + return { + item: 'asd', + stored: 12, + ttl: 123, + }; + }, async set(): Promise {}, async drop(): Promise {}, isReady(): boolean { return true; }, validateSegmentName(segment: string): null { return null; }, }; -const client = new Client(Memory, { partition: 'cache' }); +const client = new Client(Memory, { partition: 'cache' }); const cache = new Policy({ expiresIn: 5000, @@ -25,3 +31,11 @@ cache.drop('foo').then(() => {}); cache.isReady(); cache.stats(); + +const decoratedCache = new Policy({ + getDecoratedValue: true, +}, client, 'cache2'); + +decoratedCache.get('test').then((a: DecoratedResult) => { + const res: string = a.value; +}); diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index f6881b1aef..62b99ac5b3 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -4,7 +4,7 @@ // AJP // Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 /** * Client @@ -17,7 +17,7 @@ * the Riak bucket, or as a key prefix in Redis and Memcached. To share the cache across multiple clients, use the same partition name. * @see {@link https://github.com/hapijs/catbox#client} */ -export class Client implements ClientApi { +export class Client implements ClientApi { constructor(engine: EnginePrototypeOrObject, options: ClientOptions); /** start() - creates a connection to the cache server. Must be called before any other method is available. */ @@ -28,14 +28,14 @@ export class Client implements ClientApi { * get(key, callback) - retrieve an item from the cache engine if found where: * * key - a cache key object (see [ICacheKey]). */ - get(key: CacheKey): Promise; + get(key: CacheKey): Promise>; /** * set(key, value, ttl, callback) - store an item in the cache for a specified length of time, where: * * key - a cache key object (see [ICacheKey]). * * value - the string or object value to be stored. * * ttl - a time-to-live value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). */ - set(key: CacheKey, value: CacheItem, ttl: number): Promise; + set(key: CacheKey, value: T, ttl: number): Promise; /** * drop(key, callback) - remove an item from cache where: * * key - a cache key object (see [ICacheKey]). @@ -47,13 +47,13 @@ export class Client implements ClientApi { validateSegmentName(segment: string): null | Error; } -export type EnginePrototypeOrObject = EnginePrototype | ClientApi; +export type EnginePrototypeOrObject = EnginePrototype | ClientApi; /** * A prototype CatBox engine function */ -export interface EnginePrototype { - new(settings: ClientOptions): ClientApi; +export interface EnginePrototype { + new(settings: ClientOptions): ClientApi; } /** @@ -61,7 +61,7 @@ export interface EnginePrototype { * The Client object provides the following methods: * @see {@link https://github.com/hapijs/catbox#api} */ -export interface ClientApi { +export interface ClientApi { /** start() - creates a connection to the cache server. Must be called before any other method is available. */ start(): Promise; /** stop() - terminates the connection to the cache server. */ @@ -70,14 +70,14 @@ export interface ClientApi { * get(key, callback) - retrieve an item from the cache engine if found where: * * key - a cache key object (see [ICacheKey]). */ - get(key: CacheKey): Promise; + get(key: CacheKey): Promise>; /** * set(key, value, ttl) - store an item in the cache for a specified length of time, where: * * key - a cache key object (see [ICacheKey]). * * value - the string or object value to be stored. * * ttl - a time-to-live value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). */ - set(key: CacheKey, value: CacheItem, ttl: number): Promise; + set(key: CacheKey, value: T, ttl: number): Promise; /** * drop(key) - remove an item from cache where: * * key - a cache key object (see [ICacheKey]). @@ -100,17 +100,15 @@ export interface CacheKey { } /** Cached object contains the following: */ -export interface CachedObject { +export interface CachedObject { /** item - the value stored in the cache using set(). */ - item: any; + item: T; /** stored - the timestamp when the item was stored in the cache (in milliseconds). */ stored: number; /** ttl - the remaining time-to-live (not the original value used when storing the object). */ ttl: number; } -export type CacheItem = any; - export interface ClientOptions { /** * this will store items under keys that start with this value. @@ -118,89 +116,71 @@ export interface ClientOptions { partition: string; } +export type PolicyOptionVariants = PolicyOptions | DecoratedPolicyOptions; + +export type Id = string | { id: string }; + /** - * The Policy object provides a convenient cache interface by setting a global policy which is automatically applied to every storage action. + * The Policy object provides a convenient cache interface by setting a + * global policy which is automatically applied to every storage action. * The object is constructed using new Policy(options, [cache, segment]) where: * * options - an object with the IPolicyOptions structure * * cache - a Client instance (which has already been started). - * * segment - required when cache is provided. The segment name used to isolate cached items within the cache partition. + * * segment - required when cache is provided. The segment name used to + * isolate cached items within the cache partition. * @see {@link https://github.com/hapijs/catbox#policy} */ -export class Policy implements PolicyAPI { - constructor(options: PolicyOptions, cache: Client, segment: string); +export class Policy> { + constructor(options: O, cache: Client, segment: string); /** - * get(id) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, - * a new value is generated, stored in the cache, and returned. Multiple concurrent requests are queued and processed once. The method arguments are: - * * id - the unique item identifier (within the policy segment). Can be a string or an object with the required 'id' key. + * retrieve an item from the cache. If the item is not + * found and the generateFunc method was provided, + * a new value is generated, stored in the cache, and returned. + * Multiple concurrent requests are queued and processed once. The method arguments are: + * @param id the unique item identifier (within the policy segment). + * Can be a string or an object with the required 'id' key. */ - get(id: string | { id: string }): Promise; + get(id: Id): Promise ? DecoratedResult : T | null>; + /** - * set(id, value, ttl) - store an item in the cache where: - * * id - the unique item identifier (within the policy segment). - * * value - the string or object value to be stored. - * * ttl - a time-to-live override value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). + * store an item in the cache where: + * @param id - the unique item identifier (within the policy segment). + * @param value - the string or object value to be stored. + * @param ttl - a time-to-live override value in milliseconds after which the item is automatically + * removed from the cache (or is marked invalid). * This should be set to 0 in order to use the caching rules configured when creating the Policy object. */ - set(id: string | { id: string }, value: CacheItem, ttl: number | null): Promise; + set(id: Id, value: T, ttl?: number): Promise; /** - * drop(id) - remove the item from cache where: - * * id - the unique item identifier (within the policy segment). + * remove the item from cache where: + * @param id the unique item identifier (within the policy segment). + */ + drop(id: Id): Promise; + /** + * given a created timestamp in milliseconds, returns the time-to-live left + * based on the configured rules. */ - drop(id: string | { id: string }): Promise; - /** ttl(created) - given a created timestamp in milliseconds, returns the time-to-live left based on the configured rules. */ ttl(created: number): number; - /** rules(options) - changes the policy rules after construction (note that items already stored will not be affected) */ - rules(options: PolicyOptions): void; - /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready or if there is no cache engine set. */ + /** changes the policy rules after construction (note that items already stored will not be affected) */ + rules(options: PolicyOptions): void; + /** + * returns true if cache engine determines itself as ready, false if it is not ready or if + * here is no cache engine set. + */ isReady(): boolean; - /** stats - an object with cache statistics */ + /** an object with cache statistics */ stats(): CacheStatisticsObject; } -/** - * Policy API - * The Policy object provides the following methods: - * @see {@link https://github.com/hapijs/catbox#api-1} - */ -export interface PolicyAPI { - /** - * get(id) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, - * a new value is generated, stored in the cache, and returned. Multiple concurrent requests are queued and processed once. The method arguments are: - * * id - the unique item identifier (within the policy segment). Can be a string or an object with the required 'id' key. - */ - get(id: string | { id: string }): Promise; - /** - * set(id, value, ttl) - store an item in the cache where: - * * id - the unique item identifier (within the policy segment). - * * value - the string or object value to be stored. - * * ttl - a time-to-live override value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). - * This should be set to 0 in order to use the caching rules configured when creating the Policy object. - */ - set(id: string | { id: string }, value: CacheItem, ttl: number | null): Promise; - /** - * drop(id) - remove the item from cache where: - * * id - the unique item identifier (within the policy segment). - */ - drop(id: string | { id: string }): Promise; - /** ttl(created) - given a created timestamp in milliseconds, returns the time-to-live left based on the configured rules. */ - ttl(created: number): number; - /** rules(options) - changes the policy rules after construction (note that items already stored will not be affected) */ - rules(options: PolicyOptions): void; - /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready or if there is no cache engine set. */ - isReady(): boolean; - /** stats - an object with cache statistics */ - stats(): CacheStatisticsObject; -} - -export interface PolicyGetPromiseResult { - value: CacheItem; - cached: PolicyGetCachedOptions; +export interface DecoratedResult { + value: T; + cached: PolicyGetCachedOptions; report: PolicyGetReportLog; } -export interface PolicyGetCachedOptions { +export interface PolicyGetCachedOptions { /** item - the cached value. */ - item: CacheItem; + item: T; /** stored - the timestamp when the item was stored in the cache. */ stored: number; /** ttl - the cache ttl value for the record. */ @@ -212,13 +192,13 @@ export interface PolicyGetCachedOptions { /** * @see {@link https://github.com/hapijs/catbox#policy} */ -export interface PolicyOptions { +export interface PolicyOptions { /** expiresIn - relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ expiresIn?: number; /** expiresAt - time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Uses local time. Cannot be used together with expiresIn. */ expiresAt?: string; /** generateFunc - a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: */ - generateFunc?: GenerateFunc; + generateFunc?: GenerateFunc; /** * staleIn - number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. * Must be less than expiresIn. Alternatively function that returns staleIn value in milliseconds. The function signature is function(stored, ttl) where: @@ -242,11 +222,18 @@ export interface PolicyOptions { generateIgnoreWriteError?: boolean; /** * pendingGenerateTimeout - number of milliseconds while generateFunc call is in progress for a given id, before a subsequent generateFunc call is allowed. - * Defaults to 0, no blocking of concurrent generateFunc calls beyond staleTimeout. + * @default 0, no blocking of concurrent generateFunc calls beyond staleTimeout. */ pendingGenerateTimeout?: number; } +export interface DecoratedPolicyOptions extends PolicyOptions { + /** + * @default false + */ + getDecoratedValue?: boolean; +} + export interface GenerateFuncFlags { ttl: number; } @@ -262,7 +249,7 @@ export interface GenerateFuncFlags { * * ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. * @see {@link https://github.com/hapijs/catbox#policy} */ -export type GenerateFunc = (id: string, flags: GenerateFuncFlags) => Promise; +export type GenerateFunc = (id: string, flags: GenerateFuncFlags) => Promise; /** * An object with logging information about the generation operation containing the following keys (as relevant): diff --git a/types/chai-fs/chai-fs-tests.ts b/types/chai-fs/chai-fs-tests.ts new file mode 100644 index 0000000000..2b7df3ed8f --- /dev/null +++ b/types/chai-fs/chai-fs-tests.ts @@ -0,0 +1,400 @@ +import { assert, expect, use, should } from 'chai'; +import Chaifs = require('chai-fs'); + +use(Chaifs); +should(); + +const name = 'name'; +const path = 'tmp/'; +const otherPath = 'otherPath/'; +const msg = 'message'; +const array: any[] = [1, 2, 3, 4]; +const data: ArrayBuffer = new ArrayBuffer(512); +const obj: object = { key: 'value' }; +const schema = JSON.parse('{ "name":"John", "age":30, "city":"New York"}'); + +// basename() +expect(path).to.have.basename(name); +expect(path).to.have.basename(name, msg); +expect(path).to.not.have.basename(name); +expect(path).to.not.have.basename(name, msg); + +path.should.have.basename(name); +path.should.have.basename(name, msg); +path.should.not.have.basename(name); +path.should.not.have.basename(name, msg); + +assert.basename(path, name); +assert.basename(path, name, msg); +assert.notBasename(path, name); +assert.notBasename(path, name, msg); + +// dirname() +expect(path).to.have.dirname(name); +expect(path).to.have.dirname(name, msg); +expect(path).to.not.have.dirname(name); +expect(path).to.not.have.dirname(name, msg); + +path.should.have.dirname(name); +path.should.have.dirname(name, msg); +path.should.not.have.dirname(name); +path.should.not.have.dirname(name, msg); + +assert.dirname(path, name); +assert.dirname(path, name, msg); +assert.notDirname(path, name); +assert.notDirname(path, name, msg); + +// extname() +expect(path).to.have.extname(name); +expect(path).to.have.extname(name, msg); +expect(path).to.not.have.extname(name); +expect(path).to.not.have.extname(name, msg); + +path.should.have.extname(name); +path.should.have.extname(name, msg); +path.should.not.have.extname(name); +path.should.not.have.extname(name, msg); + +assert.extname(path, name); +assert.extname(path, name, msg); +assert.notExtname(path, name); +assert.notExtname(path, name, msg); + +// path() +expect(path).to.be.a.path(); +expect(path).to.be.a.path(msg); +expect(path).to.not.be.a.path(); +expect(path).to.not.be.a.path(msg); + +path.should.be.a.path(); +path.should.be.a.path(msg); +path.should.be.a.path(); +path.should.be.a.path(msg); +path.should.not.be.a.path(); +path.should.not.be.a.path(msg); + +assert.pathExists(path); +assert.pathExists(path, msg); +assert.notPathExists(path); +assert.notPathExists(path, msg); + +// directory +expect(path).to.be.a.directory(); +expect(path).to.be.a.directory(msg); +expect(path).to.not.be.a.directory(); +expect(path).to.not.be.a.directory(msg); + +path.should.be.a.directory(); +path.should.be.a.directory(msg); +path.should.not.be.a.directory(); +path.should.not.be.a.directory(msg); + +assert.isDirectory(path); +assert.isDirectory(path, msg); +assert.notIsDirectory(path); +assert.notIsDirectory(path, msg); + +// directory().and.empty +expect(path).to.be.a.directory().and.empty; +expect(path).to.be.a.directory(msg).and.empty; +expect(path).to.be.a.directory().and.not.empty; +expect(path).to.be.a.directory(msg).and.not.empty; + +path.should.be.a.directory().and.empty; +path.should.be.a.directory(msg).and.empty; +path.should.be.a.directory().and.not.empty; +path.should.be.a.directory(msg).and.not.empty; + +assert.isEmptyDirectory(path); +assert.isEmptyDirectory(path, msg); +assert.notIsEmptyDirectory(path); +assert.notIsEmptyDirectory(path, msg); + +// directory().with.contents([...]) +// #1 +expect(path).to.be.a.directory(msg).with.contents(array); +expect(path).to.be.a.directory(msg).with.contents(array, msg); +// #2 +expect(path).to.be.a.directory(msg).and.not.have.contents(array); +expect(path).to.be.a.directory(msg).and.not.have.contents(array, msg); +// #3 +expect(path).to.be.a.directory(msg).with.deep.contents(array); +expect(path).to.be.a.directory(msg).with.deep.contents(array, msg); +// #4 +expect(path).to.be.a.directory(msg).and.not.have.deep.contents(array); +expect(path).to.be.a.directory(msg).and.not.have.deep.contents(array, msg); +// #5 +expect(path).to.be.a.directory(msg).and.include.contents(array); +expect(path).to.be.a.directory(msg).and.include.contents(array, msg); +// #6 +expect(path).to.be.a.directory(msg).and.not.include.contents(array); +expect(path).to.be.a.directory(msg).and.not.include.contents(array, msg); + +// #1 +path.should.be.a.directory(msg).with.contents(array); +path.should.be.a.directory(msg).with.contents(array, msg); +// #2 +path.should.be.a.directory(msg).and.not.have.contents(array); +path.should.be.a.directory(msg).and.not.have.contents(array, msg); +// #3 +path.should.be.a.directory(msg).with.deep.contents(array); +path.should.be.a.directory(msg).with.deep.contents(array, msg); +// #4 +path.should.be.a.directory(msg).and.not.have.deep.contents(array); +path.should.be.a.directory(msg).and.not.have.deep.contents(array, msg); +// #5 +path.should.be.a.directory(msg).and.include.contents(array); +path.should.be.a.directory(msg).and.include.contents(array, msg); +// #6 +path.should.be.a.directory(msg).and.not.include.contents(array); +path.should.be.a.directory(msg).and.not.include.contents(array, msg); + +assert.directoryContent(path, array); +assert.directoryContent(path, array, msg); +assert.notDirectoryContent(path, array); +assert.notDirectoryContent(path, array, msg); +assert.directoryDeepContent(path, array); +assert.directoryDeepContent(path, array, msg); +assert.notDirectoryDeepContent(path, array); +assert.notDirectoryDeepContent(path, array, msg); +assert.directoryInclude(path, array); +assert.directoryInclude(path, array, msg); +assert.notDirectoryInclude(path, array); +assert.notDirectoryInclude(path, array, msg); + +// directory().with.files([...]) +// #1 +expect(path).to.be.a.directory(msg).with.files(array); +expect(path).to.be.a.directory(msg).with.files(array, msg); +// #2 +expect(path).to.be.a.directory(msg).with.files(array); +expect(path).to.be.a.directory(msg).with.files(array, msg); +// #3 +expect(path).to.be.a.directory(msg).and.not.have.files(array); +expect(path).to.be.a.directory(msg).and.not.have.files(array, msg); +// #4 +expect(path).to.be.a.directory(msg).and.not.have.files(array); +expect(path).to.be.a.directory(msg).and.not.have.files(array, msg); +// #5 +expect(path).to.be.a.directory(msg).with.deep.files(array, msg); +expect(path).to.be.a.directory(msg).with.deep.files(array); +// #6 +expect(path).to.be.a.directory(msg).with.deep.files(array); +expect(path).to.be.a.directory(msg).with.deep.files(array, msg); +// #7 +expect(path).to.be.a.directory(msg).and.not.have.deep.files(array); +expect(path).to.be.a.directory(msg).and.not.have.deep.files(array, msg); +// #8 +expect(path).to.be.a.directory(msg).and.not.have.deep.files(array); +expect(path).to.be.a.directory(msg).and.not.have.deep.files(array, msg); +// #9 +expect(path).to.be.a.directory(msg).and.include.files(array); +expect(path).to.be.a.directory(msg).and.include.files(array, msg); +// #10 +expect(path).to.be.a.directory(msg).and.not.include.files(array); +expect(path).to.be.a.directory(msg).and.not.include.files(array, msg); + +// #1 +path.should.be.a.directory(msg).with.files(array); +path.should.be.a.directory(msg).with.files(array, msg); +// #2 +path.should.be.a.directory().and.not.have.files(array); +path.should.be.a.directory(msg).and.not.have.files(array); +path.should.be.a.directory(msg).and.not.have.files(array, msg); +// #3 +path.should.be.a.directory().with.deep.files(array); +path.should.be.a.directory(msg).with.deep.files(array); +path.should.be.a.directory(msg).with.deep.files(array, msg); +// #4 +path.should.be.a.directory(msg).and.not.have.deep.files(array); +path.should.be.a.directory(msg).and.not.have.deep.files(array, msg); +// #5 +path.should.be.a.directory(msg).and.include.files(array); +path.should.be.a.directory(msg).and.include.files(array, msg); +// #6 +path.should.be.a.directory(msg).and.not.include.files(array); +path.should.be.a.directory(msg).and.not.include.files(array, msg); + +assert.directoryFiles(path, array); +assert.directoryFiles(path, array, msg); +assert.notDirectoryFiles(path, array); +assert.notDirectoryFiles(path, array, msg); +assert.directoryDeepFiles(path, array); +assert.directoryDeepFiles(path, array, msg); +assert.notDirectoryDeepFiles(path, array); +assert.notDirectoryDeepFiles(path, array, msg); +assert.directoryIncludeFiles(path, array); +assert.directoryIncludeFiles(path, array, msg); +assert.notDirectoryIncludeFiles(path, array); +assert.notDirectoryIncludeFiles(path, array, msg); + +// directory().with.subDirs([...]) +// #1 +expect(path).to.be.a.directory(msg).with.subDirs(array); +expect(path).to.be.a.directory(msg).with.subDirs(array, msg); +// #2 +expect(path).to.be.a.directory(msg).and.not.have.subDirs(array); +expect(path).to.be.a.directory(msg).and.not.have.subDirs(array, msg); +// #3 +expect(path).to.be.a.directory(msg).with.deep.subDirs(array); +expect(path).to.be.a.directory(msg).with.deep.subDirs(array, msg); +// #4 +expect(path).to.be.a.directory(msg).and.not.have.deep.subDirs(array); +expect(path).to.be.a.directory(msg).and.not.have.deep.subDirs(array, msg); +// #5 +expect(path).to.be.a.directory(msg).and.include.subDirs(array); +expect(path).to.be.a.directory(msg).and.include.subDirs(array, msg); +// #6 +expect(path).to.be.a.directory(msg).and.not.include.subDirs(array); +expect(path).to.be.a.directory(msg).and.not.include.subDirs(array, msg); + +// #1 +path.should.be.a.directory(msg).with.subDirs(array); +path.should.be.a.directory(msg).with.subDirs(array, msg); +// #2 +path.should.be.a.directory(msg).and.not.have.subDirs(array); +path.should.be.a.directory(msg).and.not.have.subDirs(array, msg); +// #3 +path.should.be.a.directory(msg).with.deep.subDirs(array); +path.should.be.a.directory(msg).with.deep.subDirs(array, msg); +// #4 +path.should.be.a.directory(msg).and.not.have.deep.subDirs(array); +path.should.be.a.directory(msg).and.not.have.deep.subDirs(array, msg); +// #5 +path.should.be.a.directory(msg).and.include.subDirs(array); +path.should.be.a.directory(msg).and.include.subDirs(array, msg); +// #6 +path.should.be.a.directory(msg).and.not.include.subDirs(array); +path.should.be.a.directory(msg).and.not.include.subDirs(array, msg); + +assert.directorySubDirs(path, array, msg); +assert.notDirectorySubDirs(path, array, msg); +assert.directoryDeepSubDirs(path, array, msg); +assert.notDirectoryDeepSubDirs(path, array, msg); +assert.directoryIncludeSubDirs(path, array, msg); +assert.notDirectoryIncludeSubDirs(path, array, msg); + +// directory().and.equal(otherPath) +// #1 +expect(path).to.be.a.directory(msg).and.equal(otherPath); +expect(path).to.be.a.directory(msg).and.equal(otherPath, msg); +// #2 +expect(path).to.be.a.directory(msg).and.not.equal(otherPath); +expect(path).to.be.a.directory(msg).and.not.equal(otherPath, msg); +// #3 +expect(path).to.be.a.directory(msg).and.deep.equal(otherPath); +expect(path).to.be.a.directory(msg).and.deep.equal(otherPath, msg); +// #4 +expect(path).to.be.a.directory(msg).and.not.deep.equal(otherPath); +expect(path).to.be.a.directory(msg).and.not.deep.equal(otherPath, msg); + +// #1 +path.should.be.a.directory(msg).and.equal(otherPath); +path.should.be.a.directory(msg).and.equal(otherPath, msg); +// #2 +path.should.be.a.directory(msg).and.not.equal(otherPath); +path.should.be.a.directory(msg).and.not.equal(otherPath, msg); +// #3 +path.should.be.a.directory(msg).and.deep.equal(otherPath); +path.should.be.a.directory(msg).and.deep.equal(otherPath, msg); +// #4 +path.should.be.a.directory(msg).and.not.deep.equal(otherPath); +path.should.be.a.directory(msg).and.not.deep.equal(otherPath, msg); + +assert.directoryEqual(path, otherPath, msg); +assert.notDirectoryEqual(path, otherPath, msg); +assert.directoryDeepEqual(path, otherPath, msg); +assert.notDirectoryDeepEqual(path, otherPath, msg); + +// file() +expect(path).to.be.a.file(); +expect(path).to.be.a.file(msg); +expect(path).to.not.be.a.file(); +expect(path).to.not.be.a.file(msg); + +path.should.be.a.file(); +path.should.be.a.file(msg); +path.should.not.be.a.file(); +path.should.not.be.a.file(msg); + +assert.isFile(path); +assert.isFile(path, msg); +assert.notIsFile(path); +assert.notIsFile(path, msg); + +// file().and.empty +expect(path).to.be.a.file(msg).and.empty; +expect(path).to.be.a.file(msg).and.not.empty; + +path.should.be.a.file(msg).and.empty; +path.should.be.a.file(msg).and.not.empty; + +assert.isEmptyFile(path, msg); +assert.notIsEmptyFile(path, msg); + +// file().with.content(str) +expect(path).to.be.a.file(msg).with.content(data); +expect(path).to.be.a.file(msg).with.content(data, msg); +expect(path).to.be.a.file(msg).and.not.have.content(data); +expect(path).to.be.a.file(msg).and.not.have.content(data, msg); + +path.should.be.a.file(msg).with.content(data); +path.should.be.a.file(msg).with.content(data, msg); +path.should.be.a.file(msg).and.not.have.content(data); +path.should.be.a.file(msg).and.not.have.content(data, msg); + +assert.fileContent(path, data); +assert.fileContent(path, data, msg); +assert.notFileContent(path, data); +assert.notFileContent(path, data, msg); + +// file().with.contents.that.match(/xyz/) +// expect(path).to.be.a.file(msg).with.contents.that.match(/xyz/, msg); +// expect(path).to.be.a.file(msg).and.not.have.contents.that.match(/xyz/, msg); + +// path.should.be.a.file(msg).with.contents.that.match(/xyz/, msg); +// path.should.be.a.file(msg).and.not.have.contents.that.match(/xyz/, msg); + +assert.fileContentMatch(path, /xyz/); +assert.fileContentMatch(path, /xyz/, msg); +assert.notFileContentMatch(path, /xyz/); +assert.notFileContentMatch(path, /xyz/, msg); + +// file().and.equal(otherPath) +expect(path).to.be.a.file(msg).and.equal(otherPath); +expect(path).to.be.a.file(msg).and.equal(otherPath, msg); +expect(path).to.be.a.file(msg).and.not.equal(otherPath); +expect(path).to.be.a.file(msg).and.not.equal(otherPath, msg); + +path.should.be.a.file(msg).and.equal(otherPath); +path.should.be.a.file(msg).and.equal(otherPath, msg); +path.should.be.a.file(msg).and.not.equal(otherPath); +path.should.be.a.file(msg).and.not.equal(otherPath, msg); + +assert.fileEqual(path, otherPath, msg); +assert.notFileEqual(path, otherPath, msg); + +// file().with.json +expect(path).to.be.a.file(msg).with.json; +expect(path).to.be.a.file(msg).with.not.json; + +path.should.be.a.file(msg).with.json; +path.should.be.a.file(msg).with.not.json; + +assert.jsonFile(path); +assert.jsonFile(path, msg); +assert.notJsonFile(path); +assert.notJsonFile(path, msg); + +// file().using.json.schema(obj) +expect(path).to.be.a.file(msg).with.json.using.schema(obj); +expect(path).to.be.a.file(msg).with.json.not.using.schema(obj); + +path.should.be.a.file(msg).with.json.using.schema(obj); +path.should.be.a.file(msg).with.json.not.using.schema(obj); + +assert.jsonSchemaFile(path, schema); +assert.jsonSchemaFile(path, schema, msg); +assert.notJsonSchemaFile(path, schema); +assert.notJsonSchemaFile(path, schema, msg); diff --git a/types/chai-fs/index.d.ts b/types/chai-fs/index.d.ts new file mode 100644 index 0000000000..3b82eee078 --- /dev/null +++ b/types/chai-fs/index.d.ts @@ -0,0 +1,222 @@ +// Type definitions for chai-fs 2.0 +// Project: https://github.com/chaijs/chai-fs +// Definitions by: Dimitar Danailov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// +/// + +declare global { + namespace Chai { + interface TypeComparison { + path(msg?: string): Assertion; + directory(msg?: string): Assertion; + file(msg?: string): Assertion; + } + + interface Deep { + contents(array: any[], msg?: string): Assertion; + files(array: any[], msg?: string): Assertion; + subDirs(array: any[], msg?: string): Assertion; + } + + interface Include { + contents(array: any[], msg?: string): Assertion; + files(array: any[], msg?: string): Assertion; + subDirs(array: any[], msg?: string): Assertion; + } + + interface LanguageChains { + json: Assertion; + using: Assertion; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + // Basename + basename(path?: string, name?: string, msg?: string): Assertion; + notBasename(path: string, name: string, msg?: string): Assertion; + + // Dirname + dirname(name: string, msg?: string): Assertion; + notDirname(path: string, name: string, msg?: string): Assertion; + + // Еxtname + extname(path: string, name?: string, msg?: string): Assertion; + notExtname(path: string, name: string, msg?: string): Assertion; + + // Path + pathExists(path: string, msg?: string): Assertion; + notPathExists(path: string, msg?: string): Assertion; + + // Directory + isDirectory(path: string, msg?: string): Assertion; + notIsDirectory(path: string, msg?: string): Assertion; + + // directory().and.empty + isEmptyDirectory(path: string, msg?: string): Assertion; + notIsEmptyDirectory(path: string, msg?: string): Assertion; + + // directory().with.contents([...]) + contents(array: any[], msg?: string): Assertion; + directoryContent(path: string, array: any[], msg?: string): Assertion; + notDirectoryContent(path: string, array: any[], msg?: string): Assertion; + directoryDeepContent(path: string, array: any[], msg?: string): Assertion; + notDirectoryDeepContent(path: string, array: any[], msg?: string): Assertion; + directoryInclude(path: string, array: any[], msg?: string): Assertion; + notDirectoryInclude(path: string, array: any[], msg?: string): Assertion; + + // directory().with.files([...]) + files(array: any[], msg?: string): Assertion; + directoryFiles(path: string, array: any[], msg?: string): Assertion; + notDirectoryFiles(path: string, array: any[], msg?: string): Assertion; + directoryDeepFiles(path: string, array: any[], msg?: string): Assertion; + notDirectoryDeepFiles(path: string, array: any[], msg?: string): Assertion; + directoryIncludeFiles(path: string, array: any[], msg?: string): Assertion; + notDirectoryIncludeFiles(path: string, array: any[], msg?: string): Assertion; + + // directory().with.subDirs([...]) + subDirs(array: any[], msg?: string): Assertion; + directorySubDirs(path: string, array: any[], msg?: string): Assertion; + notDirectorySubDirs(path: string, array: any[], msg?: string): Assertion; + directoryDeepSubDirs(path: string, array: any[], msg?: string): Assertion; + notDirectoryDeepSubDirs(path: string, array: any[], msg?: string): Assertion; + directoryIncludeSubDirs(path: string, array: any[], msg?: string): Assertion; + notDirectoryIncludeSubDirs(path: string, array: any[], msg?: string): Assertion; + + // directory().and.equal(otherPath) + directoryEqual(path: string, otherPath: string, msg?: string): Assertion; + notDirectoryEqual(path: string, otherPath: string, msg?: string): Assertion; + directoryDeepEqual(path: string, otherPath: string, msg?: string): Assertion; + notDirectoryDeepEqual(path: string, otherPath: string, msg?: string): Assertion; + + // file + isFile(path: string, msg?: string): Assertion; + notIsFile(path: string, msg?: string): Assertion; + + // file().and.empty + isEmptyFile(path: string, msg?: string): Assertion; + notIsEmptyFile(path: string, msg?: string): Assertion; + + // file().with.content(str) + content(data: any, msg?: string): Assertion; + fileContent(path: string, data: any, msg?: string): Assertion; + notFileContent(path: string, data: any, msg?: string): Assertion; + + // file().with.contents.that.match(/xyz/) + fileContentMatch(path: string, regExp: RegExp, msg?: string): Assertion; + notFileContentMatch(path: string, regExp: RegExp, msg?: string): Assertion; + + // file().and.equal(otherPath) + fileEqual(path: string, otherPath: string, msg?: string): Assertion; + notFileEqual(path: string, otherPath: string, msg?: string): Assertion; + + // file().with.json + jsonFile(path: string, msg?: string): Assertion; + notJsonFile(path: string, msg?: string): Assertion; + + // file().using.json.schema(obj) + jsonSchemaFile(path: string, schema: any, msg?: string): Assertion; + notJsonSchemaFile(path: string, schema: any, msg?: string): Assertion; + schema(obj: object): Assertion; + } + + interface Assert { + // Basename + basename(path: string, name: string, msg?: string): void; + notBasename(path: string, name: string, msg?: string): void; + + // Dirname + dirname(path: string, name?: string, msg?: string): void; + notDirname(path: string, name: string, msg?: string): void; + + // Еxtname + extname(path: string, name: string, msg?: string): void; + notExtname(path: string, name: string, msg?: string): void; + + // Path + path(msg?: string): void; + pathExists(path: string, msg?: string): void; + notPathExists(path: string, msg?: string): void; + + // Directory + directory(msg?: string): void; + isDirectory(path: string, msg?: string): void; + notIsDirectory(path: string, msg?: string): void; + + // directory().and.empty + isEmptyDirectory(path: string, msg?: string): void; + notIsEmptyDirectory(path: string, msg?: string): void; + + // directory().with.contents([...]) + contents(array: any[], msg?: string): void; + directoryContent(path: string, array: any[], msg?: string): void; + notDirectoryContent(path: string, array: any[], msg?: string): void; + directoryDeepContent(path: string, array: any[], msg?: string): void; + notDirectoryDeepContent(path: string, array: any[], msg?: string): void; + directoryInclude(path: string, array: any[], msg?: string): void; + notDirectoryInclude(path: string, array: any[], msg?: string): void; + + // directory().with.files([...]) + files(array: any[], msg?: string): void; + directoryFiles(path: string, array: any[], msg?: string): void; + notDirectoryFiles(path: string, array: any[], msg?: string): void; + directoryDeepFiles(path: string, array: any[], msg?: string): void; + notDirectoryDeepFiles(path: string, array: any[], msg?: string): void; + directoryIncludeFiles(path: string, array: any[], msg?: string): void; + notDirectoryIncludeFiles(path: string, array: any[], msg?: string): void; + + // directory().with.subDirs([...]) + subDirs(array: any[], msg?: string): void; + directorySubDirs(path: string, array: any[], msg?: string): void; + notDirectorySubDirs(path: string, array: any[], msg?: string): void; + directoryDeepSubDirs(path: string, array: any[], msg?: string): void; + notDirectoryDeepSubDirs(path: string, array: any[], msg?: string): void; + directoryIncludeSubDirs(path: string, array: any[], msg?: string): void; + notDirectoryIncludeSubDirs(path: string, array: any[], msg?: string): void; + + // directory().and.equal(otherPath) + directoryEqual(path: string, otherPath: string, msg?: string): void; + notDirectoryEqual(path: string, otherPath: string, msg?: string): void; + directoryDeepEqual(path: string, otherPath: string, msg?: string): void; + notDirectoryDeepEqual(path: string, otherPath: string, msg?: string): void; + + // file + file(msg?: string): void; + isFile(path: string, msg?: string): void; + notIsFile(path: string, msg?: string): void; + + // file().and.empty + isEmptyFile(path: string, msg?: string): void; + notIsEmptyFile(path: string, msg?: string): void; + + // file().with.content(str) + fileContent(path: string, data: any, msg?: string): void; + notFileContent(path: string, data: any, msg?: string): void; + + // file().with.contents.that.match(/xyz/) + fileContentMatch(path: string, regExp: RegExp, msg?: string): void; + notFileContentMatch(path: string, regExp: RegExp, msg?: string): void; + + // file().and.equal(otherPath) + fileEqual(path: string, otherPath: string, msg?: string): void; + notFileEqual(path: string, otherPath: string, msg?: string): void; + + // file().with.json + jsonFile(path: string, msg?: string): void; + notJsonFile(path: string, msg?: string): void; + + // file().using.json.schema(obj) + jsonSchemaFile(path: string, schema: any, msg?: string): void; + notJsonSchemaFile(path: string, schema: any, msg?: string): void; + schema(obj: object): void; + } + } +} + +declare function chaiFs(chai: any, utils: any): void; +export = chaiFs; + +interface Object { + should: Chai.Assertion; +} diff --git a/types/chai-fs/tsconfig.json b/types/chai-fs/tsconfig.json new file mode 100644 index 0000000000..8ca5abeb7d --- /dev/null +++ b/types/chai-fs/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chai-fs-tests.ts" + ] +} diff --git a/types/chai-fs/tslint.json b/types/chai-fs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chai-fs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/chai-http/tsconfig.json b/types/chai-http/tsconfig.json index 3554b4ab09..45d92cf188 100644 --- a/types/chai-http/tsconfig.json +++ b/types/chai-http/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/chai-jest-snapshot/tslint.json b/types/chai-jest-snapshot/tslint.json index 3db14f85ea..1c36270d47 100644 --- a/types/chai-jest-snapshot/tslint.json +++ b/types/chai-jest-snapshot/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-angle-bracket-type-assertion": false + } +} diff --git a/types/chai-jquery/chai-jquery-tests.ts b/types/chai-jquery/chai-jquery-tests.ts index 894acf9ca5..bd798be847 100644 --- a/types/chai-jquery/chai-jquery-tests.ts +++ b/types/chai-jquery/chai-jquery-tests.ts @@ -67,6 +67,10 @@ function test_disabled() { expect($('#foo')).to.be.disabled; } +function test_enabled() { + expect($('#foo')).to.be.enabled; +} + function test_empty() { $('.empty').should.be.empty; expect($('body')).not.to.be.empty; diff --git a/types/chai-jquery/index.d.ts b/types/chai-jquery/index.d.ts index bd6826ca08..c2827d2e05 100644 --- a/types/chai-jquery/index.d.ts +++ b/types/chai-jquery/index.d.ts @@ -25,6 +25,7 @@ declare namespace Chai { selected(): Assertion; checked(): Assertion; disabled(): Assertion; + enabled(): Assertion; (selector: string): Assertion; } diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 2c81c42aeb..36002d9bfa 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -808,6 +808,24 @@ function frozen() { expect(Object.freeze({})).to.be.frozen; ({}).should.be.not.frozen; Object.freeze({}).should.be.frozen; + + expect([1, 2, 3]).to.have.all.members([1, 2, 3]); + expect([1, 2, 3]).to.have.all.members(Object.freeze([1, 2, 3])); + + expect({1: "", 2: "", 3: ""}).to.have.all.keys([1, 2, 3]); + expect({1: "", 2: "", 3: ""}).to.have.all.keys(Object.freeze([1, 2, 3])); + + assert.notDeepInclude([1, 2, 3], 1); + assert.notDeepInclude(Object.freeze([1, 2, 3]), 1); + + assert.include([1, 2, 3], 1); + assert.include(Object.freeze([1, 2, 3]), 1); + + assert.notInclude([1, 2, 3], 1); + assert.notInclude(Object.freeze([1, 2, 3]), 1); + + expect([1, 2, 3]).to.have.oneOf([1, 2, 3]); + expect([1, 2, 3]).to.have.oneOf(Object.freeze([1, 2, 3])); } class PoorlyConstructedError { @@ -1145,6 +1163,8 @@ function members() { expect([5, 4]).not.members([]); expect([5, 4]).not.members([6, 3]); expect([5, 4]).not.members([5, 4, 2]); + + expect([5, 4]).to.have.all.members([4, 5]); } function increaseDecreaseChange() { diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 6f0edecc06..5f73803757 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -118,7 +118,7 @@ declare namespace Chai { extensible: Assertion; sealed: Assertion; frozen: Assertion; - oneOf(list: any[], message?: string): Assertion; + oneOf(list: ReadonlyArray, message?: string): Assertion; } interface LanguageChains { @@ -195,6 +195,7 @@ declare namespace Chai { interface KeyFilter { keys: Keys; + members: Members; } interface Equal { @@ -234,7 +235,7 @@ declare namespace Chai { interface Keys { (...keys: string[]): Assertion; - (keys: any[]|Object): Assertion; + (keys: ReadonlyArray|Object): Assertion; } interface Throw { @@ -251,7 +252,7 @@ declare namespace Chai { } interface Members { - (set: any[], message?: string): Assertion; + (set: ReadonlyArray, message?: string): Assertion; } interface PropertyChange { @@ -695,7 +696,7 @@ declare namespace Chai { * @param needle Potential value contained in haystack. * @param message Message to display on error. */ - include(haystack: T[], needle: T, message?: string): void; + include(haystack: ReadonlyArray, needle: T, message?: string): void; /** * Asserts that haystack does not include needle. @@ -704,7 +705,7 @@ declare namespace Chai { * @param needle Potential expected substring of haystack. * @param message Message to display on error. */ - notInclude(haystack: string | any[], needle: any, message?: string): void; + notInclude(haystack: string | ReadonlyArray, needle: any, message?: string): void; /** * Asserts that haystack includes needle. Can be used to assert the inclusion of a value in an array or a subset of properties in an object. Deep equality is used. @@ -731,7 +732,7 @@ declare namespace Chai { * @param needle Potential expected substring of haystack. * @param message Message to display on error. */ - notDeepInclude(haystack: string | any[], needle: any, message?: string): void; + notDeepInclude(haystack: string | ReadonlyArray, needle: any, message?: string): void; /** * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 41ab453e0f..705392baed 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -19,7 +19,7 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), { backgroundColor: "#000000", borderWidth: 1, label: "test", - data: [1] + data: [1, null, 3] } ] }, @@ -36,6 +36,7 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), { tooltips: { filter: data => Number(data.yLabel) > 0, intersect: true, + mode: 'index', itemSort: (a, b) => Math.random() - 0.5, position: "average", caretPadding: 2, @@ -125,6 +126,7 @@ const chartConfig: Chart.ChartConfiguration = { backgroundColor: '#37738353', borderColor: '#37738353', borderWidth: 3, + borderCapStyle: 'round', fill: true }] }, diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 37f4757460..884ddaa760 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -10,7 +10,6 @@ // Guillaume Rodriguez // Simon Archer // Ken Elkabany -// Slavik Nychkalo // Francesco Benedetto // Alexandros Dorodoulis // Manuel Heidrich @@ -174,6 +173,8 @@ declare namespace Chart { type PositionType = 'left' | 'right' | 'top' | 'bottom'; + type InteractionMode = 'point' | 'nearest' | 'single' | 'label' | 'index' | 'x-axis' | 'dataset' | 'x' | 'y'; + interface ChartArea { top: number; right: number; @@ -185,10 +186,10 @@ declare namespace Chart { text?: string; fillStyle?: string; hidden?: boolean; - lineCap?: string; + lineCap?: 'butt' | 'round' | 'square'; lineDash?: number[]; lineDashOffset?: number; - lineJoin?: string; + lineJoin?: 'bevel' | 'round' | 'miter'; lineWidth?: number; strokeStyle?: string; pointStyle?: PointStyle; @@ -331,7 +332,7 @@ declare namespace Chart { interface ChartTooltipOptions { enabled?: boolean; custom?(a: any): void; - mode?: string; + mode?: InteractionMode; intersect?: boolean; backgroundColor?: ChartColor; titleFontFamily?: string; @@ -373,7 +374,7 @@ declare namespace Chart { type ChartTooltipPositioner = (elements: any[], eventPosition: Point) => Point; interface ChartHoverOptions { - mode?: string; + mode?: InteractionMode; animationDuration?: number; intersect?: boolean; onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any; @@ -479,7 +480,12 @@ declare namespace Chart { fontStyle?: string; } - interface TickOptions { + interface TickOptions extends NestedTickOptions { + minor?: NestedTickOptions | false; + major?: NestedTickOptions | false; + } + + interface NestedTickOptions { autoSkip?: boolean; autoSkipPadding?: number; backdropColor?: ChartColor; @@ -504,6 +510,7 @@ declare namespace Chart { reverse?: boolean; showLabelBackdrop?: boolean; source?: 'auto' | 'data' | 'labels'; + stepSize?: number; suggestedMax?: number; suggestedMin?: number; } @@ -540,12 +547,12 @@ declare namespace Chart { backgroundColor?: ChartColor | ChartColor[]; borderWidth?: number | number[]; borderColor?: ChartColor | ChartColor[]; - borderCapStyle?: string; + borderCapStyle?: 'butt' | 'round' | 'square'; borderDash?: number[]; borderDashOffset?: number; - borderJoinStyle?: string; + borderJoinStyle?: 'bevel' | 'round' | 'miter'; borderSkipped?: PositionType; - data?: number[] | ChartPoint[]; + data?: Array | ChartPoint[]; fill?: boolean | number | string; hoverBackgroundColor?: string | string[]; hoverBorderColor?: string | string[]; @@ -565,7 +572,7 @@ declare namespace Chart { pointStyle?: PointStyle | HTMLImageElement | HTMLCanvasElement | Array; xAxisID?: string; yAxisID?: string; - type?: string; + type?: ChartType | string; hidden?: boolean; hideInLegendAndTooltip?: boolean; showLine?: boolean; diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index bd7006723e..cb7f884264 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -197,6 +197,7 @@ new Chartist.Bar('.ct-chart', { }, { // Default mobile configuration stackBars: true, + stackMode: 'accumulate', axisX: { labelInterpolationFnc: (value: string) => { return value.split(/\s+/).map((word: string) => { diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index 3d72210c73..9b096839cc 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -283,6 +283,7 @@ declare namespace Chartist { * If set to true this property will cause the series bars to be stacked and form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect. */ stackBars?: boolean; + stackMode?: 'overlap' | 'accumulate'; horizontalBars?: boolean; distributeSeries?: boolean; diff --git a/types/chartmogul-node/common.d.ts b/types/chartmogul-node/common.d.ts index ced10f98d7..d12587f090 100644 --- a/types/chartmogul-node/common.d.ts +++ b/types/chartmogul-node/common.d.ts @@ -1,5 +1,5 @@ export interface Map { - [key: string]: any + [key: string]: any; } export interface CursorParams { page?: number; @@ -15,9 +15,9 @@ export interface Cursor { total_pages?: number; } export interface Entries extends Cursor { - entries: T[] + entries: T[]; } -interface Summary { +export interface Summary { current: number; previous: number; ['percentage-change']: number; @@ -25,4 +25,4 @@ interface Summary { export interface EntriesSummary { entries: T[]; summary: Summary; -} \ No newline at end of file +} diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index cb8031705e..6c893021a3 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Cheerio v0.22.0 // Project: https://github.com/cheeriojs/cheerio -// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani , LiJinyao , Chennakrishna +// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani , LiJinyao , Chennakrishna , AzSiAz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Cheerio { @@ -111,9 +111,8 @@ interface Cheerio { eq(index: number): Cheerio; - get(): string[]; - get(): CheerioElement[]; - get(index: number): CheerioElement; + get(): any[]; + get(index: number): any; index(): number; index(selector: string): number; diff --git a/types/chordsheetjs/chordsheetjs-tests.ts b/types/chordsheetjs/chordsheetjs-tests.ts new file mode 100644 index 0000000000..7f01828e7f --- /dev/null +++ b/types/chordsheetjs/chordsheetjs-tests.ts @@ -0,0 +1,5 @@ +import { Song, HtmlTableFormatter } from 'chordsheetjs'; + +const song = new Song({ key: 'value' }); +const formatter = new HtmlTableFormatter(); +formatter.format(song); diff --git a/types/chordsheetjs/index.d.ts b/types/chordsheetjs/index.d.ts new file mode 100644 index 0000000000..ee2e69593f --- /dev/null +++ b/types/chordsheetjs/index.d.ts @@ -0,0 +1,372 @@ +// Type definitions for chordsheetjs 2.8 +// Project: https://github.com/martijnversluis/ChordSheetJS +// Definitions by: Adam Bloom +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/** + * Represents a chord with the corresponding (partial) lyrics + */ +export class ChordLyricsPair { + /** + * Initialises a ChordLyricsPair + * @param chords The chords + * @param lyrics The lyrics + */ + constructor(chords: string, lyrics: string); + + chords: string; + lyrics: string; + + /** + * Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets) + */ + isRenderable: () => boolean; + + /** + * Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song + */ + clone: () => ChordLyricsPair; + + toString: () => string; +} + +/** + * Represents a tag/directive. See https://www.chordpro.org/chordpro/ChordPro-Directives.html + */ +export class Tag { + constructor(name: string, value: string | null); + + /** + * The tag full name. When the original tag used the short name, `name` will return the full name. + */ + name: string; + + /** + * The tag value + */ + value: string | null; + + static parse(tag: string): Tag | null; + static parseWithRegex(tag: string, regex: string): Tag | null; + + /** + * The original tag name that was used to construct the tag. + */ + originalName: string; + + /** + * Checks whether the tag value is a non-empty string. + */ + hasValue(): boolean; + + /** + * Checks whether the tag is usually rendered inline. It currently only applies to comment tags. + */ + isRenderable(): boolean; + + /** + * Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`) + */ + isMetaTag(): boolean; + + /** + * Returns a clone of the tag. + */ + clone(): Tag; + + toString(): string; +} + +/** + * Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag + */ +export class Line { + constructor(); + + /** + * The items (ChordLyricsPair or Tag) of which the line consists + */ + items: Array; + + /** + * The line type, This is set by the ChordProParser when it read tags like {start_of_chorus} or {start_of_verse} + * Values can be 'verse', 'chorus' or 'none' + */ + type: 'verse' | 'chorus' | 'none'; + + /** + * Indicates whether the line contains any items + */ + isEmpty(): boolean; + + /** + * Adds an item to the line + * @param item The item to be added + */ + addItem(item: ChordLyricsPair | Tag): void; + + /** + * Indicates whether the line contains items that are renderable + */ + hasRenderableItems(): boolean; + + /** + * Returns a deep copy of the line and all of its items + */ + clone(): Line; + + /** + * Indicates whether the line type is 'verse' + */ + isVerse(): boolean; + + /** + * Indicates whether the line type is 'chorus' + */ + isChorus(): boolean; + + /** + * Indicates whether the line contains items that are renderable. Please use hasRenderableItems + * @deprecated + */ + hasContent(): boolean; + + addChordLyricsPair( + chords: ChordLyricsPair | string, + lyrics: string + ): ChordLyricsPair; + ensureChordLyricsPair(): void; + chords(chr: string): void; + lyrics(chr: string): void; + addTag(name: Tag | string, value: string | null): Tag; +} + +/** + * Represents a paragraph of lines in a chord sheet + */ +export class Paragraph { + constructor(); + + /** + * The Line items of which the paragraph consists + */ + lines: Line[]; + + addLine(line: Line): void; + + /** + * Tries to determine the common type for all lines. If the types for all lines are equal, it returns that type. + * If not, it returns 'indeterminate'. + */ + type: string; +} + +/** + * Represents a song in a chord sheet. Currently a chord sheet can only have one song. + */ +export class Song { + constructor(metadata: object); + + /** + * The Line items of which the song consists + */ + lines: Line[]; + + /** + * The Paragraph items of which the song consists + */ + paragraphs: Paragraph[]; + + currentLine: Line; + currentParagraph: Paragraph; + assignMetaData(metadata: object): void; + + /** + * Returns the song lines, skipping the leading empty lines (empty as in not rendering any content). This is useful + * if you want to skip the "header lines": the lines that only contain meta data. + */ + bodyLines: Line[]; + + chords(chr: string): void; + lyrics(chr: string): void; + addLine(): Line; + setCurrentLineType(type: string): void; + flushLine(): void; + finish(): void; + addChordLyricsPair(): ChordLyricsPair; + ensureLine(): void; + addParagraph(): Paragraph; + ensureParagraph(): void; + addTag(tagContents: string): Tag; + + /** + * Returns a deep clone of the song + */ + clone(): Song; + + setMetaData(name: string, value: string): void; + metaData: object; + optimizedMetaData: object; + getOptimizedMetaData(): object; + optimizeMetaDataValue( + valueSet: string[] | undefined + ): string | string[] | null; + getMetaData(name: string): string | null; +} + +/** + * Represents a parser warning, currently only used by ChordProParser. + */ +export class ParserWarning { + /** + * The warning message + */ + message: string; + + /** + * The line number on which the warning occurred + */ + lineNumber: string; + + toString(): string; +} + +/** + * Parses a ChordPro chord sheet + */ +export class ChordProParser { + /** + * Parses a ChordPro chord sheet into a song + * @param chordProChordSheet The ChordPro chord sheet + */ + parse(chordProChordSheet: string): Song; + + song: Song; + lineNumber: number; + sectionType: string; + warnings: ParserWarning[]; + + parseDocument(document: string): void; + readLyrics(chr: string): void; + readChords(chr: string): void; + readTag(chr: string): void; + readComment(chr: string): void; + finishTag(): void; + resetTag(): void; + applyTag(tag: Tag): void; + startSection(sectionType: string, tag: Tag): void; + endSection(sectionType: string, tag: Tag): void; + checkCurrentSectionType(sectionType: string, tag: Tag): void; + addWarning(message: string): void; +} + +export interface ChordSheetParserProps { + preserveWhitespace: boolean; +} + +/** + * Formats a song into a plain text chord sheet + */ +export class ChordSheetParser { + constructor(props: ChordSheetParserProps); + + song: Song; + lines: Line[]; + songLine: Line; + chordLyricsPair: ChordLyricsPair; + currentLine: number; + lineCount: number; + processingText: string; + preserveWhitespace: boolean; + + /** + * Parses a chord sheet into a song + * @param chordSheet The ChordPro chord sheet + */ + parse(chordSheet: string): Song; + + parseLine(line: string): void; + parseNonEmptyLine(line: string): void; + initialize(document: string): void; + readLine(): Line; + hasNextLine(): boolean; + parseLyricsWithChords(chordsLine: string, lyricsLine: string): void; + processCharacters(chordsLine: string, lyricsLine: string): void; + addCharacter(chr: string, nextChar: string): void; + shouldAddCharacterToChords(nextChar: string): boolean; + ensureChordLyricsPairInitialized(): void; +} + +export interface SongHeader { + title: string; + subtitle: string; +} + +export class TextFormatter { + constructor(); + /** + * Formats a song into a plain text chord sheet + * @param song The song to be formatted + */ + format(song: Song): string; + formatHeader(header: SongHeader): string; + formatParagraphs(song: Song): string; + formatParagraph(paragraph: Paragraph): string; + formatLine(line: Line): string; + formatTitle(title: string): string; + formatSubtitle(subtitle: string): string; + formatTopLine(line: Line): string | null; + chordLyricsPairLength(chordLyricsPair: ChordLyricsPair): number; + formatItemTop(item: Tag | ChordLyricsPair | Line): string; + formatLineBottom(line: Line): string; + formatLineWithFormatter( + line: Line, + formatter: (x: string) => string + ): string; + formatItemBottom(item: Tag | ChordLyricsPair | Line): string; +} + +/** + * Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like + * PDF conversion. + */ +export class HtmlTableFormatter { + constructor(); + /** + * Formats a song into HTML. + * @param song The song to be formatted + */ + format(song: Song): string; +} + +/** + * Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages. + */ +export class HtmlDivFormatter { + constructor(); + /** + * Formats a song into HTML. + * @param song The song to be formatted + */ + format(song: Song): string; +} + +/** + * Formats a song into a ChordPro chord sheet + */ +export class ChordProFormatter { + constructor(); + /** + * Formats a song into a ChordPro chord sheet. + * @param song The song to be formatted + */ + format(song: Song): string; + + formatLine(line: Line): string; + formatItem(item: Tag | ChordLyricsPair | Line): string; + formatTag(tag: Tag): string; + formatChordLyricsPair(chordLyricsPair: ChordLyricsPair): string; + formatChordLyricsPairChords(chordLyricsPair: ChordLyricsPair): string; + formatChordLyricsPairLyrics(chordLyricsPair: ChordLyricsPair): string; +} diff --git a/types/chordsheetjs/tsconfig.json b/types/chordsheetjs/tsconfig.json new file mode 100644 index 0000000000..0b2e8140ca --- /dev/null +++ b/types/chordsheetjs/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "chordsheetjs-tests.ts"] +} diff --git a/types/chordsheetjs/tslint.json b/types/chordsheetjs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chordsheetjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/chroma-js/chroma-js-tests.ts b/types/chroma-js/chroma-js-tests.ts index fdd1b5946b..f1709dd31a 100644 --- a/types/chroma-js/chroma-js-tests.ts +++ b/types/chroma-js/chroma-js-tests.ts @@ -82,6 +82,9 @@ function test_color() { chroma('aquamarine').luminance(0.5, 'lab'); chroma('aquamarine').luminance(0.5, 'hsl'); chroma('orange').hex(); + chroma('orange').hex('auto'); + chroma('orange').hex('rgb'); + chroma('orange').alpha(0.5).hex('rgba'); chroma('#ffa500').name(); chroma('#ffa505').name(); chroma('teal').css(); @@ -107,6 +110,11 @@ function test_color() { chroma('teal').alpha(0.5).css(); chroma('teal').css('hsl'); chroma('orange').rgb(); + + chroma('#000000').num(); + chroma('#0000ff').num(); + chroma('#00ff00').num(); + chroma('#ff0000').num(); } function test_scale() { diff --git a/types/chroma-js/index.d.ts b/types/chroma-js/index.d.ts index faeba01bb1..162a318dc8 100644 --- a/types/chroma-js/index.d.ts +++ b/types/chroma-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Chroma.js 1.3 +// Type definitions for Chroma.js 1.4 // Project: https://github.com/gka/chroma.js // Definitions by: Sebastian Brückner , Marcin Pacholec // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -260,9 +260,18 @@ declare namespace chroma { luminance(l: number, colorSpace?: keyof ColorSpaces): Color; /** - * Get color as hexadecimal string. E.g. '#ffa500' + * Get color as hexadecimal string. + * + * @param mode `auto` - string will include alpha channel only if it's less than 1. + * `rgb` - string will not include alpha channel. + * `rgba` - string will include alpha channel. + * + * @example + * chroma('orange').hex() === '#ffa500' + * chroma('orange').alpha(0.5).hex() === '#ffa50080' + * chroma('orange').alpha(0.5).hex('rgb') === '#ffa500' */ - hex(): string; + hex(mode?: 'auto' | 'rgb' | 'rgba'): string; /** * Returns the named color. Falls back to hexadecimal RGB string, if the color isn't present. @@ -280,6 +289,17 @@ declare namespace chroma { * [temperature gradient]{@link ChromaStatic.temperature} above. */ temperature(): number; + + /** + * Returns the numeric representation of the hexadecimal RGB color. + * + * @example + * chroma('#000000').num() === 0 + * chroma('#0000ff').num() === 255 + * chroma('#00ff00').num() === 65280 + * chroma('#ff0000').num() === 16711680 + */ + num(): number; } & { [K in keyof ColorSpaces]: () => ColorSpaces[K]; }; diff --git a/types/chrome-apps/index.d.ts b/types/chrome-apps/index.d.ts index 33b760ce82..8873e80da2 100644 --- a/types/chrome-apps/index.d.ts +++ b/types/chrome-apps/index.d.ts @@ -612,7 +612,10 @@ declare namespace chrome { * @deprecated Deprecated since Chrome 36. Use innerBounds or outerBounds. */ maxHeight?: integer; - /** Type of window to create */ + /** + * @deprecated Deprecated since Chrome 69. All app windows use the 'shell' window type. + * @description Type of window to create + **/ type?: 'shell'; /** * If true, the window will have its own shelf icon. @@ -919,7 +922,8 @@ declare namespace chrome { level?: integer; } /** - * Device properties by which to filter the list of returned audio devices. If the filter is not set or set to {}, returned device list will contain all available audio devices. + * Device properties by which to filter the list of returned audio devices. + * If the filter is not set or set to {}, returned device list will contain all available audio devices. */ interface Filter { /** @@ -1083,8 +1087,9 @@ declare namespace chrome { function getDevices(callback: (devices: Device[]) => void): void; /** - * Get a list of Bluetooth devices known to the system, including paired and recently discovered devices. - * @param filter Since Chrome 67. Some criteria to filter the list of returned bluetooth devices. If the filter is not set or set to {}, returned device list will contain all bluetooth devices. Right now this is only supported in ChromeOS, for other platforms, a full list is returned. + * @since Chrome 67. + * @description Get a list of Bluetooth devices known to the system, including paired and recently discovered devices. + * @param filter Some criteria to filter the list of returned bluetooth devices. If the filter is not set or set to {}, returned device list will contain all bluetooth devices. Right now this is only supported in ChromeOS, for other platforms, a full list is returned. * @param callback Called when the search is completed. */ function getDevices(filter: DeviceFilter, callback: (devices: Device[]) => void): void; @@ -2082,12 +2087,12 @@ declare namespace chrome { /** * **Dev channel only.** * Sets image data to clipboard - * @param imageData The encoded image data. *Since Chrome 70. Warning: this is the current Beta channel.* - * @param type The type of image being passed. *Since Chrome 70. Warning: this is the current Beta channel.* + * @param imageData The encoded image data. *Since Chrome 71. Warning: this is the current Dev channel.* + * @param type The type of image being passed. *Since Chrome 71. Warning: this is the current Dev channel.* * @param [additionalItems] Additional data items for describing image data. * The callback is called with chrome.runtime.lastError set to error code if there is an error. * Requires clipboard and clipboardWrite permissions. - * *Since Chrome 70. Warning: this is the current Beta channel.* + * *Since Chrome 71. Warning: this is the current Dev channel.* * @param [callback] */ function setImageData(imageData: ArrayBuffer, type: ImageType, additionalItems?: AdditionalItems, callback?: () => void): void; @@ -3078,7 +3083,8 @@ declare namespace chrome { 'document_end' | 'document_idle'; /** - * The origin of injected CSS. + * @since Chrome 66. + * @description The origin of injected CSS. **/ type CSSOrigin = 'author' | @@ -3363,7 +3369,7 @@ declare namespace chrome { function chooseEntry(options: ChooseEntryOptionsBase, callback: FileEntryCallback): void; function chooseEntry(options: ChooseFileEntryOptions, callback: FileEntryCallback): void; function chooseEntry(options: ChooseSaveFileEntryOptions, callback: FileEntryCallback): void; - function chooseEntry(options: ChooseMultipleFilesEntryOptions, callback: FileEntryCallback): void; + function chooseEntry(options: ChooseMultipleFilesEntryOptions, callback: FileEntryCallback): void; function chooseEntry(options: ChooseDirectoryEntryOptions, callback: FileEntryCallback): void; /** Returns the file entry with the given id if it can be restored. This call will fail with a runtime error otherwise. */ function restoreEntry(id: string, callback: (entry: FileEntry) => void): void; @@ -5968,6 +5974,11 @@ declare namespace chrome { SSID?: S; /** The network signal strength. */ SignalStrength?: integer; + /** + * @since Chrome 70 + * @description The tethering state associated with the connection. + */ + TetheringState?: string; } interface WiFiProperties void>; /** - * The user clicked on a link for the app's notification settings. - * @since Chrome 32. + * @deprecated Deprecated since Chrome 65. Custom notification settings button is no longer supported. + * @description The user clicked on a link for the app's notification settings. + * As of Chrome 47, only ChromeOS has UI that dispatches this event. + * As of Chrome 65, that UI has been removed from ChromeOS, too. */ const onShowSettings: chrome.events.Event<() => void>; @@ -9319,7 +9339,10 @@ declare namespace chrome { /** The display mode height in native pixels. */ heightInNativePixels: integer; - /** The display mode UI scale factor. */ + /** + * @deprecated Deprecated since Chrome 70. Use `displayZoomFactor` + * @description The display mode UI scale factor. + **/ uiScale: integer; /** The display mode device scale factor. */ @@ -9380,15 +9403,16 @@ declare namespace chrome { * If set to true, changes the display mode to unified desktop. * If set to false, unified desktop mode will be disabled. * This is only valid for the primary display. - * If provided, mirroringSourceId must not be provided and other properties may not apply. This is has no effect if not provided. - * @see(See enableUnifiedDesktop for details). + * If provided, mirroringSourceId must not be provided and other properties may not apply. + * This is has no effect if not provided. + * @see(See `enableUnifiedDesktop` for details). * @since Chrome 59 * */ isUnified?: boolean; /** * @requires(CrOS) Chrome OS only. - * @deprecated Deprecated since Chrome 68. Use *setMirrorMode* + * @deprecated Deprecated since Chrome 68. Use ´setMirrorMode´ * @see setMirrorMode * @description * If set and not empty, enables mirroring for this display. @@ -9416,7 +9440,7 @@ declare namespace chrome { * If set, updates the display's rotation. * Legal values are [0, 90, 180, 270]. * The rotation is set clockwise, relative to the display's vertical position. - * It's applied after overscan paramter. + * It's applied after overscan parameter. */ rotation?: 0 | 90 | 180 | 270; @@ -9912,10 +9936,10 @@ declare namespace chrome { /** The language that this voice supports, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ lang?: string; /** - * This voice's gender. - * One of: 'male', or 'female' + * @deprecated Deprecated since Chrome 70. Gender is deprecated and will be ignored. + * @description This voice's gender. */ - gender?: string; + gender?: 'male' | 'female'; /** The name of the voice. */ voiceName?: string; /** The ID of the extension providing this voice. */ @@ -9959,10 +9983,10 @@ declare namespace chrome { /** The extension ID of the speech engine to use, if known. */ extensionId?: string; /** - * Gender of voice for synthesized speech. - * One of: 'male', or 'female' + * @deprecated Deprecated since Chrome 70. Gender is deprecated and will be ignored. + * @description Gender of voice for synthesized speech. */ - gender?: string; + gender?: 'male' | 'female'; /** The TTS event types the voice must support. */ requiredEventTypes?: string[]; /** The TTS event types that you are interested in listening to. If missing, all event types may be sent. */ @@ -10983,7 +11007,7 @@ declare namespace chrome { */ class RequestMatcher { protected readonly typeGuard: 'RequestMatcher'; - constructor (parameters?: RequestMatcherFields); + constructor(parameters?: RequestMatcherFields); public readonly instanceType: string; } @@ -11001,7 +11025,7 @@ declare namespace chrome { /** Declarative event action that redirects a network request. */ class RedirectRequest { protected readonly typeGuard: 'RedirectRequest'; - constructor (parameters: RedirectRequestParams); + constructor(parameters: RedirectRequestParams); public readonly instanceType: string; } @@ -11036,7 +11060,7 @@ declare namespace chrome { */ class RedirectByRegEx { protected readonly typeGuard: 'RedirectByRegEx'; - constructor (parameters: RedirectByRegExParams); + constructor(parameters: RedirectByRegExParams); public readonly instanceType: string; } @@ -11055,7 +11079,7 @@ declare namespace chrome { */ class SetRequestHeader { protected readonly typeGuard: 'SetRequestHeader'; - constructor (parameters: SetRequestHeaderParams); + constructor(parameters: SetRequestHeaderParams); public readonly instanceType: string; } @@ -11072,7 +11096,7 @@ declare namespace chrome { */ class RemoveRequestHeader { protected readonly typeGuard: 'RemoveRequestHeader'; - constructor (parameters: RemoveRequestHeaderParams); + constructor(parameters: RemoveRequestHeaderParams); public readonly instanceType: string; } @@ -11091,7 +11115,7 @@ declare namespace chrome { */ class AddResponseHeader { protected readonly typeGuard: 'AddResponseHeader'; - constructor (parameters: AddResponseHeaderParams); + constructor(parameters: AddResponseHeaderParams); public readonly instanceType: string; } @@ -11107,7 +11131,7 @@ declare namespace chrome { */ class RemoveResponseHeader { protected readonly typeGuard: 'RemoveResponseHeader'; - constructor (parameters: RemoveResponseHeaderParams); + constructor(parameters: RemoveResponseHeaderParams); public readonly instanceType: string; } @@ -11133,7 +11157,7 @@ declare namespace chrome { */ class IgnoreRules { protected readonly typeGuard: 'IgnoreRules'; - constructor (parameters: IgnoreRulesParams); + constructor(parameters: IgnoreRulesParams); public readonly instanceType: string; } @@ -11150,7 +11174,7 @@ declare namespace chrome { */ class SendMessageToExtension { protected readonly typeGuard: 'SendMessageToExtension'; - constructor (parameters: SendMessageParams); + constructor(parameters: SendMessageParams); public readonly instanceType: string; } @@ -11248,7 +11272,7 @@ declare namespace chrome { */ class AddRequestCookie { protected readonly typeGuard: 'AddRequestCookie'; - constructor (parameters: AddCookie); + constructor(parameters: AddCookie); public readonly instanceType: string; } @@ -11259,7 +11283,7 @@ declare namespace chrome { */ class AddResponseCookie { protected readonly typeGuard: 'AddResponseCookie'; - constructor (parameters: AddCookie); + constructor(parameters: AddCookie); public readonly instanceType: string; } @@ -11292,7 +11316,7 @@ declare namespace chrome { * @param modification Attributes that shall be overridden in cookies that machted the filter. * Attributes that are set to an empty string are removed. */ - constructor (parameters: EditCookieParams); + constructor(parameters: EditCookieParams); public readonly instanceType: string; } @@ -11306,7 +11330,7 @@ declare namespace chrome { * @param filter Filter for cookies that will be modified.All empty entries are ignored. * @param modification */ - constructor (parameter: EditCookieParams); + constructor(parameter: EditCookieParams); public readonly instanceType: string; } @@ -11316,7 +11340,7 @@ declare namespace chrome { */ class RemoveRequestCookie { protected readonly typeGuard: 'RemoveRequestCookie'; - constructor (parameters: RemoveCookieParams); + constructor(parameters: RemoveCookieParams); public readonly instanceType: string; } @@ -11340,7 +11364,7 @@ declare namespace chrome { */ class RemoveResponseCookie { protected readonly typeGuard: 'RemoveResponseCookie'; - constructor (parameters: RemoveCookieParams); + constructor(parameters: RemoveCookieParams); public readonly instanceType: string; } @@ -11518,7 +11542,7 @@ declare namespace chrome { */ declare class HTMLAppViewElement extends HTMLElement { /** Create a new AppView tag */ - constructor (); + constructor(); /** * Requests another app to be embedded. * @param app The extension id of the app to be embedded. @@ -11626,7 +11650,7 @@ declare class HTMLWebViewElement extends HTMLElement { src: string; /** Create a new element */ - constructor (); + constructor(); /** * Queries audio state. @@ -11908,6 +11932,21 @@ declare class HTMLWebViewElement extends HTMLElement { */ loadDataWithBaseUrl(dataUrl: string, baseUrl: string, virtualUrl?: string): void; + /** + * @since Chrome 71 + * @description Sets spatial navigation state of the webview. + * @param enabled Spatial navigation state value. + */ + setSpatialNavigationEnabled(enabled: boolean): void; + + /** + * @since Chrome 71 + * @description Queries whether spatial navigation is enabled for the webview. + * @param callback Callback that will provide the value of the spatial navigation state. + */ + isSpatialNavigationEnabled(callback: (enabled: boolean) => void): void; + + /** * Forcibly kills the guest web page's renderer process. * This may affect multiple webview tags in the current app if they share the same process, diff --git a/types/chrome-apps/test/index.ts b/types/chrome-apps/test/index.ts index 93864d107b..499a34bab1 100644 --- a/types/chrome-apps/test/index.ts +++ b/types/chrome-apps/test/index.ts @@ -1114,6 +1114,7 @@ chrome.networking.onc.getNetworks({ 'networkType': 'All' }, (networkList) => { if (networkObj.WiFi) { // WiFi active :) console.log('Wifi BSID: ' + networkObj.WiFi.BSSID); + const state = networkObj.WiFi.TetheringState; } chrome.networking.onc.setProperties(networkObj.GUID || '', { WiFi: { @@ -1124,6 +1125,19 @@ chrome.networking.onc.getNetworks({ 'networkType': 'All' }, (networkList) => { chrome.networking.onc.getProperties(networkObj.GUID || '', (props) => { const WiFiResult = props.WiFi; }); + chrome.networking.onc.getState(networkObj.GUID || '', (state) => { + const wifiState = state.WiFi || {}; + return wifiState.TetheringState; + }); + chrome.networking.onc.getManagedProperties(networkObj.GUID || '', (result) => { + const wifiResult = result.WiFi; + if (wifiResult !== undefined) { + const managed = wifiResult.HexSSID; + if (managed !== undefined) { + return managed.UserPolicy; + } + } + }); } }); diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 49f079e159..ba074550f8 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -4525,12 +4525,12 @@ declare namespace chrome.pageAction { * Shows the page action. The page action is shown whenever the tab is selected. * @param tabId The id of the tab for which you want to modify the page action. */ - export function hide(tabId: number): void; + export function hide(tabId: number, callback?: () => void): void; /** * Shows the page action. The page action is shown whenever the tab is selected. * @param tabId The id of the tab for which you want to modify the page action. */ - export function show(tabId: number): void; + export function show(tabId: number, callback?: () => void): void; /** Sets the title of the page action. This is displayed in a tooltip over the page action. */ export function setTitle(details: TitleDetails): void; /** Sets the html document to be opened as a popup when the user clicks on the page action's icon. */ diff --git a/types/chrome/tslint.json b/types/chrome/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/chrome/tslint.json +++ b/types/chrome/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index a6f9c9cf5c..6a0b50a4d8 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -914,6 +914,9 @@ function test_skin() { CKEDITOR.skin.loadPart('part', () => console.log('load')); var path2: string = CKEDITOR.skin.path(); + + CKEDITOR.skin.ua_dialog = 'ie,iequirks,ie8,gecko'; + CKEDITOR.skin.ua_editor = 'ie,gecko'; } function test_style() { diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 6815d3aa98..69c23d6a99 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -2,6 +2,7 @@ // Project: https://ckeditor.com/ckeditor-4/ // Definitions by: Thomas Wittwer // Stuart Long +// Viktor Pegy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // WORK-IN-PROGRESS: Any contribution support welcomed. @@ -2168,6 +2169,8 @@ declare namespace CKEDITOR { // tslint:disable-next-line:no-duplicate-variable var name: string; var ua: { [name: string]: any }; + var ua_dialog: string; + var ua_editor: string; function addIcon(name: string, path: string, offset?: number, bgsize?: string): void; function chameleon(editor: string, part: string): void; diff --git a/types/ckeditor__ckeditor5-utils/ckeditor__ckeditor5-utils-tests.ts b/types/ckeditor__ckeditor5-utils/ckeditor__ckeditor5-utils-tests.ts new file mode 100644 index 0000000000..82c272a6ec --- /dev/null +++ b/types/ckeditor__ckeditor5-utils/ckeditor__ckeditor5-utils-tests.ts @@ -0,0 +1,594 @@ +import * as utils from "ckeditor__ckeditor5-utils"; + +declare const document: Document; +declare const locale: utils.Locale; +declare let bool: boolean; +declare let changes: utils.Change[]; +declare let emitter: utils.Emitter; +declare let htmlElement: HTMLElement; +declare let map: Map; +declare let num: number; +declare let rect: utils.Rect; +declare let rectOrNull: utils.Rect | null; +declare let str: string; + +// utils/dom + +utils.createElement(document, "p"); +utils.createElement(document, "p", {class: "foo"}); +utils.createElement(document, "p", null, "foo"); +utils.createElement(document, "p", null, ["foo", utils.createElement(document, "img")]); + +// TODO? utils/dom/emittermixin + +utils.getAncestors(htmlElement); + +utils.getBorderWidths(htmlElement); + +utils.getCommonAncestor(htmlElement, htmlElement); + +str = utils.getDataFromElement(htmlElement); + +let strNull: HTMLElement | null = utils.getPositionedAncestor(); +strNull = utils.getPositionedAncestor(htmlElement); + +num = utils.indexOf(htmlElement); + +utils.insertAt(htmlElement, 2, htmlElement); + +bool = utils.isNode(htmlElement); +bool = utils.isNode(new Date()); + +bool = utils.isRange(new Range()); +bool = utils.isRange(new Date()); + +bool = utils.isText(new Text("foo")); +bool = utils.isText(new Date()); + +bool = utils.isWindow(window); +bool = utils.isWindow(new Date()); + +let position: utils.Position; + +position = utils.getOptimalPosition({ + element: htmlElement, + target: () => htmlElement, + positions: [(targetRect, elementRect) => ({ + top: targetRect.top, + left: targetRect.left + elementRect.width, + name: "right" + })] +}); + +position = utils.getOptimalPosition({ + element: htmlElement, + target: htmlElement, + positions: [ + (targetRect) => ({ + top: targetRect.bottom, + left: targetRect.left, + name: "mySouthEastPosition" + }), + (targetRect, elementRect) => ({ + top: targetRect.top - elementRect.height, + left: targetRect.left, + name: "myNorthEastPosition" + }) + ], + limiter: document.body, + fitInViewport: true, +}); + +rect = new utils.Rect(document.body); +rect = new utils.Rect(document.getSelection()!.getRangeAt(0)); +rect = new utils.Rect(window); +rect = new utils.Rect({top: 0, right: 10, bottom: 10, left: 0, width: 10, height: 10}); +rect = new utils.Rect(rect); +rect = new utils.Rect(document.body.getClientRects().item(0)!); + +rect = rect.clone(); +bool = rect.contains(rect); +rect = rect.excludeScrollbarsAndBorders(); +num = rect.getArea(); +rect = rect.getIntersection(rect); +num = rect.getIntersectionArea(rect); +rectOrNull = rect.getVisible(); +bool = rect.isEqual(rect); +rect = rect.moveBy(1, 1); +rect = rect.moveTo(1, 1); + +utils.remove(htmlElement); + +utils.scrollAncestorsToShowTarget(new Range()); +utils.scrollAncestorsToShowTarget(htmlElement); + +utils.scrollViewportToShowTarget({target: new Range()}); +utils.scrollViewportToShowTarget({target: htmlElement}); +utils.scrollViewportToShowTarget({target: new Range(), viewportOffset: 30}); +utils.scrollViewportToShowTarget({target: htmlElement, viewportOffset: 30}); + +utils.setDataInElement(htmlElement, "foo"); + +str = utils.toUnit("rem")(10); + +// utils/ckeditorerror ======================================================== + +const regularError = new Error("foo"); +let ckeditorError: utils.CKEditorError; + +const data = {bar: 1}; +ckeditorError = new utils.CKEditorError("foo"); +ckeditorError = new utils.CKEditorError("foo", data); + +utils.CKEditorError.isCKEditorError(ckeditorError); +utils.CKEditorError.isCKEditorError(regularError); + +// utils/collection =========================================================== + +interface Foo { + foo: number; +} + +interface Props { + id: string; +} + +interface PropsStr { + id: string; + name: string; +} + +declare let foo: Foo; +let items: PropsStr[]; +let itemOrNull: Props | null; +let itemOrUndef: Props | undefined; + +const item1 = {id: "id1"}; +const item2 = {id: "id2"}; +const itemStr1 = {id: "foo", name: "yy"}; +const itemStr2 = {id: "foo", name: "xx"}; + +const coll = new utils.Collection(); +const collStr = new utils.Collection({idProperty: "name"}); + +coll.add(item1); +coll.add(item2); +collStr.add(itemStr1); +collStr.add(itemStr2); + +coll.add(item1, 0); +coll.add(item1).add(item2); + +coll.clear(); + +items = collStr.filter((item) => item.name === "yy"); +items = collStr.filter((_, idx) => idx > 0); +items = collStr.filter(function(this: Foo, _, idx) {return this.foo > 0 && idx === 0; }, foo); + +itemOrUndef = collStr.find((item) => item.name === "yy"); +itemOrUndef = collStr.find((_, idx) => idx === 3); +itemOrUndef = collStr.find(function(this: Foo, _, idx) {return this.foo > 0 && idx === 0; }, foo); + +itemOrNull = coll.get(0); +itemOrNull = coll.get("id1"); + +num = coll.getIndex("id1"); +num = coll.getIndex(item1); + +coll.remove(0); +coll.remove("id1"); +coll.remove(item1); + +const strings: string[] = collStr.map((item) => item.name); +const nums: number[] = collStr.map((_, idx) => idx); +const bools: boolean[] = collStr.map(function(this: Foo, _, idx) {return this.foo === idx; }, foo); + +// collection#bindTo + +interface LabelObj { + label: string; +} + +interface LabelValueObj { + label: {value: string}; +} + +interface HiddenObj { + hidden: boolean; +} + +class FactoryClass { + factoryLabel: string; + constructor(data: LabelObj) { + this.factoryLabel = data.label; + } +} + +const source1 = new utils.Collection({idProperty: "label"}); +const target1 = new utils.Collection(); + +target1.bindTo(source1).as(FactoryClass); + +source1.add({label: "foo"}); +source1.add({label: "bar"}); + +source1.remove(0); +console.log(target1.length); +console.log(target1.get(0)!.factoryLabel); + +class FooClass { + fooLabel: string; + constructor(data: LabelObj) { + this.fooLabel = data.label; + } +} + +class BarClass { + barLabel: string; + constructor(data: LabelObj) { + this.barLabel = data.label; + } +} + +const source2 = new utils.Collection({idProperty: "label"}); +const target2 = new utils.Collection(); + +target2.bindTo(source2).using((item) => { + if (item.label === "foo") { + return new FooClass(item); + } else { + return new BarClass(item); + } +}); + +source2.add({label: "foo"}); +source2.add({label: "bar"}); + +console.log(target2.length); +console.log(target2.get(0)! instanceof FooClass); +console.log(target2.get(1)! instanceof BarClass); + +const source3 = new utils.Collection({idProperty: "label"}); +const target3 = new utils.Collection(); + +target3.bindTo(source2).using("label"); + +source3.add({label: {value: "foo"}}); +source3.add({label: {value: "bar"}}); + +console.log(target3.length); +console.log(target3.get(0)!.value); +console.log(target3.get(1)!.value); + +const source4 = new utils.Collection(); +const target4 = new utils.Collection(); + +target4.bindTo(source4).using(item => { + if (item.hidden) { + return null; + } + + return item; +}); + +source4.add({hidden: true}); +source4.add({hidden: false}); + +// utils/comparearrays ======================================================== + +utils.compareArrays([0, 2], [0, 2, 1]); +utils.compareArrays(["abc", 0 ], ["abc", 0, 3]); + +// utils/config =============================================================== + +let strOrUndef: string | undefined; +let config: utils.Config; +const defaultConfig = { + foo: 1, bar: 2, +}; + +config = new utils.Config(); +config = new utils.Config({foo: 10}); +config = new utils.Config({}, defaultConfig); +config = new utils.Config({foo: 10}, defaultConfig); + +config.define({ + resize: { + minHeight: 400, + hidden: true + } +}); + +config.define("resize", {minHeight: 400, hidden: true}); +config.define("language", "en"); +config.define("resize.minHeight", 400); + +str = config.get("language"); +num = config.get("resize.minHeight"); + +config.define("language", undefined); +strOrUndef = config.get("language"); + +// utils/count ================================================================ + +num = utils.count([1, 2, 3, 4, 5]); + +// utils/diff ================================================================= + +changes = utils.diff("aba", "acca"); +changes = utils.diff(Array.from("aba"), Array.from("acca")); + +// utils/difftochanges ======================================================== + +const input = Array.from("abc"); +const output = Array.from("xaby"); +const allChanges = utils.diffToChanges(utils.diff(input, output), output); +allChanges.forEach(change => { + if (change.type === "insert") { + input.splice(change.index, 0, ...change.values); + } else if (change.type === "delete") { + input.splice(change.index, change.howMany); + } +}); + +// utils/elementreplacer ====================================================== + +const replacer = new utils.ElementReplacer(); + +replacer.replace(htmlElement, htmlElement); +replacer.replace(htmlElement); + +replacer.restore(); + +// utils/emittermixin + +emitter = utils.EmitterMixin; +emitter = Object.create(utils.EmitterMixin); + +emitter.delegate("foo") ; +emitter.delegate("foo", "bar"); +emitter.delegate("foo").to(emitter); +emitter.delegate("foo").to(emitter, "bar"); +emitter.delegate("foo").to(emitter, name => name + "-delegated"); + +emitter.fire("foo"); +emitter.fire("foo", 1, "b", true); +emitter.fire("getSelectedContent", (evt: utils.EventInfo) => { + evt.return = new DocumentFragment(); + evt.stop(); +}); + +emitter.listenTo(emitter, "foo", () => {}); +emitter.listenTo(emitter, "foo", () => {}, {priority: 10}); +emitter.listenTo(emitter, "foo", () => {}, {priority: "highest"}); + +emitter.off("foo"); +emitter.off("foo", () => {}); + +emitter.on("foo", () => {}); +emitter.on("foo", () => {}, {priority: 10}); +emitter.on("foo", () => {}, {priority: "normal"}); + +emitter.once("foo", () => {}); +emitter.once("foo", () => {}, {priority: 10}); +emitter.once("foo", () => {}, {priority: "lowest"}); + +emitter.stopDelegating(); +emitter.stopDelegating("foo"); +emitter.stopDelegating("foo", emitter); + +emitter.stopListening(); +emitter.stopListening(emitter); +emitter.stopListening(emitter, "foo"); +emitter.stopListening(emitter, "foo", () => {}); + +// utils/env ================================================================== + +bool = utils.env.isEdge; +bool = utils.env.isMac; + +// utils/eventinfo ============================================================ + +const event = new utils.EventInfo({a: 1}, "test"); +num = event.source.a; +str = event.name; + +event.path[0]; + +event.stop(); +event.off(); + +bool = event.stop.called; +bool = event.off.called; + +// utils/fastdiff ============================================================= + +utils.fastDiff(str, "2ab").forEach(change => { + if (change.type === "insert") { + str = str.substring(0, change.index) + change.values.join("") + str.substring(change.index); + } else if (change.type === "delete") { + str = str.substring(0, change.index) + str.substring(change.index + change.howMany); + } +}); + +// utils/first ================================================================ + +const collection = [ 11, 22 ]; +const iterator = collection[Symbol.iterator](); + +utils.first(iterator); + +// utils/focustracker ========================================================= + +const focusTracker = new utils.FocusTracker(); +htmlElement = focusTracker.focusedElement; +bool = focusTracker.isFocused; +focusTracker.add(htmlElement); +focusTracker.remove(htmlElement); + +// utils/isiterable =========================================================== + +bool = utils.isIterable(str); +bool = utils.isIterable([1, 2, 3]); + +// utils/keyboard ============================================================= + +num = utils.keyCodes.a; +num = utils.keyCodes["a"]; + +num = utils.getCode("0"); +num = utils.getCode({keyCode: 48}) ; +num = utils.getCode({keyCode: 48, altKey: true, ctrlKey: true, shiftKey: true}); + +str = utils.getEnvKeystrokeText("alt+A"); + +num = utils.parseKeystroke("Ctrl+A"); +num = utils.parseKeystroke(["ctrl", "a"]); +num = utils.parseKeystroke(["shift", 33]); + +// utils/keystrokehandler ===================================================== + +declare const keystroke: utils.KeystrokeInfo; +const keystrokes = new utils.KeystrokeHandler(); + +const spy = utils.spy(); +keystrokes.set("Ctrl+A", spy); +keystrokes.set(["Ctrl", "A"], spy); +keystrokes.set(["Ctrl", "A"], spy, {priority: "high"}); +keystrokes.set(["Ctrl", 33], spy, {priority: 10}); + +const emitterMixxin = Object.create(utils.EmitterMixin) as utils.Emitter; +keystrokes.listenTo(emitterMixxin); + +bool = keystrokes.press(keystroke); + +keystrokes.destroy(); + +// utils/locale =============================================================== + +locale.t("Label"); +locale.t('Created file "%0" in %1ms.', ["fileName", "100"]); + +// utils/log ================================================================== + +utils.log.warn("message"); +utils.log.warn('plugin-load: It was not possible to load the "{$pluginName}" plugin in module "{$moduleName}', { + pluginName: "foo", + moduleName: "bar" +}); + +utils.log.error("message"); +utils.log.error('plugin-load: It was not possible to load the "{$pluginName}" plugin in module "{$moduleName}', { + pluginName: "foo", + moduleName: "bar" +}); + +// utils/mapsequal ============================================================ + +utils.mapsEqual(map, map); + +// utils/mix ================================================================== + +class Editor { + b: () => number; +} + +interface SomeMixin { + a: () => string; +} + +const SomeMixin = { + a() { + return "a"; + } +}; + +utils.mix(Editor, SomeMixin); +const mixEditor = new Editor() as Editor & SomeMixin; +mixEditor.a(); +mixEditor.b(); + +// utils/nth ================================================================== + +function* getGenerator() { + yield 11; + yield 22; + yield 33; +} + +utils.nth(2, getGenerator()); + +// utils/objecttomap ========================================================== + +const objMap: Map = utils.objectToMap({foo: 1, bar: 2}); +num = objMap.get("foo")!; + +// utils/observablemixin ====================================================== + +const observable: utils.Observable = utils.ObservableMixin; + +const vehicle = Object.create(utils.ObservableMixin) as utils.Observable; +const car = Object.create(utils.ObservableMixin) as utils.Observable; + +vehicle.bind("color"); +vehicle.bind("color", "year"); +vehicle.bind("color", "year").to(car); +vehicle.bind("color", "year").to(car, "color"); +vehicle.bind("color", "year").to(car, "color", car, "year"); +vehicle.bind("year").to(car, "color", car, "year", (a: string, b: number) => a + b); +vehicle.bind("custom").to(car, "color", car, "year", car, "hue", (...args: Array) => args.join("/")); // TS 3.0: [string, number, string] +vehicle.bind("color").toMany([car, car], "color", () => {}); + +vehicle.decorate("method"); + +car.set("color", "red"); +car.set("seats", undefined); +car.set({ + color: "blue", + wheels: 4, + seats: 5, +}); + +vehicle.unbind(); +vehicle.unbind("color"); +vehicle.unbind("color", "year"); + +// utils/priorities =========================================================== + +num = utils.priorities.get(2); +num = utils.priorities.get("normal"); + +// utils/spy + +const fn1 = utils.spy(); +fn1(); +bool = fn1.called; + +// utils/tomap + +map = utils.toMap({foo: 1, bar: 2}); +map = utils.toMap([["foo", 1], ["bar", 2]]); +map = utils.toMap(map); + +// utils/translation-service ================================================== + +utils.add("pl", { + OK: "OK", + "Cancel [context: reject]": "Anuluj" +}); + +utils.translate("pl", "Cancel [context: reject]"); + +// utils/uid ================================================================== + +str = utils.uid(); + +// utils/unicode ============================================================== + +bool = utils.isCombiningMark("a"); +bool = utils.isHighSurrogateHalf("a"); +bool = utils.isInsideCombinedSymbol(str, 2); +bool = utils.isInsideSurrogatePair(str, 2); +bool = utils.isLowSurrogateHalf(String.fromCharCode(57166)); + +// utils/version ============================================================== diff --git a/types/ckeditor__ckeditor5-utils/index.d.ts b/types/ckeditor__ckeditor5-utils/index.d.ts new file mode 100644 index 0000000000..8d9d50e889 --- /dev/null +++ b/types/ckeditor__ckeditor5-utils/index.d.ts @@ -0,0 +1,471 @@ +// Type definitions for @ckeditor/ckeditor5-utils 10.2 +// Project: https://github.com/ckeditor/ckeditor5-utils +// Definitions by: denisname +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// Helpers + +export interface DeleteChange { + index: number; + type: "delete"; + howMany: number; +} + +export interface InsertChange { + index: number; + type: "insert"; + values: string[]; +} + +export interface BindChain { + to(observable: Observable, ...bindProperties: Array): void; + toMany(observable: Observable[], ...bindProperties: Array): void; +} + +export interface CollectionBindTo { + as: (Class: {new(item: T): K}) => void; + using: (callbackOrProperty: keyof T | ((item: T) => K)) => void; +} + +// utils/dom + +export function createElement(doc: Document, name: string, attributes?: object | null, children?: Node | string | Array): Element; + +// TODO? utils/dom/emittermixin + +export function getAncestors(node: Node): Array; + +export function getBorderWidths(element: HTMLElement): {top: number, right: number, bottom: number, left: number}; + +export function getCommonAncestor(nodeA: Node, nodeB: Node): Node | DocumentFragment | Document | null; + +export function getDataFromElement(el: HTMLElement): string; + +export function getPositionedAncestor(element?: HTMLElement): HTMLElement | null; + +export function indexOf(node: Node): number; + +export function insertAt(parentElement: Element, index: number, nodeToInsert: Node): void; + +export function isNode(obj: any): obj is Node; + +export function isRange(obj: any): obj is Range; + +export function isText(obj: any): obj is Text; + +export function isWindow(obj: any): obj is Window; + +export interface Options { + element: HTMLElement; + fitInViewport?: boolean; + limiter?: HTMLElement | Range | ClientRect | Rect | (() => HTMLElement | Range | ClientRect | Rect); + positions: Array<(targetRect: Rect, elementRect: Rect) => Position>; + target: HTMLElement | Range | ClientRect | Rect | (() => HTMLElement | Range | ClientRect | Rect); +} + +export interface Position { + left: number; + name: string; + top: number; +} + +export function getOptimalPosition(options: Options): Position; + +export class Rect { + readonly bottom: number; + readonly height: number; + readonly left: number; + readonly right: number; + readonly top: number; + readonly width: number; + + constructor(source: HTMLElement | Range | Window | ClientRect | Rect | object); + clone(): Rect; + contains(anotherRect: Rect): boolean; + excludeScrollbarsAndBorders(): Rect; + getArea(): number; + getIntersection(anotherRect: Rect): Rect; + getIntersectionArea(anotherRect: Rect): number; + getVisible(): Rect | null; + isEqual(rect: Rect): boolean; + moveBy(x: number, y: number): Rect; + moveTo(x: number, y: number): Rect; + + static getDomRangeRects(range: Range): Rect[]; +} + +export function remove(node: Node): void; + +export function scrollAncestorsToShowTarget(target: HTMLElement | Range): void; + +export function scrollViewportToShowTarget(options: {target: HTMLElement | Range, viewportOffset?: number}): void; + +export function setDataInElement(el: HTMLElement, data: string): void; + +export function toUnit(unit: string): (value: number) => string; + +// utils/ckeditorerror + +export const DOCUMENTATION_URL: string; + +export class CKEditorError extends Error { + data: object | undefined; + name: string; + + constructor(message: string, data?: object); + + static isCKEditorError(error: Error): boolean; +} + +export function attachLinkToDocumentation(message: string): string; + +// utils/collection + +export function as(Class: Function): void; +export function using(callbackOrProperty: Function | string): void; + +export class Collection implements Iterable, Emitter { + first: T | null; + last: T | null; + length: number; + + constructor(options?: {idProperty?: keyof T}); + add(item: T, index?: number): this; + bindTo(externalCollection: Collection): CollectionBindTo; + clear(): void; + filter(callbackfn: (item: T, index: number) => boolean, thisArg?: any): T[]; + find(predicate: (item: T, index: number) => boolean, thisArg?: any): T | undefined; + get(idOrIndex: string | number): T | null; + getIndex(idOrItem: string | T): number; + map(callbackfn: (item: T, index: number) => U, thisArg?: any): U[]; + remove(subject: T | number | string): T; + + // Iterable + [Symbol.iterator](): Iterator; + + // Emitter + delegate(...events: string[]): EmitterMixinDelegateChain; + fire(eventOrInfo: string | EventInfo, ...args: any[]): any; + listenTo(emitter: Emitter, event: string, callback: Function, options?: {priority?: PriorityString | number }): void; + off(event: string, callback?: Function): void; + on(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + once(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + stopDelegating(event?: string, emitter?: Emitter): void; + stopListening(emitter?: Emitter, event?: string, callback?: Function): void; +} + +// utils/comparearrays + +export type ArrayRelation = "extension" | "same" | "prefix"; + +export function compareArrays(a: ReadonlyArray, b: ReadonlyArray): number | ArrayRelation; + +// utils/config + +export class Config { + constructor(configurations?: object, defaultConfigurations?: object); + define(name: object): void; + define(name: string, value: any): void; + get(name: string): any /*| undefined*/; + set(name: string, value: any /*| undefined*/): void; +} + +// utils/count + +export function count(iterator: Iterable): number; + +// utils/diff + +export type Change = "equal" | "insert" | "delete"; + +export function diff(a: string, b: string, cmp?: (a: string, b: string) => boolean): Change[]; +export function diff(a: ReadonlyArray, b: ReadonlyArray, cmp?: (a: string, b: string) => boolean): Change[]; + +// utils/difftochanges + +export function diffToChanges(diff: Change[], output: string | string[]): Array; + +// utils/elementreplacer + +export class ElementReplacer { + replace(element: HTMLElement, newElement?: HTMLElement): void; + restore(): void; +} + +// utils/emittermixin + +export const EmitterMixin: Emitter; + +export interface Emitter { + delegate(...events: string[]): EmitterMixinDelegateChain; + fire(eventOrInfo: string | EventInfo, ...args: any[]): any; + listenTo(emitter: Emitter, event: string, callback: Function, options?: {priority?: PriorityString | number }): void; + off(event: string, callback?: Function): void; + on(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + once(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + stopDelegating(event?: string, emitter?: Emitter): void; + stopListening(emitter?: Emitter, event?: string, callback?: Function): void; +} + +export interface EmitterMixinDelegateChain { + to(emitter: Emitter, nameOrFunction?: string | ((name: string) => string)): void; +} + +// utils/env + +export namespace env { + const isEdge: boolean; + const isMac: boolean; +} + +// utils/eventinfo + +export class EventInfo { + readonly name: string; + readonly path: object[]; + return: any /*| undefined*/; + readonly source: T; + + constructor(source: T, name: string); + off: { + (): void; + called: boolean; + }; + stop: { + (): void; + called: boolean; + }; +} + +// utils/fastdiff + +export function fastDiff(oldText: string, newText: string): Array; + +// utils/first + +export function first(iterable: Iterable): T; + +// utils/focustracker + +export class FocusTracker implements Observable { + readonly focusedElement: HTMLElement; + readonly isFocused: boolean; + + add(element: HTMLElement): void; + remove(element: HTMLElement): void; + + // Observable + bind(...bindProperties: string[]): BindChain; + decorate(methodName: string): void; + set(name: object): void; + set(name: string, value: any): void; + unbind(...unbindProperties: string[]): void; + + // Observable (Emitter) + delegate(...events: string[]): EmitterMixinDelegateChain; + fire(eventOrInfo: string | EventInfo, ...args: any[]): any; + listenTo(emitter: Emitter, event: string, callback: Function, options?: {priority?: PriorityString | number }): void; + off(event: string, callback?: Function): void; + on(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + once(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + stopDelegating(event?: string, emitter?: Emitter): void; + stopListening(emitter?: Emitter, event?: string, callback?: Function): void; +} + +// utils/isiterable + +export function isIterable(value: any): value is Iterable; + +// utils/keyboard + +export const keyCodes: { + a: 65, + b: 66, + c: 67; + d: 68; + e: 69; + f: 70; + g: 71; + h: 72; + i: 73; + j: 74; + k: 75; + l: 76; + m: 77; + n: 78; + o: 79; + p: 80; + q: 81; + r: 82; + s: 83; + t: 84; + u: 85; + v: 86; + w: 87; + x: 88; + y: 89; + z: 90; + + 0: 48; + 1: 49; + 2: 50; + 3: 51; + 4: 52; + 5: 53; + 6: 54; + 7: 55; + 8: 56; + 9: 57; + + f1: 112; + f2: 113; + f3: 114; + f4: 115; + f5: 116; + f6: 117; + f7: 118; + f8: 118; + f9: 120; + f10: 121; + f11: 122; + f12: 123; + + arrowleft: 37, + arrowup: 38, + arrowright: 39, + arrowdown: 40, + backspace: 8, + "delete": 46, + enter: 13, + space: 32, + esc: 27, + tab: 9, + ctrl: 0x110000, + cmd: 0x110000, + shift: 0x220000, + alt: 0x440000 +}; + +export interface KeystrokeInfo { + altKey?: boolean; + ctrlKey?: boolean; + keyCode: number; + shiftKey?: boolean; +} + +export function getCode(key: string | KeystrokeInfo): number; + +export function getEnvKeystrokeText(keystroke: string): string; + +export function parseKeystroke(keystroke: string | Array): number; + +// utils/keystrokehandler + +export class KeystrokeHandler { + constructor(); + destroy(): void; + listenTo(emitter: Emitter): void; + press(keyEvtData: KeystrokeInfo): boolean; + set(keystroke: string | Array, callback: Function, options?: {priority?: PriorityString | number}): void; +} + +// utils/locale + +export class Locale { + readonly language: string; + + constructor(language?: string); + t(str: string, values?: string[]): string; +} + +// utils/log + +export namespace log { + function error(message: string, data?: object): void; + function warn(message: string, data?: object): void; +} + +// utils/mapsequal + +export function mapsEqual(mapsA: Map, mapsB: Map): boolean; + +// utils/mix + +export function mix(baseClass: {new(): any}, ...mixins: any[]): void; + +// utils/nth + +export function nth(index: number, iterable: Iterable): T; + +// utils/objecttomap + +export function objectToMap(obj: T): Map; + +// utils/observablemixin + +export const ObservableMixin: Observable; + +export interface Observable extends Emitter { + bind(...bindProperties: string[]): BindChain; + decorate(methodName: string): void; + set(name: object): void; + set(name: string, value: any): void; + unbind(...unbindProperties: string[]): void; + + // Emitter + delegate(...events: string[]): EmitterMixinDelegateChain; + fire(eventOrInfo: string | EventInfo, ...args: any[]): any; + listenTo(emitter: Emitter, event: string, callback: Function, options?: {priority?: PriorityString | number }): void; + off(event: string, callback?: Function): void; + on(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + once(event: string, callback: Function, options?: {priority: PriorityString | number}): void; + stopDelegating(event?: string, emitter?: Emitter): void; + stopListening(emitter?: Emitter, event?: string, callback?: Function): void; +} + +// utils/priorities + +export namespace priorities { + function get(priority: PriorityString | number): number; +} + +export type PriorityString = "highest" | "high" | "normal" | "low" | "lowest"; + +// utils/spy + +export function spy(): {(): void; called: boolean}; + +// utils/tomap + +export function toMap(data: Map): Map; +export function toMap(data: ReadonlyArray<[K, V]>): Map; +export function toMap(data: T): Map; + +// utils/translation-service + +export function add(language: string, translations: {[key: string]: string}): void; + +export function translate(language: string, translationKey: string): string; + +// TODO: CKEDITOR_TRANSLATIONS + +// utils/uid + +export function uid(): string; + +// utils/unicode + +export function isCombiningMark(character: string): boolean; + +export function isHighSurrogateHalf(character: string): boolean; + +export function isInsideCombinedSymbol(string: string, offset: number): boolean; + +export function isInsideSurrogatePair(string: string, offset: number): boolean; + +export function isLowSurrogateHalf(character: string): boolean; + +// utils/version + +// TODO: CKEDITOR_VERSION; diff --git a/types/ckeditor__ckeditor5-utils/tsconfig.json b/types/ckeditor__ckeditor5-utils/tsconfig.json new file mode 100644 index 0000000000..1fbda2fd6b --- /dev/null +++ b/types/ckeditor__ckeditor5-utils/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ckeditor__ckeditor5-utils-tests.ts" + ] +} diff --git a/types/ckeditor__ckeditor5-utils/tslint.json b/types/ckeditor__ckeditor5-utils/tslint.json new file mode 100644 index 0000000000..332951717c --- /dev/null +++ b/types/ckeditor__ckeditor5-utils/tslint.json @@ -0,0 +1,20 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": { + "options": [ + ["Object", "Avoid using the `Object` type. Did you mean `object`?"], + ["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"], + ["Number", "Avoid using the `Number` type. Did you mean `number`?"], + ["String", "Avoid using the `String` type. Did you mean `string`?"], + ["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"] + ] + }, + "quotemark": [ + true, + "double", + "avoid-escape", + "avoid-template" + ] + } +} diff --git a/types/cli-table2/cli-table2-tests.ts b/types/cli-table2/cli-table2-tests.ts index dfaed4ec33..97d8c82dbe 100644 --- a/types/cli-table2/cli-table2-tests.ts +++ b/types/cli-table2/cli-table2-tests.ts @@ -230,3 +230,24 @@ table26.push( // feel free to use colors in your content strings, column widths will be calculated correctly const table27 = new Table({ colWidths: [5], style: { head: [], border: [] } }) as Table.HorizontalTable; table27.push([/*colors.red(*/'hello'/*)*/]); + +// Header as text +const table28 = new Table({ head: ["Top Header 1", "Top Header 2"] }) as Table.HorizontalTable; +table28.push( + ['Value Row 1 Col 1', 'Value Row 1 Col 2'], + ['Value Row 2 Col 1', 'Value Row 2 Col 2'] +); + +// Header as Cells +const table29 = new Table({ head: [{content: "Top Header 1"}, {content: "Top Header 2"}] }) as Table.HorizontalTable; +table29.push( + ['Value Row 1 Col 1', 'Value Row 1 Col 2'], + ['Value Row 2 Col 1', 'Value Row 2 Col 2'] +); + +// ColSpan in header +const table30 = new Table({ head: [{content: "Top Header 1", colSpan: 2}, {content: "Top Header 3"}] }) as Table.HorizontalTable; +table30.push( + ['Value Row 1 Col 1', 'Value Row 1 Col 2', 'Value Row 1 Col 3'], + ['Value Row 2 Col 1', 'Value Row 2 Col 2', 'Value Row 2 Col 3'] +); diff --git a/types/cli-table2/index.d.ts b/types/cli-table2/index.d.ts index b216b23832..865439f000 100644 --- a/types/cli-table2/index.d.ts +++ b/types/cli-table2/index.d.ts @@ -31,7 +31,7 @@ declare namespace CliTable2 { rowHeights: Array; colAligns: HorizontalAlignment[]; rowAligns: VerticalAlignment[]; - head: string[]; + head: Cell[]; wordWrap: boolean; } diff --git a/types/code/code-tests.ts b/types/code/code-tests.ts index 9e5f12645f..f9b55ca72e 100644 --- a/types/code/code-tests.ts +++ b/types/code/code-tests.ts @@ -103,6 +103,7 @@ expect("abcd").to.have.length(4); expect(5).to.equal(5); expect({ a: 1 }).to.equal({ a: 1 }); +expect([1, 2, 3]).to.equal([1, 2, 3]); expect(Object.create(null)).to.equal({}, { prototype: false }); diff --git a/types/code/index.d.ts b/types/code/index.d.ts index 3bdca4be9a..7047fc0702 100644 --- a/types/code/index.d.ts +++ b/types/code/index.d.ts @@ -125,9 +125,9 @@ export interface Values { /** Asserts that the reference value has a length property matching the provided size or an object with the specified number of keys. */ length(size: number): AssertionChain; /** Asserts that the reference value equals the provided value. */ - equal(value: T, options?: any): AssertionChain; + equal(value: T | T[], options?: any): AssertionChain; /** Asserts that the reference value equals the provided value. */ - equals(value: T, options?: any): AssertionChain; + equals(value: T | T[], options?: any): AssertionChain; /** Asserts that the reference value is greater than (>) the provided value. */ above(value: T): AssertionChain; /** Asserts that the reference value is greater than (>) the provided value. */ diff --git a/types/codemirror/codemirror-comment.d.ts b/types/codemirror/codemirror-comment.d.ts new file mode 100644 index 0000000000..47b99fd989 --- /dev/null +++ b/types/codemirror/codemirror-comment.d.ts @@ -0,0 +1,47 @@ +// Type definitions for CodeMirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: Nikolaj Kappler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_comment + +// Todo: add 'toggleComment' command, once command type definitions exist in main definitions + +import * as CodeMirror from "codemirror"; + +declare module "codemirror" { + + 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; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentEnd?: string; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + blockCommentLead?: string; + /** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */ + lineComment?: string; + /** A string that will be inserted after opening and leading markers, and before closing comment markers. Defaults to a single space. */ + padding?: string; + /** Whether, when adding line comments, to also comment lines that contain only whitespace. */ + commentBlankLines?: boolean; + /** 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; + /** When block commenting, this controls whether the whole lines are indented, or only the precise range that is given. Defaults to `true`. */ + fullLines?: boolean; + } +} + +declare module "codemirror/addon/comment/comment" { + export = CodeMirror; +} diff --git a/types/codemirror/codemirror-panel.d.ts b/types/codemirror/codemirror-panel.d.ts new file mode 100644 index 0000000000..2059c8ff72 --- /dev/null +++ b/types/codemirror/codemirror-panel.d.ts @@ -0,0 +1,51 @@ +// Type definitions for CodeMirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: Nikolaj Kappler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// See docs https://codemirror.net/doc/manual.html#addon_panel + +import * as CodeMirror from "codemirror"; + +declare module "codemirror" { + 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"; + /**The new panel will be added before the given panel. */ + before?: Panel; + /**The new panel will be added after the given panel. */ + after?: Panel; + /**The new panel will replace the given panel. */ + replace?: Panel; + /**Whether to scroll the editor to keep the text's vertical position stable, when adding a panel above it. Defaults to false. */ + stable?: boolean; + } + + 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; + + } +} + +declare module "codemirror/addon/display/panel" { + export = CodeMirror; +} diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index a3b775ab5e..cdc3c4cd7c 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -4,6 +4,7 @@ // nrbernard // Pr1st0n // rileymiller +// toddself // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = CodeMirror; @@ -28,11 +29,11 @@ declare namespace CodeMirror { 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", + /** 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. */ var version: string; - /** An object containing default values for all options. + /** 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). */ var defaults: any; @@ -260,16 +261,7 @@ declare namespace CodeMirror { 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?: { - /** Whether the widget should cover the gutter. */ - coverGutter?: boolean; - /** Whether the widget should stay fixed in the face of horizontal scrolling. */ - noHScroll?: boolean; - /** Causes the widget to be placed above instead of below the text of the line. */ - above?: boolean; - /** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */ - showIfHidden?: boolean; - }): CodeMirror.LineWidget; + addLineWidget(line: any, node: HTMLElement, options?: CodeMirror.LineWidgetOptions): CodeMirror.LineWidget; /** Programatically set the size of the editor (overriding the applicable CSS rules). @@ -346,8 +338,8 @@ declare namespace CodeMirror { /** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */ getTokenAt(pos: CodeMirror.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 + /** 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: CodeMirror.Position): string; @@ -364,6 +356,12 @@ declare namespace CodeMirror { 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: @@ -426,7 +424,7 @@ declare namespace CodeMirror { off(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void; /** This event is fired before the selection is moved. Its handler may modify the resulting selection head and anchor. - Handlers for this event have the same restriction as "beforeChange" handlers � they should not do anything to directly update the state of the editor. */ + Handlers for this event have the same restriction as "beforeChange" handlers they should not do anything to directly update the state of the editor. */ on(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void; off(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void; @@ -537,20 +535,20 @@ declare namespace CodeMirror { Note that line handles have a text property containing the line's content (as a string). */ eachLine(start: number, end: number, f: (line: CodeMirror.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 + /** 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 + + /** 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 + /** 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; @@ -559,7 +557,7 @@ declare namespace CodeMirror { getSelections(lineSep?: string): Array; /** 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. */ + 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; /** start is a an optional string indicating which end of the selection to return. @@ -672,6 +670,11 @@ declare namespace CodeMirror { /** Returns an array containing all marked ranges in the document. */ getAllMarks(): CodeMirror.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?: CodeMirror.LineWidgetOptions): CodeMirror.LineWidget; /** 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. */ @@ -709,8 +712,27 @@ declare namespace CodeMirror { or undefined if the marker is no longer in the document. */ find(): {from: CodeMirror.Position, to: CodeMirror.Position}; + /** Called when you've done something that might change the size of the marker and want to cheaply update the display*/ + changed(): void; + /** Returns an object representing the options for the marker. If copyWidget is given true, it will clone the value of the replacedWith option, if any. */ getOptions(copyWidget: boolean): CodeMirror.TextMarkerOptions; + + /** Fired when the cursor enters the marked range */ + on(eventName: 'beforeCursorEnter', handler: () => void) : void; + off(eventName: 'beforeCursorEnter', handler: () => void) : void; + + /** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method */ + on(eventName: 'clear', handler: (from: Position, to: Position) => void) : void; + off(eventName: 'clear', handler: () => void) : void; + + /** Fired when the last part of the marker is removed from the document by editing operations */ + on(eventName: 'hide', handler: () => void) : void; + off(eventname: 'hide', handler: () => void) : void; + + /** Fired when, after the marker was removed by editing, a undo operation brough the marker back */ + on(eventName: 'unhide', handler: () => void) : void; + off(eventname: 'unhide', handler: () => void) : void; } interface LineWidget { @@ -722,6 +744,17 @@ declare namespace CodeMirror { changed(): void; } + interface LineWidgetOptions { + /** Whether the widget should cover the gutter. */ + coverGutter?: boolean; + /** Whether the widget should stay fixed in the face of horizontal scrolling. */ + noHScroll?: boolean; + /** Causes the widget to be placed above instead of below the text of the line. */ + above?: boolean; + /** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */ + showIfHidden?: boolean; + } + interface EditorChange { /** Position (in the pre-change coordinate system) where the change started. */ from: CodeMirror.Position; diff --git a/types/codemirror/test/comment.ts b/types/codemirror/test/comment.ts new file mode 100644 index 0000000000..f022704a86 --- /dev/null +++ b/types/codemirror/test/comment.ts @@ -0,0 +1,16 @@ +const editor = CodeMirror(document.body); +const position: CodeMirror.Position = { ch: 0, line: 0 }; +const opt: CodeMirror.CommentOptions = { + blockCommentEnd: "*/", + blockCommentStart: "/*", + blockCommentLead: "*", + commentBlankLines: true, + fullLines: true, + indent: true, + lineComment: "//", + padding: " " +}; +editor.toggleComment(opt); +editor.blockComment(position, position, opt); +editor.lineComment(position, position, opt); +const b: boolean = editor.uncomment(position, position, opt); diff --git a/types/codemirror/test/index.ts b/types/codemirror/test/index.ts index bd2aefac88..851e891e8f 100644 --- a/types/codemirror/test/index.ts +++ b/types/codemirror/test/index.ts @@ -91,3 +91,12 @@ CodeMirror.registerHelper("lint", "javascript", {}); myCodeMirror.isReadOnly(); myCodeMirror.execCommand('selectAll'); + +let htmlElement1 = document.createElement('div'); +let htmlElement2 = document.createElement('div'); +let widget1 = myCodeMirror.addLineWidget(1, htmlElement1, {}); +let widget2 = doc.addLineWidget(1, htmlElement2, {}); +widget1.clear(); +widget2.clear(); +htmlElement1.remove(); +htmlElement2.remove(); diff --git a/types/codemirror/test/panel.ts b/types/codemirror/test/panel.ts new file mode 100644 index 0000000000..3cf200beae --- /dev/null +++ b/types/codemirror/test/panel.ts @@ -0,0 +1,17 @@ + +var cm: CodeMirror.Editor = CodeMirror(document.body); + +var panel1 = cm.addPanel(document.body); + +var panel2: CodeMirror.Panel = cm.addPanel(document.body, { + position: "top", + after: panel1, + before: panel1, + replace: panel1, + stable: true +}); + +panel2.changed(); +panel2.changed(100); + +panel2.clear(); diff --git a/types/codemirror/tsconfig.json b/types/codemirror/tsconfig.json index a2c6a52430..d081586f6e 100644 --- a/types/codemirror/tsconfig.json +++ b/types/codemirror/tsconfig.json @@ -20,13 +20,17 @@ "files": [ "index.d.ts", "codemirror-matchbrackets.d.ts", + "codemirror-panel.d.ts", "codemirror-runmode.d.ts", "codemirror-showhint.d.ts", + "codemirror-comment.d.ts", "searchcursor.d.ts", "test/index.ts", "test/matchbrackets.ts", + "test/panel.ts", "test/runmode.ts", "test/searchcursor.ts", - "test/showhint.ts" + "test/showhint.ts", + "test/comment.ts" ] } \ No newline at end of file diff --git a/types/colresizable/colresizable-tests.ts b/types/colresizable/colresizable-tests.ts new file mode 100644 index 0000000000..9fc62512c1 --- /dev/null +++ b/types/colresizable/colresizable-tests.ts @@ -0,0 +1,61 @@ +$("#table").colResizable(); // $ExpectType JQuery + +$("#table").colResizable({ + resizeMode: "fit", + disable: false, + disabledColumns: [1, 2, 3], + liveDrag: true, + postbackSafe: false, + partialRefresh: true, + headerOnly: false, + gripInnerHtml: "", + draggingClass: ".myClass", + minWidth: 100, + hoverCursor: 'pointer', + dragCursor: 'e-resize', + flush: false, + marginLeft: "14px", + marginRight: "auto", + fixed: false, + + onResize(evt) { + evt.currentTarget; // $ExpectType Element + }, + onDrag(evt) { + evt.currentTarget; // $ExpectType Element + } +}); + +// Samples at http://www.bacubacu.com/colresizable +function onSampleResized(e: JQueryMouseEventObject) { + const table = $(e.currentTarget); // reference to the resized table +} + +$("#sample").colResizable({ + liveDrag: true, + gripInnerHtml: "
", + draggingClass: "dragging", + onResize: onSampleResized +}); + +function postbackSample() { + $("#updatePanelSample").colResizable({ + liveDrag: true, + postbackSafe: true, + partialRefresh: true + }); +} + +$("#flexSample").colResizable({resizeMode: 'flex'}); + +$("#overflowSample").colResizable({resizeMode: 'overflow'}); + +function onSlide() {} + +$("#sample5").colResizable({ + liveDrag: true, + draggingClass: "rangeDrag", + gripInnerHtml: "
", + onResize: onSlide, + minWidth: 8 +}); diff --git a/types/colresizable/index.d.ts b/types/colresizable/index.d.ts new file mode 100644 index 0000000000..693c40923c --- /dev/null +++ b/types/colresizable/index.d.ts @@ -0,0 +1,149 @@ +// Type definitions for colresizable 1.6 +// Project: http://bacubacu.com/colresizable/ +// Definitions by: Gilles Waeber +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +interface JQuery { + colResizable(param?: colResizable.Settings): JQuery; +} + +declare namespace colResizable { + interface Settings { + /** + * [default: 'fit'] It is used to set how the resize method works. Those are the possible values: + * - 'fit': this is default resizing model, in which resizing a column does not alter table width, which means that when a column is expanded the next one shrinks. + * - 'flex': in this mode tables can change its width and each column can shrink or expand independently if there is enough space in the parent container. + * If there is not enough space, columns will share its width as they are resized. Table will never get bigger than its parent. + * - 'overflow': allows to resize columns with overflow of parent container. + * [version: 1.6] + */ + resizeMode?: 'fit' | 'flex' | 'overflow'; + + /** + * [default: false] When set to true the table layout is updated while dragging column anchors. + * liveDrag enabled is more CPU consuming so it is not recommended for slow computers, specially when dealing with huge or extremely complicated tables. + * [version: 1.0] + */ + liveDrag?: boolean; + + /** + * @deprecated use resizeMode instead + * [default: true] It is used to set how the resize method works. + * In fixed mode resizing a column does not alter total table width, which means that when a column is expanded the next one shrinks. + * If fixed is set to false then table can change its width and each column can shrink or expand independently. + * [version: 1.5] + */ + fixed?: boolean; + + /** + * [default: false] This attribute can be used to specify that the manually selected column widths must remain unaltered after a postback or browser refresh. + * This feature is mainly oriented to those pages created with server-side logic (codebehind), such as PHP or .NET, and it is only compatible with browsers + * with sessionStorage support (all modern browsers). + * However, if you are targeting older browsers (such as IE7 and IE8) you can still emulate sessionStorage using sessionStorage.js. + * It is important to note that some browsers (IE and FF) doesn’t enable the sessionStorage object while running the website directly from the local file system, + * so if you want to test this feature it is recommended to view the website through a web server or use browsers such as Chrome or Opera which doesn’t have this limitation. + * Don't worry about compatibility issues, once your site is up on the internet, all browsers will act in exactly the same way. + * [version: 1.3] + */ + postbackSafe?: boolean; + + /** + * [default: false] This attribute should be set to true if the table is inside of an updatePanel or any other kind of partial page refresh using ajax. + * Table's ID should be same before and after the partial partial refresh. + * [version: 1.5] + */ + partialRefresh?: boolean; + + /** + * [default: false] This attribute can be used to prevent vertical expansion of the column anchors to fit the table height. + * If it is set to true, column handler's size will be bounded to the first row's vertical size. + * [version: 1.2] + */ + headerOnly?: boolean; + + /** + * [default: ""] Its purpose is to allow column anchor customization by defining the HTML to be used in the column grips to provide some visual feedback. + * It can be used in a wide range of ways to obtain very different outputs, and its flexibility can be increased by combining it with the draggingClass attribute. + * [version: 1.0] + */ + gripInnerHtml?: string; + + /** + * [default: (internal class)] This attribute is used as the css class assigned to column anchors while being dragged. It can be used for visual feedback purposes. + * [version: 1.0] + */ + draggingClass?: string; + + /** + * [default: false] When set to true it aims to remove all previously added enhancements such as events and additional DOM elements assigned by this plugin to + * a single or collection of tables. It is required to disable a previously colResized table prior its removal from the document object tree. + * [version: 1.0] + */ + disable?: boolean; + + /** + * [default: [ ] ] An array of column indexes to be excluded, so it will not be possible to drag them manually. + * [version: 1.6] + */ + disabledColumns?: number[]; + + /** + * [default: 15] This value specifies the minimum width (measured in pixels) that is allowed for the columns. + * [version: 1.1] + */ + minWidth?: number; + + /** + * [default: "e-resize"] This attribute can be used to customize the cursor that will be displayed when the user is positioned on the column anchors. + * [version: 1.3] + */ + hoverCursor?: string; + + /** + * [default: "e-resize"] Defines the cursor that will be used while the user is resizing a column. + * [version: 1.3] + */ + dragCursor?: string; + + /** + * [default: false] Flush is only effective when postbackSafe is enabled. + * Its purpose is to remove all previously stored data related to the current table layout to get it back to its original layout preventing width restoration after postback. + * [version: ] + */ + flush?: boolean; + + /** + * [default: null] If the target table contains an explicit margin-left CSS rule, the same value must be used in this attribute (for example: "auto", "20%", "10px"). + * The reason why it is needed it is because most browsers (all except of IE) don’t allow direct access to the current CSS rule applied to an element in + * its original units (such as "%", "em" or "auto" values). + * If you know any workaround which doesn’t involve iteration through all the styles defined in the site and any other external dependencies, please let me know! + * [version: 1.3] + */ + marginLeft?: string; + + /** + * [default: null] It behaves in exactly the same way than the marginLeft attribute but applied to the right margin. + * [version: 1.3] + */ + marginRight?: string; + + /** + * If a callback function is supplied it will be fired when the user has ended dragging a column anchor altering the previous table layout. + * The callback function can obtain a reference to the updated table through the currentTarget attribute of the event retrieved by parameters + * [version: 1.0] + */ + onResize?: FunctionCallback; + + /** + * This event is fired while dragging a column anchor if liveDrag is enabled. It can be useful if the table is being used as a multiple range slider. + * The callback function can obtain a reference to the updated table through the currentTarget attribute of the event retrieved by parameters + * [version: 1.1] + */ + onDrag?: FunctionCallback; + } + + type FunctionCallback = (e: JQueryMouseEventObject) => void; +} diff --git a/types/colresizable/tsconfig.json b/types/colresizable/tsconfig.json new file mode 100644 index 0000000000..35bf902824 --- /dev/null +++ b/types/colresizable/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "colresizable-tests.ts" + ] +} diff --git a/types/colresizable/tslint.json b/types/colresizable/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/colresizable/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/combined-stream/combined-stream-tests.ts b/types/combined-stream/combined-stream-tests.ts index ffdc0eaac7..540db77b68 100644 --- a/types/combined-stream/combined-stream-tests.ts +++ b/types/combined-stream/combined-stream-tests.ts @@ -1,17 +1,17 @@ -import CombinedStream = require("combined-stream"); -import { createReadStream, createWriteStream } from "fs"; +import CombinedStream = require('combined-stream'); +import { createReadStream, createWriteStream } from 'fs'; const stream1 = new CombinedStream(); -stream1.append(createReadStream("tsconfig.json")); -stream1.append(createReadStream("tslint.json")); -stream1.append(createReadStream("index.d.ts")); +stream1.append(createReadStream('tsconfig.json')); +stream1.append(createReadStream('tslint.json')); +stream1.append(createReadStream('index.d.ts')); -stream1.pipe(createWriteStream("combined.txt")); +stream1.pipe(createWriteStream('combined.txt')); const stream2 = CombinedStream.create({ maxDataSize: 1 << 32, - pauseStreams: false, + pauseStreams: false }); stream1.destroy(); @@ -19,12 +19,29 @@ stream1.destroy(); // should log true console.log(CombinedStream.isStreamLike(stream2)); -stream2.on("data", (data) => { +stream2.on('data', data => { console.log(data); }); -stream2.pipe(createWriteStream("combined.txt")); +stream2.pipe(createWriteStream('combined.txt')); stream2.write(CombinedStream.name); stream2.destroy(); + +const arrowFunction = (): CombinedStream => { + const stream3 = new CombinedStream(); + + // test next function + stream3.append(next => { + stream3.append('hello world'); + next(createReadStream('')); + }); + + // next function with no next + stream3.append(() => { + stream3.append('hello again'); + }); + + return stream3; +}; diff --git a/types/combined-stream/index.d.ts b/types/combined-stream/index.d.ts index 271814a4af..b82b399e7f 100644 --- a/types/combined-stream/index.d.ts +++ b/types/combined-stream/index.d.ts @@ -1,19 +1,27 @@ // Type definitions for combined-stream 1.0 // Project: https://github.com/felixge/node-combined-stream -// Definitions by: Felix Geisendörfer , Tomek Łaziuk +// Definitions by: Felix Geisendörfer , Tomek Łaziuk , Kon Pik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -import { Stream } from "stream"; +import { Stream } from 'stream'; -declare class CombinedStream extends Stream implements CombinedStream.Options { +type Appendable = NodeJS.ReadableStream | NodeJS.WritableStream | Buffer | string | NextFunction; +type NextFunction = (next: (stream: Appendable) => any) => any; + +interface Options { + maxDataSize?: number; + pauseStreams?: boolean; +} + +declare class CombinedStream extends Stream implements Options { readonly writable: boolean; readonly readable: boolean; readonly dataSize: number; maxDataSize: number; pauseStreams: boolean; - append(stream: NodeJS.ReadableStream | NodeJS.WritableStream | Buffer | string): this; + append(stream: Appendable): this; write(data: any): void; pause(): void; resume(): void; @@ -34,23 +42,15 @@ declare class CombinedStream extends Stream implements CombinedStream.Options { _emitError(error: Error): void; // events - on(event: "close" | "end" | "resume" | "pause", cb: () => void): this; - on(event: "error", cb: (err: Error) => void): this; - on(event: "data", cb: (data: any) => void): this; - once(event: "close" | "end" | "resume" | "pause", cb: () => void): this; - once(event: "error", cb: (err: Error) => void): this; - once(event: "data", cb: (data: any) => void): this; -} + on(event: 'close' | 'end' | 'resume' | 'pause', cb: () => void): this; + on(event: 'error', cb: (err: Error) => void): this; + on(event: 'data', cb: (data: any) => void): this; + once(event: 'close' | 'end' | 'resume' | 'pause', cb: () => void): this; + once(event: 'error', cb: (err: Error) => void): this; + once(event: 'data', cb: (data: any) => void): this; -declare namespace CombinedStream { - interface Options { - maxDataSize?: number; - pauseStreams?: boolean; - } - - function create(options?: Options): CombinedStream; - - function isStreamLike(stream: any): stream is Stream; + static create(options?: Options): CombinedStream; + static isStreamLike(stream: any): stream is Stream; } export = CombinedStream; diff --git a/types/cometd/cometd-tests.ts b/types/cometd/cometd-tests.ts index ada9412c04..ef56879d6f 100644 --- a/types/cometd/cometd-tests.ts +++ b/types/cometd/cometd-tests.ts @@ -1,4 +1,4 @@ -import { CometD, Listener, Message } from "cometd"; +import { CometD, Listener, Message, SubscriptionHandle } from "cometd"; const cometd = new CometD(); @@ -78,7 +78,7 @@ cometd.unsubscribe(subscription3, additionalInfoUnsubscribe, unsubscribeReply => // Subscribers versus Listeners // ============================ -let _reportListener: Listener | undefined; +let _reportListener: SubscriptionHandle | undefined; cometd.addListener("/meta/handshake", message => { // Only subscribe if the handshake is successful @@ -106,7 +106,7 @@ cometd.addListener("/meta/handshake", message => { // Dynamic Resubscription // ====================== -let _subscription: Listener | undefined; +let _subscription: SubscriptionHandle | undefined; class Controller { dynamicSubscribe = () => { diff --git a/types/cometd/index.d.ts b/types/cometd/index.d.ts index 32e4f962bb..cd829d444c 100644 --- a/types/cometd/index.d.ts +++ b/types/cometd/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for CometD 4.0 // Project: http://cometd.org -// Definitions by: Derek Cicerone , Daniel Perez Alvarez +// Definitions by: Derek Cicerone , Daniel Perez Alvarez , Alex Henry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -75,6 +75,15 @@ export interface Message { } export type Listener = (message: Message) => void; +export type Callback = (data: any) => void; + +export interface SubscriptionHandle { + id: number; + channel: string; + listener: boolean; + callback: Callback; + scope?: any; +} export interface Extension { incoming?: Listener; @@ -202,14 +211,14 @@ export class CometD { * @param callback the callback to call when a message is sent to the channel * @returns the subscription handle to be passed to `removeListener` */ - addListener(channel: string, callback: Listener): Listener; + addListener(channel: string, callback: Listener): SubscriptionHandle; /** * Removes the subscription obtained with a call to `addListener`. * * @param subscription the subscription to unsubscribe. */ - removeListener(subscription: Listener): void; + removeListener(subscription: SubscriptionHandle): void; /** * Removes all listeners registered with `addListener` or `subscribe`. @@ -234,7 +243,7 @@ export class CometD { * @param subscribeCallback a function to be invoked when the subscription is acknowledged * @return the subscription handle to be passed to `unsubscribe` */ - subscribe(channel: string, callback: Listener, subscribeCallback?: Listener): Listener; + subscribe(channel: string, callback: Callback, subscribeCallback?: Listener): SubscriptionHandle; /** * Subscribes to the given channel, performing the given callback in the given scope when a @@ -255,7 +264,7 @@ export class CometD { * @param subscribeCallback a function to be invoked when the subscription is acknowledged * @return the subscription handle to be passed to `unsubscribe` */ - subscribe(channel: string, callback: Listener, subscribeProps: object, subscribeCallback?: Listener): Listener; + subscribe(channel: string, callback: Callback, subscribeProps: object, subscribeCallback?: Listener): SubscriptionHandle; /** * Unsubscribes the subscription obtained with a call to `subscribe`. @@ -263,7 +272,7 @@ export class CometD { * @param subscription the subscription to unsubscribe. * @param unsubscribeCallback a function to be invoked when the unsubscription is acknowledged */ - unsubscribe(subscription: Listener, unsubscribeCallback?: Listener): void; + unsubscribe(subscription: SubscriptionHandle, unsubscribeCallback?: Listener): void; /** * Unsubscribes the subscription obtained with a call to `subscribe`. @@ -272,12 +281,12 @@ export class CometD { * @param unsubscribeProps an object to be merged with the unsubscribe message * @param unsubscribeCallback a function to be invoked when the unsubscription is acknowledged */ - unsubscribe(subscription: Listener, unsubscribeProps: object, unsubscribeCallback?: Listener): void; + unsubscribe(subscription: SubscriptionHandle, unsubscribeProps: object, unsubscribeCallback?: Listener): void; /** * Resubscribes as necessary in case of a re-handshake. */ - resubscribe(subscription: Listener, subscribeProps?: object): Listener; + resubscribe(subscription: SubscriptionHandle, subscribeProps?: object): SubscriptionHandle; /** * Removes all subscriptions added via `subscribe`, but does not remove the listeners added via @@ -463,5 +472,5 @@ export class CometD { * @param isListener whether it was a listener * @param message the message received from the Bayeux server */ - onListenerException: (exception: any, subscriptionHandle: Listener, isListener: boolean, message: string) => void; + onListenerException: (exception: any, subscriptionHandle: SubscriptionHandle, isListener: boolean, message: string) => void; } diff --git a/types/commangular/commangular-mock.d.ts b/types/commangular/commangular-mock.d.ts index 134e4d0d1e..a31563bc9e 100644 --- a/types/commangular/commangular-mock.d.ts +++ b/types/commangular/commangular-mock.d.ts @@ -4,33 +4,33 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module commangular { - + /////////////////////////////////////////////////////////////////////////// // Commangular Static // see http://commangular.org/docs/#commangular-namespace /////////////////////////////////////////////////////////////////////////// interface ICommAngularStatic { - + /** * Mock dispatch function for testing commands. */ dispatch( ec: ICommandCall, callback: Function ): void; } - + interface ICommandCall { /** * Name of the command that needs to * execute */ command: string; - + /** * Data that needs to be passed to the command */ data?: any; } - - + + /** * Object type expected to be passed into the callback function * of the dispatch() function @@ -41,25 +41,25 @@ declare module commangular { * @param key The property name that is in the object that was passed */ dataPassed( key : string ) : any; - + /** * The data that was returned by the command * @param key The result key that was defined in the command. If no result * was defined use 'lastResult' as the key */ resultKey( key: string ): any; - + /** * Indicates if the command execution was cancelled. */ canceled( ): boolean; - + /** * Indicates if the command was executed???? */ commandExecuted( ): boolean; } - + } @@ -67,7 +67,6 @@ declare module commangular { * Mock dispatch function for testing commands. * @param ec an ICommandCall object * @param callback The function that will be called upon the completion of the command -* function should expecte an ICommandInfo paramter. +* function should expecte an ICommandInfo parameter. */ -declare function dispatch( ec: commangular.ICommandCall, callback: Function ): void; - +declare function dispatch( ec: commangular.ICommandCall, callback: Function ): void; diff --git a/types/commercetools__enzyme-extensions/commercetools__enzyme-extensions-tests.tsx b/types/commercetools__enzyme-extensions/commercetools__enzyme-extensions-tests.tsx new file mode 100644 index 0000000000..bceab689e7 --- /dev/null +++ b/types/commercetools__enzyme-extensions/commercetools__enzyme-extensions-tests.tsx @@ -0,0 +1,30 @@ +import React = require('react'); +import enzyme = require('enzyme'); +import configureExtensions = require('@commercetools/enzyme-extensions'); + +configureExtensions(enzyme.ShallowWrapper); + +function App() { + return 'Hello world'} />; +} + +interface ChildProps { + cb: () => string; +} + +function Child(props: ChildProps) { + return
{props.cb()}
; +} + +enzyme.shallow() + .find(App) + .renderProp('render'); +enzyme.shallow() + .find(Child) + .renderProp('render', 1, 2); + +enzyme.shallow() + .find(Child) + .drill(props => props.cb()); + +enzyme.shallow().until(Child); diff --git a/types/commercetools__enzyme-extensions/index.d.ts b/types/commercetools__enzyme-extensions/index.d.ts new file mode 100644 index 0000000000..7c009f8e95 --- /dev/null +++ b/types/commercetools__enzyme-extensions/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for @commercetools/enzyme-extensions 3.0 +// Project: https://github.com/commercetools/enzyme-extensions +// Definitions by: Christian Rackerseder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as enzyme from 'enzyme'; + +declare module 'enzyme' { + interface UntilOptions { + maxDepth: number; + } + interface ShallowWrapper

{ + renderProp(propName: string, ...args: any[]): ShallowWrapper

; + drill(expander: (props: any) => ShallowWrapper): ShallowWrapper

; + until(selector: EnzymeSelector, options?: UntilOptions): ShallowWrapper

; + } +} + +declare function monkeyPatchShallowWrapper(s: typeof enzyme.ShallowWrapper): void; + +export = monkeyPatchShallowWrapper; diff --git a/types/commercetools__enzyme-extensions/tsconfig.json b/types/commercetools__enzyme-extensions/tsconfig.json new file mode 100644 index 0000000000..9e6d70239e --- /dev/null +++ b/types/commercetools__enzyme-extensions/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "paths": { + "@commercetools/enzyme-extensions": ["commercetools__enzyme-extensions"] + } + }, + "files": [ + "index.d.ts", + "commercetools__enzyme-extensions-tests.tsx" + ] +} diff --git a/types/commercetools__enzyme-extensions/tslint.json b/types/commercetools__enzyme-extensions/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/commercetools__enzyme-extensions/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/compare-func/compare-func-tests.ts b/types/compare-func/compare-func-tests.ts new file mode 100644 index 0000000000..47b2842724 --- /dev/null +++ b/types/compare-func/compare-func-tests.ts @@ -0,0 +1,30 @@ +import compareFunc = require("compare-func"); + +// This is taken from https://github.com/stevemao/compare-func/blob/master/README.md#usage and extended + +// sort by an object property +[{ x: "b" }, { x: "a" }, { x: "c" }].sort(compareFunc("x")); +// => [{x: "a"}, {x: "b"}, {x: "c"}] + +// sort by a nested object property +[{ x: { y: "b" } }, { x: { y: "a" } }].sort(compareFunc("x.y")); +// => [{x: {y: "a"}}, {x: {y: "b"}}] + +// sort by the `x` property, then `y` +[{ x: "c", y: "c" }, { x: "b", y: "a" }, { x: "b", y: "b" }].sort(compareFunc(["x", "y"])); +// => [{x: "b", y: "a"}, {x: "b", y: "b"}, {x: "c", y: "c"}] + +// sort by the returned value +[{ x: "b" }, { x: "a" }, { x: "c" }].sort(compareFunc((el) => el.x)); +// => [{x: "a"}, {x: "b"}, {x: "c"}] + +// sort by an array of functions +[{ x: "c", y: "c" }, { x: "b", y: "a" }, { x: "b", y: "b" }].sort(compareFunc([ + (el) => el.x, + (el) => el.y, +])); +// => [{x: "a"}, {x: "b"}, {x: "c"}] + +// sort by itself +[1, 3, 2].sort(compareFunc()); +// => [1, 2, 3] diff --git a/types/compare-func/index.d.ts b/types/compare-func/index.d.ts new file mode 100644 index 0000000000..357de04fb0 --- /dev/null +++ b/types/compare-func/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for compare-func 1.3 +// Project: https://github.com/stevemao/compare-func +// Definitions by: Dogan Fennibay +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +type extractFunc = (e: T) => number | string; + +declare function compare_func(prop?: ReadonlyArray> | string | extractFunc): + (e1: T, e2: T) => number; + +export = compare_func; diff --git a/types/compare-func/tsconfig.json b/types/compare-func/tsconfig.json new file mode 100644 index 0000000000..9aa5f60c9d --- /dev/null +++ b/types/compare-func/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "compare-func-tests.ts" + ] +} diff --git a/types/compare-func/tslint.json b/types/compare-func/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/compare-func/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/connect-datadog/connect-datadog-tests.ts b/types/connect-datadog/connect-datadog-tests.ts new file mode 100644 index 0000000000..4160ba4bc0 --- /dev/null +++ b/types/connect-datadog/connect-datadog-tests.ts @@ -0,0 +1,16 @@ +import connectDD = require('connect-datadog'); +import dogstatsd = require('node-dogstatsd'); + +// works with no options +const middleware = connectDD({}); + +// works with all options +const middleware2 = connectDD({ + stat: 'foo', + path: true, + method: true, + protocol: true, + response_code: true, + tags: ['abc', 'def'], + dogstatsd: new dogstatsd.StatsD('localhost'), +}); diff --git a/types/connect-datadog/index.d.ts b/types/connect-datadog/index.d.ts new file mode 100644 index 0000000000..c3aad8aac7 --- /dev/null +++ b/types/connect-datadog/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for connect-datadog 0.0 +// Project: https://github.com/AppPress/node-connect-datadog +// Definitions by: Moshe Good +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import express = require('express'); +import dogstatsd = require('node-dogstatsd'); + +export = Factory; + +declare function Factory(options?: Factory.Options): express.RequestHandler; + +declare namespace Factory { + interface Options { + stat?: string; + tags?: string[]; + path?: boolean; + method?: boolean; + protocol?: boolean; + response_code?: boolean; + dogstatsd?: dogstatsd.StatsD; + } +} diff --git a/types/connect-datadog/tsconfig.json b/types/connect-datadog/tsconfig.json new file mode 100644 index 0000000000..fa91239b96 --- /dev/null +++ b/types/connect-datadog/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "connect-datadog-tests.ts" + ] +} diff --git a/types/connect-datadog/tslint.json b/types/connect-datadog/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/connect-datadog/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/consola/consola-tests.ts b/types/consola/consola-tests.ts new file mode 100644 index 0000000000..f6cc225346 --- /dev/null +++ b/types/consola/consola-tests.ts @@ -0,0 +1,15 @@ +import * as consola from 'consola'; + +consola.start('TEST'); +consola.info('TEST'); +consola.success('TEST'); +consola.error('TEST'); + +const logger = new consola.Consola({ + level: 30, +}); + +logger.start('TEST'); +logger.info('TEST'); +logger.success('TEST'); +logger.error('TEST'); diff --git a/types/consola/index.d.ts b/types/consola/index.d.ts new file mode 100644 index 0000000000..a17c0c5c8f --- /dev/null +++ b/types/consola/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for consola 1.x +// Project: https://github.com/nuxt/consola +// Definitions by: Jungwoo An +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +export interface LevelType { + level: number; + color: string; + isError?: boolean; +} + +export interface Reporter { + log(logObj: any): void; +} + +export interface Option { + level?: number; + types?: LevelType; + reporters?: Reporter[]; +} + +export class Consola { + constructor(option?: Option); + + add(reporter: Reporter): Consola; + remove(reporter: Reporter): Consola; + clear(): Consola; + withScope(scope: string): void; + start(...arguments: string[]): void; + success(...arguments: string[]): void; + info(...arguments: string[]): void; + error(...arguments: Array): void; +} + +export function start(...arguments: string[]): void; +export function success(...arguments: string[]): void; +export function info(...arguments: string[]): void; +export function error(...arguments: Array): void; diff --git a/types/consola/tsconfig.json b/types/consola/tsconfig.json new file mode 100644 index 0000000000..aab34c3363 --- /dev/null +++ b/types/consola/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "consola-tests.ts"] +} diff --git a/types/consola/tslint.json b/types/consola/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/consola/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/console-ui/console-ui-tests.ts b/types/console-ui/console-ui-tests.ts new file mode 100644 index 0000000000..0092ce60db --- /dev/null +++ b/types/console-ui/console-ui-tests.ts @@ -0,0 +1,60 @@ +import { Question } from 'inquirer'; +import UI = require('console-ui'); + +new UI({ + inputStream: process.stdin, + outputStream: process.stderr, + errorStream: process.stdout, + writeLevel: 'DEBUG', + ci: false +}); + +const ui = new UI(); + +ui.write(); // $ExpectError +ui.write('hello'); +ui.write('hello', 'DEBUG'); +ui.write('hello', 'INFO'); +ui.write('hello', 'WARNING'); +ui.write('hello', 'ERROR'); +ui.write('hello', 'NONEXISTENT'); // $ExpectError + +ui.writeLine(); // $ExpectError +ui.writeLine('hello'); +ui.writeLine('hello', 'DEBUG'); +ui.writeLine('hello', 'INFO'); +ui.writeLine('hello', 'WARNING'); +ui.writeLine('hello', 'ERROR'); +ui.writeLine('hello', 'NONEXISTENT'); // $ExpectError + +ui.writeDebugLine('hello'); + +ui.writeWarnLine('hello'); +ui.writeWarnLine('hello', true); +ui.writeWarnLine('hello', false, true); + +ui.writeDeprecateLine('hello'); +ui.writeDeprecateLine('hello', true); +ui.writeDeprecateLine('hello', false, true); + +ui.writeError(new Error('boom!')); +ui.writeError('boom!'); // $ExpectError + +ui.setWriteLevel('DEBUG'); +ui.setWriteLevel('INFO'); +ui.setWriteLevel('WARNING'); +ui.setWriteLevel('ERROR'); +ui.setWriteLevel('NONEXISTENT'); // $ExpectError + +ui.startProgress('hello'); +ui.stopProgress(); +ui.stopProgress('hello'); // $ExpectError + +const question: Question<{ answer: boolean }> = { + message: 'Yes / No?', + type: 'confirm' +}; + +ui.prompt(question).then(result => { + result.answer; // $ExpectType boolean +}); diff --git a/types/console-ui/index.d.ts b/types/console-ui/index.d.ts new file mode 100644 index 0000000000..a5a7cb994a --- /dev/null +++ b/types/console-ui/index.d.ts @@ -0,0 +1,93 @@ +// Type definitions for console-ui 2.2 +// Project: https://github.com/ember-cli/console-ui#readme +// Definitions by: Dan Freeman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Readable, Writable } from 'stream'; +import { Questions } from 'inquirer'; + +type WriteLevel = 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR'; + +export = UI; + +/** + * The UI provides the CLI with a unified mechanism for providing output and + * requesting input from the user. This becomes useful when wanting to adjust + * logLevels, or mock input/output for tests. + */ +declare class UI { + constructor(options?: { + inputStream?: Readable; + outputStream?: Writable; + errorStream?: Writable; + writeLevel?: WriteLevel; + ci?: boolean; + }); + + /** + * Unified mechanism to write a string to the console. + * Optionally include a writeLevel, this is used to decide if the specific + * logging mechanism should or should not be printed. + */ + write(message: string, level?: WriteLevel): void; + + /** + * Unified mechanism to write a string and new line to the console. + * Optionally include a writeLevel, this is used to decide if the specific + * logging mechanism should or should not be printed. + */ + writeLine(message: string, level?: WriteLevel): void; + + /** + * Helper method to write a string with the DEBUG writeLevel and gray chalk + */ + writeDebugLine(message: string): void; + + /** + * Helper method to write a string with the INFO writeLevel and cyan chalk + */ + writeInfoLine(message: string): void; + + /** + * Helper method to write a string with the WARNING writeLevel and yellow chalk. + * Optionally include a test. If falsy, the warning will be printed. By default, warnings + * will be prepended with WARNING text when printed. + */ + writeWarnLine(message: string, test?: boolean, prepend?: boolean): void; + + /** + * Helper method to write a string with the WARNING writeLevel and yellow chalk. + * Optionally include a test. If falsy, the deprecation will be printed. By default deprecations + * will be prepended with DEPRECATION text when printed. + */ + writeDeprecateLine(message: string, test?: boolean, prepend?: boolean): void; + + /** + * Unified mechanism to an Error to the console. + * This will occure at a writeLevel of ERROR + */ + writeError(error: object): void; + + /** + * Sets the write level for the UI. Valid write levels are 'DEBUG', 'INFO', + * 'WARNING', and 'ERROR'. + */ + setWriteLevel(level: WriteLevel): void; + + /** + * Begins a progress spinner with a message (only if the INFO write level is visible). + */ + startProgress(message: string): void; + + /** + * Ends the current progress spinner. + */ + stopProgress(): void; + + /** + * Launch the prompt interface (inquiry session) with (Array of Questions || Question) + * See [Inquirer.js#question](https://github.com/SBoudrias/Inquirer.js#question) for Question properties + */ + prompt(questions: Questions, callback?: (answers: T) => void): Promise; +} diff --git a/types/console-ui/tsconfig.json b/types/console-ui/tsconfig.json new file mode 100644 index 0000000000..fbb24995c7 --- /dev/null +++ b/types/console-ui/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "console-ui-tests.ts" + ] +} diff --git a/types/console-ui/tslint.json b/types/console-ui/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/console-ui/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/consul/index.d.ts b/types/consul/index.d.ts index 3d344ae983..096a906c8b 100644 --- a/types/consul/index.d.ts +++ b/types/consul/index.d.ts @@ -625,6 +625,7 @@ declare namespace Consul { dc?: string; tag?: string; passing?: boolean; + near?: string; } interface StateOptions extends CommonOptions { diff --git a/types/cookie/index.d.ts b/types/cookie/index.d.ts index bb7fc2cb54..cb03c91980 100644 --- a/types/cookie/index.d.ts +++ b/types/cookie/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for cookie 0.3 // Project: https://github.com/jshttp/cookie -// Definitions by: Pine Mizune +// Definitions by: Pine Mizune // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface CookieSerializeOptions { diff --git a/types/copy-text-to-clipboard/tslint.json b/types/copy-text-to-clipboard/tslint.json index 3db14f85ea..1c36270d47 100644 --- a/types/copy-text-to-clipboard/tslint.json +++ b/types/copy-text-to-clipboard/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-angle-bracket-type-assertion": false + } +} diff --git a/types/cordova-plugin-bluetoothclassic-serial/cordova-plugin-bluetoothclassic-serial-tests.ts b/types/cordova-plugin-bluetoothclassic-serial/cordova-plugin-bluetoothclassic-serial-tests.ts new file mode 100644 index 0000000000..72925fe5ba --- /dev/null +++ b/types/cordova-plugin-bluetoothclassic-serial/cordova-plugin-bluetoothclassic-serial-tests.ts @@ -0,0 +1,63 @@ +let BluetoothClassicSerial: BluetoothClassicSerial = + window.BluetoothClassicSerial; + +BluetoothClassicSerial.connect( + "", + [""] +); +BluetoothClassicSerial.connect( + "", + [""], + results => {} +); +BluetoothClassicSerial.connect( + "", + [""], + results => {}, + error => {} +); +BluetoothClassicSerial.connectInsecure("", [""]); +BluetoothClassicSerial.connectInsecure("", [""], results => {}); +BluetoothClassicSerial.connectInsecure("", [""], results => {}, error => {}); +BluetoothClassicSerial.register(() => {}); +BluetoothClassicSerial.disconnect(results => {}); +BluetoothClassicSerial.disconnect(results => {}, error => {}); +BluetoothClassicSerial.write("", ""); +BluetoothClassicSerial.write("", "", results => {}); +BluetoothClassicSerial.write("", "", results => {}, error => {}); +BluetoothClassicSerial.available(""); +BluetoothClassicSerial.available("", results => {}); +BluetoothClassicSerial.available("", results => {}, error => {}); +BluetoothClassicSerial.read(""); +BluetoothClassicSerial.read("", results => {}); +BluetoothClassicSerial.read("", results => {}, error => {}); +BluetoothClassicSerial.readUntil("", ""); +BluetoothClassicSerial.readUntil("", "", results => {}); +BluetoothClassicSerial.readUntil("", "", results => {}, error => {}); +BluetoothClassicSerial.subscribe("", ""); +BluetoothClassicSerial.subscribe("", "", results => {}); +BluetoothClassicSerial.subscribe("", "", results => {}, error => {}); +BluetoothClassicSerial.unsubscribe(""); +BluetoothClassicSerial.unsubscribe("", results => {}); +BluetoothClassicSerial.unsubscribe("", results => {}, error => {}); +BluetoothClassicSerial.subscribeRawData(""); +BluetoothClassicSerial.subscribeRawData("", results => {}); +BluetoothClassicSerial.subscribeRawData("", results => {}, error => {}); +BluetoothClassicSerial.unsubscribeRawData(""); +BluetoothClassicSerial.unsubscribeRawData("", results => {}); +BluetoothClassicSerial.unsubscribeRawData("", results => {}, error => {}); +BluetoothClassicSerial.clear(""); +BluetoothClassicSerial.clear("", results => {}); +BluetoothClassicSerial.clear("", results => {}, error => {}); +BluetoothClassicSerial.list(results => {}); +BluetoothClassicSerial.list(results => {}, error => {}); +BluetoothClassicSerial.isConnected(results => {}); +BluetoothClassicSerial.isConnected(results => {}, error => {}); +BluetoothClassicSerial.isEnabled(results => {}); +BluetoothClassicSerial.isEnabled(results => {}, error => {}); +BluetoothClassicSerial.showBluetoothSettings(results => {}); +BluetoothClassicSerial.showBluetoothSettings(results => {}, error => {}); +BluetoothClassicSerial.enable(results => {}); +BluetoothClassicSerial.enable(results => {}, error => {}); +BluetoothClassicSerial.discoverUnpaired(results => {}); +BluetoothClassicSerial.discoverUnpaired(results => {}, error => {}); diff --git a/types/cordova-plugin-bluetoothclassic-serial/index.d.ts b/types/cordova-plugin-bluetoothclassic-serial/index.d.ts new file mode 100644 index 0000000000..2dfe8c94ae --- /dev/null +++ b/types/cordova-plugin-bluetoothclassic-serial/index.d.ts @@ -0,0 +1,105 @@ +// Type definitions for cordova-plugin-bluetoothClassic-serial 0.9 +// Project: https://github.com/soltius/BluetoothClassicSerial +// Definitions by: Wouter Roosendaal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Global object bluetoothClassicSerial. + */ +interface Window { + BluetoothClassicSerial: BluetoothClassicSerial; +} + +interface BluetoothClassicSerial { + connect: ( + deviceId: string, + interfaceArray: [any], + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + connectInsecure: ( + deviceId: string, + interfaceArray: [any], + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + register: (data_cb?: () => any) => void; + disconnect: ( + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + write: ( + interfaceId: string, + data: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + available: ( + interfaceId: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + read: ( + interfaceId: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + readUntil: ( + interfaceId: string, + delimiter: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + subscribe: ( + interfaceId: string, + delimiter: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + unsubscribe: ( + interfaceId: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + subscribeRawData: ( + interfaceId: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + unsubscribeRawData: ( + interfaceId: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + clear: ( + interfaceId: string, + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + list: ( + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + isConnected: ( + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + isEnabled: ( + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + showBluetoothSettings: ( + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + enable: ( + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; + discoverUnpaired: ( + success_cb?: (results: any) => any, + fail_cb?: (error: any) => any + ) => void; +} + +declare var bluetoothClassicSerial: BluetoothClassicSerial; diff --git a/types/cordova-plugin-bluetoothclassic-serial/tsconfig.json b/types/cordova-plugin-bluetoothclassic-serial/tsconfig.json new file mode 100644 index 0000000000..5cd12b710a --- /dev/null +++ b/types/cordova-plugin-bluetoothclassic-serial/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cordova-plugin-bluetoothclassic-serial-tests.ts" + ] +} diff --git a/types/cordova-plugin-bluetoothclassic-serial/tslint.json b/types/cordova-plugin-bluetoothclassic-serial/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/cordova-plugin-bluetoothclassic-serial/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/cordova/tslint.json b/types/cordova/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/cordova/tslint.json +++ b/types/cordova/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/core-object/-private/utils.d.ts b/types/core-object/-private/utils.d.ts new file mode 100644 index 0000000000..35e3880150 --- /dev/null +++ b/types/core-object/-private/utils.d.ts @@ -0,0 +1,40 @@ +export type Constructor = new (...args: any[]) => Instance; +export type Mix = U & Pick>; +export type Values = T[keyof T]; + +/** Just the strings corresponding to method names on the given type */ +export type MethodNames = Values<{ [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never }>; + +/** + * Given a `this` type, arg types tuple and return type, creates a function-ish + * type that can only be only be invoked via `.call` or `.apply`. Because of the + * way CoreObject's `_super` works, it's an error to write e.g. `this._super.init()`; + */ +export interface CallOrApply { + apply: (thisArg: This, args: Args extends undefined ? any[] : Args | IArguments) => Return; + + // TODO support this properly with `...args: Args` once we can restrict to 3.0+ on DT + call: + Args extends undefined ? (thisArg: This) => Return : + Args extends [infer A] ? (thisArg: This, a: A) => Return : + Args extends [infer A, infer B] ? (thisArg: This, a: A, b: B) => Return : + Args extends [infer A, infer B, infer C] ? (thisArg: This, a: A, b: B, c: C) => Return : + Args extends [infer A, infer B, infer C, infer D] ? (thisArg: This, a: A, b: B, c: C, d: D) => Return : + (thisArg: This, ...args: any[]) => Return; +} + +/** + * The type of `this._super`, which has keys for all methods appearing in the given + * type, but forces the caller to use `.call` or `.apply` to invoke them. + */ +export type Super = { + // TODO just do `infer Args` once we can restrict to 3.0+ on DT + [K in MethodNames]: + T[K] extends () => infer Return ? CallOrApply : + T[K] extends (a: infer A) => infer Return ? CallOrApply : + T[K] extends (a: infer A, b: infer B) => infer Return ? CallOrApply : + T[K] extends (a: infer A, b: infer B, c: infer C) => infer Return ? CallOrApply : + T[K] extends (a: infer A, b: infer B, c: infer C, d: infer D) => infer Return ? CallOrApply : + T[K] extends (...args: any[]) => infer Return ? CallOrApply : + never; +}; diff --git a/types/core-object/core-object-tests.ts b/types/core-object/core-object-tests.ts new file mode 100644 index 0000000000..b434ee97fc --- /dev/null +++ b/types/core-object/core-object-tests.ts @@ -0,0 +1,163 @@ +import { Mix, MethodNames } from 'core-object/-private/utils'; +import CoreObject, { ExtendOptions, ExtendThisType } from 'core-object'; + +//////////// Mix //////////// + +declare const mix1: Mix<{ a: number }, { b: string }>; +mix1.a; // $ExpectType number +mix1.b; // $ExpectType string + +declare const mix2: Mix<{ a: number }, { a: string }>; +mix2.a; // $ExpectType string +mix2.b; // $ExpectError + +//////////// MethodNames //////////// + +declare const names1: MethodNames<{ a: string }>; +names1; // $ExpectType never + +declare const names2: MethodNames<{ a: () => number; b(arg: number): void }>; +names2; // $ExpectType "a" | "b" + +declare const names3: MethodNames<{ a: () => 'hi'; b: null }>; +names3; // $ExpectType "a" + +//////////// ExtendOptions //////////// + +const extendOptions1: ExtendOptions<{}> = { a: 1, b: 'hi' }; +const extendOptions2: ExtendOptions<{ a: number }> = { b: 'hi' }; +const extendOptions3: ExtendOptions<{ a: number }> = { a: 5 }; +const extendOptions4: ExtendOptions<{ a: number }> = { a: 'hi' }; // $ExpectError + +//////////// ExtendThisType //////////// + +declare function extendThisType1(options: T & ExtendThisType<{ prop: string; method: () => number }, T>): void; +extendThisType1({ + otherMethod() { + this.prop; // $ExpectType string + this.random; // $ExpectError + + this._super.method.call(this); // $ExpectType number + this._super.random; // $ExpectError + } +}); + +//////////// CoreObject //////////// + +const A = CoreObject.extend({ + foo: 'hello', + + method(): string { + return this.foo; + } +}); + +const a = new A(); +a.foo; // $ExpectType string +a.bar; // $ExpectError +a.method(); // $ExpectType string + +const B = A.extend({ + bar: 123, + + other(): string { + return this._super.method.call(this) + this.foo; + } +}); + +const b = new B(); +b.foo; // $ExpectType string +b.bar; // $ExpectType number +b.method(); // $ExpectType string +b.other(); // $ExpectType string + +class ClassWithMethods extends CoreObject.extend({ + extendMethod(arg: number): string { + return 'ok'; + } +}) { + esMethod(arg: string): number { + return 123; + } +} + +const ExtendSubclass = ClassWithMethods.extend({ + anotherMethod() { + this._super.extendMethod(1); // $ExpectError + this._super.esMethod('hi'); // $ExpectError + + this._super.extendMethod.call(this, 1); // $ExpectType string + this._super.extendMethod.apply(this, [1]); // $ExpectType string + + this._super.esMethod.call(this, 'hi'); // $ExpectType number + this._super.esMethod.apply(this, ['hi']); // $ExpectType number + } +}); + +class ESSubclass extends ClassWithMethods { + anotherMethod() { + this._super; // $ExpectError + + super.extendMethod(1); // $ExpectType string + super.esMethod('hi'); // $ExpectType number + } +} + +ClassWithMethods.extend({ extendMethod: null }); // $ExpectError +ClassWithMethods.extend({ extendMethod() {} }); // $ExpectError +ClassWithMethods.extend({ esMethod: null }); // $ExpectError +ClassWithMethods.extend({ esMethod() {} }); // $ExpectError + +ClassWithMethods.extend({ + extendMethod(arg: number): string { + const result = this._super.extendMethod.call(this, arg); + result; // $ExpectType string + return result; + }, + + esMethod(arg: string): number { + const result = this._super.esMethod.call(this, arg); + result; // $ExpectType number + return result; + } +}); + +declare class ClassWithManyMethods extends CoreObject { + method0(): 0; + method1(a: 'a'): 1; + method2(a: 'a', b: 'b'): 2; + method3(a: 'a', b: 'b', c: 'c'): 3; + method4(a: 'a', b: 'b', c: 'c', d: 'd'): 4; + method5(a: 'a', b: 'b', c: 'c', d: 'd', e: 'e'): 5; +} + +ClassWithManyMethods.extend({ + child(): void { + this._super.method0.call(this); // $ExpectType 0 + this._super.method0.apply(this, []); // $ExpectType 0 + + this._super.method1.call(this, 'a'); // $ExpectType 1 + this._super.method1.apply(this, ['a']); // $ExpectType 1 + this._super.method1.call(this, 'x'); // $ExpectError + this._super.method1.apply(this, ['x']); // $ExpectError + + this._super.method2.call(this, 'a', 'b'); // $ExpectType 2 + this._super.method2.apply(this, ['a', 'b']); // $ExpectType 2 + this._super.method2.call(this, 'a', 'x'); // $ExpectError + this._super.method2.apply(this, ['a', 'x']); // $ExpectError + + this._super.method3.call(this, 'a', 'b', 'c'); // $ExpectType 3 + this._super.method3.apply(this, ['a', 'b', 'c']); // $ExpectType 3 + this._super.method3.call(this, 'a', 'b', 'x'); // $ExpectError + this._super.method3.apply(this, ['a', 'b', 'x']); // $ExpectError + + this._super.method4.call(this, 'a', 'b', 'c', 'd'); // $ExpectType 4 + this._super.method4.apply(this, ['a', 'b', 'c', 'd']); // $ExpectType 4 + this._super.method4.call(this, 'a', 'b', 'c', 'x'); // $ExpectError + this._super.method4.apply(this, ['a', 'b', 'c', 'x']); // $ExpectError + + // Arity 4 is as high as we go for arg checking + this._super.method5.call(this, 'foo', 'bar', 'baz'); // $ExpectType 5 + this._super.method5.apply(this, ['foo', 'bar', 'baz']); // $ExpectType 5 + } +}); diff --git a/types/core-object/index.d.ts b/types/core-object/index.d.ts new file mode 100644 index 0000000000..aa4566cac2 --- /dev/null +++ b/types/core-object/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for core-object 3.0 +// Project: https://github.com/ember-cli/core-object +// Definitions by: Dan Freeman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { Mix, Super, Constructor } from './-private/utils'; + +/** The type of options allowed to be passed to `Base.extend()` */ +export type ExtendOptions = { [K in keyof Base]?: Base[K] } & Record; + +/** The `this` type for any methods on the options passed to `Base.extend()` */ +export type ExtendThisType = ThisType & { _super: Super }>; + +export default class CoreObject { + // TODO restrict to `Record` once we can restrict to 3.0+ on DT + init(options?: Record): void; + + static extend, Ext extends ExtendOptions>>( + this: BaseClass, + options: Ext & ExtendThisType, Ext> + ): BaseClass & Constructor, Ext>>; +} diff --git a/types/core-object/tsconfig.json b/types/core-object/tsconfig.json new file mode 100644 index 0000000000..908527fc38 --- /dev/null +++ b/types/core-object/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "-private/utils.d.ts", + "core-object-tests.ts" + ] +} diff --git a/types/core-object/tslint.json b/types/core-object/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/core-object/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/cote/cote-tests.ts b/types/cote/cote-tests.ts index 8fd52a73a4..1851654625 100644 --- a/types/cote/cote-tests.ts +++ b/types/cote/cote-tests.ts @@ -80,10 +80,10 @@ class Readme { payload: { val: number }; } - randomResponder.on('randomRequest', (req: RandomRequest, callback: (answer: number) => void) => { + randomResponder.on('randomRequest', (req: RandomRequest, callback: (error: any, answer?: number) => void) => { const answer = Math.floor(Math.random() * 10); console.log('request', req.payload.val, 'answering with', answer); - callback(answer); + callback(null, answer); }); } diff --git a/types/cote/index.d.ts b/types/cote/index.d.ts index f6c60c54a2..4c959af76b 100644 --- a/types/cote/index.d.ts +++ b/types/cote/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for cote 0.14 +// Type definitions for cote 0.17 // Project: https://github.com/dashersw/cote#readme // Definitions by: makepost +// Labat Robin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { EventEmitter2 } from "eventemitter2"; @@ -55,7 +56,7 @@ export class Requester extends Component { * @param event Request. * @param callback Function to execute after getting a result. */ - send(event: T, callback: (result: any) => void): void; + send(event: T, callback: (error: any, result: any) => void): void; } /** @@ -100,7 +101,7 @@ export class Responder extends Component { on( type: string | string[], listener: ( - ((event: T, callback: (result: any) => void) => void) | + ((event: T, callback: (error: any, result: any) => void) => void) | ((event: T) => Promise) ) ): this; diff --git a/types/countdown/tslint.json b/types/countdown/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/countdown/tslint.json +++ b/types/countdown/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/country-list/country-list-tests.ts b/types/country-list/country-list-tests.ts index d96fe630e2..50952d2a87 100644 --- a/types/country-list/country-list-tests.ts +++ b/types/country-list/country-list-tests.ts @@ -1,5 +1,4 @@ -import countries from 'country-list'; -const Countries = countries(); +import * as Countries from 'country-list'; Countries.getCode('Barbados'); // BB @@ -14,3 +13,5 @@ Countries.getName('BB'); // Barbados Countries.getNameList(); Countries.getNames(); + +Countries.overwrite([{ code: 'TW', name: 'Taiwan' }]); diff --git a/types/country-list/index.d.ts b/types/country-list/index.d.ts index 6c1747ff2a..ac3c80c9d5 100644 --- a/types/country-list/index.d.ts +++ b/types/country-list/index.d.ts @@ -1,41 +1,45 @@ -// Type definitions for country-list 1.1 +// Type definitions for country-list 2.1 // Project: https://github.com/fannarsh/country-list // Definitions by: Kyle Roach +// Adam Binford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function Countries(): { - /** - * Expects a two-digit country code. Returns the name for that country. If not found, it returns undefined. - */ - getName(code: string): string | undefined; +/** + * Expects an array of code and country name pairs to add to the list. Doesn't return anything. + */ +export function overwrite(countries: Array<{ code: string, name: string}>): void; - /** - * Expects the English country name. Returns the code for that country. If not found, it returns undefined. - */ - getCode(name: string): string | undefined; +/** + * Expects a two-digit country code. Returns the name for that country. If not found, it returns undefined. + */ +export function getName(code: string): string | undefined; - /** - * Returns an array of all country names. - */ - getNames(): string[]; +/** + * Expects the English country name. Returns the code for that country. If not found, it returns undefined. + */ +export function getCode(name: string): string | undefined; - /** - * Returns an array of all country codes. - */ - getCodes(): string[]; +/** + * Returns an array of all country names. + */ +export function getNames(): string[]; - /** - * Returns a key-value object of all countries using the name as key. - */ - getNameList(): {[name: string]: string}; +/** + * Returns an array of all country codes. + */ +export function getCodes(): string[]; - /** - * Returns a key-value object of all countries using the code as key. - */ - getCodeList(): {[code: string]: string}; +/** + * Returns a key-value object of all countries using the name as key. + */ +export function getNameList(): {[name: string]: string}; - /** - * Returns an array of all country information, in the same format as it gets imported. - */ - getData(): Array<{ code: string, name: string }>; -}; +/** + * Returns a key-value object of all countries using the code as key. + */ +export function getCodeList(): {[code: string]: string}; + +/** + * Returns an array of all country information, in the same format as it gets imported. + */ +export function getData(): Array<{ code: string, name: string }>; diff --git a/types/country-list/v1/country-list-tests.ts b/types/country-list/v1/country-list-tests.ts new file mode 100644 index 0000000000..d96fe630e2 --- /dev/null +++ b/types/country-list/v1/country-list-tests.ts @@ -0,0 +1,16 @@ +import countries from 'country-list'; +const Countries = countries(); + +Countries.getCode('Barbados'); // BB + +Countries.getCodes(); + +Countries.getCodeList(); + +Countries.getData(); + +Countries.getName('BB'); // Barbados + +Countries.getNameList(); + +Countries.getNames(); diff --git a/types/country-list/v1/index.d.ts b/types/country-list/v1/index.d.ts new file mode 100644 index 0000000000..e225845bde --- /dev/null +++ b/types/country-list/v1/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for country-list 1.1 +// Project: https://github.com/fannarsh/country-list +// Definitions by: Kyle Roach +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function Countries(): { + /** + * Expects a two-digit country code. Returns the name for that country. If not found, it returns undefined. + */ + getName(code: string): string | undefined; + + /** + * Expects the English country name. Returns the code for that country. If not found, it returns undefined. + */ + getCode(name: string): string | undefined; + + /** + * Returns an array of all country names. + */ + getNames(): string[]; + + /** + * Returns an array of all country codes. + */ + getCodes(): string[]; + + /** + * Returns a key-value object of all countries using the name as key. + */ + getNameList(): {[name: string]: string}; + + /** + * Returns a key-value object of all countries using the code as key. + */ + getCodeList(): {[code: string]: string}; + + /** + * Returns an array of all country information, in the same format as it gets imported. + */ + getData(): Array<{ code: string, name: string }>; +}; diff --git a/types/country-list/v1/tsconfig.json b/types/country-list/v1/tsconfig.json new file mode 100644 index 0000000000..f10adfdde5 --- /dev/null +++ b/types/country-list/v1/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "country-list": ["country-list/v1"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "country-list-tests.ts" + ] +} \ No newline at end of file diff --git a/types/country-list/v1/tslint.json b/types/country-list/v1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/country-list/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/countup.js/countup.js-tests.ts b/types/countup.js/countup.js-tests.ts new file mode 100644 index 0000000000..4b0dfc36d6 --- /dev/null +++ b/types/countup.js/countup.js-tests.ts @@ -0,0 +1,32 @@ +const b = new CountUp(".foo", 0, 100); + +const options: CountUp.CountUpOptions = { + decimal: ",", + useGrouping: true, + suffix: "-", + prefix: "=", + separator: "/", + useEasing: true, + formattingFn: number => number + "-", + easingFn: (t, b, c, d) => t + b + c + d, + numerals: ["q", 2, "e", [3], "t", 0, "u", 7, "o", "p"] +}; + +const element = document.getElementById("#id"); +if (element) { + const instance2 = new CountUp(element, 2, "3", 0, "5", options); +} + +const instance = new CountUp(".js-target", 2, "3", 0, "5", options); + +instance.start(); + +instance.start(() => { + console.log(instance.version()); +}); + +instance.update(999); + +instance.pauseResume(); + +if (instance.paused) instance.reset(); diff --git a/types/countup.js/index.d.ts b/types/countup.js/index.d.ts new file mode 100644 index 0000000000..e74376d75b --- /dev/null +++ b/types/countup.js/index.d.ts @@ -0,0 +1,124 @@ +// Type definitions for countup.js 1.9 +// Project: https://github.com/inorganik/CountUp.js +// Definitions by: Rostislav Shermenyov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class CountUp { + /** + * @param target Id of html element or var of previously selected html element where counting occurs + * @param startVal The value you want to begin at + * @param endVal The value you want to arrive at + * @param decimals Number of decimal places, default 0 + * @param duration Duration of animation in seconds, default 2 + * @param options Object of options + */ + constructor( + target: string | HTMLElement, + startVal: number | string, + endVal: number | string, + decimals?: number | string, + duration?: number | string, + options?: CountUp.CountUpOptions + ); + // #region Dynamic params + // Will appear(or not) in the CountUpInstance object once the other functions fire + // i.e. paused will return undefined instead of boolean unless the pauseResume() was called before + countDown?: boolean; + d?: any; + dec?: number; + decimals?: number; + duration?: number; + endVal?: number; + error?: string; + frameVal?: number; + initialized?: boolean; + options?: CountUp.CountUpOptions; + paused?: boolean; + rAF?: number; + remaining?: number; + startTime?: number; + startVal?: number; + timestamp?: number; + callback?(): void; + // #endregion + /** + * @param timestamp + */ + count(timestamp: number): void; + initialize(): boolean; + /** + * Toggles pause/resume animation. + */ + pauseResume(): void; + /** + * Print value to target. + * @param value number that will be passed to formattingFn and then printed to the target + */ + printValue(value: number): void; + /** + * Reset to startVal so animation can be run again. + */ + reset(): void; + /** + * Start your animation. + * @param callback Option callback to run on animation end + */ + start(callback?: () => void): void; + /** + * Pass a new endVal and start animation. + * @param newEndVal new value + */ + update(newEndVal: number | string): void; + version(): string; +} + +declare namespace CountUp { + interface CountUpOptions { + /** + * Character to use as a decimal + */ + decimal?: string; + /** + * Optional custom easing function, default is Robert Penner's easeOutExpo + * @param t current time + * @param b start value + * @param c change in value + * @param d duration + * @return calculated value + */ + easingFn?(t: number, b: number, c: number, d: number): number; + /** + * Optional custom formatting function + * @param num + * @return + */ + formattingFn?(num: number): string; + /** + * Optionally pass an array of custom numerals for 0-9 + */ + numerals?: any[]; + /** + * Optional text before the result + */ + prefix?: string; + /** + * Character to use as a separator + */ + separator?: string; + /** + * Optional text after the result + */ + suffix?: string; + /** + * Toggle easing + */ + useEasing?: boolean; + /** + * 1,000,000 vs 1000000 + */ + useGrouping?: boolean; + } +} + +export = CountUp; +export as namespace CountUp; diff --git a/types/countup.js/tsconfig.json b/types/countup.js/tsconfig.json new file mode 100644 index 0000000000..dc6a91b4a2 --- /dev/null +++ b/types/countup.js/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "countup.js-tests.ts" + ] +} diff --git a/types/countup.js/tslint.json b/types/countup.js/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/countup.js/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/critters-webpack-plugin/critters-webpack-plugin-tests.ts b/types/critters-webpack-plugin/critters-webpack-plugin-tests.ts new file mode 100644 index 0000000000..69d520eaff --- /dev/null +++ b/types/critters-webpack-plugin/critters-webpack-plugin-tests.ts @@ -0,0 +1,14 @@ +import Critters from 'critters-webpack-plugin'; + +new Critters({ + compress: true, + external: true, + inlineFonts: false, + preloadFonts: true, + keyframes: 'critical', + noscriptFallback: true, + inlineThreshold: 0, + mergeStylesheets: true, + pruneSource: true, + minimumExternalSize: 0, +}); diff --git a/types/critters-webpack-plugin/index.d.ts b/types/critters-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..daf9b3c218 --- /dev/null +++ b/types/critters-webpack-plugin/index.d.ts @@ -0,0 +1,85 @@ +// Type definitions for critters-webpack-plugin 2.0 +// Project: https://github.com/GoogleChromeLabs/critters +// Definitions by: Juan José González Giraldo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Plugin } from 'webpack'; + +export default Critters; +declare class Critters extends Plugin { + constructor(options?: Critters.CrittersOptions); +} + +declare namespace Critters { + interface CrittersOptions { + /** + * Inline styles from external stylesheets. + * @default true + */ + external?: boolean; + /** + * Inline external stylesheets smaller than a given size. + * @default 0 + */ + inlineThreshold?: number; + /** + * If the non-critical external stylesheet would be below this size, just inline it. + * @default 0 + */ + minimumExternalSize?: number; + /** + * Remove inlined rules from the external stylesheet. + * @default true + */ + pruneSource?: boolean; + /** + * Merged inlined stylesheets into a single + + + +​ +

​ + +​ + + +``` + */ + length: number; + /** + * Create a new jQuery object with elements added to the set of matched elements. + * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. + * @param context The point in the document at which the selector should begin matching; similar to the context + * argument of the $(selector, context) method. + * @see \`{@link https://api.jquery.com/add/ }\` + * @since 1.4 + */ + add(selector: JQuery.Selector, context: Element): this; + /** + * Create a new jQuery object with elements added to the set of matched elements. + * @param selector_elements_html_selection _@param_ `selector_elements_html_selection` + *
+ * * `selector` — A string representing a selector expression to find additional elements to add to the set of matched elements.
+ * * `elements` — One or more elements to add to the set of matched elements.
+ * * `html` — An HTML fragment to add to the set of matched elements.
+ * * `selection` — An existing jQuery object to add to the set of matched elements. + * @see \`{@link https://api.jquery.com/add/ }\` + * @since 1.0 + * @since 1.3.2 + * @example ​ ````Finds all divs and makes a border. Then adds all paragraphs to the jQuery object to set their backgrounds yellow. +```html + + + + + add demo + + + + +​ +
+
+
+
+
+
+​ +

Added this... (notice no border)

+​ + +​ + + +``` + * @example ​ ````Adds more elements, matched by the given expression, to the set of matched elements. +```html + + + + + add demo + + + +​ +

Hello

+Hello Again +​ + +​ + + +``` + * @example ​ ````Adds more elements, created on the fly, to the set of matched elements. +```html + + + + + add demo + + + +​ +

Hello

+​ + +​ + + +``` + * @example ​ ````Adds one or more Elements to the set of matched elements. +```html + + + + + add demo + + + +​ +

Hello

+Hello Again +​ + +​ + + +``` + * @example ​ ````Demonstrates how to add (or push) elements to an existing collection +```html + + + + + add demo + + + +​ +

Hello

+Hello Again +​ + +​ + + +``` + */ + add(selector_elements_html_selection: JQuery.Selector | JQuery.TypeOrArray | JQuery.htmlString | JQuery): this; + /** + * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. + * @param selector A string containing a selector expression to match the current set of elements against. + * @see \`{@link https://api.jquery.com/addBack/ }\` + * @since 1.8 + * @example ​ ````The .addBack() method causes the previous set of DOM elements in the traversal stack to be added to the current set. In the first example, the top stack contains the set resulting from .find("p"). In the second example, .addBack() adds the previous set of elements on the stack — in this case $("div.after-addback") — to the current set, selecting both the div and its enclosed paragraphs. +```html + + + + + addBack demo + + + + +​ +
+

Before addBack()

+
+

First Paragraph

+

Second Paragraph

+
+
+
+

After addBack()

+
+

First Paragraph

+

Second Paragraph

+
+
+​ + +​ + + +``` + */ + addBack(selector?: JQuery.Selector): this; + /** + * Adds the specified class(es) to each element in the set of matched elements. + * @param className_function _@param_ `className_function` + *
+ * * `className` — One or more space-separated classes to be added to the class attribute of each matched element.
+ * * `function` — A function returning one or more space-separated class names to be added to the existing class + * name(s). Receives the index position of the element in the set and the existing class name(s) as + * arguments. Within the function, `this` refers to the current element in the set. + * @see \`{@link https://api.jquery.com/addClass/ }\` + * @since 1.0 + * @since 1.4 + * @since 3.3 + * @example ​ ````Add the class "selected" to the matched elements. +```html + + + + + addClass demo + + + + +​ +

Hello

+

and

+

Goodbye

+​ + +​ + + +``` + * @example ​ ````Add the classes "selected" and "highlight" to the matched elements. +```html + + + + + addClass demo + + + + +​ +

Hello

+

and

+

Goodbye

+​ + +​ + + +``` + * @example ​ ````Pass in a function to .addClass() to add the "green" class to a div that already has a "red" class. +```html + + + + + addClass demo + + + + +​ +
This div should be white
+
This div will be green because it now has the "green" and "red" classes. + It would be red if the addClass function failed.
+
This div should be white
+

There are zero green divs

+​ + +​ + + +``` + */ + addClass(className_function: JQuery.TypeOrArray | ((this: TElement, index: number, currentClassName: string) => string)): this; + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert after each element in the set of matched elements. + * @see \`{@link https://api.jquery.com/after/ }\` + * @since 1.0 + * @example ​ ````Inserts some HTML after all paragraphs. +```html + + + + + after demo + + + + +​ +

I would like to say:

+​ + +​ + + +``` + * @example ​ ````Inserts a DOM element after all paragraphs. +```html + + + + + after demo + + + + +​ +

I would like to say:

+​ + +​ + + +``` + * @example ​ ````Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs. +```html + + + + + after demo + + + + +​ +Hello +

I would like to say:

+​ + +​ + + +``` + */ + after(...contents: Array>>): this; + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * @param function_functionーhtml _@param_ `function_functionーhtml` + *
+ * * `function` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * after each element in the set of matched elements. Receives the index position of the element in the + * set as an argument. Within the function, `this` refers to the current element in the set.
+ * * `functionーhtml` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * after each element in the set of matched elements. Receives the index position of the element in the + * set and the old HTML value of the element as arguments. Within the function, `this` refers to the + * current element in the set. + * @see \`{@link https://api.jquery.com/after/ }\` + * @since 1.4 + * @since 1.10 + */ + after(function_functionーhtml: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; + /** + * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. + * @param handler The function to be invoked. + * @see \`{@link https://api.jquery.com/ajaxComplete/ }\` + * @since 1.0 + * @example ​ ````Show a message when an Ajax request completes. +```javascript +$( document ).ajaxComplete(function( event, request, settings ) { + $( "#msg" ).append( "
  • Request Complete.
  • " ); +}); +``` + */ + ajaxComplete(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; + /** + * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. + * @param handler The function to be invoked. + * @see \`{@link https://api.jquery.com/ajaxError/ }\` + * @since 1.0 + * @example ​ ````Show a message when an Ajax request fails. +```javascript +$( document ).ajaxError(function( event, request, settings ) { + $( "#msg" ).append( "
  • Error requesting page " + settings.url + "
  • " ); +}); +``` + */ + ajaxError(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxSettings: JQuery.AjaxSettings, thrownError: string) => void | false): this; + /** + * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. + * @param handler The function to be invoked. + * @see \`{@link https://api.jquery.com/ajaxSend/ }\` + * @since 1.0 + * @example ​ ````Show a message before an Ajax request is sent. +```javascript +$( document ).ajaxSend(function( event, request, settings ) { + $( "#msg" ).append( "
  • Starting request at " + settings.url + "
  • " ); +}); +``` + */ + ajaxSend(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; + /** + * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. + * @param handler The function to be invoked. + * @see \`{@link https://api.jquery.com/ajaxStart/ }\` + * @since 1.0 + * @example ​ ````Show a loading message whenever an Ajax request starts (and none is already active). +```javascript +$( document ).ajaxStart(function() { + $( "#loading" ).show(); +}); +``` + */ + ajaxStart(handler: (this: Document) => void | false): this; + /** + * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. + * @param handler The function to be invoked. + * @see \`{@link https://api.jquery.com/ajaxStop/ }\` + * @since 1.0 + * @example ​ ````Hide a loading message after all the Ajax requests have stopped. +```javascript +$( document ).ajaxStop(function() { + $( "#loading" ).hide(); +}); +``` + */ + ajaxStop(handler: (this: Document) => void | false): this; + /** + * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. + * @param handler The function to be invoked. + * @see \`{@link https://api.jquery.com/ajaxSuccess/ }\` + * @since 1.0 + * @example ​ ````Show a message when an Ajax request completes successfully. +```javascript +$( document ).ajaxSuccess(function( event, request, settings ) { + $( "#msg" ).append( "
  • Successful Request!
  • " ); +}); +``` + */ + ajaxSuccess(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings, data: JQuery.PlainObject) => void | false): this; + /** + * Perform a custom animation of a set of CSS properties. + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/animate/ }\` + * @since 1.0 + * @example ​ ````An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function. Note, this code will do nothing unless the paragraph element is hidden. +```javascript +$( "p" ).animate({ + opacity: "show" +}, "slow", "easein" ); +``` + * @example ​ ````Animate all paragraphs and execute a callback function when the animation is complete. The first argument is an object of CSS properties, the second specifies that the animation should take 1000 milliseconds to complete, the third states the easing type, and the fourth argument is an anonymous callback function. +```javascript +$( "p" ).animate({ + height: 200, + width: 400, + opacity: 0.5 +}, 1000, "linear", function() { + alert( "all done" ); +}); +``` + */ + animate(properties: JQuery.PlainObject, + duration: JQuery.Duration, + easing: string, + complete?: (this: TElement) => void): this; + /** + * Perform a custom animation of a set of CSS properties. + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration_easing _@param_ `duration_easing` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `easing` — A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/animate/ }\` + * @since 1.0 + * @example ​ ````Click the button to animate the div with a number of different properties. +```html + + + + + animate demo + + + + +​ + +
    Hello!
    +​ + +​ + + +``` + * @example ​ ````Animates a div's left property with a relative value. Click several times on the buttons to see the relative animations queued up. +```html + + + + + animate demo + + + + +​ + + +
    +​ + +​ + + +``` + * @example ​ ````Animate all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds. +```javascript +$( "p" ).animate({ + height: "toggle", + opacity: "toggle" +}, "slow" ); +``` + * @example ​ ````Animate all paragraphs to a left style of 50 and opacity of 1 (opaque, visible), completing the animation within 500 milliseconds. +```javascript +$( "p" ).animate({ + left: 50, + opacity: 1 +}, 500 ); +``` + */ + animate(properties: JQuery.PlainObject, + duration_easing: JQuery.Duration | string, + complete?: (this: TElement) => void): this; + /** + * Perform a custom animation of a set of CSS properties. + * @param properties An object of CSS properties and values that the animation will move toward. + * @param options A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/animate/ }\` + * @since 1.0 + * @example ​ ````The first button shows how an unqueued animation works. It expands the div out to 90% width while the font-size is increasing. Once the font-size change is complete, the border animation will begin. + +The second button starts a traditional chained animation, where each animation will start once the previous animation on the element has completed. +```html + + + + + animate demo + + + + +​ + + + + +
    Block1
    +
    Block2
    +​ + +​ + + +``` + * @example ​ ````Animates the first div's left property and synchronizes the remaining divs, using the step function to set their left properties at each stage of the animation. +```html + + + + + animate demo + + + + +​ +

    +
    +
    +
    +
    +
    +
    +​ + +​ + + +``` + * @example ​ ````Animate the left and opacity style properties of all paragraphs; run the animation outside the queue, so that it will automatically start without waiting for its turn. +```javascript +$( "p" ).animate({ + left: "50px", + opacity: 1 +}, { + duration: 500, + queue: false +}); +``` + * @example ​ ````Animates all paragraphs to toggle both height and opacity, completing the animation within 600 milliseconds. +```javascript +$( "p" ).animate({ + height: "toggle", + opacity: "toggle" +}, { + duration: "slow" +}); +``` + * @example ​ ````Use an easing function to provide a different style of animation. This will only work if you have a plugin that provides this easing function. +```javascript +$( "p" ).animate({ + opacity: "show" +}, { + duration: "slow", + easing: "easein" +}); +``` + */ + animate(properties: JQuery.PlainObject, + options: JQuery.EffectsOptions): this; + /** + * Perform a custom animation of a set of CSS properties. + * @param properties An object of CSS properties and values that the animation will move toward. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/animate/ }\` + * @since 1.0 + */ + animate(properties: JQuery.PlainObject, + complete?: (this: TElement) => void): this; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert at the end of each element in the set of matched elements. + * @see \`{@link https://api.jquery.com/append/ }\` + * @since 1.0 + * @example ​ ````Appends some HTML to all paragraphs. +```html + + + + + append demo + + + + +​ +

    I would like to say:

    +​ + +​ + + +``` + * @example ​ ````Appends an Element to all paragraphs. +```html + + + + + append demo + + + + +​ +

    I would like to say:

    +​ + +​ + + +``` + * @example ​ ````Appends a jQuery object (similar to an Array of DOM Elements) to all paragraphs. +```html + + + + + append demo + + + + +​ +Hello world!!! +

    I would like to say:

    +​ + +​ + + +``` + */ + append(...contents: Array>>): this; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * @param funсtion A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at + * the end of each element in the set of matched elements. Receives the index position of the element + * in the set and the old HTML value of the element as arguments. Within the function, `this` refers to + * the current element in the set. + * @see \`{@link https://api.jquery.com/append/ }\` + * @since 1.4 + */ + append(funсtion: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; + /** + * Insert every element in the set of matched elements to the end of the target. + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements + * will be inserted at the end of the element(s) specified by this parameter. + * @see \`{@link https://api.jquery.com/appendTo/ }\` + * @since 1.0 + * @example ​ ````Append all spans to the element with the ID "foo" (Check append() documentation for more examples) +```html + + + + + appendTo demo + + + + +​ +I have nothing more to say... +​ +
    FOO!
    +​ + +​ + + +``` + */ + appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Set one or more attributes for the set of matched elements. + * @param attributeName The name of the attribute to set. + * @param value_function _@param_ `value_function` + *
    + * * `value` — A value to set for the attribute. If `null`, the specified attribute will be removed (as in \`{@link removeAttr .removeAttr()}`).
    + * * `function` — A function returning the value to set. `this` is the current element. Receives the index position of + * the element in the set and the old attribute value as arguments. + * @see \`{@link https://api.jquery.com/attr/ }\` + * @since 1.0 + * @since 1.1 + * @example ​ ````Set the id for divs based on the position in the page. +```html + + + + + attr demo + + + + +​ +
    Zero-th
    +
    First
    +
    Second
    +​ + +​ + + +``` + * @example ​ ````Set the src attribute from title attribute on the image. +```html + + + + + attr demo + + + +​ + +​ + +​ + + +``` + */ + attr(attributeName: string, + value_function: string | number | null | ((this: TElement, index: number, attr: string) => string | number | void | undefined)): this; + /** + * Set one or more attributes for the set of matched elements. + * @param attributes An object of attribute-value pairs to set. + * @see \`{@link https://api.jquery.com/attr/ }\` + * @since 1.0 + * @example ​ ````Set some attributes for all <img>s in the page. +```html + + + + + attr demo + + + + +​ + + + +​ +
    Attribute of Ajax
    +​ + +​ + + +``` + */ + attr(attributes: JQuery.PlainObject): this; + /** + * Get the value of an attribute for the first element in the set of matched elements. + * @param attributeName The name of the attribute to get. + * @see \`{@link https://api.jquery.com/attr/ }\` + * @since 1.0 + * @example ​ ````Display the checked attribute and property of a checkbox as it changes. +```html + + + + + attr demo + + + + +​ + + +

    +​ + +​ + + +``` + * @example ​ ````Find the title attribute of the first <em> in the page. +```html + + + + + attr demo + + + + +​ +

    Once there was a large dinosaur...

    +​ +The title of the emphasis is:
    +​ + +​ + + +``` + */ + attr(attributeName: string): string | undefined; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert before each element in the set of matched elements. + * @see \`{@link https://api.jquery.com/before/ }\` + * @since 1.0 + * @example ​ ````Inserts some HTML before all paragraphs. +```html + + + + + before demo + + + + +​ +

    is what I said...

    +​ + +​ + + +``` + * @example ​ ````Inserts a DOM element before all paragraphs. +```html + + + + + before demo + + + + +​ +

    is what I said...

    +​ + +​ + + +``` + * @example ​ ````Inserts a jQuery object (similar to an Array of DOM Elements) before all paragraphs. +```html + + + + + before demo + + + + +​ +

    is what I said...

    Hello +​ + +​ + + +``` + */ + before(...contents: Array>>): this; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * @param function_functionーhtml _@param_ `function_functionーhtml` + *
    + * * `function` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * before each element in the set of matched elements. Receives the index position of the element in + * the set as an argument. Within the function, `this` refers to the current element in the set.
    + * * `functionーhtml` — A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * before each element in the set of matched elements. Receives the index position of the element in + * the set and the old HTML value of the element as arguments. Within the function, `this` refers to the + * current element in the set. + * @see \`{@link https://api.jquery.com/before/ }\` + * @since 1.4 + * @since 1.10 + */ + before(function_functionーhtml: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; + // [bind() overloads] https://github.com/jquery/api.jquery.com/issues/1048 + /** + * Attach a handler to an event for the elements. + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/bind/ }\` + * @since 1.0 + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + */ + bind(eventType: string, + eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Attach a handler to an event for the elements. + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler_preventBubble _@param_ `handler_preventBubble` + *
    + * * `handler` — A function to execute each time the event is triggered.
    + * * `preventBubble` — Setting the third argument to false will attach a function that prevents the default action from + * occurring and stops the event from bubbling. The default is `true`. + * @see \`{@link https://api.jquery.com/bind/ }\` + * @since 1.0 + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + * @example ​ ````Handle click and double-click for the paragraph. Note: the coordinates are window relative, so in this case relative to the demo iframe. +```html + + + + + bind demo + + + + +​ +

    Click or double click here.

    + +​ + +​ + + +``` + * @example ​ ````To display each paragraph's text in an alert box whenever it is clicked: +```javascript +$( "p" ).bind( "click", function() { + alert( $( this ).text() ); +}); +``` + * @example ​ ````Cancel a default action and prevent it from bubbling up by returning false: +```javascript +$( "form" ).bind( "submit", function() { + return false; +}) +``` + * @example ​ ````Cancel only the default action by using the .preventDefault() method. +```javascript +$( "form" ).bind( "submit", function( event ) { + event.preventDefault(); +}); +``` + * @example ​ ````Stop an event from bubbling without preventing the default action by using the .stopPropagation() method. +```javascript +$( "form" ).bind( "submit", function( event ) { + event.stopPropagation(); +}); +``` + * @example ​ ````Bind custom events. +```html + + + + + bind demo + + + + +​ +

    Has an attached custom event.

    + + +​ + +​ + + +``` + */ + bind(eventType: string, + handler_preventBubble: JQuery.EventHandler | JQuery.EventHandlerBase> | false | null | undefined): this; + /** + * Attach a handler to an event for the elements. + * @param events An object containing one or more DOM event types and functions to execute for them. + * @see \`{@link https://api.jquery.com/bind/ }\` + * @since 1.4 + * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + * @example ​ ````Bind multiple events simultaneously. +```javascript +$( "div.test" ).bind({ + click: function() { + $( this ).addClass( "active" ); + }, + mouseenter: function() { + $( this ).addClass( "inside" ); + }, + mouseleave: function() { + $( this ).removeClass( "inside" ); + } +}); +``` + */ + bind(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; + /** + * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/blur/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + blur(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/blur/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````To trigger the blur event on all paragraphs: +```javascript +$( "p" ).blur(); +``` + */ + blur(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "change" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/change/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + change(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "change" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/change/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Attaches a change event to the select that gets the text for each selected option and writes them in the div. It then triggers the event for the initial text draw. +```html + + + + + change demo + + + + +​ + +
    +​ + +​ + + +``` + * @example ​ ````To add a validity test to all text input elements: +```javascript +$( "input[type='text']" ).change(function() { + // Check input( $( this ).val() ) for validity here +}); +``` + */ + change(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Get the children of each element in the set of matched elements, optionally filtered by a selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/children/ }\` + * @since 1.0 + * @example ​ ````Find all children of the clicked element. +```html + + + + + children demo + + + + +​ +
    +
    +

    This is the way we + write the demo,

    +
    +​ +
    + write the demo, demo, +
    +​ +
    + This the way we write the demo so + in +
    +​ +

    + the morning. + Found 0 children in TAG. +

    +
    +​ + +​ + + +``` + * @example ​ ````Find all children of each div. +```html + + + + + children demo + + + + +​ +

    Hello (this is a paragraph)

    +​ +
    Hello Again (this span is a child of the a div)
    +

    And Again (in another paragraph)

    +​ +
    And One Last Time (most text directly in a div)
    +​ + +​ + + +``` + * @example ​ ````Find all children with a class "selected" of each div. +```html + + + + + children demo + + + + +​ +
    + Hello +

    Hello Again

    +
    And Again
    +

    And One Last Time

    +
    +​ + +​ + + +``` + */ + children(selector?: JQuery.Selector): this; + /** + * Remove from the queue all items that have not yet been run. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see \`{@link https://api.jquery.com/clearQueue/ }\` + * @since 1.4 + * @example ​ ````Empty the queue. +```html + + + + + clearQueue demo + + + + +​ + + +
    +​ + +​ + + +``` + */ + clearQueue(queueName?: string): this; + /** + * Bind an event handler to the "click" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/click/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + click(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "click" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/click/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Hide paragraphs on a page when they are clicked: +```html + + + + + click demo + + + + +​ +

    First Paragraph

    +

    Second Paragraph

    +

    Yet one more Paragraph

    +​ + +​ + + +``` + * @example ​ ````Trigger the click event on all of the paragraphs on the page: +```javascript +$( "p" ).click(); +``` + */ + click(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Create a deep copy of the set of matched elements. + * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The + * default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back + * to false in 1.5.1 and up. + * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should + * be copied. By default its value matches the first argument's value (which defaults to false). + * @see \`{@link https://api.jquery.com/clone/ }\` + * @since 1.0 + * @since 1.5 + * @example ​ ````Clones all b elements (and selects the clones) and prepends them to all paragraphs. +```html + + + + + clone demo + + + +​ +Hello

    , how are you?

    +​ + +​ + + +``` + */ + clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param selector A string containing a selector expression to match elements against. + * @param context A DOM element within which a matching element may be found. + * @see \`{@link https://api.jquery.com/closest/ }\` + * @since 1.4 + */ + closest(selector: JQuery.Selector, context: Element): this; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param selector_selection_element _@param_ `selector_selection_element` + *
    + * * `selector` — A string containing a selector expression to match elements against.
    + * * `selection` — A jQuery object to match elements against.
    + * * `element` — An element to match elements against. + * @see \`{@link https://api.jquery.com/closest/ }\` + * @since 1.3 + * @since 1.6 + * @example ​ ````Show how event delegation can be done with closest. The closest list element toggles a yellow background when it or its descendent is clicked. +```html + + + + + closest demo + + + + +​ +
      +
    • Click me!
    • +
    • You can also Click me!
    • +
    +​ + +​ + + +``` + * @example ​ ````Pass a jQuery object to closest. The closest list element toggles a yellow background when it or its descendent is clicked. +```html + + + + + closest demo + + + + +​ +
      +
    • Click me!
    • +
    • You can also Click me!
    • +
    +​ + +​ + + +``` + */ + closest(selector_selection_element: JQuery.Selector | Element | JQuery): this; + /** + * Get the children of each element in the set of matched elements, including text and comment nodes. + * @see \`{@link https://api.jquery.com/contents/ }\` + * @since 1.2 + * @example ​ ````Find all the text nodes inside a paragraph and wrap them with a bold tag. +```html + + + + + contents demo + + + +​ +

    Hello John, how are you doing?

    +​ + +​ + + +``` + * @example ​ ````Change the background color of links inside of an iframe. +```html + + + + + contents demo + + + +​ + +​ + +​ + + +``` + */ + contents(): JQuery; + /** + * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/contextmenu/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + contextmenu(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/contextmenu/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````To show a "Hello World!" alert box when the contextmenu event is triggered on a paragraph on the page: +```javascript +$( "p" ).contextmenu(function() { + alert( "Hello World!" ); +}); +``` + * @example ​ ````Right click to toggle background color. +```html + + + + + contextmenu demo + + + + +​ +
    +Right click the block +​ + +​ + + +``` + */ + contextmenu(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Set one or more CSS properties for the set of matched elements. + * @param propertyName A CSS property name. + * @param value_function _@param_ `value_function` + *
    + * * `value` — A value to set for the property.
    + * * `function` — A function returning the value to set. `this` is the current element. Receives the index position of + * the element in the set and the old value as arguments. + * @see \`{@link https://api.jquery.com/css/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Change the color of any paragraph to red on mouseover event. +```html + + + + + css demo + + + + +​ +

    Just roll the mouse over me.

    +​ +

    Or me to see a color change.

    +​ + +​ + + +``` + * @example ​ ````Increase the width of #box by 200 pixels the first time it is clicked. +```html + + + + + css demo + + + + +​ +
    Click me to grow
    +​ + +​ + + +``` + * @example ​ ````Highlight a clicked word in the paragraph. +```html + + + + + css demo + + + + +​ +

    + Once upon a time there was a man + who lived in a pizza parlor. This + man just loved pizza and ate it all + the time. He went on to be the + happiest man in the world. The end. +

    +​ + +​ + + +``` + */ + css(propertyName: string, + value_function: string | number | ((this: TElement, index: number, value: string) => string | number | void | undefined)): this; + /** + * Set one or more CSS properties for the set of matched elements. + * @param properties An object of property-value pairs to set. + * @see \`{@link https://api.jquery.com/css/ }\` + * @since 1.0 + * @example ​ ````Change the font weight and background color on mouseenter and mouseleave. +```html + + + + + css demo + + + + +​ +

    Move the mouse over a paragraph.

    +

    Like this one or the one above.

    +​ + +​ + + +``` + * @example ​ ````Increase the size of a div when you click it. +```html + + + + + css demo + + + + +​ +
    click
    +
    click
    +​ + +​ + + +``` + */ + css(properties: JQuery.PlainObject string | number | void | undefined)>): this; + /** + * Get the computed style properties for the first element in the set of matched elements. + * @param propertyName A CSS property. + * @see \`{@link https://api.jquery.com/css/ }\` + * @since 1.0 + * @example ​ ````Get the background color of a clicked div. +```html + + + + + css demo + + + + +​ +  +
    +
    +
    +
    +​ + +​ + + +``` + */ + css(propertyName: string): string; + /** + * Get the computed style properties for the first element in the set of matched elements. + * @param propertyNames An array of one or more CSS properties. + * @see \`{@link https://api.jquery.com/css/ }\` + * @since 1.9 + * @example ​ ````Get the width, height, text color, and background color of a clicked div. +```html + + + + + css demo + + + + +​ +

     

    +
    1
    +
    2
    +
    3
    +
    4
    +​ + +​ + + +``` + */ + css(propertyNames: string[]): JQuery.PlainObject; + /** + * Store arbitrary data associated with the matched elements. + * @param key A string naming the piece of data to set. + * @param value The new data value; this can be any Javascript type except `undefined`. + * @see \`{@link https://api.jquery.com/data/ }\` + * @since 1.2.3 + * @example ​ ````Store then retrieve a value from the div element. +```html + + + + + data demo + + + + +​ +
    + The values stored were + + and + +
    +​ + +​ + + +``` + */ + data(key: string, value: string | number | boolean | symbol | object | null): this; + /** + * Store arbitrary data associated with the matched elements. + * @param obj An object of key-value pairs of data to update. + * @see \`{@link https://api.jquery.com/data/ }\` + * @since 1.4.3 + */ + data(obj: JQuery.PlainObject): this; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * @param key Name of the data stored. + * @param value `undefined` is not recognized as a data value. Calls such as `.data( "name", undefined )` + * will return the jQuery object that it was called on, allowing for chaining. + * @see \`{@link https://api.jquery.com/data/ }\` + * @since 1.2.3 + */ + // `unified-signatures` is disabled so that behavior when passing `undefined` to `value` can be documented. Unifying the signatures + // results in potential confusion for users from an unexpected parameter. + // tslint:disable-next-line:unified-signatures + data(key: string, value: undefined): any; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * @param key Name of the data stored. + * @see \`{@link https://api.jquery.com/data/ }\` + * @since 1.2.3 + * @example ​ ````Get the data named "blah" stored at for an element. +```html + + + + + data demo + + + + +​ +
    A div
    + + + + +

    The "blah" value of this div is ?

    +​ + +​ + + +``` + */ + data(key: string): any; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * @see \`{@link https://api.jquery.com/data/ }\` + * @since 1.4 + */ + data(): JQuery.PlainObject; + /** + * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/dblclick/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + dblclick(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/dblclick/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````To bind a "Hello World!" alert box to the dblclick event on every paragraph on the page: +```javascript +$( "p" ).dblclick(function() { + alert( "Hello World!" ); +}); +``` + * @example ​ ````Double click to toggle background color. +```html + + + + + dblclick demo + + + + +​ +
    +Double click the block +​ + +​ + + +``` + */ + dblclick(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Set a timer to delay execution of subsequent items in the queue. + * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see \`{@link https://api.jquery.com/delay/ }\` + * @since 1.4 + * @example ​ ````Animate the hiding and showing of two divs, delaying the first before showing it. +```html + + + + + delay demo + + + + +​ +

    +
    +
    +​ + +​ + + +``` + */ + delay(duration: JQuery.Duration, queueName?: string): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. + * @param selector A selector to filter the elements that trigger the event. + * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or + * "keydown," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/delegate/ }\` + * @since 1.4.2 + * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + */ + delegate(selector: JQuery.Selector, + eventType: string, + eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. + * @param selector A selector to filter the elements that trigger the event. + * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or + * "keydown," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/delegate/ }\` + * @since 1.4.2 + * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + * @example ​ ````Click a paragraph to add another. Note that .delegate() attaches a click event handler to all paragraphs - even new ones. +```html + + + + + delegate demo + + + + +​ +

    Click me!

    +​ + +​ + +​ + + +``` + * @example ​ ````To display each paragraph's text in an alert box whenever it is clicked: +```javascript +$( "body" ).delegate( "p", "click", function() { + alert( $( this ).text() ); +}); +``` + * @example ​ ````To cancel a default action and prevent it from bubbling up, return false: +```javascript +$( "body" ).delegate( "a", "click", function() { + return false; +}); +``` + * @example ​ ````To cancel only the default action by using the preventDefault method. +```javascript +$( "body" ).delegate( "a", "click", function( event ) { + event.preventDefault(); +}); +``` + * @example ​ ````Can bind custom events too. +```html + + + + + delegate demo + + + + +​ +

    Has an attached custom event.

    + + +​ + +​ + + +``` + */ + delegate(selector: JQuery.Selector, + eventType: string, + handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. + * @param selector A selector to filter the elements that trigger the event. + * @param events A plain object of one or more event types and functions to execute for them. + * @see \`{@link https://api.jquery.com/delegate/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.0. Use \`{@link on }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + */ + delegate(selector: JQuery.Selector, + events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; + /** + * Execute the next function on the queue for the matched elements. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see \`{@link https://api.jquery.com/dequeue/ }\` + * @since 1.2 + * @example ​ ````Use dequeue to end a custom queue function which allows the queue to keep going. +```html + + + + + dequeue demo + + + + +​ + +
    +​ + +​ + + +``` + */ + dequeue(queueName?: string): this; + /** + * Remove the set of matched elements from the DOM. + * @param selector A selector expression that filters the set of matched elements to be removed. + * @see \`{@link https://api.jquery.com/detach/ }\` + * @since 1.4 + * @example ​ ````Detach all paragraphs from the DOM +```html + + + + + detach demo + + + + +​ +

    Hello

    +how are +

    you?

    + +​ + +​ + + +``` + */ + detach(selector?: JQuery.Selector): this; + /** + * Iterate over a jQuery object, executing a function for each matched element. + * @param funсtion A function to execute for each matched element. + * @see \`{@link https://api.jquery.com/each/ }\` + * @since 1.0 + * @example ​ ````Iterate over three divs and sets their color property. +```html + + + + + each demo + + + + +​ +
    Click here
    +
    to iterate through
    +
    these divs.
    +​ + +​ + + +``` + * @example ​ ````To access a jQuery object instead of the regular DOM element, use $( this ). For example: +```html + + + + + each demo + + + + +​ +To do list: (click here to change) +
      +
    • Eat
    • +
    • Sleep
    • +
    • Be merry
    • +
    +​ + +​ + + +``` + * @example ​ ````Use return false to break out of each() loops early. +```html + + + + + each demo + + + + +​ + + +
    +
    +
    +
    +
    Stop here
    +
    +
    +
    +​ + +​ + + +``` + */ + each(funсtion: (this: TElement, index: number, element: TElement) => void | false): this; + /** + * Remove all child nodes of the set of matched elements from the DOM. + * @see \`{@link https://api.jquery.com/empty/ }\` + * @since 1.0 + * @example ​ ````Removes all child nodes (including text nodes) from all paragraphs +```html + + + + + empty demo + + + + +​ +

    + Hello, Person and person. +

    +​ + +​ + +​ + + +``` + */ + empty(): this; + /** + * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. + * @see \`{@link https://api.jquery.com/end/ }\` + * @since 1.0 + * @example ​ ````Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs. +```html + + + + + end demo + + + + +​ +

    + Hi there how are you doing? +

    +​ +

    + This span is one of + several spans in this + sentence. +

    +​ +
    + Tags in jQuery object initially: +
    +​ +
    + Tags in jQuery object after find: +
    +​ +
    + Tags in jQuery object after end: +
    +​ + +​ + + +``` + * @example ​ ````Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs. +```html + + + + + end demo + + + + +​ +

    Hello, how are you?

    +​ + +​ + + +``` + */ + end(): this; + /** + * Reduce the set of matched elements to the one at the specified index. + * @param index An integer indicating the 0-based position of the element. + * An integer indicating the position of the element, counting backwards from the last element in the set. + * @see \`{@link https://api.jquery.com/eq/ }\` + * @since 1.1.2 + * @since 1.4 + * @example ​ ````Turn the div with index 2 blue by adding an appropriate class. +```html + + + + + eq demo + + + + +​ +
    +
    +
    +
    +
    +
    +​ + +​ + + +``` + */ + eq(index: number): this; + /** + * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. + * @param obj An object to merge onto the jQuery prototype. + * @see \`{@link https://api.jquery.com/jQuery.fn.extend/ }\` + * @since 1.0 + * @example ​ ````Add two methods to the jQuery prototype ($.fn) object and then use one of them. +```html + + + + + jQuery.fn.extend demo + + + + +​ + + +​ + +​ + + +``` + */ + extend(obj: object): this; + /** + * Display the matched elements by fading them to opaque. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeIn/ }\` + * @since 1.4.3 + */ + fadeIn(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements by fading them to opaque. + * @param duration_easing _@param_ `duration_easing` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `easing` — A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeIn/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Fades a red block in over the text. Once the animation is done, it quickly fades in more text on top. +```html + + + + + fadeIn demo + + + + +​ +

    + Let it be known that the party of the first part + and the party of the second part are henceforth + and hereto directed to assess the allegations + for factual correctness... (click!) +

    CENSORED!
    +

    +​ + +​ + + +``` + */ + fadeIn(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; + /** + * Display the matched elements by fading them to opaque. + * @param duration_easing_complete_options _@param_ `duration_easing_complete_options` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `easing` — A string indicating which easing function to use for the transition.
    + * * `complete` — A function to call once the animation is complete, called once per matched element.
    + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/fadeIn/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates hidden divs to fade in one by one, completing each animation within 600 milliseconds. +```html + + + + + fadeIn demo + + + + +​ +Click here... +
    +
    +
    +​ + +​ + + +``` + */ + fadeIn(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Hide the matched elements by fading them to transparent. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeOut/ }\` + * @since 1.4.3 + * @example ​ ````Fades out two divs, one with a "linear" easing and one with the default, "swing," easing. +```html + + + + + fadeOut demo + + + + +​ + + +​ +
    +​ +
    linear
    +
    swing
    +​ + +​ + + +``` + */ + fadeOut(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements by fading them to transparent. + * @param duration_easing _@param_ `duration_easing` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `easing` — A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeOut/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Fades out spans in one section that you click on. +```html + + + + + fadeOut demo + + + + +​ +

    Find the modifiers -

    +

    + If you really want to go outside + in the cold then make sure to wear + your warm jacket given to you by + your favorite teacher. +

    +​ + +​ + + +``` + */ + fadeOut(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; + /** + * Hide the matched elements by fading them to transparent. + * @param duration_easing_complete_options _@param_ `duration_easing_complete_options` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `easing` — A string indicating which easing function to use for the transition.
    + * * `complete` — A function to call once the animation is complete, called once per matched element.
    + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/fadeOut/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates all paragraphs to fade out, completing the animation within 600 milliseconds. +```html + + + + + fadeOut demo + + + + +​ +

    + If you click on this paragraph + you'll see it just fade away. +

    +​ + +​ + + +``` + */ + fadeOut(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Adjust the opacity of the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeTo/ }\` + * @since 1.4.3 + */ + fadeTo(duration: JQuery.Duration, opacity: number, easing: string, complete?: (this: TElement) => void): this; + /** + * Adjust the opacity of the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeTo/ }\` + * @since 1.0 + * @example ​ ````Animates first paragraph to fade to an opacity of 0.33 (33%, about one third visible), completing the animation within 600 milliseconds. +```html + + + + + fadeTo demo + + + +​ +

    +Click this paragraph to see it fade. +

    +​ +

    +Compare to this one that won't fade. +

    +​ + +​ + + +``` + * @example ​ ````Fade div to a random opacity on each click, completing the animation within 200 milliseconds. +```html + + + + + fadeTo demo + + + + +​ +

    And this is the library that John built...

    +​ +
    +
    +
    +​ + +​ + + +``` + * @example ​ ````Find the right answer! The fade will take 250 milliseconds and change various styles when it completes. +```html + + + + + fadeTo demo + + + + +​ +

    Wrong

    +
    +

    Wrong

    +
    +

    Right!

    +
    +​ + +​ + + +``` + */ + fadeTo(duration: JQuery.Duration, opacity: number, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeToggle/ }\` + * @since 1.4.4 + * @example ​ ````Fades first paragraph in or out, completing the animation within 600 milliseconds and using a linear easing. Fades last paragraph in or out for 200 milliseconds, inserting a "finished" message upon completion. +```html + + + + + fadeToggle demo + + + +​ + + +

    This paragraph has a slow, linear fade.

    +

    This paragraph has a fast animation.

    +
    +​ + +​ + + +``` + */ + fadeToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * @param duration_easing _@param_ `duration_easing` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `easing` — A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/fadeToggle/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Fades first paragraph in or out, completing the animation within 600 milliseconds and using a linear easing. Fades last paragraph in or out for 200 milliseconds, inserting a "finished" message upon completion. +```html + + + + + fadeToggle demo + + + +​ + + +

    This paragraph has a slow, linear fade.

    +

    This paragraph has a fast animation.

    +
    +​ + +​ + + +``` + */ + fadeToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * @param duration_easing_complete_options _@param_ `duration_easing_complete_options` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `easing` — A string indicating which easing function to use for the transition.
    + * * `complete` — A function to call once the animation is complete, called once per matched element.
    + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/fadeToggle/ }\` + * @since 1.0 + * @since 1.4.3 + */ + fadeToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * @param selector_elements_selection_function _@param_ `selector_elements_selection_function` + *
    + * * `selector` — A string containing a selector expression to match the current set of elements against.
    + * * `elements` — One or more DOM elements to match the current set of elements against.
    + * * `selection` — An existing jQuery object to match the current set of elements against.
    + * * `function` — A function used as a test for each element in the set. this is the current DOM element. + * @see \`{@link https://api.jquery.com/filter/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Change the color of all divs; then add a border to those with a "middle" class. +```html + + + + + filter demo + + + + +​ +
    +
    +
    +
    +
    +
    +​ + +​ + + +``` + * @example ​ ````Change the color of all divs; then add a border to the second one (index == 1) and the div with an id of "fourth." +```html + + + + + filter demo + + + + +​ +
    +
    +
    +
    +
    +
    +​ + +​ + + +``` + * @example ​ ````Select all divs and filter the selection with a DOM element, keeping only the one with an id of "unique". +```javascript +$( "div" ).filter( document.getElementById( "unique" ) ); +``` + * @example ​ ````Select all divs and filter the selection with a jQuery object, keeping only the one with an id of "unique". +```javascript +$( "div" ).filter( $( "#unique" ) ); +``` + */ + filter(selector_elements_selection_function: + JQuery.Selector | + JQuery.TypeOrArray | + JQuery | + ((this: TElement, index: number, element: TElement) => boolean) + ): this; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * @param selector_element _@param_ `selector_element` + *
    + * * `selector` — A string containing a selector expression to match elements against.
    + * * `element` — An element or a jQuery object to match elements against. + * @see \`{@link https://api.jquery.com/find/ }\` + * @since 1.0 + * @since 1.6 + * @example ​ ````Starts with all paragraphs and searches for descendant span elements, same as $( "p span" ) +```html + + + + + find demo + + + +​ +

    Hello, how are you?

    +

    Me? I'm good.

    +​ + +​ + + +``` + * @example ​ ````A selection using a jQuery collection of all span tags. Only spans within p tags are changed to red while others are left blue. +```html + + + + + find demo + + + + +​ +

    Hello, how are you?

    +

    Me? I'm good.

    +
    Did you eat yet?
    +​ + +​ + + +``` + * @example ​ ````Add spans around each word then add a hover and italicize words with the letter t. +```html + + + + + find demo + + + + +​ +

    + When the day is short + find that which matters to you + or stop believing +

    +​ + +​ + + +``` + */ + find(selector_element: JQuery.Selector | Element | JQuery): this; + /** + * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. + * @param queue The name of the queue in which to stop animations. + * @see \`{@link https://api.jquery.com/finish/ }\` + * @since 1.9 + * @example ​ ````Click the Go button once to start the animation, and then click the other buttons to see how they affect the current and queued animations. +```html + + + + + finish demo + + + + +​ +
    +
    + +
    + + +
    + + +
    + + +
    + +
    + +
    +​ + +​ + + +``` + */ + finish(queue?: string): this; + /** + * Reduce the set of matched elements to the first in the set. + * @see \`{@link https://api.jquery.com/first/ }\` + * @since 1.4 + * @example ​ ````Highlight the first span in a paragraph. +```html + + + + + first demo + + + + +​ +

    + Look: + This is some text in a paragraph. + This is a note about it. +

    +​ + +​ + + +``` + */ + first(): this; + /** + * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/focus/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + focus(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/focus/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Fire focus. +```html + + + + + focus demo + + + + +​ +

    focus fire

    +

    focus fire

    +​ + +​ + + +``` + * @example ​ ````To stop people from writing in text input boxes, try: +```javascript +$( "input[type=text]" ).focus(function() { + $( this ).blur(); +}); +``` + * @example ​ ````To focus on a login input box with id 'login' on page startup, try: +```javascript +$( document ).ready(function() { + $( "#login" ).focus(); +}); +``` + */ + focus(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "focusin" event. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/focusin/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + focusin(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "focusin" event. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/focusin/ }\` + * @since 1.4 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Watch for a focus to occur within the paragraphs on the page. +```html + + + + + focusin demo + + + + +​ +

    focusin fire

    +

    focusin fire

    +​ + +​ + + +``` + */ + focusin(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "focusout" JavaScript event. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/focusout/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + focusout(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "focusout" JavaScript event. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/focusout/ }\` + * @since 1.4 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Watch for a loss of focus to occur inside paragraphs and note the difference between the focusout count and the blur count. (The blur count does not change because those events do not bubble.) +```html + + + + + focusout demo + + + + +​ +
    +

    +
    + +

    +

    + +

    +
    +
    focusout fire
    +
    blur fire
    +​ + +​ + + +``` + */ + focusout(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Retrieve one of the elements matched by the jQuery object. + * @param index A zero-based integer indicating which element to retrieve. + * @see \`{@link https://api.jquery.com/get/ }\` + * @since 1.0 + * @example ​ ````Display the tag name of the click element. +```html + + + + + get demo + + + + +​ +  +

    In this paragraph is an important section

    +
    +​ + +​ + + +``` + */ + get(index: number): TElement; + /** + * Retrieve the elements matched by the jQuery object. + * @see \`{@link https://api.jquery.com/get/ }\` + * @since 1.0 + * @example ​ ````Select all divs in the document and return the DOM Elements as an Array; then use the built-in reverse() method to reverse that array. +```html + + + + + get demo + + + + +​ +Reversed - +​ +
    One
    +
    Two
    +
    Three
    +​ + +​ + + +``` + */ + get(): TElement[]; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * @param selector_contained _@param_ `selector_contained` + *
    + * * `selector` — A string containing a selector expression to match elements against.
    + * * `contained` — A DOM element to match elements against. + * @see \`{@link https://api.jquery.com/has/ }\` + * @since 1.4 + * @example ​ ````Check if an element is inside another. +```html + + + + + has demo + + + + +​ +
    • Does the UL contain an LI?
    +​ + +​ + + +``` + */ + has(selector_contained: string | Element): this; + /** + * Determine whether any of the matched elements are assigned the given class. + * @param className The class name to search for. + * @see \`{@link https://api.jquery.com/hasClass/ }\` + * @since 1.2 + * @example ​ ````Looks for the paragraph that contains 'selected' as a class. +```html + + + + + hasClass demo + + + + +​ +

    This paragraph is black and is the first paragraph.

    +

    This paragraph is red and is the second paragraph.

    +
    First paragraph has selected class:
    +
    Second paragraph has selected class:
    +
    At least one paragraph has selected class:
    +​ + +​ + + +``` + */ + hasClass(className: string): boolean; + /** + * Set the CSS height of every matched element. + * @param value_function _@param_ `value_function` + *
    + * * `value` — An integer representing the number of pixels, or an integer with an optional unit of measure + * appended (as a string).
    + * * `function` — A function returning the height to set. Receives the index position of the element in the set and + * the old height as arguments. Within the function, `this` refers to the current element in the set. + * @see \`{@link https://api.jquery.com/height/ }\` + * @since 1.0 + * @since 1.4.1 + * @example ​ ````To set the height of each div on click to 30px plus a color change. +```html + + + + + height demo + + + + +​ +
    +
    +
    +
    +
    +​ + +​ + + +``` + */ + height(value_function: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * Get the current computed height for the first element in the set of matched elements. + * @see \`{@link https://api.jquery.com/height/ }\` + * @since 1.0 + * @example ​ ````Show various heights. Note the values are from the iframe so might be smaller than you expected. The yellow highlight shows the iframe body. +```html + + + + + height demo + + + + +​ + + + +​ +
     
    +

    + Sample paragraph to test height +

    +​ + +​ + + +``` + */ + height(): number | undefined; + /** + * Hide the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/hide/ }\` + * @since 1.4.3 + */ + hide(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; + /** + * Hide the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param easing_complete _@param_ `easing_complete` + *
    + * * `easing` — A string indicating which easing function to use for the transition.
    + * * `complete` — A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/hide/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates all spans (words in this case) to hide fastly, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one. +```html + + + + + hide demo + + + + +​ + + +
    + Once upon a + time there were + three programmers... +
    +​ + +​ + + +``` + * @example ​ ````Hides the divs when clicked over 2 seconds, then removes the div element when its hidden. Try clicking on more than one box at a time. +```html + + + + + hide demo + + + + +​ +
    +​ + +​ + + +``` + */ + hide(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; + /** + * Hide the matched elements. + * @param duration_complete_options _@param_ `duration_complete_options` + *
    + * * `duration` — A string or number determining how long the animation will run.
    + * * `complete` — A function to call once the animation is complete, called once per matched element.
    + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/hide/ }\` + * @since 1.0 + * @example ​ ````Hides all paragraphs then the link on click. +```html + + + + + hide demo + + + +​ +

    Hello

    +Click to hide me too +

    Here is another paragraph

    +​ + +​ + + +``` + * @example ​ ````Animates all shown paragraphs to hide slowly, completing the animation within 600 milliseconds. +```html + + + + + hide demo + + + + +​ + +

    Hiya

    +

    Such interesting text, eh?

    +​ + +​ + + +``` + */ + hide(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. + * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. + * @param handlerOut A function to execute when the mouse pointer leaves the element. + * @see \`{@link https://api.jquery.com/hover/ }\` + * @since 1.0 + * @since 1.4 + * @deprecated ​ Deprecated. + * + * **Cause**: The `.hover()` method is a shorthand for the use of the `mouseover`/`mouseout` events. It is often a poor user interface choice because it does not allow for any small amounts of delay between when the mouse enters or exits an area and when the event fires. This can make it quite difficult to use with UI widgets such as drop-down menus. For more information on the problems of hovering, see the \`{@link http://cherne.net/brian/resources/jquery.hoverIntent.html hoverIntent plugin}\`. + * + * **Solution**: Review uses of `.hover()` to determine if they are appropriate, and consider use of plugins such as `hoverIntent` as an alternative. The direct replacement for `.hover(fn1, fn2)`, is `.on("mouseenter", fn1).on("mouseleave", fn2)`. + * @example ​ ````To add a special style to list items that are being hovered over, try: +```html + + + + + hover demo + + + + +​ +
      +
    • Milk
    • +
    • Bread
    • +
    • Chips
    • +
    • Socks
    • +
    +​ + +​ + + +``` + * @example ​ ````To add a special style to table cells that are being hovered over, try: +```javascript +$( "td" ).hover( + function() { + $( this ).addClass( "hover" ); + }, function() { + $( this ).removeClass( "hover" ); + } +); +``` + * @example ​ ````To unbind the above example use: +```javascript +$( "td" ).off( "mouseenter mouseleave" ); +``` + * @example ​ ````Slide the next sibling LI up or down on hover, and toggle a class. +```html + + + + + hover demo + + + + +​ +
      +
    • Milk
    • +
    • White
    • +
    • Carrots
    • +
    • Orange
    • +
    • Broccoli
    • +
    • Green
    • +
    +​ + +​ + + +``` + */ + // HACK: The type parameter T is not used but ensures the 'event' callback parameter is typed correctly. + // tslint:disable-next-line:no-unnecessary-generics + hover(handlerInOut: JQuery.EventHandler | JQuery.EventHandlerBase> | false, + handlerOut?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Set the HTML contents of each element in the set of matched elements. + * @param htmlString_function _@param_ `htmlString_function` + *
    + * * `htmlString` — A string of HTML to set as the content of each matched element.
    + * * `function` — A function returning the HTML content to set. Receives the index position of the element in the set + * and the old HTML value as arguments. jQuery empties the element before calling the function; use the + * oldhtml argument to reference the previous content. Within the function, `this` refers to the current + * element in the set. + * @see \`{@link https://api.jquery.com/html/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Add some html to each div. +```html + + + + + html demo + + + + +​ +Hello +
    +
    +
    +​ + +​ + + +``` + * @example ​ ````Add some html to each div then immediately do further manipulations to the inserted html. +```html + + + + + html demo + + + + +​ +
    +
    +
    +​ + +​ + + +``` + */ + html(htmlString_function: JQuery.htmlString | ((this: TElement, index: number, oldhtml: JQuery.htmlString) => JQuery.htmlString)): this; + /** + * Get the HTML contents of the first element in the set of matched elements. + * @see \`{@link https://api.jquery.com/html/ }\` + * @since 1.0 + * @example ​ ````Click a paragraph to convert it from html to text. +```html + + + + + html demo + + + + +​ +

    + Click to change the html +

    +

    + to a text node. +

    +

    + This does nothing. +

    +​ + +​ + + +``` + */ + html(): string; + /** + * Search for a given element from among the matched elements. + * @param selector_element _@param_ `selector_element` + *
    + * * `selector` — A selector representing a jQuery collection in which to look for an element.
    + * * `element` — The DOM element or first element within the jQuery object to look for. + * @see \`{@link https://api.jquery.com/index/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````On click, returns the index (zero-based) of that div in the page. +```html + + + + + index demo + + + + +​ +Click a div! +
    First div
    +
    Second div
    +
    Third div
    +​ + +​ + + +``` + * @example ​ ````Returns the index for the element with ID bar. +```html + + + + + index demo + + + + +​ +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    +
    +​ + +​ + + +``` + * @example ​ ````Returns the index for the first item in the jQuery collection. +```html + + + + + index demo + + + + +​ +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    +
    +​ + +​ + + +``` + * @example ​ ````Returns the index for the element with ID bar in relation to all <li> elements. +```html + + + + + index demo + + + + +​ +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    +
    +​ + +​ + + +``` + * @example ​ ````Returns the index for the element with ID bar in relation to its siblings. +```html + + + + + index demo + + + + +​ +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    +
    +​ + +​ + + +``` + * @example ​ ````Returns -1, as there is no element with ID foobar. +```html + + + + + index demo + + + + +​ +
      +
    • foo
    • +
    • bar
    • +
    • baz
    • +
    +
    +​ + +​ + + +``` + */ + index(selector_element?: JQuery.Selector | Element | JQuery): number; + /** + * Set the CSS inner height of each element in the set of matched elements. + * @param value_function _@param_ `value_function` + *
    + * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string).
    + * * `function` — A function returning the inner height (including padding but not border) to set. Receives the index + * position of the element in the set and the old inner height as arguments. Within the function, `this` + * refers to the current element in the set. + * @see \`{@link https://api.jquery.com/innerHeight/ }\` + * @since 1.8.0 + * @example ​ ````Change the inner height of each div the first time it is clicked (and change its color). +```html + + + + + innerHeight demo + + + + +​ +
    d
    +
    d
    +
    d
    +
    d
    +
    d
    +​ + +​ + + +``` + */ + innerHeight(value_function: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * Get the current computed height for the first element in the set of matched elements, including padding but not border. + * @see \`{@link https://api.jquery.com/innerHeight/ }\` + * @since 1.2.6 + * @example ​ ````Get the innerHeight of a paragraph. +```html + + + + + innerHeight demo + + + + +​ +

    Hello

    +

    +​ + +​ + + +``` + */ + innerHeight(): number | undefined; + /** + * Set the CSS inner width of each element in the set of matched elements. + * @param value_function _@param_ `value_function` + *
    + * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string).
    + * * `function` — A function returning the inner width (including padding but not border) to set. Receives the index + * position of the element in the set and the old inner width as arguments. Within the function, `this` + * refers to the current element in the set. + * @see \`{@link https://api.jquery.com/innerWidth/ }\` + * @since 1.8.0 + * @example ​ ````Change the inner width of each div the first time it is clicked (and change its color). +```html + + + + + innerWidth demo + + + + +​ +
    d
    +
    d
    +
    d
    +
    d
    +
    d
    +​ + +​ + + +``` + */ + innerWidth(value_function: string | number | ((this: TElement, index: number, width: number) => string | number)): this; + /** + * Get the current computed inner width for the first element in the set of matched elements, including padding but not border. + * @see \`{@link https://api.jquery.com/innerWidth/ }\` + * @since 1.2.6 + * @example ​ ````Get the innerWidth of a paragraph. +```html + + + + + innerWidth demo + + + + +​ +

    Hello

    +

    +​ + +​ + + +``` + */ + innerWidth(): number | undefined; + /** + * Insert every element in the set of matched elements after the target. + * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements + * will be inserted after the element(s) specified by this parameter. + * @see \`{@link https://api.jquery.com/insertAfter/ }\` + * @since 1.0 + * @example ​ ````Insert all paragraphs after an element with id of "foo". Same as $( "#foo" ).after( "p" ) +```html + + + + + insertAfter demo + + + + +​ +

    is what I said...

    +
    FOO!
    +​ + +​ + + +``` + */ + insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Insert every element in the set of matched elements before the target. + * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements + * will be inserted before the element(s) specified by this parameter. + * @see \`{@link https://api.jquery.com/insertBefore/ }\` + * @since 1.0 + * @example ​ ````Insert all paragraphs before an element with id of "foo". Same as $( "#foo" ).before( "p" ) +```html + + + + + insertBefore demo + + + + +​ +
    FOO!
    +

    I would like to say:

    +​ + +​ + + +``` + */ + insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * @param selector_function_selection_elements _@param_ `selector_function_selection_elements` + *
    + * * `selector` — A string containing a selector expression to match elements against.
    + * * `function` — A function used as a test for every element in the set. It accepts two arguments, `index`, which is + * the element's index in the jQuery collection, and `element`, which is the DOM element. Within the + * function, `this` refers to the current DOM element.
    + * * `selection` — An existing jQuery object to match the current set of elements against.
    + * * `elements` — One or more elements to match the current set of elements against. + * @see \`{@link https://api.jquery.com/is/ }\` + * @since 1.0 + * @since 1.6 + * @example ​ ````Shows a few ways is() can be used inside an event handler. +```html + + + + + is demo + + + + +​ +
    +
    +
    +
    +

    Peter
    +
    +

     

    +​ + +​ + + +``` + * @example ​ ````Returns true, because the parent of the input is a form element. +```html + + + + + is demo + + + + +​ +
    + +
    +
    +​ + +​ + + +``` + * @example ​ ````Returns false, because the parent of the input is a p element. +```html + + + + + is demo + + + + +​ +
    +

    +
    +
    +​ + +​ + + +``` + * @example ​ ````Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red. +```html + + + + + is demo + + + + +​ +
      +
    • Chrome
    • +
    • Safari
    • +
    • Firefox
    • +
    • Opera
    • +
    +​ + +​ + + +``` + * @example ​ ````An alternate way to achieve the above example using an element rather than a jQuery object. Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red. +```html + + + + + is demo + + + + +​ +
      +
    • Chrome
    • +
    • Safari
    • +
    • Firefox
    • +
    • Opera
    • +
    +​ + +​ + + +``` + */ + is(selector_function_selection_elements: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): boolean; + /** + * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/keydown/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + keydown(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/keydown/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show the event object for the keydown handler when a key is pressed in the input. +```html + + + + + keydown demo + + + + +​ +
    +
    + + +
    +
    + + +​ + +​ + + +``` + */ + keydown(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/keypress/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + keypress(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/keypress/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show the event object when a key is pressed in the input. Note: This demo relies on a simple $.print() plugin (https://api.jquery.com/resources/events.js) for the event object's output. +```html + + + + + keypress demo + + + + +​ +
    +
    + + +
    +
    + + +​ + +​ + + +``` + */ + keypress(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/keyup/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + keyup(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/keyup/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show the event object for the keyup handler (using a simple $.print plugin) when a key is released in the input. +```html + + + + + keyup demo + + + + +​ +
    +
    + + +
    +
    + + +​ + +​ + + +``` + */ + keyup(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Reduce the set of matched elements to the final one in the set. + * @see \`{@link https://api.jquery.com/last/ }\` + * @since 1.4 + * @example ​ ````Highlight the last span in a paragraph. +```html + + + + + last demo + + + + +​ +

    Look: This is some text in a paragraph. This is a note about it.

    +​ + +​ + + +``` + */ + last(): this; + /** + * Load data from the server and place the returned HTML into the matched element. + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param complete A callback function that is executed when the request completes. + * @see \`{@link https://api.jquery.com/load/ }\` + * @since 1.0 + * @example ​ ````Same as above, but will POST the additional parameters to the server and a callback that is executed when the server is finished responding. +```javascript +$( "#feeds" ).load( "feeds.php", { limit: 25 }, function() { + alert( "The last 25 entries in the feed have been loaded" ); +}); +``` + */ + load(url: string, + data: string | JQuery.PlainObject, + complete: (this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void): this; + /** + * Load data from the server and place the returned HTML into the matched element. + * @param url A string containing the URL to which the request is sent. + * @param complete_data _@param_ `complete_data` + *
    + * * `complete` — A callback function that is executed when the request completes.
    + * * `data` — A plain object or string that is sent to the server with the request. + * @see \`{@link https://api.jquery.com/load/ }\` + * @since 1.0 + * @example ​ ````Load another page's list items into an ordered list. +```html + + + + + load demo + + + + +​ +Projects: +
      +​ + +​ + + +``` + * @example ​ ````Display a notice if the Ajax request encounters an error. +```html + + + + + load demo + + + + +​ +Successful Response (should be blank): +
      +Error Response: +
      +​ + +​ + + +``` + * @example ​ ````Load the feeds.html file into the div with the ID of feeds. +```javascript +$( "#feeds" ).load( "feeds.html" ); +``` + * @example ​ ````pass arrays of data to the server. +```javascript +$( "#objectID" ).load( "test.php", { "choices[]": [ "Jon", "Susan" ] } ); +``` + */ + load(url: string, + complete_data?: ((this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void) | string | JQuery.PlainObject): this; + /** + * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. + * @param callback A function object that will be invoked for each element in the current set. + * @see \`{@link https://api.jquery.com/map/ }\` + * @since 1.2 + * @example ​ ````Build a list of all the values within a form. +```html + + + + + map demo + + + + +​ +

      Values:

      +
      + + + +
      +​ + +​ + + +``` + * @example ​ ````A contrived example to show some functionality. +```html + + + + + map demo + + + + +​ +
        +
      • First
      • +
      • Second
      • +
      • Third
      • +
      • Fourth
      • +
      • Fifth
      • +
      +
        +
      +​ + +​ + + +``` + * @example ​ ````Equalize the heights of the divs. +```html + + + + + map demo + + + + +​ + +
      +
      +
      +​ + +​ + + +``` + */ + map(callback: (this: TElement, index: number, domElement: TElement) => JQuery.TypeOrArray | null | undefined): JQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mousedown/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + mousedown(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mousedown/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show texts when mouseup and mousedown event triggering. +```html + + + + + mousedown demo + + + +​ +

      Press mouse and release here.

      +​ + +​ + + +``` + */ + mousedown(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseenter/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + mouseenter(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseenter/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show texts when mouseenter and mouseout event triggering. + mouseover fires when the pointer moves into the child element as well, while mouseenter fires only when the pointer moves into the bound element. +```html + + + + + mouseenter demo + + + + +​ +
      +

      move your mouse

      +

      move your mouse

      0

      +

      0

      +
      +​ +
      +

      move your mouse

      +

      move your mouse

      0

      +

      0

      +
      +​ + +​ + + +``` + */ + mouseenter(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseleave/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + mouseleave(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseleave/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show number of times mouseout and mouseleave events are triggered. mouseout fires when the pointer moves out of child element as well, while mouseleave fires only when the pointer moves out of the bound element. +```html + + + + + mouseleave demo + + + + +​ +
      +

      move your mouse

      +

      move your mouse

      0

      +

      0

      +
      +
      +

      move your mouse

      +

      move your mouse

      0

      +

      0

      +
      +​ + +​ + + +``` + */ + mouseleave(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mousemove/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + mousemove(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mousemove/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show the mouse coordinates when the mouse is moved over the yellow div. Coordinates are relative to the window, which in this case is the iframe. +```html + + + + + mousemove demo + + + + +​ +

      + Move the mouse over the div. +   +

      +
      +​ + +​ + + +``` + */ + mousemove(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseout/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + mouseout(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseout/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show the number of times mouseout and mouseleave events are triggered. + mouseout fires when the pointer moves out of the child element as well, while mouseleave fires only when the pointer moves out of the bound element. +```html + + + + + mouseout demo + + + + +​ +
      +

      move your mouse

      +

      move your mouse

      0

      +

      0

      +
      +​ +
      +

      move your mouse

      +

      move your mouse

      0

      +

      0

      +
      +​ + +​ + + +``` + */ + mouseout(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseover/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + mouseover(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseover/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show the number of times mouseover and mouseenter events are triggered. +mouseover fires when the pointer moves into the child element as well, while mouseenter fires only when the pointer moves into the bound element. +```html + + + + + mouseover demo + + + + +​ +
      + move your mouse +
      +
      +
      +​ +
      + move your mouse +
      +
      +
      +​ + +​ + + +``` + */ + mouseover(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseup/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + mouseup(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/mouseup/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````Show texts when mouseup and mousedown event triggering. +```html + + + + + mouseup demo + + + +​ +

      Press mouse and release here.

      +​ + +​ + + +``` + */ + mouseup(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/next/ }\` + * @since 1.0 + * @example ​ ````Find the very next sibling of each disabled button and change its text "this button is disabled". +```html + + + + + next demo + + + + +​ +
      -
      +
      -
      +
      -
      +​ + +​ + + +``` + * @example ​ ````Find the very next sibling of each paragraph. Keep only the ones with a class "selected". +```html + + + + + next demo + + + +​ +

      Hello

      +

      Hello Again

      +
      And Again
      +​ + +​ + + +``` + */ + next(selector?: JQuery.Selector): this; + /** + * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/nextAll/ }\` + * @since 1.2 + * @example ​ ````Locate all the divs after the first and give them a class. +```html + + + + + nextAll demo + + + + +​ +
      first
      +
      sibling
      child
      +
      sibling
      +
      sibling
      ​ + +​ + + +``` + * @example ​ ````Locate all the paragraphs after the second child in the body and give them a class. +```html + + + + + nextAll demo + + + + +​ +

      p

      +
      div
      +

      p

      +

      p

      +
      div
      +

      p

      +
      div
      +​ + +​ + + +``` + */ + nextAll(selector?: string): this; + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * @param selector_element _@param_ `selector_element` + *
      + * * `selector` — A string containing a selector expression to indicate where to stop matching following sibling elements.
      + * * `element` — A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/nextUntil/ }\` + * @since 1.4 + * @since 1.6 + * @example ​ ````Find the siblings that follow <dt id="term-2"> up to the next <dt> and give them a red background color. Also, find <dd> siblings that follow <dt id="term-1"> up to <dt id="term-3"> and give them a green text color. +```html + + + + + nextUntil demo + + + +​ +
      +
      term 1
      +
      definition 1-a
      +
      definition 1-b
      +
      definition 1-c
      +
      definition 1-d
      +
      term 2
      +
      definition 2-a
      +
      definition 2-b
      +
      definition 2-c
      +
      term 3
      +
      definition 3-a
      +
      definition 3-b
      +
      +​ + +​ + + +``` + */ + nextUntil(selector_element?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Remove elements from the set of matched elements. + * @param selector_function_selection _@param_ `selector_function_selection` + *
      + * * `selector` — A string containing a selector expression, a DOM element, or an array of elements to match against the set.
      + * * `function` — A function used as a test for each element in the set. It accepts two arguments, `index`, which is + * the element's index in the jQuery collection, and `element`, which is the DOM element. Within the + * function, `this` refers to the current DOM element.
      + * * `selection` — An existing jQuery object to match the current set of elements against. + * @see \`{@link https://api.jquery.com/not/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Adds a border to divs that are not green or blue. +```html + + + + + not demo + + + + +​ +
      +
      +
      +
      +
      +
      +
      +​ + +​ + + +``` + * @example ​ ````Removes the element with the ID "selected" from the set of all paragraphs. +```javascript +$( "p" ).not( $( "#selected" )[ 0 ] ); +``` + * @example ​ ````Removes the element with the ID "selected" from the set of all paragraphs. +```javascript +$( "p" ).not( "#selected" ); +``` + * @example ​ ````Removes all elements that match "div p.selected" from the total set of all paragraphs. +```javascript +$( "p" ).not( $( "div p.selected" ) ); +``` + */ + not(selector_function_selection: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): this; + /** + * Remove an event handler. + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as + * "click", "keydown.myPlugin", or ".myPlugin". + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/off/ }\` + * @since 1.7 + * @example ​ ````Add and remove event handlers on the colored button. +```html + + + + + off demo + + + + +​ + + + +
      Click!
      +​ + +​ + + +``` + * @example ​ ````Remove just one previously bound handler by passing it as the third argument: +```javascript +var foo = function() { + // Code to handle some kind of event +}; +​ +// ... Now foo will be called when paragraphs are clicked ... +$( "body" ).on( "click", "p", foo ); +​ +// ... Foo will no longer be called. +$( "body" ).off( "click", "p", foo ); +``` + */ + off(events: string, selector: JQuery.Selector, handler: JQuery.EventHandlerBase> | false): this; + /** + * Remove an event handler. + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as + * "click", "keydown.myPlugin", or ".myPlugin". + * @param selector_handler _@param_ `selector_handler` + *
      + * * `selector` — A selector which should match the one originally passed to `.on()` when attaching event handlers.
      + * * `handler` — A handler function previously attached for the event(s), or the special value `false`. + * @see \`{@link https://api.jquery.com/off/ }\` + * @since 1.7 + * @example ​ ````Remove all delegated click handlers from all paragraphs: +```javascript +$( "p" ).off( "click", "**" ); +``` + * @example ​ ````Unbind all delegated event handlers by their namespace: +```javascript +var validate = function() { + // Code to validate form entries +}; +​ +// Delegate events under the ".validator" namespace +$( "form" ).on( "click.validator", "button", validate ); +​ +$( "form" ).on( "keypress.validator", "input[type='text']", validate ); +​ +// Remove event handlers in the ".validator" namespace +$( "form" ).off( ".validator" ); +``` + */ + off(events: string, selector_handler?: JQuery.Selector | JQuery.EventHandlerBase> | false): this; + /** + * Remove an event handler. + * @param events An object where the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent handler functions previously attached for the event(s). + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @see \`{@link https://api.jquery.com/off/ }\` + * @since 1.7 + */ + off(events: JQuery.PlainObject> | false>, selector?: JQuery.Selector): this; + /** + * Remove an event handler. + * @param event A jQuery.Event object. + * @see \`{@link https://api.jquery.com/off/ }\` + * @since 1.7 + * @example ​ ````Remove all event handlers from all paragraphs: +```javascript +$( "p" ).off(); +``` + */ + off(event?: JQuery.Event): this; + /** + * Set the current coordinates of every element in the set of matched elements, relative to the document. + * @param coordinates_function _@param_ `coordinates_function` + *
      + * * `coordinates` — An object containing the properties `top` and `left`, which are numbers indicating the new top and + * left coordinates for the elements.
      + * * `function` — A function to return the coordinates to set. Receives the index of the element in the collection as + * the first argument and the current coordinates as the second argument. The function should return an + * object with the new `top` and `left` properties. + * @see \`{@link https://api.jquery.com/offset/ }\` + * @since 1.4 + * @example ​ ````Set the offset of the second paragraph: +```html + + + + + offset demo + + + + +​ +

      Hello

      2nd Paragraph

      +​ + +​ + + +``` + */ + offset(coordinates_function: JQuery.CoordinatesPartial | ((this: TElement, index: number, coords: JQuery.Coordinates) => JQuery.CoordinatesPartial)): this; + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the document. + * @see \`{@link https://api.jquery.com/offset/ }\` + * @since 1.2 + * @example ​ ````Access the offset of the second paragraph: +```html + + + + + offset demo + + + + +​ +

      Hello

      2nd Paragraph

      +​ + +​ + + +``` + * @example ​ ````Click to see the offset. +```html + + + + + offset demo + + + + +​ +
      Click an element.
      +

      + This is the best way to find an offset. +

      +
      +
      +​ + +​ + + +``` + */ + offset(): JQuery.Coordinates | undefined; + /** + * Get the closest ancestor element that is positioned. + * @see \`{@link https://api.jquery.com/offsetParent/ }\` + * @since 1.2.6 + * @example ​ ````Find the offsetParent of item "A." +```html + + + + + offsetParent demo + + + +​ +
        +
      • I
      • +
      • II +
          +
        • A
        • +
        • B +
            +
          • 1
          • +
          • 2
          • +
          • 3
          • +
          +
        • +
        • C
        • +
        +
      • +
      • III
      • +
      +​ + +​ + + +``` + */ + offsetParent(): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + */ + on(events: string, + selector: JQuery.Selector | null, + data: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\` in place of \`{@link JQueryEventObject }\`. + */ + on(events: string, + selector: JQuery.Selector | null, + data: any, + handler: ((event: JQueryEventObject) => void)): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @example ​ ````Click any paragraph to add another after it. Note that .on() allows a click event on any paragraph--even new ones--since the event is handled by the ever-present body element after it bubbles to there. +```html + + + + + on demo + + + + +​ +

      Click me!

      + +​ + +​ + + +``` + * @example ​ ````Display each paragraph's text in an alert box whenever it is clicked: +```javascript +$( "body" ).on( "click", "p", function() { + alert( $( this ).text() ); +}); +``` + * @example ​ ````Cancel a link's default action using the .preventDefault() method: +```javascript +$( "body" ).on( "click", "a", function( event ) { + event.preventDefault(); +}); +``` + */ + on(events: string, + selector: JQuery.Selector, + handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\` in place of \`{@link JQueryEventObject }\`. + * @example ​ ````Click any paragraph to add another after it. Note that .on() allows a click event on any paragraph--even new ones--since the event is handled by the ever-present body element after it bubbles to there. +```html + + + + + on demo + + + + +​ +

      Click me!

      + +​ + +​ + + +``` + * @example ​ ````Display each paragraph's text in an alert box whenever it is clicked: +```javascript +$( "body" ).on( "click", "p", function() { + alert( $( this ).text() ); +}); +``` + * @example ​ ````Cancel a link's default action using the .preventDefault() method: +```javascript +$( "body" ).on( "click", "a", function( event ) { + event.preventDefault(); +}); +``` + */ + on(events: string, + selector: JQuery.Selector, + // tslint:disable-next-line:unified-signatures + handler: ((event: JQueryEventObject) => void)): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @example ​ ````Pass data to the event handler, which is specified here by name: +```javascript +function myHandler( event ) { + alert( event.data.foo ); +} +$( "p" ).on( "click", { foo: "bar" }, myHandler ); +``` + */ + on(events: string, + data: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\` in place of \`{@link JQueryEventObject }\`. + * @example ​ ````Pass data to the event handler, which is specified here by name: +```javascript +function myHandler( event ) { + alert( event.data.foo ); +} +$( "p" ).on( "click", { foo: "bar" }, myHandler ); +``` + */ + on(events: string, + // tslint:disable-next-line:unified-signatures + data: any, + handler: ((event: JQueryEventObject) => void)): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @example ​ ````Display a paragraph's text in an alert when it is clicked: +```javascript +$( "p" ).on( "click", function() { + alert( $( this ).text() ); +}); +``` + * @example ​ ````Cancel a form submit action and prevent the event from bubbling up by returning false: +```javascript +$( "form" ).on( "submit", false ); +``` + * @example ​ ````Cancel only the default action by using .preventDefault(). +```javascript +$( "form" ).on( "submit", function( event ) { + event.preventDefault(); +}); +``` + * @example ​ ````Stop submit events from bubbling without preventing form submit, using .stopPropagation(). +```javascript +$( "form" ).on( "submit", function( event ) { + event.stopPropagation(); +}); +``` + * @example ​ ````Pass data to the event handler using the second argument to .trigger() +```javascript +$( "div" ).on( "click", function( event, person ) { + alert( "Hello, " + person.name ); +}); +$( "div" ).trigger( "click", { name: "Jim" } ); +``` + * @example ​ ````Use the the second argument of .trigger() to pass an array of data to the event handler +```javascript +$( "div" ).on( "click", function( event, salutation, name ) { + alert( salutation + ", " + name ); +}); +$( "div" ).trigger( "click", [ "Goodbye", "Jim" ] ); +``` + * @example ​ ````Attach and trigger custom (non-browser) events. +```html + + + + + on demo + + + + +​ +

      Has an attached custom event.

      + + +​ + +​ + + +``` + * @example ​ ````Attach multiple events—one on mouseenter and one on mouseleave to the same element: +```javascript +$( "#cart" ).on( "mouseenter mouseleave", function( event ) { + $( this ).toggleClass( "active" ); +}); +``` + */ + on(events: string, + handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\` in place of \`{@link JQueryEventObject }\`. + * @example ​ ````Display a paragraph's text in an alert when it is clicked: +```javascript +$( "p" ).on( "click", function() { + alert( $( this ).text() ); +}); +``` + * @example ​ ````Cancel a form submit action and prevent the event from bubbling up by returning false: +```javascript +$( "form" ).on( "submit", false ); +``` + * @example ​ ````Cancel only the default action by using .preventDefault(). +```javascript +$( "form" ).on( "submit", function( event ) { + event.preventDefault(); +}); +``` + * @example ​ ````Stop submit events from bubbling without preventing form submit, using .stopPropagation(). +```javascript +$( "form" ).on( "submit", function( event ) { + event.stopPropagation(); +}); +``` + * @example ​ ````Pass data to the event handler using the second argument to .trigger() +```javascript +$( "div" ).on( "click", function( event, person ) { + alert( "Hello, " + person.name ); +}); +$( "div" ).trigger( "click", { name: "Jim" } ); +``` + * @example ​ ````Use the the second argument of .trigger() to pass an array of data to the event handler +```javascript +$( "div" ).on( "click", function( event, salutation, name ) { + alert( salutation + ", " + name ); +}); +$( "div" ).trigger( "click", [ "Goodbye", "Jim" ] ); +``` + * @example ​ ````Attach and trigger custom (non-browser) events. +```html + + + + + on demo + + + + +​ +

      Has an attached custom event.

      + + +​ + +​ + + +``` + * @example ​ ````Attach multiple events—one on mouseenter and one on mouseleave to the same element: +```javascript +$( "#cart" ).on( "mouseenter mouseleave", function( event ) { + $( this ).toggleClass( "active" ); +}); +``` + */ + on(events: string, + // tslint:disable-next-line:unified-signatures + handler: ((event: JQueryEventObject) => void)): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + */ + on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, + selector: JQuery.Selector | null, + data: TData): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + */ + on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, + // tslint:disable-next-line:unified-signatures + selector: JQuery.Selector): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + */ + on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, + data: TData): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @see \`{@link https://api.jquery.com/on/ }\` + * @since 1.7 + * @example ​ ````Attach multiple event handlers simultaneously using a plain object. +```html + + + + + on demo + + + + +​ +
      test div
      +​ + +​ + + +``` + */ + on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + */ + one(events: string, + selector: JQuery.Selector | null, + data: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + */ + one(events: string, + selector: JQuery.Selector, + handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + */ + one(events: string, + data: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + * @example ​ ````Tie a one-time click to each div. +```html + + + + + one demo + + + + +​ +
      +
      +
      +
      +
      +

      Click a green square...

      +​ + +​ + + +``` + * @example ​ ````To display the text of all paragraphs in an alert box the first time each of them is clicked: +```javascript +$( "p" ).one( "click", function() { + alert( $( this ).text() ); +}); +``` + * @example ​ ````Event handlers will trigger once per element per event type +```html + + + + + one demo + + + +​ +
      0
      +
      Hover/click me
      +​ + +​ + + +``` + */ + one(events: string, + handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + */ + one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, + selector: JQuery.Selector | null, + data: TData): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + */ + one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, + // tslint:disable-next-line:unified-signatures + selector: JQuery.Selector): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + */ + one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, + data: TData): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @see \`{@link https://api.jquery.com/one/ }\` + * @since 1.7 + */ + one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; + /** + * Set the CSS outer height of each element in the set of matched elements. + * @param value_function _@param_ `value_function` + *
      + * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string).
      + * * `function` — A function returning the outer height to set. Receives the index position of the element in the set + * and the old outer height as arguments. Within the function, `this` refers to the current element in + * the set. + * @see \`{@link https://api.jquery.com/outerHeight/ }\` + * @since 1.8.0 + * @example ​ ````Change the outer height of each div the first time it is clicked (and change its color). +```html + + + + + outerHeight demo + + + + +​ +
      d
      +
      d
      +
      d
      +
      d
      +
      d
      +​ + +​ + + +``` + */ + outerHeight(value_function: string | number | ((this: TElement, index: number, height: number) => string | number), + includeMargin?: boolean): this; + /** + * Get the current computed outer height (including padding, border, and optionally margin) for the first element in the set of matched elements. + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + * @see \`{@link https://api.jquery.com/outerHeight/ }\` + * @since 1.2.6 + * @example ​ ````Get the outerHeight of a paragraph. +```html + + + + + outerHeight demo + + + + +​ +

      Hello

      +​ + +​ + + +``` + */ + outerHeight(includeMargin?: boolean): number | undefined; + /** + * Set the CSS outer width of each element in the set of matched elements. + * @param value_function _@param_ `value_function` + *
      + * * `value` — A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string).
      + * * `function` — A function returning the outer width to set. Receives the index position of the element in the set + * and the old outer width as arguments. Within the function, `this` refers to the current element in + * the set. + * @see \`{@link https://api.jquery.com/outerWidth/ }\` + * @since 1.8.0 + * @example ​ ````Change the outer width of each div the first time it is clicked (and change its color). +```html + + + + + outerWidth demo + + + + +​ +
      d
      +
      d
      +
      d
      +
      d
      +
      d
      +​ + +​ + + +``` + */ + outerWidth(value_function: string | number | ((this: TElement, index: number, width: number) => string | number), + includeMargin?: boolean): this; + /** + * Get the current computed outer width (including padding, border, and optionally margin) for the first element in the set of matched elements. + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + * @see \`{@link https://api.jquery.com/outerWidth/ }\` + * @since 1.2.6 + * @example ​ ````Get the outerWidth of a paragraph. +```html + + + + + outerWidth demo + + + + +​ +

      Hello

      +​ + +​ + + +``` + */ + outerWidth(includeMargin?: boolean): number | undefined; + /** + * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/parent/ }\` + * @since 1.0 + * @example ​ ````Shows the parent of each element as (parent > child). Check the View Source to see the raw html. +```html + + + + + parent demo + + + + +​ +
      div, + span, + b +
      +​ +

      p, + span, + em + +

      +​ +
      div, + strong, + span, + em, + b, + + + b +
      +​ + +​ + + +``` + * @example ​ ````Find the parent element of each paragraph with a class "selected". +```html + + + + + parent demo + + + +​ +

      Hello

      +

      Hello Again

      +​ + +​ + + +``` + */ + parent(selector?: JQuery.Selector): this; + /** + * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/parents/ }\` + * @since 1.0 + * @example ​ ````Find all parent elements of each b. +```html + + + + + parents demo + + + + +​ +
      +

      + + My parents are: + +

      +
      +​ + +​ + + +``` + * @example ​ ````Click to find all unique div parent elements of each span. +```html + + + + + parents demo + + + + +​ +

      +

      +
      Hello
      + Hello Again +
      +
      + And Hello Again +
      +

      + Click Hellos to toggle their parents. +​ + +​ + + +``` + */ + parents(selector?: JQuery.Selector): this; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * @param selector_element _@param_ `selector_element` + *
      + * * `selector` — A string containing a selector expression to indicate where to stop matching ancestor elements.
      + * * `element` — A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/parentsUntil/ }\` + * @since 1.4 + * @since 1.6 + * @example ​ ````Find the ancestors of <li class="item-a"> up to <ul class="level-1"> and give them a red background color. Also, find ancestors of <li class="item-2"> that have a class of "yes" up to <ul class="level-1"> and give them a green border. +```html + + + + + parentsUntil demo + + + +​ +
        +
      • I
      • +
      • II +
          +
        • A
        • +
        • B +
            +
          • 1
          • +
          • 2
          • +
          • 3
          • +
          +
        • +
        • C
        • +
        +
      • +
      • III
      • +
      +​ + +​ + + +``` + */ + parentsUntil(selector_element?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. + * @see \`{@link https://api.jquery.com/position/ }\` + * @since 1.2 + * @example ​ ````Access the position of the second paragraph: +```html + + + + + position demo + + + + +​ +
      +

      Hello

      +
      +

      +​ + +​ + + +``` + */ + position(): JQuery.Coordinates; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert at the beginning of each element in the set of matched elements. + * @see \`{@link https://api.jquery.com/prepend/ }\` + * @since 1.0 + * @example ​ ````Prepends some HTML to all paragraphs. +```html + + + + + prepend demo + + + + +​ +

      there, friend!

      +

      amigo!

      +​ + +​ + + +``` + * @example ​ ````Prepends a DOM Element to all paragraphs. +```html + + + + + prepend demo + + + + +​ +

      is what I'd say

      +

      is what I said

      +​ + +​ + + +``` + * @example ​ ````Prepends a jQuery object (similar to an Array of DOM Elements) to all paragraphs. +```html + + + + + prepend demo + + + + +​ +

      is what was said.

      Hello +​ + +​ + + +``` + */ + prepend(...contents: Array>>): this; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * @param funсtion A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at + * the beginning of each element in the set of matched elements. Receives the index position of the + * element in the set and the old HTML value of the element as arguments. Within the function, `this` + * refers to the current element in the set. + * @see \`{@link https://api.jquery.com/prepend/ }\` + * @since 1.4 + */ + prepend(funсtion: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; + /** + * Insert every element in the set of matched elements to the beginning of the target. + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements + * will be inserted at the beginning of the element(s) specified by this parameter. + * @see \`{@link https://api.jquery.com/prependTo/ }\` + * @since 1.0 + * @example ​ ````Prepend all spans to the element with the ID "foo" (Check .prepend() documentation for more examples) +```html + + + + + prependTo demo + + + + +​ +
      FOO!
      +I have something to say... +​ + +​ + + +``` + */ + prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/prev/ }\` + * @since 1.0 + * @example ​ ````Find the very previous sibling of each div. +```html + + + + + prev demo + + + + +​ +
      +
      +
      has child
      +
      +
      +
      +
      +
      +

      +​ + +​ + + +``` + * @example ​ ````For each paragraph, find the very previous sibling that has a class "selected". +```html + + + + + prev demo + + + +​ +
      Hello
      +

      Hello Again

      +

      And Again

      +​ + +​ + + +``` + */ + prev(selector?: JQuery.Selector): this; + /** + * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/prevAll/ }\` + * @since 1.2 + * @example ​ ````Locate all the divs preceding the last div and give them a class. +```html + + + + + prevAll demo + + + + +​ +
      +
      +
      +
      +​ + +​ + + +``` + */ + prevAll(selector?: JQuery.Selector): this; + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * @param selector_element _@param_ `selector_element` + *
      + * * `selector` — A string containing a selector expression to indicate where to stop matching preceding sibling elements.
      + * * `element` — A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/prevUntil/ }\` + * @since 1.4 + * @since 1.6 + * @example ​ ````Find the siblings that precede <dt id="term-2"> up to the preceding <dt> and give them a red background color. Also, find previous <dd> siblings of <dt id="term-3"> up to <dt id="term-1"> and give them a green text color. +```html + + + + + prevUntil demo + + + +​ +
      +
      term 1
      +
      definition 1-a
      +
      definition 1-b
      +
      definition 1-c
      +
      definition 1-d
      +​ +
      term 2
      +
      definition 2-a
      +
      definition 2-b
      +
      definition 2-c
      +​ +
      term 3
      +
      definition 3-a
      +
      definition 3-b
      +
      +​ + +​ + + +``` + */ + prevUntil(selector_element?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. + * @param type The type of queue that needs to be observed. + * @param target Object onto which the promise methods have to be attached + * @see \`{@link https://api.jquery.com/promise/ }\` + * @since 1.6 + */ + promise(type: string, target: T): T & JQuery.Promise; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. + * @param target Object onto which the promise methods have to be attached + * @see \`{@link https://api.jquery.com/promise/ }\` + * @since 1.6 + */ + promise(target: T): T & JQuery.Promise; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. + * @param type The type of queue that needs to be observed. + * @see \`{@link https://api.jquery.com/promise/ }\` + * @since 1.6 + * @example ​ ````Using .promise() on a collection with no active animation returns a resolved Promise: +```javascript +var div = $( "
      " ); +​ +div.promise().done(function( arg1 ) { + // Will fire right away and alert "true" + alert( this === div && arg1 === div ); +}); +``` + * @example ​ ````Resolve the returned Promise when all animations have ended (including those initiated in the animation callback or added later on): +```html + + + + + promise demo + + + + +​ + +

      Ready...

      +
      +
      +
      +
      +​ + +​ + + +``` + * @example ​ ````Resolve the returned Promise using a $.when() statement (the .promise() method makes it possible to do this with jQuery collections): +```html + + + + + promise demo + + + + +​ + +

      Ready...

      +
      +
      +
      +
      +​ + +​ + + +``` + */ + promise(type?: string): JQuery.Promise; + /** + * Set one or more properties for the set of matched elements. + * @param propertyName The name of the property to set. + * @param value_function _@param_ `value_function` + *
      + * * `value` — A value to set for the property.
      + * * `function` — A function returning the value to set. Receives the index position of the element in the set and the + * old property value as arguments. Within the function, the keyword `this` refers to the current element. + * @see \`{@link https://api.jquery.com/prop/ }\` + * @since 1.6 + */ + prop(propertyName: string, + value_function: string | number | boolean | symbol | object | null | undefined | ((this: TElement, index: number, oldPropertyValue: any) => any)): this; + /** + * Set one or more properties for the set of matched elements. + * @param properties An object of property-value pairs to set. + * @see \`{@link https://api.jquery.com/prop/ }\` + * @since 1.6 + * @example ​ ````Disable all checkboxes on the page. +```html + + + + + prop demo + + + + +​ + + + + +​ + +​ + + +``` + */ + prop(properties: JQuery.PlainObject): this; + /** + * Get the value of a property for the first element in the set of matched elements. + * @param propertyName The name of the property to get. + * @see \`{@link https://api.jquery.com/prop/ }\` + * @since 1.6 + * @example ​ ````Display the checked property and attribute of a checkbox as it changes. +```html + + + + + prop demo + + + + +​ + + +

      +​ + +​ + + +``` + */ + prop(propertyName: string): any; + /** + * Add a collection of DOM elements onto the jQuery stack. + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @param name The name of a jQuery method that generated the array of elements. + * @param args The arguments that were passed in to the jQuery method (for serialization). + * @see \`{@link https://api.jquery.com/pushStack/ }\` + * @since 1.3 + */ + pushStack(elements: ArrayLike, name: string, args: any[]): this; + /** + * Add a collection of DOM elements onto the jQuery stack. + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @see \`{@link https://api.jquery.com/pushStack/ }\` + * @since 1.0 + * @example ​ ````Add some elements onto the jQuery stack, then pop back off again. +```javascript +jQuery([]) + .pushStack( document.getElementsByTagName( "div" ) ) + .remove() + .end(); +``` + */ + pushStack(elements: ArrayLike): this; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. + * An array of functions to replace the current queue contents. + * @see \`{@link https://api.jquery.com/queue/ }\` + * @since 1.2 + * @example ​ ````Set a queue array to delete the queue. +```html + + + + + queue demo + + + + +​ + + +
      +​ + +​ + + +``` + */ + queue(queueName: string, newQueue: JQuery.TypeOrArray>): this; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. + * An array of functions to replace the current queue contents. + * @see \`{@link https://api.jquery.com/queue/ }\` + * @since 1.2 + * @example ​ ````Queue a custom function. +```html + + + + + queue demo + + + + +​ +Click here... +
      +​ + +​ + + +``` + */ + queue(newQueue: JQuery.TypeOrArray>): this; + /** + * Show the queue of functions to be executed on the matched elements. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see \`{@link https://api.jquery.com/queue/ }\` + * @since 1.2 + * @example ​ ````Show the length of the queue. +```html + + + + + queue demo + + + + +​ +

      The queue length is:

      +
      +​ + +​ + + +``` + */ + queue(queueName?: string): JQuery.Queue; + /** + * Specify a function to execute when the DOM is fully loaded. + * @param handler A function to execute after the DOM is ready. + * @see \`{@link https://api.jquery.com/ready/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.0. Use `jQuery(function() { })`. + * @example ​ ````Display a message when the DOM is loaded. +```html + + + + + ready demo + + + + + +​ +

      Not loaded yet.

      +​ + + +``` + */ + ready(handler: ($: JQueryStatic) => void): this; + /** + * Remove the set of matched elements from the DOM. + * @param selector A selector expression that filters the set of matched elements to be removed. + * @see \`{@link https://api.jquery.com/remove/ }\` + * @since 1.0 + * @example ​ ````Removes all paragraphs from the DOM +```html + + + + + remove demo + + + + +​ +

      Hello

      +how are +

      you?

      + +​ + +​ + + +``` + * @example ​ ````Removes all paragraphs that contain "Hello" from the DOM. Analogous to doing $("p").filter(":contains('Hello')").remove(). +```html + + + + + remove demo + + + + +​ +

      Hello

      +how are +

      you?

      + +​ + +​ + + +``` + */ + remove(selector?: string): this; + /** + * Remove an attribute from each element in the set of matched elements. + * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. + * @see \`{@link https://api.jquery.com/removeAttr/ }\` + * @since 1.0 + * @example ​ ````Clicking the button changes the title of the input next to it. Move the mouse pointer over the text input to see the effect of adding and removing the title attribute. +```html + + + + + removeAttr demo + + + +​ + + +
      +​ + +​ + + +``` + */ + removeAttr(attributeName: string): this; + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * @param className_function _@param_ `className_function` + *
      + * * `className` — One or more space-separated classes to be removed from the class attribute of each matched element.
      + * * `function` — A function returning one or more space-separated class names to be removed. Receives the index + * position of the element in the set and the old class value as arguments. + * @see \`{@link https://api.jquery.com/removeClass/ }\` + * @since 1.0 + * @since 1.4 + * @since 3.3 + * @example ​ ````Remove the class 'blue' from the matched elements. +```html + + + + + removeClass demo + + + + +​ +

      Hello

      +

      and

      +

      then

      +

      Goodbye

      +​ + +​ + + +``` + * @example ​ ````Remove the class 'blue' and 'under' from the matched elements. +```html + + + + + removeClass demo + + + + +​ +

      Hello

      +

      and

      +

      then

      +

      Goodbye

      +​ + +​ + + +``` + * @example ​ ````Remove all the classes from the matched elements. +```html + + + + + removeClass demo + + + + +​ +

      Hello

      +

      and

      +

      then

      +

      Goodbye

      +​ + +​ + + +``` + */ + removeClass(className_function?: JQuery.TypeOrArray | ((this: TElement, index: number, className: string) => string)): this; + /** + * Remove a previously-stored piece of data. + * @param name A string naming the piece of data to delete. + * An array or space-separated string naming the pieces of data to delete. + * @see \`{@link https://api.jquery.com/removeData/ }\` + * @since 1.2.3 + * @since 1.7 + * @example ​ ````Set a data store for 2 names then remove one of them. +```html + + + + + removeData demo + + + + +​ +
      value1 before creation:
      +
      value1 after creation:
      +
      value1 after removal:
      +
      value2 after removal:
      +​ + +​ + + +``` + */ + removeData(name?: JQuery.TypeOrArray): this; + /** + * Remove a property for the set of matched elements. + * @param propertyName The name of the property to remove. + * @see \`{@link https://api.jquery.com/removeProp/ }\` + * @since 1.6 + * @example ​ ````Set a numeric property on a paragraph and then remove it. +```html + + + + + removeProp demo + + + + +​ +

      +​ + +​ + + +``` + */ + removeProp(propertyName: string): this; + /** + * Replace each target element with the set of matched elements. + * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. + * @see \`{@link https://api.jquery.com/replaceAll/ }\` + * @since 1.2 + * @example ​ ````Replace all the paragraphs with bold words. +```html + + + + + replaceAll demo + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + */ + replaceAll(target: JQuery.Selector | JQuery | JQuery.TypeOrArray): this; + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * @param newContent_function _@param_ `newContent_function` + *
      + * * `newContent` — The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object.
      + * * `function` — A function that returns content with which to replace the set of matched elements. + * @see \`{@link https://api.jquery.com/replaceWith/ }\` + * @since 1.2 + * @since 1.4 + * @example ​ ````On click, replace the button with a div containing the same word. +```html + + + + + replaceWith demo + + + + +​ + + + +​ + +​ + + +``` + * @example ​ ````Replace all paragraphs with bold words. +```html + + + + + replaceWith demo + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + * @example ​ ````On click, replace each paragraph with a div that is already in the DOM and selected with the $() function. Notice it doesn't clone the object but rather moves it to replace the paragraph. +```html + + + + + replaceWith demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +
      Replaced!
      +​ + +​ + + +``` + * @example ​ ````On button click, replace the containing div with its child divs and append the class name of the selected element to the paragraph. +```html + + + + + replaceWith demo + + + + +​ +

      + +

      +
      +
      Scooby
      +
      Dooby
      +
      Doo
      +
      +​ + +​ + + +``` + */ + replaceWith(newContent_function: JQuery.htmlString | JQuery | JQuery.TypeOrArray | ((this: TElement) => any)): this; + /** + * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/resize/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + resize(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/resize/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````To see the window width while (or after) it is resized, try: +```javascript +$( window ).resize(function() { + $( "body" ).prepend( "
      " + $( window ).width() + "
      " ); +}); +``` + */ + resize(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/scroll/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + scroll(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/scroll/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````To do something when your page is scrolled: +```html + + + + + scroll demo + + + + +​ +
      Try scrolling the iframe.
      +

      Paragraph - Scroll happened!

      +​ + +​ + + +``` + */ + scroll(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Set the current horizontal position of the scroll bar for each of the set of matched elements. + * @param value An integer indicating the new position to set the scroll bar to. + * @see \`{@link https://api.jquery.com/scrollLeft/ }\` + * @since 1.2.6 + * @example ​ ````Set the scrollLeft of a div. +```html + + + + + scrollLeft demo + + + + +​ +

      lalala

      Hello

      +​ + +​ + + +``` + */ + scrollLeft(value: number): this; + /** + * Get the current horizontal position of the scroll bar for the first element in the set of matched elements. + * @see \`{@link https://api.jquery.com/scrollLeft/ }\` + * @since 1.2.6 + * @example ​ ````Get the scrollLeft of a paragraph. +```html + + + + + scrollLeft demo + + + + +​ +

      Hello

      +​ + +​ + + +``` + */ + scrollLeft(): number | undefined; + /** + * Set the current vertical position of the scroll bar for each of the set of matched elements. + * @param value A number indicating the new position to set the scroll bar to. + * @see \`{@link https://api.jquery.com/scrollTop/ }\` + * @since 1.2.6 + * @example ​ ````Set the scrollTop of a div. +```html + + + + + scrollTop demo + + + + +​ +

      lalala

      Hello

      +​ + +​ + + +``` + */ + scrollTop(value: number): this; + /** + * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. + * @see \`{@link https://api.jquery.com/scrollTop/ }\` + * @since 1.2.6 + * @example ​ ````Get the scrollTop of a paragraph. +```html + + + + + scrollTop demo + + + + +​ +

      Hello

      +​ + +​ + + +``` + */ + scrollTop(): number | undefined; + /** + * Bind an event handler to the "select" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/select/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + select(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "select" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/select/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````To do something when text in input boxes is selected: +```html + + + + + select demo + + + + +​ +

      Click and drag the mouse to select text in the inputs.

      + + +
      + ​ + +​ + + +``` + * @example ​ ````To trigger the select event on all input elements, try: +```javascript +$( "input" ).select(); +``` + */ + select(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Encode a set of form elements as a string for submission. + * @see \`{@link https://api.jquery.com/serialize/ }\` + * @since 1.0 + * @example ​ ````Serialize a form to a query string that could be sent to a server in an Ajax request. +```html + + + + + serialize demo + + + + +​ +
      + +​ +
      + +​ +
      + + + + +​ +
      + + + + +
      +​ +

      +​ + +​ + + +``` + */ + serialize(): string; + /** + * Encode a set of form elements as an array of names and values. + * @see \`{@link https://api.jquery.com/serializeArray/ }\` + * @since 1.2 + * @example ​ ````Get the values from a form, iterate through them, and append them to a results display. +```html + + + + + serializeArray demo + + + + +​ +

      Results:

      +
      + + +
      + + + + + + + + +
      +​ + +​ + + +``` + */ + serializeArray(): JQuery.NameValuePair[]; + /** + * Display the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/show/ }\` + * @since 1.4.3 + */ + show(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; + /** + * Display the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param easing_complete _@param_ `easing_complete` + *
      + * * `easing` — A string indicating which easing function to use for the transition.
      + * * `complete` — A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/show/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Show the first div, followed by each next adjacent sibling div in order, with a 200ms animation. Each animation starts when the previous sibling div's animation ends. +```html + + + + + show demo + + + + +​ + + +
      Hello 3,
      +
      how
      +
      are
      +
      you?
      +​ + +​ + + +``` + * @example ​ ````Show all span and input elements with an animation. Change the text once the animation is done. +```html + + + + + show demo + + + + +​ + +Are you sure? (type 'yes' if you are) +
      +
      + +
      +
      +

      I'm hidden...

      +​ + +​ + + +``` + */ + show(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; + /** + * Display the matched elements. + * @param duration_complete_options _@param_ `duration_complete_options` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `complete` — A function to call once the animation is complete, called once per matched element.
      + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/show/ }\` + * @since 1.0 + * @example ​ ````Animates all hidden paragraphs to show slowly, completing the animation within 600 milliseconds. +```html + + + + + show demo + + + + +​ + +

      Hello 2

      +​ + +​ + + +``` + */ + show(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. + * @param selector A string containing a selector expression to match elements against. + * @see \`{@link https://api.jquery.com/siblings/ }\` + * @since 1.0 + * @example ​ ````Find the unique siblings of all yellow li elements in the 3 lists (including other yellow li elements if appropriate). +```html + + + + + siblings demo + + + + +​ +
        +
      • One
      • +
      • Two
      • +
      • Three
      • +
      • Four
      • +
      +​ +
        +
      • Five
      • +
      • Six
      • +
      • Seven
      • +
      +​ +
        +
      • Eight
      • +
      • Nine
      • +
      • Ten
      • +
      • Eleven
      • +
      +​ +

      Unique siblings:

      +​ + +​ + + +``` + * @example ​ ````Find all siblings with a class "selected" of each div. +```html + + + + + siblings demo + + + +​ +
      Hello
      +

      Hello Again

      +

      And Again

      +​ + +​ + + +``` + */ + siblings(selector?: JQuery.Selector): this; + /** + * Reduce the set of matched elements to a subset specified by a range of indices. + * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, + * it indicates an offset from the end of the set. + * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, + * it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. + * @see \`{@link https://api.jquery.com/slice/ }\` + * @since 1.1.4 + * @example ​ ````Turns divs yellow based on a random slice. +```html + + + + + slice demo + + + + +​ +

      + Click the button!

      +
      +
      +
      +
      +
      +
      +
      +
      +
      + ​ + +​ + + +``` + * @example ​ ````Selects all paragraphs, then slices the selection to include only the first element. +```javascript +$( "p" ).slice( 0, 1 ).wrapInner( "" ); +``` + * @example ​ ````Selects all paragraphs, then slices the selection to include only the first and second element. +```javascript +$( "p" ).slice( 0, 2 ).wrapInner( "" ); +``` + * @example ​ ````Selects all paragraphs, then slices the selection to include only the second element. +```javascript +$( "p" ).slice( 1, 2 ).wrapInner( "" ); +``` + * @example ​ ````Selects all paragraphs, then slices the selection to include only the second and third element. +```javascript +$( "p" ).slice( 1 ).wrapInner( "" ); +``` + * @example ​ ````Selects all paragraphs, then slices the selection to include only the third element. +```javascript +$( "p" ).slice( -1 ).wrapInner( "" ); +``` + */ + slice(start: number, end?: number): this; + /** + * Display the matched elements with a sliding motion. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/slideDown/ }\` + * @since 1.4.3 + */ + slideDown(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements with a sliding motion. + * @param duration_easing _@param_ `duration_easing` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `easing` — A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/slideDown/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates all inputs to slide down, completing the animation within 1000 milliseconds. Once the animation is done, the input look is changed especially if it is the middle input which gets the focus. +```html + + + + + slideDown demo + + + + +​ +
      Push!
      + + + + ​ + +​ + + +``` + */ + slideDown(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; + /** + * Display the matched elements with a sliding motion. + * @param duration_easing_complete_options _@param_ `duration_easing_complete_options` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `easing` — A string indicating which easing function to use for the transition.
      + * * `complete` — A function to call once the animation is complete, called once per matched element.
      + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/slideDown/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates all divs to slide down and show themselves over 600 milliseconds. +```html + + + + + slideDown demo + + + + +​ +Click me! +
      +
      +
      +​ + +​ + + +``` + */ + slideDown(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Display or hide the matched elements with a sliding motion. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/slideToggle/ }\` + * @since 1.4.3 + */ + slideToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements with a sliding motion. + * @param duration_easing _@param_ `duration_easing` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `easing` — A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/slideToggle/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates divs between dividers with a toggle that makes some appear and some disappear. +```html + + + + + slideToggle demo + + + + +​ +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +

      There have been 0 toggled divs.

      +​ + +​ + + +``` + */ + slideToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; + /** + * Display or hide the matched elements with a sliding motion. + * @param duration_easing_complete_options _@param_ `duration_easing_complete_options` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `easing` — A string indicating which easing function to use for the transition.
      + * * `complete` — A function to call once the animation is complete, called once per matched element.
      + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/slideToggle/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates all paragraphs to slide up or down, completing the animation within 600 milliseconds. +```html + + + + + slideToggle demo + + + + +​ + +

      + This is the paragraph to end all paragraphs. You + should feel lucky to have seen such a paragraph in + your life. Congratulations! +

      +​ + +​ + + +``` + */ + slideToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Hide the matched elements with a sliding motion. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/slideUp/ }\` + * @since 1.4.3 + */ + slideUp(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements with a sliding motion. + * @param duration_easing _@param_ `duration_easing` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `easing` — A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/slideUp/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates the parent paragraph to slide up, completing the animation within 200 milliseconds. Once the animation is done, it displays an alert. +```html + + + + + slideUp demo + + + + +​ +
      + + +
      +​ +
      + + +
      +​ +
      + + +
      +​ +
      +​ + +​ + + +``` + */ + slideUp(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; + /** + * Hide the matched elements with a sliding motion. + * @param duration_easing_complete_options _@param_ `duration_easing_complete_options` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `easing` — A string indicating which easing function to use for the transition.
      + * * `complete` — A function to call once the animation is complete, called once per matched element.
      + * * `options` — A map of additional options to pass to the method. + * @see \`{@link https://api.jquery.com/slideUp/ }\` + * @since 1.0 + * @since 1.4.3 + * @example ​ ````Animates all divs to slide up, completing the animation within 400 milliseconds. +```html + + + + + slideUp demo + + + + +​ +Click me! +
      +
      +
      +
      +
      +​ + +​ + + +``` + */ + slideUp(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Stop the currently-running animation on the matched elements. + * @param queue The name of the queue in which to stop animations. + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + * @see \`{@link https://api.jquery.com/stop/ }\` + * @since 1.7 + */ + stop(queue: string, clearQueue?: boolean, jumpToEnd?: boolean): this; + /** + * Stop the currently-running animation on the matched elements. + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + * @see \`{@link https://api.jquery.com/stop/ }\` + * @since 1.2 + * @example ​ ````Click the Go button once to start the animation, then click the STOP button to stop it where it's currently positioned. Another option is to click several buttons to queue them up and see that stop just kills the currently playing one. +```html + + + + + stop demo + + + + +​ + + + +
      +​ + +​ + + +``` + * @example ​ ````Click the slideToggle button to start the animation, then click again before the animation is completed. The animation will toggle the other direction from the saved starting point. +```html + + + + + stop demo + + + + +​ + +
      +​ + +​ + + +``` + */ + stop(clearQueue?: boolean, jumpToEnd?: boolean): this; + /** + * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/submit/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + */ + submit(eventData: TData, + handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/submit/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.3. Use \`{@link on }\` or \`{@link trigger }\`. + * + * **Cause**: The `.on()` and `.trigger()` methods can set an event handler or generate an event for any event type, and should be used instead of the shortcut methods. This message also applies to the other event shorthands, including: blur, focus, focusin, focusout, resize, scroll, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and contextmenu. + * + * **Solution**: Instead of `.click(fn)` use `.on("click", fn)`. Instead of `.click()` use `.trigger("click")`. + * @example ​ ````If you'd like to prevent forms from being submitted unless a flag variable is set, try: +```html + + + + + submit demo + + + + +​ +

      Type 'correct' to validate.

      +
      +
      + + +
      +
      + +​ + +​ + + +``` + * @example ​ ````If you'd like to prevent forms from being submitted unless a flag variable is set, try: +```javascript +$( "form" ).submit(function() { + return this.some_flag_variable; +}); +``` + * @example ​ ````To trigger the submit event on the first form on the page, try: +```javascript +$( "form:first" ).submit(); +``` + */ + submit(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Set the content of each element in the set of matched elements to the specified text. + * @param text_function _@param_ `text_function` + *
      + * * `text` — The text to set as the content of each matched element. When Number or Boolean is supplied, it will + * be converted to a String representation.
      + * * `function` — A function returning the text content to set. Receives the index position of the element in the set + * and the old text value as arguments. + * @see \`{@link https://api.jquery.com/text/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Add text to the paragraph (notice the bold tag is escaped). +```html + + + + + text demo + + + + +​ +

      Test Paragraph.

      +​ + +​ + + +``` + */ + text(text_function: string | number | boolean | ((this: TElement, index: number, text: string) => string | number | boolean)): this; + /** + * Get the combined text contents of each element in the set of matched elements, including their descendants. + * @see \`{@link https://api.jquery.com/text/ }\` + * @since 1.0 + * @example ​ ````Find the text in the first paragraph (stripping out the html), then set the html of the last paragraph to show it is just text (the red bold is gone). +```html + + + + + text demo + + + + +​ +

      Test Paragraph.

      +

      +​ + +​ + + +``` + */ + text(): string; + /** + * Retrieve all the elements contained in the jQuery set, as an array. + * @see \`{@link https://api.jquery.com/toArray/ }\` + * @since 1.4 + * @example ​ ````Select all divs in the document and return the DOM Elements as an Array; then use the built-in reverse() method to reverse that array. +```html + + + + + toArray demo + + + + +​ +Reversed - +​ +
      One
      +
      Two
      +
      Three
      ​ + +​ + + +``` + */ + toArray(): TElement[]; + /** + * Display or hide the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/toggle/ }\` + * @since 1.4.3 + */ + toggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements. + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/toggle/ }\` + * @since 1.0 + */ + toggle(duration: JQuery.Duration, complete: (this: TElement) => void): this; + /** + * Display or hide the matched elements. + * @param duration_complete_options_display _@param_ `duration_complete_options_display` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `complete` — A function to call once the animation is complete, called once per matched element.
      + * * `options` — A map of additional options to pass to the method.
      + * * `display` — Use true to show the element or false to hide it. + * @see \`{@link https://api.jquery.com/toggle/ }\` + * @since 1.0 + * @since 1.3 + * @example ​ ````Toggles all paragraphs. +```html + + + + + toggle demo + + + +​ + +

      Hello

      +

      Good Bye

      +​ + +​ + + +``` + * @example ​ ````Animates all paragraphs to be shown if they are hidden and hidden if they are visible, completing the animation within 600 milliseconds. +```html + + + + + toggle demo + + + + +​ + +

      Hiya

      +

      Such interesting text, eh?

      +​ + +​ + + +``` + * @example ​ ````Shows all paragraphs, then hides them all, back and forth. +```html + + + + + toggle demo + + + +​ + +

      Hello

      +

      Good Bye

      +​ + +​ + + +``` + */ + toggle(duration_complete_options_display?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions | boolean): this; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument. + * @param className_function _@param_ `className_function` + *
      + * * `className` — One or more class names (separated by spaces) to be toggled for each element in the matched set.
      + * * `function` — A function that returns class names to be toggled in the class attribute of each element in the + * matched set. Receives the index position of the element in the set, the old class value, and the state as arguments. + * @param state A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. + * @see \`{@link https://api.jquery.com/toggleClass/ }\` + * @since 1.0 + * @since 1.3 + * @since 1.4 + * @since 3.3 + * @example ​ ````Toggle the class 'highlight' when a paragraph is clicked. +```html + + + + + toggleClass demo + + + + +​ +

      Click to toggle

      +

      highlight

      +

      on these

      +

      paragraphs

      +​ + +​ + + +``` + * @example ​ ````Add the "highlight" class to the clicked paragraph on every third click of that paragraph, remove it every first and second click. +```html + + + + + toggleClass demo + + + + +​ +

      Click to toggle (clicks: 0)

      +

      highlight (clicks: 0)

      +

      on these (clicks: 0)

      +

      paragraphs (clicks: 0)

      +​ + +​ + + +``` + * @example ​ ````Toggle the class name(s) indicated on the buttons for each div. +```html + + + + + toggleClass demo + + + + +​ +
      + + + + + reset +
      +
      +
      +
      +
      +
      +
      +​ + +​ + + +``` + */ + toggleClass(className_function: JQuery.TypeOrArray | ((this: TElement, index: number, className: string, state: TState) => string), + state?: TState): this; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument. + * @param state A boolean value to determine whether the class should be added or removed. + * @see \`{@link https://api.jquery.com/toggleClass/ }\` + * @since 1.4 + * @deprecated ​ Deprecated since 3.0. See \`{@link https://github.com/jquery/jquery/pull/2618 }\`. + * + * **Cause**: Calling `.toggleClass()` with no arguments, or with a single Boolean `true` or `false` argument, has been deprecated. Its behavior was poorly documented, but essentially the method saved away the current class value in a data item when the class was removed and restored the saved value when it was toggled back. If you do not believe you are specificially trying to use this form of the method, it is possible you are accidentally doing so via an inadvertent undefined value, as `.toggleClass( undefined )` toggles all classes. + * + * **Solution**: If this functionality is still needed, save the current full `.attr( "class" )` value in a data item and restore it when required. + */ + toggleClass(state?: boolean): this; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * @param eventType_event _@param_ `eventType_event` + *
      + * * `eventType` — A string containing a JavaScript event type, such as `click` or `submit`.
      + * * `event` — A \`{@link https://api.jquery.com/category/events/event-object/ jQuery.Event}\` object. + * @param extraParameters Additional parameters to pass along to the event handler. + * @see \`{@link https://api.jquery.com/trigger/ }\` + * @since 1.0 + * @since 1.3 + * @example ​ ````Clicks to button #2 also trigger a click for button #1. +```html + + + + + trigger demo + + + + +​ + + +
      0 button #1 clicks.
      +
      0 button #2 clicks.
      +​ + +​ + + +``` + * @example ​ ````To submit the first form without using the submit() function, try: +```javascript +$( "form:first" ).trigger( "submit" ); +``` + * @example ​ ````To submit the first form without using the submit() function, try: +```javascript +var event = jQuery.Event( "submit" ); +$( "form:first" ).trigger( event ); +if ( event.isDefaultPrevented() ) { + // Perform an action... +} +``` + * @example ​ ````To pass arbitrary data to an event: +```javascript +$( "p" ) + .click(function( event, a, b ) { + // When a normal click fires, a and b are undefined + // for a trigger like below a refers to "foo" and b refers to "bar" + }) + .trigger( "click", [ "foo", "bar" ] ); +``` + * @example ​ ````To pass arbitrary data through an event object: +```javascript +var event = jQuery.Event( "logged" ); +event.user = "foo"; +event.pass = "bar"; +$( "body" ).trigger( event ); +``` + * @example ​ ````Alternative way to pass data through an event object: +```javascript +$( "body" ).trigger({ + type:"logged", + user:"foo", + pass:"bar" +}); +``` + */ + trigger(eventType_event: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject | string | number | boolean): this; + /** + * Execute all handlers attached to an element for an event. + * @param eventType_event _@param_ `eventType_event` + *
      + * * `eventType` — A string containing a JavaScript event type, such as `click` or `submit`.
      + * * `event` — A \`{@link https://api.jquery.com/category/events/event-object/ jQuery.Event}\` object. + * @param extraParameters Additional parameters to pass along to the event handler. + * @see \`{@link https://api.jquery.com/triggerHandler/ }\` + * @since 1.2 + * @since 1.3 + * @example ​ ````If you called .triggerHandler() on a focus event - the browser's default focus action would not be triggered, only the event handlers bound to the focus event. +```html + + + + + triggerHandler demo + + + +​ + +

      +​ + +​ + +​ + + +``` + */ + triggerHandler(eventType_event: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject | string | number | boolean): any; + /** + * Remove a previously-attached event handler from the elements. + * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/unbind/ }\` + * @since 1.0 + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + * @example ​ ````Can bind and unbind events to the colored button. +```html + + + + + unbind demo + + + + +​ + + + +
      Click!
      +​ + +​ + + +``` + * @example ​ ````To unbind just one previously bound handler, pass the function in as the second argument: +```javascript +var foo = function() { + // Code to handle some kind of event +}; +​ +$( "p" ).bind( "click", foo ); // ... Now foo will be called when paragraphs are clicked ... +​ +$( "p" ).unbind( "click", foo ); // ... foo will no longer be called. +``` + */ + unbind(event: string, handler: JQuery.EventHandlerBase> | false): this; + /** + * Remove a previously-attached event handler from the elements. + * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * A jQuery.Event object. + * @see \`{@link https://api.jquery.com/unbind/ }\` + * @since 1.0 + * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + * @example ​ ````To unbind all events from all paragraphs, write: +```javascript +$( "p" ).unbind(); +``` + * @example ​ ````To unbind all click events from all paragraphs, write: +```javascript +$( "p" ).unbind( "click" ); +``` + */ + unbind(event?: string | JQuery.Event): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * @param selector A selector which will be used to filter the event results. + * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" + * @param handler A function to execute each time the event is triggered. + * @see \`{@link https://api.jquery.com/undelegate/ }\` + * @since 1.4.2 + * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + * @example ​ ````Can bind and unbind events to the colored button. +```html + + + + + undelegate demo + + + + +​ + + + +
      Click!
      +​ + +​ + + +``` + * @example ​ ````To undelegate just one previously bound handler, pass the function in as the third argument: +```javascript +var foo = function () { + // Code to handle some kind of event +}; +​ +// ... Now foo will be called when paragraphs are clicked ... +$( "body" ).delegate( "p", "click", foo ); +​ +// ... foo will no longer be called. +$( "body" ).undelegate( "p", "click", foo ); +``` + */ + undelegate(selector: JQuery.Selector, eventType: string, handler: JQuery.EventHandlerBase> | false): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * @param selector A selector which will be used to filter the event results. + * @param eventTypes A string containing a JavaScript event type, such as "click" or "keydown" + * An object of one or more event types and previously bound functions to unbind from them. + * @see \`{@link https://api.jquery.com/undelegate/ }\` + * @since 1.4.2 + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + */ + undelegate(selector: JQuery.Selector, eventTypes: string | JQuery.PlainObject> | false>): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * @param namespace A selector which will be used to filter the event results. + * @see \`{@link https://api.jquery.com/undelegate/ }\` + * @since 1.4.2 + * @since 1.6 + * @deprecated ​ Deprecated since 3.0. Use \`{@link off }\`. + * + * **Cause**: These event binding methods have been deprecated in favor of the `.on()` and `.off()` methods which can handle both delegated and direct event binding. Although the older methods are still present in jQuery 3.0, they may be removed as early as the next major-version update. + * + * **Solution**: Change the method call to use `.on()` or `.off()`, the documentation for the old methods include specific instructions. In general, the `.bind()` and `.unbind()` methods can be renamed directly to `.on()` and `.off()` respectively since the argument orders are identical. + * @example ​ ````To unbind all delegated events from all paragraphs, write: +```javascript +$( "p" ).undelegate(); +``` + * @example ​ ````To unbind all delegated click events from all paragraphs, write: +```javascript +$( "p" ).undelegate( "click" ); +``` + * @example ​ ````To unbind all delegated events by their namespace: +```javascript +var foo = function() { + // Code to handle some kind of event +}; +​ +// Delegate events under the ".whatever" namespace +$( "form" ).delegate( ":button", "click.whatever", foo ); +​ +$( "form" ).delegate( "input[type='text'] ", "keypress.whatever", foo ); +​ +// Unbind all events delegated under the ".whatever" namespace +$( "form" ).undelegate( ".whatever" ); +``` + */ + undelegate(namespace?: string): this; + /** + * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + * @param selector A selector to check the parent element against. If an element's parent does not match the selector, + * the element won't be unwrapped. + * @see \`{@link https://api.jquery.com/unwrap/ }\` + * @since 1.4 + * @since 3.0 + * @example ​ ````Wrap/unwrap a div around each of the paragraphs. +```html + + + + + unwrap demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      ​ + +​ + + +``` + */ + unwrap(selector?: string): this; + /** + * Set the value of each element in the set of matched elements. + * @param value_function _@param_ `value_function` + *
      + * * `value` — A string of text, a number, or an array of strings corresponding to the value of each matched + * element to set as selected/checked.
      + * * `function` — A function returning the value to set. `this` is the current element. Receives the index position of + * the element in the set and the old value as arguments. + * @see \`{@link https://api.jquery.com/val/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Set the value of an input box. +```html + + + + + val demo + + + + +​ +
      + + + +
      + +​ + +​ + + +``` + * @example ​ ````Use the function argument to modify the value of an input box. +```html + + + + + val demo + + + +​ +

      Type something and then click or tab out of the input.

      + +​ + +​ + + +``` + * @example ​ ````Set a single select, a multiple select, checkboxes and a radio button . +```html + + + + + val demo + + + + +​ + +​ + +​ +
      + check1 + check2 + radio1 + radio2 +​ + +​ + + +``` + */ + val(value_function: string | number | string[] | ((this: TElement, index: number, value: string) => string)): this; + /** + * Get the current value of the first element in the set of matched elements. + * @see \`{@link https://api.jquery.com/val/ }\` + * @since 1.0 + * @example ​ ````Get the single value from a single select and an array of values from a multiple select and display their values. +```html + + + + + val demo + + + + +​ +

      +​ + +​ + +​ + +​ + + +``` + * @example ​ ````Find the value of an input box. +```html + + + + + val demo + + + + +​ + +

      +​ + +​ + + +``` + */ + val(): string | number | string[] | undefined; + /** + * Set the CSS width of each element in the set of matched elements. + * @param value_function _@param_ `value_function` + *
      + * * `value` — An integer representing the number of pixels, or an integer along with an optional unit of measure + * appended (as a string).
      + * * `function` — A function returning the width to set. Receives the index position of the element in the set and the + * old width as arguments. Within the function, `this` refers to the current element in the set. + * @see \`{@link https://api.jquery.com/width/ }\` + * @since 1.0 + * @since 1.4.1 + * @example ​ ````Change the width of each div the first time it is clicked (and change its color). +```html + + + + + width demo + + + + +​ +
      d
      +
      d
      +
      d
      +
      d
      +
      d
      +​ + +​ + + +``` + */ + width(value_function: string | number | ((this: TElement, index: number, value: number) => string | number)): this; + /** + * Get the current computed width for the first element in the set of matched elements. + * @see \`{@link https://api.jquery.com/width/ }\` + * @since 1.0 + * @example ​ ````Show various widths. Note the values are from the iframe so might be smaller than you expected. The yellow highlight shows the iframe body. +```html + + + + + width demo + + + + +​ + + + +
       
      +

      + Sample paragraph to test width +

      +​ + +​ + + +``` + */ + width(): number | undefined; + /** + * Wrap an HTML structure around each element in the set of matched elements. + * @param wrappingElement_function _@param_ `wrappingElement_function` + *
      + * * `wrappingElement` — A selector, element, HTML string, or jQuery object specifying the structure to wrap around the + * matched elements. When you pass a jQuery collection containing more than one element, or a selector + * matching more than one element, the first element will be used.
      + * * `function` — A callback function returning the HTML content or jQuery object to wrap around the matched elements. + * Receives the index position of the element in the set as an argument. Within the function, `this` + * refers to the current element in the set. + * @see \`{@link https://api.jquery.com/wrap/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Wrap a new div around all of the paragraphs. +```html + + + + + wrap demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + * @example ​ ````Wraps a newly created tree of objects around the spans. Notice anything in between the spans gets left out like the <strong> (red text) in this example. Even the white space between spans is left out. Click View Source to see the original html.> +```html + + + + + wrap demo + + + + +​ +Span Text +What about me? +Another One +​ + +​ + + +``` + * @example ​ ````Wrap a new div around all of the paragraphs. +```html + + + + + wrap demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + * @example ​ ````Wrap a jQuery object double depth div around all of the paragraphs. Notice it doesn't move the object but just clones it to wrap around its target. +```html + + + + + wrap demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +
      +​ + +​ + + +``` + */ + wrap(wrappingElement_function: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery)): this; + /** + * Wrap an HTML structure around all elements in the set of matched elements. + * @param wrappingElement_function _@param_ `wrappingElement_function` + *
      + * * `wrappingElement` — A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
      + * * `function` — A callback function returning the HTML content or jQuery object to wrap around all the matched + * elements. Within the function, `this` refers to the first element in the set. **Prior to jQuery + * 3.0**, the callback was incorrectly called for every element in the set and received the index + * position of the element in the set as an argument. + * @see \`{@link https://api.jquery.com/wrapAll/ }\` + * @since 1.2 + * @since 1.4 + * @example ​ ````Wrap a new div around all of the paragraphs. +```html + + + + + wrapAll demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + * @example ​ ````Wraps a newly created tree of objects around the spans. Notice anything in between the spans gets left out like the <strong> (red text) in this example. Even the white space between spans is left out. Click View Source to see the original html. +```html + + + + + wrapAll demo + + + + +​ +Span Text +What about me? +Another One +​ + +​ + + +``` + * @example ​ ````Wrap a new div around all of the paragraphs. +```html + + + + + wrapAll demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + * @example ​ ````Wrap a jQuery object double depth div around all of the paragraphs. Notice it doesn't move the object but just clones it to wrap around its target. +```html + + + + + wrapAll demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +
      +​ + +​ + + +``` + */ + wrapAll(wrappingElement_function: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement) => string | JQuery)): this; + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * @param wrappingElement_function _@param_ `wrappingElement_function` + *
      + * * `wrappingElement` — An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap + * around the content of the matched elements.
      + * * `function` — A callback function which generates a structure to wrap around the content of the matched elements. + * Receives the index position of the element in the set as an argument. Within the function, `this` + * refers to the current element in the set. + * @see \`{@link https://api.jquery.com/wrapInner/ }\` + * @since 1.2 + * @since 1.4 + * @example ​ ````Selects all paragraphs and wraps a bold tag around each of its contents. +```html + + + + + wrapInner demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + * @example ​ ````Wraps a newly created tree of objects around the inside of the body. +```html + + + + + wrapInner demo + + + + +​ +Plain old text, or is it? +​ + +​ + + +``` + * @example ​ ````Selects all paragraphs and wraps a bold tag around each of its contents. +```html + + + + + wrapInner demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + * @example ​ ````Selects all paragraphs and wraps a jQuery object around each of its contents. +```html + + + + + wrapInner demo + + + + +​ +

      Hello

      +

      cruel

      +

      World

      +​ + +​ + + +``` + */ + wrapInner(wrappingElement_function: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery | Element)): this; + + [n: number]: TElement; +} diff --git a/types/jquery/JQueryStatic.d.ts b/types/jquery/JQueryStatic.d.ts new file mode 100644 index 0000000000..20d3a9e8c5 --- /dev/null +++ b/types/jquery/JQueryStatic.d.ts @@ -0,0 +1,13516 @@ +// tslint:disable:jsdoc-format +// tslint:disable:max-line-length +// tslint:disable:no-irregular-whitespace + +interface JQueryStatic { + /** + * @see \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax1 }\` + * @deprecated ​ Deprecated. Use \`{@link ajaxSetup }\`. + */ + ajaxSettings: JQuery.AjaxSettings; + Animation: JQuery.AnimationStatic; + Callbacks: JQuery.CallbacksStatic; + /** + * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. + * @see \`{@link https://api.jquery.com/jQuery.cssHooks/ }\` + * @since 1.4.3 + */ + cssHooks: JQuery.CSSHooks; + /** + * An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values. + * @see \`{@link https://api.jquery.com/jQuery.cssNumber/ }\` + * @since 1.4.3 + */ + cssNumber: JQuery.PlainObject; + Deferred: JQuery.DeferredStatic; + easing: JQuery.Easings; + Event: JQuery.EventStatic; + /** + * @see \`{@link https://learn.jquery.com/events/event-extensions/ }\` + */ + event: JQuery.EventExtensions; + expr: JQuery.Selectors; + // Set to HTMLElement to minimize breaks but should probably be Element. + readonly fn: JQuery; + fx: JQuery.Effects; + /** + * A Promise-like object (or "thenable") that resolves when the document is ready. + * @see \`{@link https://api.jquery.com/jQuery.ready/ }\` + * @since 1.8 + * @example ​ ````Listen for document ready using jQuery.when. +```javascript +$.when( $.ready ).then(function() { + // Document is ready. +}); +``` + * @example ​ ````Typical usage involving another promise, using jQuery.when. +```javascript +$.when( + $.getJSON( "ajax/test.json" ), + $.ready +).done(function( data ) { + // Document is ready. + // Value of test.json is passed as `data`. +}); +``` + */ + ready: JQuery.Thenable; + /** + * A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support. + * @see \`{@link https://api.jquery.com/jQuery.support/ }\` + * @since 1.3 + * @deprecated ​ Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`. + */ + support: JQuery.PlainObject; + timers: Array>; + Tween: JQuery.TweenStatic; + valHooks: JQuery.ValHooks; + // HACK: This is the factory function returned when importing jQuery without a DOM. Declaring it separately breaks using the type parameter on JQueryStatic. + // HACK: The discriminator parameter handles the edge case of passing a Window object to JQueryStatic. It doesn't actually exist on the factory function. + (window: Window, discriminator: boolean): JQueryStatic; + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * @param html _@param_ `html` + *
      + * * `html (ownerDocument)` — A string of HTML to create on the fly. Note that this parses HTML, not XML.
      + * * `html (attributes)` — A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>). + * @param ownerDocument_attributes _@param_ `ownerDocument_attributes` + *
      + * * `ownerDocument` — A document in which the new elements will be created.
      + * * `attributes` — An object of attributes, events, and methods to call on the newly-created element. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + * @since 1.4 + * @example ​ ````Create a div element (and all of its contents) dynamically and append it to the body element. Internally, an element is created and its innerHTML property set to the given markup. +```javascript +$( "

      Hello

      " ).appendTo( "body" ) +``` + * @example ​ ````Create some DOM elements. +```javascript +$( "
      ", { + "class": "test", + text: "Click me!", + click: function() { + $( this ).toggleClass( "test" ); + } +}) + .appendTo( "body" ); +``` + */ + // tslint:disable-next-line:no-unnecessary-generics + (html: JQuery.htmlString, ownerDocument_attributes?: Document | JQuery.PlainObject): JQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * @param selector A string containing a selector expression + * @param context A DOM Element, Document, or jQuery to use as context + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + * @example ​ ````Find all p elements that are children of a div element and apply a border to them. +```html + + + + + jQuery demo + + + +​ +

      one

      +

      two

      +

      three

      +​ + + + +``` + * @example ​ ````Find all inputs of type radio within the first form in the document. +```javascript +$( "input:radio", document.forms[ 0 ] ); +``` + * @example ​ ````Find all div elements within an XML document from an Ajax response. +```javascript +$( "div", xml.responseXML ); +``` +​ + */ + // tslint:disable-next-line:no-unnecessary-generics + (selector: JQuery.Selector, context?: Element | Document | JQuery): JQuery; + /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. + * @param element A DOM element to wrap in a jQuery object. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + * @example ​ ````Set the background color of the page to black. +```javascript +$( document.body ).css( "background", "black" ); +``` + */ + // Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810) + (element: T): JQuery; + /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. + * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + * @example ​ ````Hide all the input elements within a form. +```javascript +$( myForm.elements ).hide(); +``` + */ + // Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810) + // tslint:disable-next-line:unified-signatures + (elementArray: T[]): JQuery; + /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. + * @param selection An existing jQuery object to clone. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + */ + (selection: JQuery): JQuery; + /** + * Binds a function to be executed when the DOM has finished loading. + * @param callback The function to execute when the DOM is ready. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + * @example ​ ````Execute the function when the DOM is ready to be used. +```javascript +$(function() { + // Document is ready +}); +``` + * @example ​ ````Use both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias. +```javascript +jQuery(function( $ ) { + // Your code using failsafe $ alias here... +}); +``` + */ + // tslint:disable-next-line:no-unnecessary-generics unified-signatures + (callback: ((this: Document, $: JQueryStatic) => void)): JQuery; + /** + * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. + * @param object A plain object to wrap in a jQuery object. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.0 + */ + (object: T): JQuery; + /** + * Returns an empty jQuery set. + * @see \`{@link https://api.jquery.com/jQuery/ }\` + * @since 1.4 + */ + // tslint:disable-next-line:no-unnecessary-generics + (): JQuery; + /** + * Perform an asynchronous HTTP (Ajax) request. + * @param url A string containing the URL to which the request is sent. + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can + * be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings. + * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` + * @since 1.5 + */ + ajax(url: string, settings?: JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Perform an asynchronous HTTP (Ajax) request. + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can + * be set for any option with $.ajaxSetup(). + * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` + * @since 1.0 + * @example ​ ````Save some data to the server and notify the user once it's complete. +```javascript +$.ajax({ + method: "POST", + url: "some.php", + data: { name: "John", location: "Boston" } +}) + .done(function( msg ) { + alert( "Data Saved: " + msg ); + }); +``` + * @example ​ ````Retrieve the latest version of an HTML page. +```javascript +$.ajax({ + url: "test.html", + cache: false +}) + .done(function( html ) { + $( "#results" ).append( html ); + }); +``` + * @example ​ ````Send an xml document as data to the server. By setting the processData + option to false, the automatic conversion of data to strings is prevented. +```javascript +var xmlDocument = [create xml document]; +var xmlRequest = $.ajax({ + url: "page.php", + processData: false, + data: xmlDocument +}); +​ +xmlRequest.done( handleResponse ); +``` + * @example ​ ````Send an id as data to the server, save some data to the server, and notify the user once it's complete. If the request fails, alert the user. +```javascript +var menuId = $( "ul.nav" ).first().attr( "id" ); +var request = $.ajax({ + url: "script.php", + method: "POST", + data: { id : menuId }, + dataType: "html" +}); +​ +request.done(function( msg ) { + $( "#log" ).html( msg ); +}); +​ +request.fail(function( jqXHR, textStatus ) { + alert( "Request failed: " + textStatus ); +}); +``` + * @example ​ ````Load and execute a JavaScript file. +```javascript +$.ajax({ + method: "GET", + url: "test.js", + dataType: "script" +}); +``` + */ + ajax(settings?: JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * @param dataTypes An optional string containing one or more space-separated dataTypes + * @param handler A handler to set default values for future Ajax requests. + * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` + * @since 1.5 + */ + ajaxPrefilter(dataTypes: string, + handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * @param handler A handler to set default values for future Ajax requests. + * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` + * @since 1.5 + */ + ajaxPrefilter(handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; + /** + * Set default values for future Ajax requests. Its use is not recommended. + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + * @see \`{@link https://api.jquery.com/jQuery.ajaxSetup/ }\` + * @since 1.1 + * @example ​ ````Sets the defaults for Ajax requests to the url "/xmlhttp/", disables global handlers and uses POST instead of GET. The following Ajax requests then sends some data without having to set anything else. +```javascript +$.ajaxSetup({ + url: "/xmlhttp/", + global: false, + type: "POST" +}); +$.ajax({ data: myData }); +``` + */ + ajaxSetup(options: JQuery.AjaxSettings): JQuery.AjaxSettings; + /** + * Creates an object that handles the actual transmission of Ajax data. + * @param dataType A string identifying the data type to use + * @param handler A handler to return the new transport object to use with the data type provided in the first argument. + * @see \`{@link https://api.jquery.com/jQuery.ajaxTransport/ }\` + * @since 1.5 + */ + ajaxTransport(dataType: string, + handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => JQuery.Transport | void): void; + /** + * @deprecated ​ Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/3384 }\`. + */ + camelCase(value: string): string; + cleanData(elems: ArrayLike): void; + /** + * Check to see if a DOM element is a descendant of another DOM element. + * @param container The DOM element that may contain the other element. + * @param contained The DOM element that may be contained by (a descendant of) the other element. + * @see \`{@link https://api.jquery.com/jQuery.contains/ }\` + * @since 1.4 + * @example ​ ````Check if an element is a descendant of another. +```javascript +$.contains( document.documentElement, document.body ); // true +$.contains( document.body, document.documentElement ); // false +``` + */ + contains(container: Element, contained: Element): boolean; + css(elem: Element, name: string): any; + /** + * Store arbitrary data associated with the specified element. Returns the value that was set. + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + * @param value The new data value; this can be any Javascript type except `undefined`. + * @see \`{@link https://api.jquery.com/jQuery.data/ }\` + * @since 1.2.3 + * @example ​ ````Get the data named "blah" stored at for an element. +```html + + + + + jQuery.data demo + + + + +​ +
      A div
      + + + + +

      The "blah" value of this div is ?

      +​ + +​ + + +``` + */ + data(element: Element | Document | Window | JQuery.PlainObject, key: string, value: T): T; + /** + * Returns value at named data store for the element, as set by `jQuery.data(element, name, value)`, or the full data store for the element. + * @param element The DOM element to query for the data. + * @param key Name of the data stored. + * @param value `undefined` is not recognized as a data value. Calls such as `jQuery.data( el, "name", undefined )` + * will return the corresponding data for "name", and is therefore the same as `jQuery.data( el, "name" )` + * @see \`{@link https://api.jquery.com/jQuery.data/ }\` + * @since 1.2.3 + */ + // `unified-signatures` is disabled so that behavior when passing `undefined` to `value` can be documented. Unifying the signatures + // results in potential confusion for users from an unexpected parameter. + // tslint:disable-next-line:unified-signatures + data(element: Element | Document | Window | JQuery.PlainObject, key: string, value: undefined): any; + /** + * Returns value at named data store for the element, as set by `jQuery.data(element, name, value)`, or the full data store for the element. + * @param element The DOM element to query for the data. + * @param key Name of the data stored. + * @see \`{@link https://api.jquery.com/jQuery.data/ }\` + * @since 1.2.3 + * @since 1.4 + * @example ​ ````Store then retrieve a value from the div element. +```html + + + + + jQuery.data demo + + + + +​ +
      + The values stored were + + and + +
      +​ + +​ + + +``` + */ + data(element: Element | Document | Window | JQuery.PlainObject, key?: string): any; + /** + * Execute the next function on the queue for the matched element. + * @param element A DOM element from which to remove and execute a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see \`{@link https://api.jquery.com/jQuery.dequeue/ }\` + * @since 1.3 + * @example ​ ````Use jQuery.dequeue() to end a custom queue function which allows the queue to keep going. +```html + + + + + jQuery.dequeue demo + + + + +​ + +
      +​ + +​ + + +``` + */ + dequeue(element: Element, queueName?: string): void; + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * @param array The array to iterate over. + * @param callback The function that will be executed on every object. + * @see \`{@link https://api.jquery.com/jQuery.each/ }\` + * @since 1.0 + * @example ​ ````Iterates through the array displaying each number as both a word and numeral +```html + + + + + jQuery.each demo + + + + +​ +
      +
      +
      +
      +
      +​ + +​ + + +``` + * @example ​ ````Iterates over items in an array, accessing both the current item and its index. +```javascript +$.each( [ "a", "b", "c" ], function( i, l ){ + alert( "Index #" + i + ": " + l ); +}); +``` + */ + each(array: ArrayLike, callback: (this: T, indexInArray: number, value: T) => any): ArrayLike; + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * @param obj The object to iterate over. + * @param callback The function that will be executed on every object. + * @see \`{@link https://api.jquery.com/jQuery.each/ }\` + * @since 1.0 + * @example ​ ````Iterates through the array displaying each number as both a word and numeral +```html + + + + + jQuery.each demo + + + + +​ +
      +
      +
      +
      +
      +​ + +​ + + +``` + * @example ​ ````Iterates over the properties in an object, accessing both the current item and its key. +```javascript +$.each({ name: "John", lang: "JS" }, function( k, v ) { + alert( "Key: " + k + ", Value: " + v ); +}); +``` + */ + each(obj: T, callback: (this: T[K], propertyName: K, valueOfProperty: T[K]) => any): T; + /** + * Takes a string and throws an exception containing it. + * @param message The message to send out. + * @see \`{@link https://api.jquery.com/jQuery.error/ }\` + * @since 1.4.1 + * @example ​ ````Override jQuery.error for display in Firebug. +```javascript +jQuery.error = console.error; +``` + */ + error(message: string): any; + /** + * Escapes any character that has a special meaning in a CSS selector. + * @param selector A string containing a selector expression to escape. + * @see \`{@link https://api.jquery.com/jQuery.escapeSelector/ }\` + * @since 3.0 + * @example ​ ````Escape an ID containing a hash. +```javascript +$.escapeSelector( "#target" ); // "\#target" +``` + * @example ​ ````Select all the elements having a class name of .box inside a div. +```javascript +$( "div" ).find( "." + $.escapeSelector( ".box" ) ); +``` + */ + escapeSelector(selector: JQuery.Selector): JQuery.Selector; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @param object4 An object containing additional properties to merge in. + * @param object5 An object containing additional properties to merge in. + * @param object6 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + * @example ​ ````Merge two objects recursively, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @param object4 An object containing additional properties to merge in. + * @param object5 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + * @example ​ ````Merge two objects recursively, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @param object4 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + * @example ​ ````Merge two objects recursively, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + * @example ​ ````Merge two objects recursively, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + * @example ​ ````Merge two objects recursively, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(deep: true, target: T, object1: U, object2: V): T & U & V; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + * @example ​ ````Merge two objects recursively, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(deep: true, target: T, object1: U): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + */ + extend(deep: true, target: T): this & T; + /** + * Merge the contents of two or more objects together into the first object. + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.1.4 + * @example ​ ````Merge two objects recursively, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(deep: true, target: any, object1: any, ...objectN: any[]): any; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @param object4 An object containing additional properties to merge in. + * @param object5 An object containing additional properties to merge in. + * @param object6 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + * @example ​ ````Merge two objects, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @param object4 An object containing additional properties to merge in. + * @param object5 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + * @example ​ ````Merge two objects, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @param object4 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + * @example ​ ````Merge two objects, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @param object3 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + * @example ​ ````Merge two objects, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(target: T, object1: U, object2: V, object3: W): T & U & V & W; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param object2 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + * @example ​ ````Merge two objects, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(target: T, object1: U, object2: V): T & U & V; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + * @example ​ ````Merge two objects, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(target: T, object1: U): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + */ + extend(target: T): this & T; + /** + * Merge the contents of two or more objects together into the first object. + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` + * @since 1.0 + * @example ​ ````Merge two objects, modifying the first. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Merge defaults and options, without modifying the defaults. This is a common plugin development pattern. +```html + + + + + jQuery.extend demo + + + +​ +
      +​ + +​ + + +``` + */ + extend(target: any, object1: any, ...objectN: any[]): any; + /** + * Load data from the server using a HTTP GET request. + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. Required if `dataType` is provided, + * but you can use `null` or \`{@link noop jQuery.noop}\` as a placeholder. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` + * @since 1.0 + */ + get(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback | null, + dataType?: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. Required if `dataType` is provided, + * but you can use `null` or \`{@link noop jQuery.noop}\` as a placeholder. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` + * @since 1.0 + * @example ​ ````Get the test.php page contents, which has been returned in json format (<?php echo json_encode( array( "name"=>"John","time"=>"2pm" ) ); ?>), and add it to the page. +```javascript +$.get( "test.php", function( data ) { + $( "body" ) + .append( "Name: " + data.name ) // John + .append( "Time: " + data.time ); // 2pm +}, "json" ); +``` + */ + get(url: string, + success: JQuery.jqXHR.DoneCallback | null, + dataType: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * @param url A string containing the URL to which the request is sent. + * @param success_data _@param_ `success_data` + *
      + * * `success` — A callback function that is executed if the request succeeds. Required if `dataType` is provided, + * but you can use `null` or \`{@link noop jQuery.noop}\` as a placeholder.
      + * * `data` — A plain object or string that is sent to the server with the request. + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` + * @since 1.0 + * @example ​ ````Request the test.php page and send some additional data along (while still ignoring the return results). +```javascript +$.get( "test.php", { name: "John", time: "2pm" } ); +``` + * @example ​ ````Pass arrays of data to the server (while still ignoring the return results). +```javascript +$.get( "test.php", { "choices[]": ["Jon", "Susan"] } ); +``` + * @example ​ ````Alert the results from requesting test.php (HTML or XML, depending on what was returned). +```javascript +$.get( "test.php", function( data ) { + alert( "Data Loaded: " + data ); +}); +``` + * @example ​ ````Alert the results from requesting test.cgi with an additional payload of data (HTML or XML, depending on what was returned). +```javascript +$.get( "test.cgi", { name: "John", time: "2pm" } ) + .done(function( data ) { + alert( "Data Loaded: " + data ); + }); +``` + */ + get(url: string, + success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * @param url_settings _@param_ `url_settings` + *
      + * * `url` — A string containing the URL to which the request is sent.
      + * * `settings` — A set of key/value pairs that configure the Ajax request. All properties except for `url` are + * optional. A default can be set for any option with \`{@link ajaxSetup $.ajaxSetup()}\`. See \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings jQuery.ajax( settings )}\` + * for a complete list of all settings. The type option will automatically be set to `GET`. + * @see \`{@link https://api.jquery.com/jQuery.get/ }\` + * @since 1.0 + * @since 1.12 + * @since 2.2 + * @example ​ ````Request the test.php page, but ignore the return results. +```javascript +$.get( "test.php" ); +``` + */ + get(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\` + * @since 1.0 + */ + getJSON(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * @param url A string containing the URL to which the request is sent. + * @param success_data _@param_ `url_settings` + *
      + * * `success` — A callback function that is executed if the request succeeds.
      + * * `data` — A plain object or string that is sent to the server with the request. + * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\` + * @since 1.0 + * @example ​ ````Loads the four most recent pictures of Mount Rainier from the Flickr JSONP API. +```html + + + + + jQuery.getJSON demo + + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Load the JSON data from test.js and access a name from the returned JSON data. +```javascript +$.getJSON( "test.js", function( json ) { + console.log( "JSON Data: " + json.users[ 3 ].name ); + }); + ``` + * @example ​ ````Load the JSON data from test.js, passing along additional data, and access a name from the returned JSON data. + If an error occurs, log an error message instead. +```javascript +$.getJSON( "test.js", { name: "John", time: "2pm" } ) + .done(function( json ) { + console.log( "JSON Data: " + json.users[ 3 ].name ); + }) + .fail(function( jqxhr, textStatus, error ) { + var err = textStatus + ", " + error; + console.log( "Request Failed: " + err ); +}); +``` + */ + getJSON(url: string, + success_data?: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + * @see \`{@link https://api.jquery.com/jQuery.getScript/ }\` + * @since 1.0 + * @example ​ ````Define a $.cachedScript() method that allows fetching a cached script: +```javascript +jQuery.cachedScript = function( url, options ) { +​ + // Allow user to set any option except for dataType, cache, and url + options = $.extend( options || {}, { + dataType: "script", + cache: true, + url: url + }); +​ + // Use $.ajax() since it is more flexible than $.getScript + // Return the jqXHR object so we can chain callbacks + return jQuery.ajax( options ); +}; +​ +// Usage +$.cachedScript( "ajax/test.js" ).done(function( script, textStatus ) { + console.log( textStatus ); +}); +``` + * @example ​ ````Load the official jQuery Color Animation plugin dynamically and bind some color animations to occur once the new functionality is loaded. +```html + + + + + jQuery.getScript demo + + + + +​ + +
      +​ + +​ + + +``` + */ + getScript(url: string, + success?: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * @see \`{@link https://api.jquery.com/jQuery.getScript/ }\` + * @since 1.12 + * @since 2.2 + */ + getScript(options: JQuery.UrlAjaxSettings): JQuery.jqXHR; + /** + * Execute some JavaScript code globally. + * @param code The JavaScript code to execute. + * @see \`{@link https://api.jquery.com/jQuery.globalEval/ }\` + * @since 1.0.4 + * @example ​ ````Execute a script in the global context. +```javascript +function test() { + jQuery.globalEval( "var newVar = true;" ) +} +test(); +// newVar === true +``` + */ + globalEval(code: string): void; + /** + * Finds the elements of an array which satisfy a filter function. The original array is not affected. + * @param array The array-like object to search through. + * @param funсtion The function to process each item against. The first argument to the function is the item, and the + * second argument is the index. The function should return a Boolean value. `this` will be the global + * window object. + * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements + * for which "callback" returns true. If "invert" is true, then the function returns an array + * consisting of all elements for which "callback" returns false. + * @see \`{@link https://api.jquery.com/jQuery.grep/ }\` + * @since 1.0 + * @example ​ ````Filters the original array of numbers leaving that are not 5 and have an index greater than 4. Then it removes all 9s. +```html + + + + + jQuery.grep demo + + + + +​ +
      +

      + +​ + +​ + + +``` + * @example ​ ````Filter an array of numbers to include only numbers bigger then zero. +```javascript +$.grep( [ 0, 1, 2 ], function( n, i ) { + return n > 0; +}); +``` + * @example ​ ````Filter an array of numbers to include numbers that are not bigger than zero. +```javascript +$.grep( [ 0, 1, 2 ], function( n, i ) { + return n > 0; +}, true ); +``` + */ + grep(array: ArrayLike, + funсtion: (elementOfArray: T, indexInArray: number) => boolean, + invert?: boolean): T[]; + /** + * Determine whether an element has any jQuery data associated with it. + * @param element A DOM element to be checked for data. + * @see \`{@link https://api.jquery.com/jQuery.hasData/ }\` + * @since 1.5 + * @example ​ ````Set data on an element and see the results of hasData. +```html + + + + + jQuery.hasData demo + + + +​ +

      Results:

      +​ + +​ + + +``` + */ + hasData(element: Element | Document | Window | JQuery.PlainObject): boolean; + /** + * Holds or releases the execution of jQuery's ready event. + * @param hold Indicates whether the ready hold is being requested or released + * @see \`{@link https://api.jquery.com/jQuery.holdReady/ }\` + * @since 1.6 + * @deprecated ​ Deprecated since 3.2. See \`{@link https://github.com/jquery/jquery/issues/3288 }\`. + * + * **Cause**: The `jQuery.holdReady()` method has been deprecated due to its detrimental effect on the global performance of the page. This method can prevent all the code on the page from initializing for extended lengths of time. + * + * **Solution**: Rewrite the page so that it does not require all jQuery ready handlers to be delayed. This might be accomplished, for example, by late-loading only the code that requires the delay when it is safe to run. Due to the complexity of this method, jQuery Migrate does not attempt to fill the functionality. If the underlying version of jQuery used with jQuery Migrate no longer contains `jQuery.holdReady()` the code will fail shortly after this warning appears. + * @example ​ ````Delay the ready event until a custom plugin has loaded. +```javascript +$.holdReady( true ); +$.getScript( "myplugin.js", function() { + $.holdReady( false ); +}); +``` + */ + holdReady(hold: boolean): void; + /** + * Modify and filter HTML strings passed through jQuery manipulation methods. + * @param html The HTML string on which to operate. + * @see \`{@link https://api.jquery.com/jQuery.htmlPrefilter/ }\` + * @since 1.12 + * @since 2.2 + */ + htmlPrefilter(html: JQuery.htmlString): JQuery.htmlString; + /** + * Search for a specified value within an array and return its index (or -1 if not found). + * @param value The value to search for. + * @param array An array through which to search. + * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array. + * @see \`{@link https://api.jquery.com/jQuery.inArray/ }\` + * @since 1.2 + * @example ​ ````Report the index of some elements in the array. +```html + + + + + jQuery.inArray demo + + + + +​ +
      "John" found at
      +
      4 found at
      +
      "Karl" not found, so
      +
      "Pete" is in the array, but not at or after index 2, so
      +​ + +​ + + +``` + */ + inArray(value: T, array: T[], fromIndex?: number): number; + /** + * Determine whether the argument is an array. + * @param obj Object to test whether or not it is an array. + * @see \`{@link https://api.jquery.com/jQuery.isArray/ }\` + * @since 1.3 + * @deprecated ​ Deprecated since 3.2. Use \`{@link ArrayConstructor.isArray Array.isArray}\`. + * @example ​ ````Finds out if the parameter is an array. +```html + + + + + jQuery.isArray demo + + + +​ +Is [] an Array? +​ + +​ + + +``` + */ + isArray(obj: any): obj is any[]; + /** + * Check to see if an object is empty (contains no enumerable properties). + * @param obj The object that will be checked to see if it's empty. + * @see \`{@link https://api.jquery.com/jQuery.isEmptyObject/ }\` + * @since 1.4 + * @example ​ ````Check an object to see if it's empty. +```javascript +jQuery.isEmptyObject({}); // true +jQuery.isEmptyObject({ foo: "bar" }); // false +``` + */ + isEmptyObject(obj: any): boolean; + /** + * Determine if the argument passed is a JavaScript function object. + * @param obj Object to test whether or not it is a function. + * @see \`{@link https://api.jquery.com/jQuery.isFunction/ }\` + * @since 1.2 + * @deprecated ​ Deprecated since 3.3. Use `typeof x === "function"`. + * @example ​ ````Test a few parameter examples. +```html + + + + + jQuery.isFunction demo + + + + +​ +
      jQuery.isFunction( objs[ 0 ] ) =
      +
      jQuery.isFunction( objs[ 1 ] ) =
      +
      jQuery.isFunction( objs[ 2 ] ) =
      +
      jQuery.isFunction( objs[ 3 ] ) =
      +
      jQuery.isFunction( objs[ 4 ] ) =
      +​ + +​ + + +``` + * @example ​ ````Finds out if the parameter is a function. +```javascript +$.isFunction(function() {}); +``` + */ + // tslint:disable-next-line:ban-types + isFunction(obj: any): obj is Function; + /** + * Determines whether its argument represents a JavaScript number. + * @param value The value to be tested. + * @see \`{@link https://api.jquery.com/jQuery.isNumeric/ }\` + * @since 1.7 + * @deprecated ​ Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/2960 }\`. + * @example ​ ````Sample return values of $.isNumeric with various inputs. +```javascript +// true (numeric) +$.isNumeric( "-10" ) +$.isNumeric( "0" ) +$.isNumeric( 0xFF ) +$.isNumeric( "0xFF" ) +$.isNumeric( "8e5" ) +$.isNumeric( "3.1415" ) +$.isNumeric( +10 ) +$.isNumeric( 0144 ) +​ +// false (non-numeric) +$.isNumeric( "-0x42" ) +$.isNumeric( "7.2acdgs" ) +$.isNumeric( "" ) +$.isNumeric( {} ) +$.isNumeric( NaN ) +$.isNumeric( null ) +$.isNumeric( true ) +$.isNumeric( Infinity ) +$.isNumeric( undefined ) +``` + */ + isNumeric(value: any): boolean; + /** + * Check to see if an object is a plain object (created using "{}" or "new Object"). + * @param obj The object that will be checked to see if it's a plain object. + * @see \`{@link https://api.jquery.com/jQuery.isPlainObject/ }\` + * @since 1.4 + * @example ​ ````Check an object to see if it's a plain object. +```javascript +jQuery.isPlainObject({}) // true +jQuery.isPlainObject( "test" ) // false +``` + */ + isPlainObject(obj: any): boolean; + /** + * Determine whether the argument is a window. + * @param obj Object to test whether or not it is a window. + * @see \`{@link https://api.jquery.com/jQuery.isWindow/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/3629 }\`. + * + * **Cause**: This method returns `true` if its argument is thought to be a `window` element. It was created for internal use and is not a reliable way of detecting `window` for public needs. + * + * **Solution**: Remove any use of `jQuery.isWindow()` from code. If it is truly needed it can be replaced with a check for `obj != null && obj === obj.window` which was the test used inside this method. + * @example ​ ````Finds out if the parameter is a window. +```html + + + + + jQuery.isWindow demo + + + +​ +Is 'window' a window? +​ + +​ + + +``` + */ + isWindow(obj: any): obj is Window; + /** + * Check to see if a DOM node is within an XML document (or is an XML document). + * @param node The DOM node that will be checked to see if it's in an XML document. + * @see \`{@link https://api.jquery.com/jQuery.isXMLDoc/ }\` + * @since 1.1.4 + * @example ​ ````Check an object to see if it's in an XML document. +```javascript +jQuery.isXMLDoc( document ) // false +jQuery.isXMLDoc( document.body ) // false +``` + */ + isXMLDoc(node: Node): boolean; + /** + * Convert an array-like object into a true JavaScript array. + * @param obj Any object to turn into a native Array. + * @see \`{@link https://api.jquery.com/jQuery.makeArray/ }\` + * @since 1.2 + * @example ​ ````Turn a collection of HTMLElements into an Array of them. +```html + + + + + jQuery.makeArray demo + + + + +​ +
      First
      +
      Second
      +
      Third
      +
      Fourth
      +​ + +​ + + +``` + * @example ​ ````Turn a jQuery object into an array +```javascript +var obj = $( "li" ); +var arr = $.makeArray( obj ); +``` + */ + makeArray(obj: ArrayLike): T[]; + /** + * Translate all items in an array or object to new array of items. + * @param array The Array to translate. + * @param callback The function to process each item against. The first argument to the function is the array item, the + * second argument is the index in array The function can return any value. A returned array will be + * flattened into the resulting array. Within the function, this refers to the global (window) object. + * @see \`{@link https://api.jquery.com/jQuery.map/ }\` + * @since 1.0 + * @example ​ ````Use $.map() to change the values of an array. +```html + + + + + jQuery.map demo + + + + +​ +
      +

      + +​ + +​ + + +``` + * @example ​ ````Map the original array to a new one and add 4 to each value. +```javascript +$.map( [ 0, 1, 2 ], function( n ) { + return n + 4; +}); +``` + * @example ​ ````Map the original array to a new one, adding 1 to each value if it is bigger then zero and removing it if not. +```javascript +$.map( [ 0, 1, 2 ], function( n ) { + return n > 0 ? n + 1 : null; +}); +``` + * @example ​ ````Map the original array to a new one; each element is added with its original value and the value plus one. +```javascript +$.map( [ 0, 1, 2 ], function( n ) { + return [ n, n + 1 ]; +}); +``` + * @example ​ ````Map the original array to a new one; each element is squared. +```javascript +$.map( [ 0, 1, 2, 3 ], function( a ) { + return a * a; +}); +``` + * @example ​ ````Map the original array to a new one, removing numbers less than 50 by returning null and subtracting 45 from the rest. +```javascript +$.map( [ 0, 1, 52, 97 ], function( a ) { + return (a > 50 ? a - 45 : null); +}); +``` + * @example ​ ````Augment the resulting array by returning an array inside the function. +```javascript +var array = [ 0, 1, 52, 97 ]; +array = $.map( array, function( a, index ) { + return [ a - 45, index ]; +}); +``` + */ + map(array: T[], callback: (this: Window, elementOfArray: T, indexInArray: number) => JQuery.TypeOrArray | null | undefined): TReturn[]; + /** + * Translate all items in an array or object to new array of items. + * @param obj The Object to translate. + * @param callback The function to process each item against. The first argument to the function is the value; the + * second argument is the key of the object property. The function can return any value to add to the + * array. A returned array will be flattened into the resulting array. Within the function, this refers + * to the global (window) object. + * @see \`{@link https://api.jquery.com/jQuery.map/ }\` + * @since 1.6 + * @example ​ ````Map the original object to a new array and double each value. +```javascript +var dimensions = { width: 10, height: 15, length: 20 }; +dimensions = $.map( dimensions, function( value, index ) { + return value * 2; +}); +``` + * @example ​ ````Map an object's keys to an array. +```javascript +var dimensions = { width: 10, height: 15, length: 20 }; +var keys = $.map( dimensions, function( value, key ) { + return key; +}); +``` + */ + map(obj: T, callback: (this: Window, propertyOfObject: T[K], key: K) => JQuery.TypeOrArray | null | undefined): TReturn[]; + /** + * Merge the contents of two arrays together into the first array. + * @param first The first array-like object to merge, the elements of second added. + * @param second The second array-like object to merge into the first, unaltered. + * @see \`{@link https://api.jquery.com/jQuery.merge/ }\` + * @since 1.0 + * @example ​ ````Merges two arrays, altering the first argument. +```javascript +$.merge( [ 0, 1, 2 ], [ 2, 3, 4 ] ) +``` + * @example ​ ````Merges two arrays, altering the first argument. +```javascript +$.merge( [ 3, 2, 1 ], [ 4, 3, 2 ] ) +``` + * @example ​ ````Merges two arrays, but uses a copy, so the original isn't altered. +```javascript +var first = [ "a", "b", "c" ]; +var second = [ "d", "e", "f" ]; +$.merge( $.merge( [], first ), second ); +``` + */ + merge(first: ArrayLike, second: ArrayLike): Array; + /** + * Relinquish jQuery's control of the $ variable. + * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). + * @see \`{@link https://api.jquery.com/jQuery.noConflict/ }\` + * @since 1.0 + * @example ​ ````Map the original object that was referenced by $ back to $. +```javascript +jQuery.noConflict(); +// Do something with jQuery +jQuery( "div p" ).hide(); +// Do something with another library's $() +$( "content" ).style.display = "none"; +``` + * @example ​ ````Revert the $ alias and then create and execute a function to provide the $ as a jQuery alias inside the function's scope. Inside the function the original $ object is not available. This works well for most plugins that don't rely on any other library. +```javascript +jQuery.noConflict(); +(function( $ ) { + $(function() { + // More code using $ as alias to jQuery + }); +})(jQuery); +​ +// Other code using $ as an alias to the other library +``` + * @example ​ ````Create a different alias instead of jQuery to use in the rest of the script. +```javascript +var j = jQuery.noConflict(); +​ +// Do something with jQuery +j( "div p" ).hide(); +​ +// Do something with another library's $() +$( "content" ).style.display = "none"; +``` + * @example ​ ````Completely move jQuery to a new namespace in another object. +```javascript +var dom = {}; +dom.query = jQuery.noConflict( true ); +``` + * @example ​ ````Load two versions of jQuery (not recommended). Then, restore jQuery's globally scoped variables to the first loaded jQuery. +```html + + + + + jQuery.noConflict demo + + + +​ +
      +

      Before $.noConflict(true)

      +
      + +​ + +​ + + +``` + */ + noConflict(removeAll?: boolean): this; + /** + * @deprecated ​ Deprecated since 3.2. + * + * **Cause**: This public but never-documented method has been deprecated as of jQuery 3.2.0. + * + * **Solution**: Replace calls such as `jQuery.nodeName( elem, "div" )` with a test such as `elem.nodeName.toLowerCase() === "div"`. + */ + nodeName(elem: Node, name: string): boolean; + /** + * An empty function. + * @see \`{@link https://api.jquery.com/jQuery.noop/ }\` + * @since 1.4 + */ + noop(): undefined; + /** + * Return a number representing the current time. + * @see \`{@link https://api.jquery.com/jQuery.now/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.3. Use \`{@link DateConstructor.now Date.now}\`. + */ + now(): number; + /** + * Create a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input elements with name/value properties. + * @param obj An array, a plain object, or a jQuery object to serialize. + * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. + * @see \`{@link https://api.jquery.com/jQuery.param/ }\` + * @since 1.2 + * @since 1.4 + * @example ​ ````Serialize a key/value object. +```html + + + + + jQuery.param demo + + + + +​ +
      +​ + +​ + + +``` + * @example ​ ````Serialize a few complex objects +```html + + + + + jQuery.param demo + + + + +​​ + +​ + + +``` + */ + param(obj: any[] | JQuery.PlainObject | JQuery, traditional?: boolean): string; + /** + * Parses a string into an array of DOM nodes. + * @param data HTML string to be parsed + * @param context Document element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\` + * @since 1.8 + */ + parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): JQuery.Node[]; + /** + * Parses a string into an array of DOM nodes. + * @param data HTML string to be parsed + * @param context_keepScripts _@param_ `context_keepScripts` + *
      + * * `context` — Document element to serve as the context in which the HTML fragment will be created
      + * * `keepScripts` — A Boolean indicating whether to include scripts passed in the HTML string + * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\` + * @since 1.8 + * @example ​ ````Create an array of DOM nodes using an HTML string and insert it into a div. +```html + + + + + jQuery.parseHTML demo + + + +​ +
      +

      Content:

      +
      +​ + +​ + + +``` + */ + parseHTML(data: string, context_keepScripts?: Document | null | boolean): JQuery.Node[]; + /** + * Takes a well-formed JSON string and returns the resulting JavaScript value. + * @param json The JSON string to parse. + * @see \`{@link https://api.jquery.com/jQuery.parseJSON/ }\` + * @since 1.4.1 + * @deprecated ​ Deprecated since 3.0. Use \`{@link JSON.parse }\`. + * + * **Cause**: The `jQuery.parseJSON` method in recent jQuery is identical to the native `JSON.parse`. As of jQuery 3.0 `jQuery.parseJSON` is deprecated. + * + * **Solution**: Replace any use of `jQuery.parseJSON` with `JSON.parse`. + * @example ​ ````Parse a JSON string. +```javascript +var obj = jQuery.parseJSON( '{ "name": "John" }' ); +alert( obj.name === "John" ); +``` + */ + parseJSON(json: string): any; + /** + * Parses a string into an XML document. + * @param data a well-formed XML string to be parsed + * @see \`{@link https://api.jquery.com/jQuery.parseXML/ }\` + * @since 1.5 + * @example ​ ````Create a jQuery object using an XML string and obtain the value of the title node. +```html + + + + + jQuery.parseXML demo + + + +​ +

      +

      +​ + +​ + + +``` + */ + parseXML(data: string): XMLDocument; + /** + * Load data from the server using a HTTP POST request. + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but + * can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` + * @since 1.0 + * @example ​ ````Post to the test.php page and get content which has been returned in json format (<?php echo json_encode(array("name"=>"John","time"=>"2pm")); ?>). +```javascript +$.post( "test.php", { func: "getNameAndTime" }, function( data ) { + console.log( data.name ); // John + console.log( data.time ); // 2pm +}, "json"); +``` + */ + post(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback | null, + dataType?: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but + * can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` + * @since 1.0 + */ + post(url: string, + success: JQuery.jqXHR.DoneCallback | null, + dataType: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * @param url A string containing the URL to which the request is sent. + * @param success_data _@param_ `success_data` + *
      + * * `success` — A callback function that is executed if the request succeeds. Required if `dataType` is provided, + * but can be `null` in that case.
      + * * `data` — A plain object or string that is sent to the server with the request. + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` + * @since 1.0 + * @example ​ ````Request the test.php page and send some additional data along (while still ignoring the return results). +```javascript +$.post( "test.php", { name: "John", time: "2pm" } ); +``` + * @example ​ ````Pass arrays of data to the server (while still ignoring the return results). +```javascript +$.post( "test.php", { 'choices[]': [ "Jon", "Susan" ] } ); +``` + * @example ​ ````Send form data using Ajax requests +```javascript +$.post( "test.php", $( "#testform" ).serialize() ); +``` + * @example ​ ````Alert the results from requesting test.php (HTML or XML, depending on what was returned). +```javascript +$.post( "test.php", function( data ) { + alert( "Data Loaded: " + data ); +}); +``` + * @example ​ ````Alert the results from requesting test.php with an additional payload of data (HTML or XML, depending on what was returned). +```javascript +$.post( "test.php", { name: "John", time: "2pm" }) + .done(function( data ) { + alert( "Data Loaded: " + data ); + }); +``` + * @example ​ ````Post a form using Ajax and put results in a div +```html + + + + + jQuery.post demo + + + +​ +
      + + +
      + +
      +​ + +​ + + +``` + */ + post(url: string, + success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * @param url_settings _@param_ `url_settings` + *
      + * * `url` — A string containing the URL to which the request is sent.
      + * * `settings` — A set of key/value pairs that configure the Ajax request. All properties except for `url` are optional. + * A default can be set for any option with \`{@link ajaxSetup $.ajaxSetup()}\`. See \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings jQuery.ajax( settings )}\` + * for a complete list of all settings. Type will automatically be set to `POST`. + * @see \`{@link https://api.jquery.com/jQuery.post/ }\` + * @since 1.0 + * @since 1.12 + * @since 2.2 + * @example ​ ````Request the test.php page, but ignore the return results. +```javascript +$.post( "test.php" ); +``` + */ + post(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR; + + // region proxy + // #region proxy + + // region (funсtion, null | undefined) + // #region (funсtion, null | undefined) + + // region 0 to 7 additional arguments + // #region 0 to 7 additional arguments + + // region 0 parameters + // #region 0 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C) => TReturn, + context: null | undefined, + a: A, b: B, c: C): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B) => TReturn, + context: null | undefined, + a: A, b: B): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A) => TReturn, + context: null | undefined, + a: A): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: () => TReturn, + context: null | undefined): () => TReturn; + + // #endregion + + // region 1 parameters + // #region 1 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, + t: T) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, + t: T) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, + t: T) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, + t: T) => TReturn, + context: null | undefined, + a: A, b: B, c: C): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, + t: T) => TReturn, + context: null | undefined, + a: A, b: B): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, + t: T) => TReturn, + context: null | undefined, + a: A): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (t: T) => TReturn, + context: null | undefined): (t: T) => TReturn; + + // #endregion + + // region 2 parameters + // #region 2 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, + t: T, u: U) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, + t: T, u: U) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, + t: T, u: U) => TReturn, + context: null | undefined, + a: A, b: B, c: C): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, + t: T, u: U) => TReturn, + context: null | undefined, + a: A, b: B): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, + t: T, u: U) => TReturn, + context: null | undefined, + a: A): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (t: T, u: U) => TReturn, + context: null | undefined): (t: T, u: U) => TReturn; + + // #endregion + + // region 3 parameters + // #region 3 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, + t: T, u: U, v: V) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, + t: T, u: U, v: V) => TReturn, + context: null | undefined, + a: A, b: B, c: C): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, + t: T, u: U, v: V) => TReturn, + context: null | undefined, + a: A, b: B): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, + t: T, u: U, v: V) => TReturn, + context: null | undefined, + a: A): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (t: T, u: U, v: V) => TReturn, + context: null | undefined): (t: T, u: U, v: V) => TReturn; + + // #endregion + + // region 4 parameters + // #region 4 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, + t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, + t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined, + a: A, b: B): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, + t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined, + a: A): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (t: T, u: U, v: V, w: W) => TReturn, + context: null | undefined): (t: T, u: U, v: V, w: W) => TReturn; + + // #endregion + + // region 5 parameters + // #region 5 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined, + a: A, b: B): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined, + a: A): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (t: T, u: U, v: V, w: W, x: X) => TReturn, + context: null | undefined): (t: T, u: U, v: V, w: W, x: X) => TReturn; + + // #endregion + + // region 6 parameters + // #region 6 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined, + a: A, b: B): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined, + a: A): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: null | undefined): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + + // #endregion + + // region 7+ parameters + // #region 7+ parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, c: C, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, b: B, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined, + a: A, b: B): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (a: A, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined, + a: A): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: null | undefined): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + + // #endregion + + // #endregion + + // region 8+ additional arguments + // #region 8+ additional arguments + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.9 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + */ + proxy(funсtion: (...args: any[]) => TReturn, + context: null | undefined, + ...additionalArguments: any[]): (...args: any[]) => TReturn; + + // #endregion + + // #endregion + + // region (funсtion, context) + // #region (funсtion, context) + + // region 0 to 7 additional arguments + // #region 0 to 7 additional arguments + + // region 0 parameters + // #region 0 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C) => TReturn, + context: TContext, + a: A, b: B, c: C): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B) => TReturn, + context: TContext, + a: A, b: B): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4` + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A) => TReturn, + context: TContext, + a: A): () => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext) => TReturn, + context: TContext): () => TReturn; + + // #endregion + + // region 1 parameters + // #region 1 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, + t: T) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, + t: T) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, + t: T) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, + t: T) => TReturn, + context: TContext, + a: A, b: B, c: C): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, + t: T) => TReturn, + context: TContext, + a: A, b: B): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, + t: T) => TReturn, + context: TContext, + a: A): (t: T) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, t: T) => TReturn, + context: TContext): (t: T) => TReturn; + + // #endregion + + // region 2 parameters + // #region 2 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, + t: T, u: U) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, + t: T, u: U) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, + t: T, u: U) => TReturn, + context: TContext, + a: A, b: B, c: C): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, + t: T, u: U) => TReturn, + context: TContext, + a: A, b: B): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, + t: T, u: U) => TReturn, + context: TContext, + a: A): (t: T, u: U) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, t: T, u: U) => TReturn, + context: TContext): (t: T, u: U) => TReturn; + + // #endregion + + // region 3 parameters + // #region 3 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, + t: T, u: U, v: V) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, + t: T, u: U, v: V) => TReturn, + context: TContext, + a: A, b: B, c: C): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, + t: T, u: U, v: V) => TReturn, + context: TContext, + a: A, b: B): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, + t: T, u: U, v: V) => TReturn, + context: TContext, + a: A): (t: T, u: U, v: V) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, t: T, u: U, v: V) => TReturn, + context: TContext): (t: T, u: U, v: V) => TReturn; + + // #endregion + + // region 4 parameters + // #region 4 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, + t: T, u: U, v: V, w: W) => TReturn, + context: TContext, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, + t: T, u: U, v: V, w: W) => TReturn, + context: TContext, + a: A, b: B): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, + t: T, u: U, v: V, w: W) => TReturn, + context: TContext, + a: A): (t: T, u: U, v: V, w: W) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, t: T, u: U, v: V, w: W) => TReturn, + context: TContext): (t: T, u: U, v: V, w: W) => TReturn; + + // #endregion + + // region 5 parameters + // #region 5 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext, + a: A, b: B): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, + t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext, + a: A): (t: T, u: U, v: V, w: W, x: X) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn, + context: TContext): (t: T, u: U, v: V, w: W, x: X) => TReturn; + + // #endregion + + // region 6 parameters + // #region 6 parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext, + a: A, b: B): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, + t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext, + a: A): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, + context: TContext): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; + + // #endregion + + // region 7+ parameters + // #region 7+ parameters + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @param g An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, g: G, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @param f An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, f: F, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @param e An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, e: E, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @param d An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, d: D, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext, + a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @param c An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, c: C, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext, + a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @param b An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, b: B, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext, + a: A, b: B): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param a An argument to be passed to the function referenced in the `function` argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, a: A, + t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext, + a: A): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, + context: TContext): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; + + // #endregion + + // #endregion + + // region 8+ additional arguments + // #region 8+ additional arguments + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param funсtion The function whose context will be changed. + * @param context The object to which the context (`this`) of the function should be set. + * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Change the context of functions bound to a click handler using the "function, context" signature. Unbind the first handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + * @example ​ ````Change the context of a function bound to the click handler, +```html + + + + + jQuery.proxy demo + + + +​ +

      +
      +​ + +​ + + +``` + */ + proxy(funсtion: (this: TContext, ...args: any[]) => TReturn, + context: TContext, + ...additionalArguments: any[]): (...args: any[]) => TReturn; + + // #endregion + + // #endregion + + // region (context, name) + // #region (context, name) + + /** + * Takes a function and returns a new one that will always have a particular context. + * @param context The object to which the context of the function should be set. + * @param name The name of the function whose context will be changed (should be a property of the context object). + * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. + * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` + * @since 1.4 + * @since 1.6 + * @deprecated ​ Deprecated since 3.3. Use \`{@link Function#bind }\`. + * @example ​ ````Enforce the context of the function using the "context, function name" signature. Unbind the handler after first click. +```html + + + + + jQuery.proxy demo + + + +​ +

      +

      +​ + +​ + + +``` + */ + proxy(context: TContext, + name: keyof TContext, + ...additionalArguments: any[]): (...args: any[]) => any; + + // #endregion + + // #endregion + + /** + * Manipulate the queue of functions to be executed on the matched element. + * @param element A DOM element where the array of queued functions is attached. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue The new function to add to the queue. + * An array of functions to replace the current queue contents. + * @see \`{@link https://api.jquery.com/jQuery.queue/ }\` + * @since 1.3 + * @example ​ ````Show the length of the queue. +```html + + + + + jQuery.queue demo + + + + +​ + + +
      + ​ + +​ + + +``` + * @example ​ ````Queue a custom function. +```html + + + + + jQuery.queue demo + + + + +​ +Click here... +
      +​ + +​ + + +``` + * @example ​ ````Set a queue array to delete the queue. +```html + + + + + jQuery.queue demo + + + + +​ + + +
      +​ + +​ + + +``` + */ + queue(element: T, queueName?: string, newQueue?: JQuery.TypeOrArray>): JQuery.Queue; + /** + * Handles errors thrown synchronously in functions wrapped in jQuery(). + * @param error An error thrown in the function wrapped in jQuery(). + * @see \`{@link https://api.jquery.com/jQuery.readyException/ }\` + * @since 3.1 + * @example ​ ````Pass the received error to console.error. +```javascript +jQuery.readyException = function( error ) { + console.error( error ); +}; +``` + */ + readyException(error: Error): any; + /** + * Remove a previously-stored piece of data. + * @param element A DOM element from which to remove data. + * @param name A string naming the piece of data to remove. + * @see \`{@link https://api.jquery.com/jQuery.removeData/ }\` + * @since 1.2.3 + * @example ​ ````Set a data store for 2 names then remove one of them. +```html + + + + + jQuery.removeData demo + + + + +​ +
      value1 before creation:
      +
      value1 after creation:
      +
      value1 after removal:
      +
      value2 after removal:
      +​ + +​ + + +``` + */ + removeData(element: Element | Document | Window | JQuery.PlainObject, name?: string): void; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` + * @since 1.1 + */ + speed(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * @param duration A string or number determining how long the animation will run. + * @param easing_complete _@param_ `easing_complete` + *
      + * * `easing` — A string indicating which easing function to use for the transition.
      + * * `complete` — A function to call once the animation is complete, called once per matched element. + * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` + * @since 1.0 + * @since 1.1 + */ + speed(duration: JQuery.Duration, + easing_complete: string | ((this: TElement) => void)): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * @param duration_complete_settings _@param_ `duration_complete_settings` + *
      + * * `duration` — A string or number determining how long the animation will run.
      + * * `complete` — A function to call once the animation is complete, called once per matched element.
      + * * `settings` — + * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` + * @since 1.0 + * @since 1.1 + */ + speed(duration_complete_settings?: JQuery.Duration | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions; + /** + * Remove the whitespace from the beginning and end of a string. + * @param str The string to trim. + * @see \`{@link https://api.jquery.com/jQuery.trim/ }\` + * @since 1.0 + * @example ​ ````Remove the white spaces at the start and at the end of the string. +```html + + + + + jQuery.trim demo + + + +​ +
      
      +
      
      +​
      +
      +​
      +
      +
      +```
      +     * @example ​ ````Remove the white spaces at the start and at the end of the string.
      +```javascript
      +$.trim("    hello, how are you?    ");
      +```
      +     * @example ​ ````Remove the white spaces at the start and at the end of the string.
      +```javascript
      +$.trim("    hello, how are you?    ");
      +```
      +     */
      +    trim(str: string): string;
      +    /**
      +     * Determine the internal JavaScript [[Class]] of an object.
      +     * @param obj Object to get the internal JavaScript [[Class]] of.
      +     * @see \`{@link https://api.jquery.com/jQuery.type/ }\`
      +     * @since 1.4.3
      +     * @deprecated ​ Deprecated since 3.3. See \`{@link https://github.com/jquery/jquery/issues/3605 }\`.
      +     * @example ​ ````Find out if the parameter is a RegExp.
      +```html
      +
      +
      +
      +  
      +  jQuery.type demo
      +  
      +
      +
      +​
      +Is it a RegExp? 
      +​
      +
      +​
      +
      +
      +```
      +     */
      +    type(obj: any): 'array' | 'boolean' | 'date' | 'error' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'string' | 'symbol' | 'undefined';
      +    /**
      +     * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
      +     * @param array The Array of DOM elements.
      +     * @see \`{@link https://api.jquery.com/jQuery.unique/ }\`
      +     * @since 1.1.3
      +     * @deprecated ​ Deprecated since 3.0. Use \`{@link uniqueSort }\`.
      +     *
      +     * **Cause**: The fact that `jQuery.unique` sorted its results in DOM order was surprising to many who did not read the documentation carefully. As of jQuery 3.0 this function is being renamed to make it clear.
      +     *
      +     * **Solution**: Replace all uses of `jQuery.unique` with `jQuery.uniqueSort` which is the same function with a better name.
      +     * @example ​ ````Removes any duplicate elements from the array of divs.
      +```html
      +
      +
      +
      +  
      +  jQuery.unique demo
      +  
      +  
      +
      +
      +​
      +
      There are 6 divs in this document.
      +
      +
      +
      +
      +
      +​ + +​ + + +``` + */ + unique(array: T[]): T[]; + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. + * @param array The Array of DOM elements. + * @see \`{@link https://api.jquery.com/jQuery.uniqueSort/ }\` + * @since 1.12 + * @since 2.2 + * @example ​ ````Removes any duplicate elements from the array of divs. +```html + + + + + jQuery.uniqueSort demo + + + + +​ +
      There are 6 divs in this document.
      +
      +
      +
      +
      +
      +​ + +​ + + +``` + */ + uniqueSort(array: T[]): T[]; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events. + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` + * @since 1.5 + * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request). +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) { + // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively. + // Each argument is an array with the following structure: [ data, statusText, jqXHR ] + var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It" + if ( /Whip It/.test( data ) ) { + alert( "We got what we came for!" ); + } +}); +``` + * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error. +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ) + .then( myFunc, myFailure ); +``` + */ + when( + deferredT: JQuery.Promise | JQuery.Thenable | TR1, + deferredU: JQuery.Promise | JQuery.Thenable | UR1, + deferredV: JQuery.Promise | JQuery.Thenable | VR1, + ): JQuery.Promise3< + TR1, TJ1, never, + UR1, UJ1, never, + VR1, VJ1, never>; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events. + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` + * @since 1.5 + * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request). +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) { + // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively. + // Each argument is an array with the following structure: [ data, statusText, jqXHR ] + var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It" + if ( /Whip It/.test( data ) ) { + alert( "We got what we came for!" ); + } +}); +``` + * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error. +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ) + .then( myFunc, myFailure ); +``` + */ + when( + deferredT: JQuery.Promise | JQuery.Thenable | TR1, + deferredU: JQuery.Promise | JQuery.Thenable | UR1, + ): JQuery.Promise2< + TR1, TJ1, never, + UR1, UJ1, never>; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events. + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` + * @since 1.5 + * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request). +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) { + // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively. + // Each argument is an array with the following structure: [ data, statusText, jqXHR ] + var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It" + if ( /Whip It/.test( data ) ) { + alert( "We got what we came for!" ); + } +}); +``` + * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error. +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ) + .then( myFunc, myFailure ); +``` + */ + when( + deferredT: JQuery.Promise3 | + JQuery.Promise2 + ): JQuery.Promise3< + TR1, TJ1, never, + TR2, TJ2, never, + TR3, TJ3, never>; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events. + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` + * @since 1.5 + * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request). +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) { + // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively. + // Each argument is an array with the following structure: [ data, statusText, jqXHR ] + var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It" + if ( /Whip It/.test( data ) ) { + alert( "We got what we came for!" ); + } +}); +``` + * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error. +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ) + .then( myFunc, myFailure ); +``` + */ + when(deferred: JQuery.Promise | JQuery.Thenable | TR1): JQuery.Promise; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events. + * @param deferreds Zero or more Thenable objects. + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` + * @since 1.5 + * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request). +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) { + // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively. + // Each argument is an array with the following structure: [ data, statusText, jqXHR ] + var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It" + if ( /Whip It/.test( data ) ) { + alert( "We got what we came for!" ); + } +}); +``` + * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error. +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ) + .then( myFunc, myFailure ); +``` + */ + when(...deferreds: Array | JQuery.Thenable | TR1>): JQuery.Promise; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events. + * @param deferreds Zero or more Thenable objects. + * @see \`{@link https://api.jquery.com/jQuery.when/ }\` + * @since 1.5 + * @example ​ ````Execute a function after two Ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request). +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) { + // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively. + // Each argument is an array with the following structure: [ data, statusText, jqXHR ] + var data = a1[ 0 ] + a2[ 0 ]; // a1[ 0 ] = "Whip", a2[ 0 ] = " It" + if ( /Whip It/.test( data ) ) { + alert( "We got what we came for!" ); + } +}); +``` + * @example ​ ````Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error. +```javascript +$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ) + .then( myFunc, myFailure ); +``` + */ + when(...deferreds: any[]): JQuery.Promise; +} diff --git a/types/jquery/dist/jquery.slim.d.ts b/types/jquery/dist/jquery.slim.d.ts new file mode 100644 index 0000000000..bdd21a7523 --- /dev/null +++ b/types/jquery/dist/jquery.slim.d.ts @@ -0,0 +1,3 @@ +/// + +export = jQuery; diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 45eae24d5d..2d4171320b 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -25,8424 +25,10 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare module 'jquery' { - export = jQuery; -} +/// +/// +/// +/// +/// -declare module 'jquery/dist/jquery.slim' { - export = jQuery; -} - -declare const jQuery: JQueryStatic; -declare const $: JQueryStatic; - -// Used by JQuery.Event -type _Event = Event; - -interface JQueryStatic { - /** - * @see \`{@link http://api.jquery.com/jquery.ajax/#jQuery-ajax1 }\` - * - * @deprecated Use \`{@link JQueryStatic.ajaxSetup }\`. - */ - ajaxSettings: JQuery.AjaxSettings; - /** - * A factory function that returns a chainable utility object with methods to register multiple - * callbacks into callback queues, invoke callback queues, and relay the success or failure state of - * any synchronous or asynchronous function. - * - * @param beforeStart A function that is called just before the constructor returns. - * @see \`{@link https://api.jquery.com/jQuery.Deferred/ }\` - * @since 1.5 - */ - Deferred: JQuery.DeferredStatic; - Event: JQuery.EventStatic; - /** - * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize - * CSS property naming, or create custom properties. - * - * @see \`{@link https://api.jquery.com/jQuery.cssHooks/ }\` - * @since 1.4.3 - */ - // Set to HTMLElement to minimize breaks but should probably be Element. - cssHooks: JQuery.PlainObject>; - /** - * An object containing all CSS properties that may be used without a unit. The .css() method uses this - * object to see if it may append px to unitless values. - * - * @see \`{@link https://api.jquery.com/jQuery.cssNumber/ }\` - * @since 1.4.3 - */ - cssNumber: JQuery.PlainObject; - // Set to HTMLElement to minimize breaks but should probably be Element. - readonly fn: JQuery; - fx: { - /** - * The rate (in milliseconds) at which animations fire. - * - * @see \`{@link https://api.jquery.com/jQuery.fx.interval/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.0. See \`{@link https://api.jquery.com/jQuery.fx.interval/ }\`. - */ - interval: number; - /** - * Globally disable all animations. - * - * @see \`{@link https://api.jquery.com/jQuery.fx.off/ }\` - * @since 1.3 - */ - off: boolean; - step: JQuery.PlainObject>; - }; - /** - * A Promise-like object (or "thenable") that resolves when the document is ready. - * - * @see \`{@link https://api.jquery.com/jQuery.ready/ }\` - * @since 1.8 - */ - ready: JQuery.Thenable; - /** - * A collection of properties that represent the presence of different browser features or bugs. - * Intended for jQuery's internal use; specific properties may be removed when they are no longer - * needed internally to improve page startup performance. For your own project's feature-detection - * needs, we strongly recommend the use of an external library such as Modernizr instead of dependency - * on properties in jQuery.support. - * - * @see \`{@link https://api.jquery.com/jQuery.support/ }\` - * @since 1.3 - * - * @deprecated Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`. - */ - support: JQuery.PlainObject; - // Set to HTMLElement to minimize breaks but should probably be Element. - valHooks: JQuery.PlainObject>; - // HACK: This is the factory function returned when importing jQuery without a DOM. Declaring it separately breaks using the type parameter on JQueryStatic. - // HACK: The discriminator parameter handles the edge case of passing a Window object to JQueryStatic. It doesn't actually exist on the factory function. - (window: Window, discriminator: boolean): JQueryStatic; - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. - * A string defining a single, standalone, HTML element (e.g.
      or
      ). - * @param ownerDocument_attributes A document in which the new elements will be created. - * An object of attributes, events, and methods to call on the newly-created element. - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.0 - * @since 1.4 - */ - // tslint:disable-next-line:no-unnecessary-generics - (html: JQuery.htmlString, ownerDocument_attributes?: Document | JQuery.PlainObject): JQuery; - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param selector A string containing a selector expression - * @param context A DOM Element, Document, or jQuery to use as context - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.0 - */ - // tslint:disable-next-line:no-unnecessary-generics - (selector: JQuery.Selector, context?: Element | Document | JQuery): JQuery; - /** - * Return a collection of matched elements either found in the DOM based on passed argument(s) or created - * by passing an HTML string. - * - * @param element A DOM element to wrap in a jQuery object. - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.0 - */ - // Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810) - // tslint:disable-next-line:unified-signatures - (element: T): JQuery; - /** - * Return a collection of matched elements either found in the DOM based on passed argument(s) or created - * by passing an HTML string. - * - * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.0 - */ - // Using a unified signature is not possible due to a TypeScript 2.4 bug (DefinitelyTyped#27810) - // tslint:disable-next-line:unified-signatures - (elementArray: T[]): JQuery; - /** - * Return a collection of matched elements either found in the DOM based on passed argument(s) or created - * by passing an HTML string. - * - * @param selection An existing jQuery object to clone. - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.0 - */ - (selection: JQuery): JQuery; - /** - * Binds a function to be executed when the DOM has finished loading. - * - * @param callback The function to execute when the DOM is ready. - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.0 - */ - // tslint:disable-next-line:no-unnecessary-generics unified-signatures - (callback: ((this: Document, $: JQueryStatic) => void)): JQuery; - /** - * Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string. - * - * @param object A plain object to wrap in a jQuery object. - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.0 - */ - (object: T): JQuery; - /** - * Returns an empty jQuery set. - * - * @see \`{@link https://api.jquery.com/jQuery/ }\` - * @since 1.4 - */ - // tslint:disable-next-line:no-unnecessary-generics - (): JQuery; - /** - * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. - * - * @param flags An optional list of space-separated flags that change how the callback list behaves. - * @see \`{@link https://api.jquery.com/jQuery.Callbacks/ }\` - * @since 1.7 - */ - // tslint:disable-next-line:ban-types no-unnecessary-generics - Callbacks(flags?: string): JQuery.Callbacks; - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param url A string containing the URL to which the request is sent. - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can - * be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings. - * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` - * @since 1.5 - */ - ajax(url: string, settings?: JQuery.AjaxSettings): JQuery.jqXHR; - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can - * be set for any option with $.ajaxSetup(). - * @see \`{@link https://api.jquery.com/jQuery.ajax/ }\` - * @since 1.0 - */ - ajax(settings?: JQuery.AjaxSettings): JQuery.jqXHR; - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they - * are processed by $.ajax(). - * - * @param dataTypes An optional string containing one or more space-separated dataTypes - * @param handler A handler to set default values for future Ajax requests. - * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` - * @since 1.5 - */ - ajaxPrefilter(dataTypes: string, - handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they - * are processed by $.ajax(). - * - * @param handler A handler to set default values for future Ajax requests. - * @see \`{@link https://api.jquery.com/jQuery.ajaxPrefilter/ }\` - * @since 1.5 - */ - ajaxPrefilter(handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; - /** - * Set default values for future Ajax requests. Its use is not recommended. - * - * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. - * @see \`{@link https://api.jquery.com/jQuery.ajaxSetup/ }\` - * @since 1.1 - */ - ajaxSetup(options: JQuery.AjaxSettings): JQuery.AjaxSettings; - /** - * Creates an object that handles the actual transmission of Ajax data. - * - * @param dataType A string identifying the data type to use - * @param handler A handler to return the new transport object to use with the data type provided in the first argument. - * @see \`{@link https://api.jquery.com/jQuery.ajaxTransport/ }\` - * @since 1.5 - */ - ajaxTransport(dataType: string, - handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => JQuery.Transport | void): void; - /** - * @deprecated Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/3384 }\`. - */ - camelCase(value: string): string; - /** - * Check to see if a DOM element is a descendant of another DOM element. - * - * @param container The DOM element that may contain the other element. - * @param contained The DOM element that may be contained by (a descendant of) the other element. - * @see \`{@link https://api.jquery.com/jQuery.contains/ }\` - * @since 1.4 - */ - contains(container: Element, contained: Element): boolean; - css(elem: Element, unknown: any): any; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or - * the full data store for the element. - * - * @param element The DOM element to query for the data. - * @param key Name of the data stored. - * @see \`{@link https://api.jquery.com/jQuery.data/ }\` - * @since 1.2.3 - */ - data(element: Element, key: string, undefined: undefined): any; // tslint:disable-line:unified-signatures - /** - * Store arbitrary data associated with the specified element. Returns the value that was set. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - * @param value The new data value; this can be any Javascript type except undefined. - * @see \`{@link https://api.jquery.com/jQuery.data/ }\` - * @since 1.2.3 - */ - data(element: Element, key: string, value: T): T; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or - * the full data store for the element. - * - * @param element The DOM element to query for the data. - * @param key Name of the data stored. - * @see \`{@link https://api.jquery.com/jQuery.data/ }\` - * @since 1.2.3 - * @since 1.4 - */ - data(element: Element, key?: string): any; - /** - * Execute the next function on the queue for the matched element. - * - * @param element A DOM element from which to remove and execute a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see \`{@link https://api.jquery.com/jQuery.dequeue/ }\` - * @since 1.3 - */ - dequeue(element: Element, queueName?: string): void; - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. - * Arrays and array-like objects with a length property (such as a function's arguments object) are - * iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param array The array to iterate over. - * @param callback The function that will be executed on every object. - * @see \`{@link https://api.jquery.com/jQuery.each/ }\` - * @since 1.0 - */ - each(array: ArrayLike, callback: (this: T, indexInArray: number, value: T) => false | any): ArrayLike; - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. - * Arrays and array-like objects with a length property (such as a function's arguments object) are - * iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param obj The object to iterate over. - * @param callback The function that will be executed on every object. - * @see \`{@link https://api.jquery.com/jQuery.each/ }\` - * @since 1.0 - */ - each(obj: T, callback: (this: T[K], propertyName: K, valueOfProperty: T[K]) => false | any): T; - /** - * Takes a string and throws an exception containing it. - * - * @param message The message to send out. - * @see \`{@link https://api.jquery.com/jQuery.error/ }\` - * @since 1.4.1 - */ - error(message: string): any; - /** - * Escapes any character that has a special meaning in a CSS selector. - * - * @param selector A string containing a selector expression to escape. - * @see \`{@link https://api.jquery.com/jQuery.escapeSelector/ }\` - * @since 3.0 - */ - escapeSelector(selector: JQuery.Selector): JQuery.Selector; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. - * @param target The object to extend. It will receive the new properties. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.1.4 - */ - extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. - * @param target The object to extend. It will receive the new properties. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.1.4 - */ - extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. - * @param target The object to extend. It will receive the new properties. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.1.4 - */ - extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. - * @param target The object to extend. It will receive the new properties. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.1.4 - */ - extend(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. - * @param target The object to extend. It will receive the new properties. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.1.4 - */ - extend(deep: true, target: T, object1: U, object2: V): T & U & V; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. - * @param target The object to extend. It will receive the new properties. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.1.4 - */ - extend(deep: true, target: T, object1: U): T & U; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. - * @param target The object to extend. It will receive the new properties. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.1.4 - */ - extend(deep: true, target: any, object1: any, ...objects: any[]): any; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will - * extend the jQuery namespace if it is the sole argument. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.0 - */ - extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will - * extend the jQuery namespace if it is the sole argument. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.0 - */ - extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will - * extend the jQuery namespace if it is the sole argument. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.0 - */ - extend(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will - * extend the jQuery namespace if it is the sole argument. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.0 - */ - extend(target: T, object1: U, object2: V, object3: W): T & U & V & W; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will - * extend the jQuery namespace if it is the sole argument. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.0 - */ - extend(target: T, object1: U, object2: V): T & U & V; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will - * extend the jQuery namespace if it is the sole argument. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.0 - */ - extend(target: T, object1: U): T & U; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will - * extend the jQuery namespace if it is the sole argument. - * @see \`{@link https://api.jquery.com/jQuery.extend/ }\` - * @since 1.0 - */ - extend(target: any, object1: any, ...objects: any[]): any; - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but - * you can use null or jQuery.noop as a placeholder. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see \`{@link https://api.jquery.com/jQuery.get/ }\` - * @since 1.0 - */ - get(url: string, - data: JQuery.PlainObject | string, - success: JQuery.jqXHR.DoneCallback | null, - dataType?: string): JQuery.jqXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but - * you can use null or jQuery.noop as a placeholder. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see \`{@link https://api.jquery.com/jQuery.get/ }\` - * @since 1.0 - */ - get(url: string, - success: JQuery.jqXHR.DoneCallback | null, - dataType: string): JQuery.jqXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param success_data A callback function that is executed if the request succeeds. Required if dataType is provided, but - * you can use null or jQuery.noop as a placeholder. - * A plain object or string that is sent to the server with the request. - * @see \`{@link https://api.jquery.com/jQuery.get/ }\` - * @since 1.0 - */ - get(url: string, - success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param url_settings A string containing the URL to which the request is sent. - * A set of key/value pairs that configure the Ajax request. All properties except for url are - * optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a - * complete list of all settings. The type option will automatically be set to GET. - * @see \`{@link https://api.jquery.com/jQuery.get/ }\` - * @since 1.0 - * @since 1.12 - * @since 2.2 - */ - get(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\` - * @since 1.0 - */ - getJSON(url: string, - data: JQuery.PlainObject | string, - success: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param success_data A callback function that is executed if the request succeeds. - * A plain object or string that is sent to the server with the request. - * @see \`{@link https://api.jquery.com/jQuery.getJSON/ }\` - * @since 1.0 - */ - getJSON(url: string, - success_data?: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; - /** - * Load a JavaScript file from the server using a GET HTTP request, then execute it. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - * @see \`{@link https://api.jquery.com/jQuery.getScript/ }\` - * @since 1.0 - */ - getScript(url: string, - success?: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; - /** - * Execute some JavaScript code globally. - * - * @param code The JavaScript code to execute. - * @see \`{@link https://api.jquery.com/jQuery.globalEval/ }\` - * @since 1.0.4 - */ - globalEval(code: string): void; - /** - * Finds the elements of an array which satisfy a filter function. The original array is not affected. - * - * @param array The array-like object to search through. - * @param fn The function to process each item against. The first argument to the function is the item, and the - * second argument is the index. The function should return a Boolean value. this will be the global window object. - * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements - * for which "callback" returns true. If "invert" is true, then the function returns an array - * consisting of all elements for which "callback" returns false. - * @see \`{@link https://api.jquery.com/jQuery.grep/ }\` - * @since 1.0 - */ - grep(array: ArrayLike, - fn: (elementOfArray: T, indexInArray: number) => boolean, - invert?: boolean): T[]; - /** - * Determine whether an element has any jQuery data associated with it. - * - * @param element A DOM element to be checked for data. - * @see \`{@link https://api.jquery.com/jQuery.hasData/ }\` - * @since 1.5 - */ - hasData(element: Element): boolean; - /** - * Holds or releases the execution of jQuery's ready event. - * - * @param hold Indicates whether the ready hold is being requested or released - * @see \`{@link https://api.jquery.com/jQuery.holdReady/ }\` - * @since 1.6 - * - * @deprecated Deprecated since 3.2. See \`{@link https://github.com/jquery/jquery/issues/3288 }\`. - */ - holdReady(hold: boolean): void; - /** - * Modify and filter HTML strings passed through jQuery manipulation methods. - * - * @param html The HTML string on which to operate. - * @see \`{@link https://api.jquery.com/jQuery.htmlPrefilter/ }\` - * @since 1.12/2.2 - */ - htmlPrefilter(html: JQuery.htmlString): JQuery.htmlString; - /** - * Search for a specified value within an array and return its index (or -1 if not found). - * - * @param value The value to search for. - * @param array An array through which to search. - * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array. - * @see \`{@link https://api.jquery.com/jQuery.inArray/ }\` - * @since 1.2 - */ - inArray(value: T, array: T[], fromIndex?: number): number; - /** - * Determine whether the argument is an array. - * - * @param obj Object to test whether or not it is an array. - * @see \`{@link https://api.jquery.com/jQuery.isArray/ }\` - * @since 1.3 - * - * @deprecated Deprecated since 3.2. Use \`{@link Array.isArray }\`. - */ - isArray(obj: any): obj is any[]; - /** - * Check to see if an object is empty (contains no enumerable properties). - * - * @param obj The object that will be checked to see if it's empty. - * @see \`{@link https://api.jquery.com/jQuery.isEmptyObject/ }\` - * @since 1.4 - */ - isEmptyObject(obj: any): boolean; - /** - * Determine if the argument passed is a JavaScript function object. - * - * @param obj Object to test whether or not it is a function. - * @see \`{@link https://api.jquery.com/jQuery.isFunction/ }\` - * @since 1.2 - * - * @deprecated Deprecated since 3.3. Use `typeof x === "function"`. - */ - // tslint:disable-next-line:ban-types - isFunction(obj: any): obj is Function; - /** - * Determines whether its argument represents a JavaScript number. - * - * @param value The value to be tested. - * @see \`{@link https://api.jquery.com/jQuery.isNumeric/ }\` - * @since 1.7 - * - * @deprecated Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/2960 }\`. - */ - isNumeric(value: any): value is number; - /** - * Check to see if an object is a plain object (created using "{}" or "new Object"). - * - * @param obj The object that will be checked to see if it's a plain object. - * @see \`{@link https://api.jquery.com/jQuery.isPlainObject/ }\` - * @since 1.4 - */ - isPlainObject(obj: any): obj is JQuery.PlainObject; - /** - * Determine whether the argument is a window. - * - * @param obj Object to test whether or not it is a window. - * @see \`{@link https://api.jquery.com/jQuery.isWindow/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Internal. See \`{@link https://github.com/jquery/jquery/issues/3629 }\`. - */ - isWindow(obj: any): obj is Window; - /** - * Check to see if a DOM node is within an XML document (or is an XML document). - * - * @param node The DOM node that will be checked to see if it's in an XML document. - * @see \`{@link https://api.jquery.com/jQuery.isXMLDoc/ }\` - * @since 1.1.4 - */ - isXMLDoc(node: Node): boolean; - /** - * Convert an array-like object into a true JavaScript array. - * - * @param obj Any object to turn into a native Array. - * @see \`{@link https://api.jquery.com/jQuery.makeArray/ }\` - * @since 1.2 - */ - makeArray(obj: ArrayLike): T[]; - /** - * Translate all items in an array or object to new array of items. - * - * @param array The Array to translate. - * @param callback The function to process each item against. The first argument to the function is the array item, the - * second argument is the index in array The function can return any value. A returned array will be - * flattened into the resulting array. Within the function, this refers to the global (window) object. - * @see \`{@link https://api.jquery.com/jQuery.map/ }\` - * @since 1.0 - */ - map(array: T[], callback: (this: Window, elementOfArray: T, indexInArray: number) => JQuery.TypeOrArray | null | undefined): TReturn[]; - /** - * Translate all items in an array or object to new array of items. - * - * @param obj The Object to translate. - * @param callback The function to process each item against. The first argument to the function is the value; the - * second argument is the key of the object property. The function can return any value to add to the - * array. A returned array will be flattened into the resulting array. Within the function, this refers - * to the global (window) object. - * @see \`{@link https://api.jquery.com/jQuery.map/ }\` - * @since 1.6 - */ - map(obj: T, callback: (this: Window, propertyOfObject: T[K], key: K) => JQuery.TypeOrArray | null | undefined): TReturn[]; - /** - * Merge the contents of two arrays together into the first array. - * - * @param first The first array-like object to merge, the elements of second added. - * @param second The second array-like object to merge into the first, unaltered. - * @see \`{@link https://api.jquery.com/jQuery.merge/ }\` - * @since 1.0 - */ - merge(first: ArrayLike, second: ArrayLike): Array; - /** - * Relinquish jQuery's control of the $ variable. - * - * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). - * @see \`{@link https://api.jquery.com/jQuery.noConflict/ }\` - * @since 1.0 - */ - noConflict(removeAll?: boolean): this; - /** - * An empty function. - * - * @see \`{@link https://api.jquery.com/jQuery.noop/ }\` - * @since 1.4 - */ - noop(): undefined; - /** - * Return a number representing the current time. - * - * @see \`{@link https://api.jquery.com/jQuery.now/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link Date.now }\`. - */ - now(): number; - /** - * Create a serialized representation of an array, a plain object, or a jQuery object suitable for use - * in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input - * elements with name/value properties. - * - * @param obj An array, a plain object, or a jQuery object to serialize. - * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. - * @see \`{@link https://api.jquery.com/jQuery.param/ }\` - * @since 1.2 - * @since 1.4 - */ - param(obj: any[] | JQuery.PlainObject | JQuery, traditional?: boolean): string; - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context Document element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\` - * @since 1.8 - */ - parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): JQuery.Node[]; - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context_keepScripts Document element to serve as the context in which the HTML fragment will be created - * A Boolean indicating whether to include scripts passed in the HTML string - * @see \`{@link https://api.jquery.com/jQuery.parseHTML/ }\` - * @since 1.8 - */ - parseHTML(data: string, context_keepScripts?: Document | null | boolean): JQuery.Node[]; - /** - * Takes a well-formed JSON string and returns the resulting JavaScript value. - * - * @param json The JSON string to parse. - * @see \`{@link https://api.jquery.com/jQuery.parseJSON/ }\` - * @since 1.4.1 - * - * @deprecated Deprecated since 3.0. Use \`{@link JSON.parse }\`. - */ - parseJSON(json: string): any; - /** - * Parses a string into an XML document. - * - * @param data a well-formed XML string to be parsed - * @see \`{@link https://api.jquery.com/jQuery.parseXML/ }\` - * @since 1.5 - */ - parseXML(data: string): XMLDocument; - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but - * can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see \`{@link https://api.jquery.com/jQuery.post/ }\` - * @since 1.0 - */ - post(url: string, - data: JQuery.PlainObject | string, - success: JQuery.jqXHR.DoneCallback | null, - dataType?: string): JQuery.jqXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but - * can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see \`{@link https://api.jquery.com/jQuery.post/ }\` - * @since 1.0 - */ - post(url: string, - success: JQuery.jqXHR.DoneCallback | null, - dataType: string): JQuery.jqXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param success_data A callback function that is executed if the request succeeds. Required if dataType is provided, but - * can be null in that case. - * A plain object or string that is sent to the server with the request. - * @see \`{@link https://api.jquery.com/jQuery.post/ }\` - * @since 1.0 - */ - post(url: string, - success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param url_settings A string containing the URL to which the request is sent. - * A set of key/value pairs that configure the Ajax request. All properties except for url are - * optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a - * complete list of all settings. Type will automatically be set to POST. - * @see \`{@link https://api.jquery.com/jQuery.post/ }\` - * @since 1.0 - * @since 1.12 - * @since 2.2 - */ - post(url_settings?: string | JQuery.UrlAjaxSettings): JQuery.jqXHR; - - // #region proxy - - // #region (fn, null | undefined) - - // #region 0 to 7 arguments - - // #region 0 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): () => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): () => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): () => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): () => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C) => TReturn, - context: null | undefined, - a: A, b: B, c: C): () => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B) => TReturn, - context: null | undefined, - a: A, b: B): () => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4` - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A) => TReturn, - context: null | undefined, - a: A): () => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: () => TReturn, - context: null | undefined): () => TReturn; - - // #endregion - - // #region 1 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): (t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): (t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): (t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T) => TReturn, - context: null | undefined, - a: A, b: B, c: C): (t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T) => TReturn, - context: null | undefined, - a: A, b: B): (t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T) => TReturn, - context: null | undefined, - a: A): (t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T) => TReturn, - context: null | undefined): (t: T) => TReturn; - - // #endregion - - // #region 2 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): (t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): (t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U) => TReturn, - context: null | undefined, - a: A, b: B, c: C): (t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U) => TReturn, - context: null | undefined, - a: A, b: B): (t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U) => TReturn, - context: null | undefined, - a: A): (t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U) => TReturn, - context: null | undefined): (t: T, u: U) => TReturn; - - // #endregion - - // #region 3 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): (t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V) => TReturn, - context: null | undefined, - a: A, b: B, c: C): (t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V) => TReturn, - context: null | undefined, - a: A, b: B): (t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V) => TReturn, - context: null | undefined, - a: A): (t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V) => TReturn, - context: null | undefined): (t: T, u: U, v: V) => TReturn; - - // #endregion - - // #region 4 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined, - a: A, b: B, c: C): (t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined, - a: A, b: B): (t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined, - a: A): (t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W) => TReturn, - context: null | undefined): (t: T, u: U, v: V, w: W) => TReturn; - - // #endregion - - // #region 5 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined, - a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined, - a: A, b: B): (t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined, - a: A): (t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W, x: X) => TReturn, - context: null | undefined): (t: T, u: U, v: V, w: W, x: X) => TReturn; - - // #endregion - - // #region 6 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined, - a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined, - a: A, b: B): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined, - a: A): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: null | undefined): (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - - // #endregion - - // #region 7+ parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E, f: F): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D, e: E): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined, - a: A, b: B, c: C, d: D): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined, - a: A, b: B, c: C): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined, - a: A, b: B): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined, - a: A): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: null | undefined): (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - - // #endregion - - // #endregion - - // #region 8+ arguments - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.9 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (...args: any[]) => TReturn, - context: null | undefined, - ...additionalArguments: any[]): (...args: any[]) => TReturn; - - // #endregion - - // #endregion - - // #region (fn, context) - - // #region 0 to 7 arguments - - // #region 0 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B) => TReturn, - context: TContext, - a: A, b: B): (this: TContext) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4` - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A) => TReturn, - context: TContext, - a: A): (this: TContext) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: () => TReturn, - context: TContext): (this: TContext) => TReturn; - - // #endregion - - // #region 1 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext, t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext, t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext, t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext, t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext, t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T) => TReturn, - context: TContext, - a: A, b: B): (this: TContext, t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T) => TReturn, - context: TContext, - a: A): (this: TContext, t: T) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T) => TReturn, - context: TContext): (this: TContext, t: T) => TReturn; - - // #endregion - - // #region 2 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext, t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext, t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext, t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext, t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext, t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U) => TReturn, - context: TContext, - a: A, b: B): (this: TContext, t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U) => TReturn, - context: TContext, - a: A): (this: TContext, t: T, u: U) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U) => TReturn, - context: TContext): (this: TContext, t: T, u: U) => TReturn; - - // #endregion - - // #region 3 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext, t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext, t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext, t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext, t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext, t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V) => TReturn, - context: TContext, - a: A, b: B): (this: TContext, t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V) => TReturn, - context: TContext, - a: A): (this: TContext, t: T, u: U, v: V) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V) => TReturn, - context: TContext): (this: TContext, t: T, u: U, v: V) => TReturn; - - // #endregion - - // #region 4 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W) => TReturn, - context: TContext, - a: A, b: B): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W) => TReturn, - context: TContext, - a: A): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W) => TReturn, - context: TContext): (this: TContext, t: T, u: U, v: V, w: W) => TReturn; - - // #endregion - - // #region 5 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext, - a: A, b: B): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext, - a: A): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W, x: X) => TReturn, - context: TContext): (this: TContext, t: T, u: U, v: V, w: W, x: X) => TReturn; - - // #endregion - - // #region 6 parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext, - a: A, b: B): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext, - a: A): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn, - context: TContext): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y) => TReturn; - - // #endregion - - // #region 7+ parameters - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F, g: G): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, f: F, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E, f: F): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, e: E, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D, e: E): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, d: D, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext, - a: A, b: B, c: C, d: D): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, c: C, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext, - a: A, b: B, c: C): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, b: B, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext, - a: A, b: B): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (a: A, - t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext, - a: A): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn, - context: TContext): (this: TContext, t: T, u: U, v: V, w: W, x: X, y: Y, z: Z, ...args: any[]) => TReturn; - - // #endregion - - // #endregion - - // #region 8+ arguments - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param fn The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(fn: (...args: any[]) => TReturn, - context: TContext, - ...additionalArguments: any[]): (this: TContext, ...args: any[]) => TReturn; - - // #endregion - - // #endregion - - // #region (context, name) - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param context The object to which the context of the function should be set. - * @param name The name of the function whose context will be changed (should be a property of the context object). - * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. - * @see \`{@link https://api.jquery.com/jQuery.proxy/ }\` - * @since 1.4 - * @since 1.6 - * - * @deprecated Deprecated since 3.3. Use \`{@link Function.bind }\`. - */ - proxy(context: TContext, - name: keyof TContext, - ...additionalArguments: any[]): (this: TContext, ...args: any[]) => any; - - // #endregion - - // #endregion - - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element where the array of queued functions is attached. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue The new function to add to the queue. - * An array of functions to replace the current queue contents. - * @see \`{@link https://api.jquery.com/jQuery.queue/ }\` - * @since 1.3 - */ - queue(element: T, queueName?: string, newQueue?: JQuery.TypeOrArray>): JQuery.Queue; - /** - * Handles errors thrown synchronously in functions wrapped in jQuery(). - * - * @param error An error thrown in the function wrapped in jQuery(). - * @see \`{@link https://api.jquery.com/jQuery.readyException/ }\` - * @since 3.1 - */ - readyException(error: Error): any; - /** - * Remove a previously-stored piece of data. - * - * @param element A DOM element from which to remove data. - * @param name A string naming the piece of data to remove. - * @see \`{@link https://api.jquery.com/jQuery.removeData/ }\` - * @since 1.2.3 - */ - removeData(element: Element, name?: string): void; - /** - * Creates an object containing a set of properties ready to be used in the definition of custom animations. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` - * @since 1.1 - */ - speed(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions; - /** - * Creates an object containing a set of properties ready to be used in the definition of custom animations. - * - * @param duration A string or number determining how long the animation will run. - * @param easing_complete A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` - * @since 1.0 - * @since 1.1 - */ - speed(duration: JQuery.Duration, - easing_complete: string | ((this: TElement) => void)): JQuery.EffectsOptions; - /** - * Creates an object containing a set of properties ready to be used in the definition of custom animations. - * - * @param duration_complete_settings A string or number determining how long the animation will run. - * A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/jQuery.speed/ }\` - * @since 1.0 - * @since 1.1 - */ - speed(duration_complete_settings?: JQuery.Duration | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions; - /** - * Remove the whitespace from the beginning and end of a string. - * - * @param str The string to trim. - * @see \`{@link https://api.jquery.com/jQuery.trim/ }\` - * @since 1.0 - */ - trim(str: string): string; - /** - * Determine the internal JavaScript [[Class]] of an object. - * - * @param obj Object to get the internal JavaScript [[Class]] of. - * @see \`{@link https://api.jquery.com/jQuery.type/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. See \`{@link https://github.com/jquery/jquery/issues/3605 }`. - */ - type(obj: any): 'array' | 'boolean' | 'date' | 'error' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'string' | 'symbol' | 'undefined'; - /** - * @description Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on - * arrays of DOM elements, not strings or numbers. - * - * @param array The Array of DOM elements. - * @see \`{@link https://api.jquery.com/jQuery.unique/ }\` - * @since 1.1.3 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQueryStatic.uniqueSort }`. - */ - unique(array: T[]): T[]; - /** - * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on - * arrays of DOM elements, not strings or numbers. - * - * @param array The Array of DOM elements. - * @see \`{@link https://api.jquery.com/jQuery.uniqueSort/ }\` - * @since 1.12 - * @since 2.2 - */ - uniqueSort(array: T[]): T[]; - /** - * Provides a way to execute callback functions based on zero or more Thenable objects, usually - * Deferred objects that represent asynchronous events. - * - * @see \`{@link https://api.jquery.com/jQuery.when/ }\` - * @since 1.5 - */ - when( - deferredT: JQuery.Promise | JQuery.Thenable | TR1, // tslint:disable-line:use-default-type-parameter - deferredU: JQuery.Promise | JQuery.Thenable | UR1, // tslint:disable-line:use-default-type-parameter - deferredV: JQuery.Promise | JQuery.Thenable | VR1): JQuery.Promise3; - /** - * Provides a way to execute callback functions based on zero or more Thenable objects, usually - * Deferred objects that represent asynchronous events. - * - * @see \`{@link https://api.jquery.com/jQuery.when/ }\` - * @since 1.5 - */ - when( - deferredT: JQuery.Promise | JQuery.Thenable | TR1, // tslint:disable-line:use-default-type-parameter - deferredU: JQuery.Promise | JQuery.Thenable | UR1): JQuery.Promise2; - /** - * Provides a way to execute callback functions based on zero or more Thenable objects, usually - * Deferred objects that represent asynchronous events. - * - * @see \`{@link https://api.jquery.com/jQuery.when/ }\` - * @since 1.5 - */ - when( - deferredT: JQuery.Promise3 | - JQuery.Promise2): JQuery.Promise3; - /** - * Provides a way to execute callback functions based on zero or more Thenable objects, usually - * Deferred objects that represent asynchronous events. - * - * @see \`{@link https://api.jquery.com/jQuery.when/ }\` - * @since 1.5 - */ - when(deferred: JQuery.Promise | JQuery.Thenable | TR1): JQuery.Promise; // tslint:disable-line:use-default-type-parameter - /** - * Provides a way to execute callback functions based on zero or more Thenable objects, usually - * Deferred objects that represent asynchronous events. - * - * @param deferreds Zero or more Thenable objects. - * @see \`{@link https://api.jquery.com/jQuery.when/ }\` - * @since 1.5 - */ - when(...deferreds: Array | JQuery.Thenable | TR1>): JQuery.Promise; // tslint:disable-line:use-default-type-parameter - /** - * Provides a way to execute callback functions based on zero or more Thenable objects, usually - * Deferred objects that represent asynchronous events. - * - * @param deferreds Zero or more Thenable objects. - * @see \`{@link https://api.jquery.com/jQuery.when/ }\` - * @since 1.5 - */ - when(...deferreds: any[]): JQuery.Promise; -} - -interface JQuery extends Iterable { - /** - * A string containing the jQuery version number. - * - * @see \`{@link https://api.jquery.com/jquery/ }\` - * @since 1.0 - */ - jquery: string; - /** - * The number of elements in the jQuery object. - * - * @see \`{@link https://api.jquery.com/length/ }\` - * @since 1.0 - */ - length: number; - /** - * Create a new jQuery object with elements added to the set of matched elements. - * - * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. - * @param context The point in the document at which the selector should begin matching; similar to the context - * argument of the $(selector, context) method. - * @see \`{@link https://api.jquery.com/add/ }\` - * @since 1.4 - */ - add(selector: JQuery.Selector, context: Element): this; - /** - * Create a new jQuery object with elements added to the set of matched elements. - * - * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. - * One or more elements to add to the set of matched elements. - * An HTML fragment to add to the set of matched elements. - * An existing jQuery object to add to the set of matched elements. - * @see \`{@link https://api.jquery.com/add/ }\` - * @since 1.0 - * @since 1.3.2 - */ - add(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery.htmlString | JQuery): this; - /** - * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match the current set of elements against. - * @see \`{@link https://api.jquery.com/addBack/ }\` - * @since 1.8 - */ - addBack(selector?: JQuery.Selector): this; - /** - * Adds the specified class(es) to each element in the set of matched elements. - * - * @param className One or more space-separated classes to be added to the class attribute of each matched element. - * An array of classes to be added to the class attribute of each matched element. - * A function returning one or more space-separated class names to be added to the existing class - * name(s). Receives the index position of the element in the set and the existing class name(s) as - * arguments. Within the function, this refers to the current element in the set. - * @see \`{@link https://api.jquery.com/addClass/ }\` - * @since 1.0 - * @since 1.4 - * @since 3.3 - */ - addClass(className: JQuery.TypeOrArray | ((this: TElement, index: number, currentClassName: string) => string)): this; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or - * jQuery objects to insert after each element in the set of matched elements. - * @see \`{@link https://api.jquery.com/after/ }\` - * @since 1.0 - */ - after(...contents: Array>>): this; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert - * after each element in the set of matched elements. Receives the index position of the element in the - * set and the old HTML value of the element as arguments. Within the function, this refers to the - * current element in the set. - * @see \`{@link https://api.jquery.com/after/ }\` - * @since 1.4 - * @since 1.10 - */ - after(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; - /** - * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. - * - * @param handler The function to be invoked. - * @see \`{@link https://api.jquery.com/ajaxComplete/ }\` - * @since 1.0 - */ - ajaxComplete(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; - /** - * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see \`{@link https://api.jquery.com/ajaxError/ }\` - * @since 1.0 - */ - ajaxError(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxSettings: JQuery.AjaxSettings, thrownError: string) => void | false): this; - /** - * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see \`{@link https://api.jquery.com/ajaxSend/ }\` - * @since 1.0 - */ - ajaxSend(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; - /** - * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see \`{@link https://api.jquery.com/ajaxStart/ }\` - * @since 1.0 - */ - ajaxStart(handler: (this: Document) => void | false): this; - /** - * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see \`{@link https://api.jquery.com/ajaxStop/ }\` - * @since 1.0 - */ - ajaxStop(handler: (this: Document) => void | false): this; - /** - * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see \`{@link https://api.jquery.com/ajaxSuccess/ }\` - * @since 1.0 - */ - ajaxSuccess(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings, data: JQuery.PlainObject) => void | false): this; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/animate/ }\` - * @since 1.0 - */ - animate(properties: JQuery.PlainObject, - duration: JQuery.Duration, - easing: string, - complete?: (this: TElement) => void): this; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration_easing A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/animate/ }\` - * @since 1.0 - */ - animate(properties: JQuery.PlainObject, - duration_easing: JQuery.Duration | string, - complete?: (this: TElement) => void): this; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param options A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/animate/ }\` - * @since 1.0 - */ - animate(properties: JQuery.PlainObject, - options: JQuery.EffectsOptions): this; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/animate/ }\` - * @since 1.0 - */ - animate(properties: JQuery.PlainObject, - complete?: (this: TElement) => void): this; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or - * jQuery objects to insert at the end of each element in the set of matched elements. - * @see \`{@link https://api.jquery.com/append/ }\` - * @since 1.0 - */ - append(...contents: Array>>): this; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at - * the end of each element in the set of matched elements. Receives the index position of the element - * in the set and the old HTML value of the element as arguments. Within the function, this refers to - * the current element in the set. - * @see \`{@link https://api.jquery.com/append/ }\` - * @since 1.4 - */ - append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements - * will be inserted at the end of the element(s) specified by this parameter. - * @see \`{@link https://api.jquery.com/appendTo/ }\` - * @since 1.0 - */ - appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. If null, the specified attribute will be removed (as in .removeAttr()). - * A function returning the value to set. this is the current element. Receives the index position of - * the element in the set and the old attribute value as arguments. - * @see \`{@link https://api.jquery.com/attr/ }\` - * @since 1.0 - * @since 1.1 - */ - attr(attributeName: string, - value: string | number | null | ((this: TElement, index: number, attr: string) => string | number | void | undefined)): this; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributes An object of attribute-value pairs to set. - * @see \`{@link https://api.jquery.com/attr/ }\` - * @since 1.0 - */ - attr(attributes: JQuery.PlainObject): this; - /** - * Get the value of an attribute for the first element in the set of matched elements. - * - * @param attributeName The name of the attribute to get. - * @see \`{@link https://api.jquery.com/attr/ }\` - * @since 1.0 - */ - attr(attributeName: string): string | undefined; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or - * jQuery objects to insert before each element in the set of matched elements. - * @see \`{@link https://api.jquery.com/before/ }\` - * @since 1.0 - */ - before(...contents: Array>>): this; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert - * before each element in the set of matched elements. Receives the index position of the element in - * the set and the old HTML value of the element as arguments. Within the function, this refers to the - * current element in the set. - * @see \`{@link https://api.jquery.com/before/ }\` - * @since 1.4 - * @since 1.10 - */ - before(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; - // [bind() overloads] https://github.com/jquery/api.jquery.com/issues/1048 - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/bind/ }\` - * @since 1.0 - * @since 1.4.3 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.on }\`. - */ - bind(eventType: string, - eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute each time the event is triggered. - * Setting the second argument to false will attach a function that prevents the default action from - * occurring and stops the event from bubbling. - * @see \`{@link https://api.jquery.com/bind/ }\` - * @since 1.0 - * @since 1.4.3 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.on }\`. - */ - bind(eventType: string, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false | null | undefined): this; - /** - * Attach a handler to an event for the elements. - * - * @param events An object containing one or more DOM event types and functions to execute for them. - * @see \`{@link https://api.jquery.com/bind/ }\` - * @since 1.4 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.on }\`. - */ - bind(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; - /** - * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/blur/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - blur(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/blur/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - blur(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "change" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/change/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - change(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "change" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/change/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - change(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Get the children of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/children/ }\` - * @since 1.0 - */ - children(selector?: JQuery.Selector): this; - /** - * Remove from the queue all items that have not yet been run. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see \`{@link https://api.jquery.com/clearQueue/ }\` - * @since 1.4 - */ - clearQueue(queueName?: string): this; - /** - * Bind an event handler to the "click" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/click/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - click(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "click" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/click/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - click(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Create a deep copy of the set of matched elements. - * - * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The - * default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back - * to false in 1.5.1 and up. - * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should - * be copied. By default its value matches the first argument's value (which defaults to false). - * @see \`{@link https://api.jquery.com/clone/ }\` - * @since 1.0 - * @since 1.5 - */ - clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this; - /** - * For each element in the set, get the first element that matches the selector by testing the element - * itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - * @param context A DOM element within which a matching element may be found. - * @see \`{@link https://api.jquery.com/closest/ }\` - * @since 1.4 - */ - closest(selector: JQuery.Selector, context: Element): this; - /** - * For each element in the set, get the first element that matches the selector by testing the element - * itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - * A jQuery object to match elements against. - * An element to match elements against. - * @see \`{@link https://api.jquery.com/closest/ }\` - * @since 1.3 - * @since 1.6 - */ - closest(selector: JQuery.Selector | Element | JQuery): this; - /** - * Get the children of each element in the set of matched elements, including text and comment nodes. - * - * @see \`{@link https://api.jquery.com/contents/ }\` - * @since 1.2 - */ - contents(): JQuery; - /** - * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/contextmenu/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - contextmenu(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/contextmenu/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - contextmenu(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - * A function returning the value to set. this is the current element. Receives the index position of - * the element in the set and the old value as arguments. - * @see \`{@link https://api.jquery.com/css/ }\` - * @since 1.0 - * @since 1.4 - */ - css(propertyName: string, - value: string | number | ((this: TElement, index: number, value: string) => string | number | void | undefined)): this; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - * @see \`{@link https://api.jquery.com/css/ }\` - * @since 1.0 - */ - css(properties: JQuery.PlainObject string | number | void | undefined)>): this; - /** - * Get the computed style properties for the first element in the set of matched elements. - * - * @param propertyName A CSS property. - * An array of one or more CSS properties. - * @see \`{@link https://api.jquery.com/css/ }\` - * @since 1.0 - */ - css(propertyName: string): string; - /** - * Get the computed style properties for the first element in the set of matched elements. - * - * @param propertyNames An array of one or more CSS properties. - * @see \`{@link https://api.jquery.com/css/ }\` - * @since 1.9 - */ - css(propertyNames: string[]): JQuery.PlainObject; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by - * data(name, value) or by an HTML5 data-* attribute. - * - * @param key Name of the data stored. - * @see \`{@link https://api.jquery.com/data/ }\` - * @since 1.2.3 - */ - data(key: string, undefined: undefined): any; // tslint:disable-line:unified-signatures - /** - * Store arbitrary data associated with the matched elements. - * - * @param key A string naming the piece of data to set. - * @param value The new data value; this can be any Javascript type except undefined. - * @see \`{@link https://api.jquery.com/data/ }\` - * @since 1.2.3 - */ - data(key: string, value: any): this; - /** - * Store arbitrary data associated with the matched elements. - * - * @param obj An object of key-value pairs of data to update. - * @see \`{@link https://api.jquery.com/data/ }\` - * @since 1.4.3 - */ - data(obj: JQuery.PlainObject): this; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by - * data(name, value) or by an HTML5 data-* attribute. - * - * @param key Name of the data stored. - * @see \`{@link https://api.jquery.com/data/ }\` - * @since 1.2.3 - */ - data(key: string): any; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by - * data(name, value) or by an HTML5 data-* attribute. - * - * @see \`{@link https://api.jquery.com/data/ }\` - * @since 1.4 - */ - data(): JQuery.PlainObject; - /** - * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/dblclick/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - dblclick(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/dblclick/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - dblclick(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Set a timer to delay execution of subsequent items in the queue. - * - * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see \`{@link https://api.jquery.com/delay/ }\` - * @since 1.4 - */ - delay(duration: JQuery.Duration, queueName?: string): this; - /** - * Attach a handler to one or more events for all elements that match the selector, now or in the - * future, based on a specific set of root elements. - * - * @param selector A selector to filter the elements that trigger the event. - * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or - * "keydown," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/delegate/ }\` - * @since 1.4.2 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.on }\`. - */ - delegate(selector: JQuery.Selector, - eventType: string, - eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Attach a handler to one or more events for all elements that match the selector, now or in the - * future, based on a specific set of root elements. - * - * @param selector A selector to filter the elements that trigger the event. - * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or - * "keydown," or custom event names. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/delegate/ }\` - * @since 1.4.2 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.on }\`. - */ - delegate(selector: JQuery.Selector, - eventType: string, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Attach a handler to one or more events for all elements that match the selector, now or in the - * future, based on a specific set of root elements. - * - * @param selector A selector to filter the elements that trigger the event. - * @param events A plain object of one or more event types and functions to execute for them. - * @see \`{@link https://api.jquery.com/delegate/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.on }\`. - */ - delegate(selector: JQuery.Selector, - events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; - /** - * Execute the next function on the queue for the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see \`{@link https://api.jquery.com/dequeue/ }\` - * @since 1.2 - */ - dequeue(queueName?: string): this; - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - * @see \`{@link https://api.jquery.com/detach/ }\` - * @since 1.4 - */ - detach(selector?: JQuery.Selector): this; - /** - * Iterate over a jQuery object, executing a function for each matched element. - * - * @param fn A function to execute for each matched element. - * @see \`{@link https://api.jquery.com/each/ }\` - * @since 1.0 - */ - each(fn: (this: TElement, index: number, element: TElement) => void | false): this; - /** - * Remove all child nodes of the set of matched elements from the DOM. - * - * @see \`{@link https://api.jquery.com/empty/ }\` - * @since 1.0 - */ - empty(): this; - /** - * End the most recent filtering operation in the current chain and return the set of matched elements - * to its previous state. - * - * @see \`{@link https://api.jquery.com/end/ }\` - * @since 1.0 - */ - end(): this; - /** - * Reduce the set of matched elements to the one at the specified index. - * - * @param index An integer indicating the 0-based position of the element. - * An integer indicating the position of the element, counting backwards from the last element in the set. - * @see \`{@link https://api.jquery.com/eq/ }\` - * @since 1.1.2 - * @since 1.4 - */ - eq(index: number): this; - /** - * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. - * - * @param obj An object to merge onto the jQuery prototype. - * @see \`{@link https://api.jquery.com/jQuery.fn.extend/ }\` - * @since 1.0 - */ - extend(obj: object): this; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeIn/ }\` - * @since 1.4.3 - */ - fadeIn(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration_easing A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeIn/ }\` - * @since 1.0 - * @since 1.4.3 - */ - fadeIn(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration_easing_complete_options A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/fadeIn/ }\` - * @since 1.0 - * @since 1.4.3 - */ - fadeIn(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeOut/ }\` - * @since 1.4.3 - */ - fadeOut(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration_easing A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeOut/ }\` - * @since 1.0 - * @since 1.4.3 - */ - fadeOut(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration_easing_complete_options A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/fadeOut/ }\` - * @since 1.0 - * @since 1.4.3 - */ - fadeOut(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeTo/ }\` - * @since 1.4.3 - */ - fadeTo(duration: JQuery.Duration, opacity: number, easing: string, complete?: (this: TElement) => void): this; - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeTo/ }\` - * @since 1.0 - */ - fadeTo(duration: JQuery.Duration, opacity: number, complete?: (this: TElement) => void): this; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeToggle/ }\` - * @since 1.4.4 - */ - fadeToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration_easing A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/fadeToggle/ }\` - * @since 1.0 - * @since 1.4.3 - */ - fadeToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration_easing_complete_options A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/fadeToggle/ }\` - * @since 1.0 - * @since 1.4.3 - */ - fadeToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param selector A string containing a selector expression to match the current set of elements against. - * One or more DOM elements to match the current set of elements against. - * An existing jQuery object to match the current set of elements against. - * A function used as a test for each element in the set. this is the current DOM element. - * @see \`{@link https://api.jquery.com/filter/ }\` - * @since 1.0 - * @since 1.4 - */ - filter(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): this; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, - * jQuery object, or element. - * - * @param selector A string containing a selector expression to match elements against. - * An element or a jQuery object to match elements against. - * @see \`{@link https://api.jquery.com/find/ }\` - * @since 1.0 - * @since 1.6 - */ - find(selector: JQuery.Selector | Element | JQuery): this; - /** - * Stop the currently-running animation, remove all queued animations, and complete all animations for - * the matched elements. - * - * @param queue The name of the queue in which to stop animations. - * @see \`{@link https://api.jquery.com/finish/ }\` - * @since 1.9 - */ - finish(queue?: string): this; - /** - * Reduce the set of matched elements to the first in the set. - * - * @see \`{@link https://api.jquery.com/first/ }\` - * @since 1.4 - */ - first(): this; - /** - * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/focus/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - focus(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/focus/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - focus(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "focusin" event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/focusin/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - focusin(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "focusin" event. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/focusin/ }\` - * @since 1.4 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - focusin(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "focusout" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/focusout/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - focusout(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "focusout" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/focusout/ }\` - * @since 1.4 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - focusout(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Retrieve one of the elements matched by the jQuery object. - * - * @param index A zero-based integer indicating which element to retrieve. - * @see \`{@link https://api.jquery.com/get/ }\` - * @since 1.0 - */ - get(index: number): TElement; - /** - * Retrieve the elements matched by the jQuery object. - * - * @see \`{@link https://api.jquery.com/get/ }\` - * @since 1.0 - */ - get(): TElement[]; - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param selector A string containing a selector expression to match elements against. - * A DOM element to match elements against. - * @see \`{@link https://api.jquery.com/has/ }\` - * @since 1.4 - */ - has(selector: string | Element): this; - /** - * Determine whether any of the matched elements are assigned the given class. - * - * @param className The class name to search for. - * @see \`{@link https://api.jquery.com/hasClass/ }\` - * @since 1.2 - */ - hasClass(className: string): boolean; - /** - * Set the CSS height of every matched element. - * - * @param value An integer representing the number of pixels, or an integer with an optional unit of measure - * appended (as a string). - * A function returning the height to set. Receives the index position of the element in the set and - * the old height as arguments. Within the function, this refers to the current element in the set. - * @see \`{@link https://api.jquery.com/height/ }\` - * @since 1.0 - * @since 1.4.1 - */ - height(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; - /** - * Get the current computed height for the first element in the set of matched elements. - * - * @see \`{@link https://api.jquery.com/height/ }\` - * @since 1.0 - */ - height(): number | undefined; - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/hide/ }\` - * @since 1.4.3 - */ - hide(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing_complete A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/hide/ }\` - * @since 1.0 - * @since 1.4.3 - */ - hide(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; - /** - * Hide the matched elements. - * - * @param duration_complete_options A string or number determining how long the animation will run. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/hide/ }\` - * @since 1.0 - */ - hide(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and - * leaves the elements. - * - * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. - * @param handlerOut A function to execute when the mouse pointer leaves the element. - * @see \`{@link https://api.jquery.com/hover/ }\` - * @since 1.0 - * @since 1.4 - */ - // HACK: The type parameter T is not used but ensures the 'event' callback parameter is typed correctly. - // tslint:disable-next-line:no-unnecessary-generics - hover(handlerInOut: JQuery.EventHandler | JQuery.EventHandlerBase> | false, - handlerOut?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param htmlString A string of HTML to set as the content of each matched element. - * A function returning the HTML content to set. Receives the index position of the element in the set - * and the old HTML value as arguments. jQuery empties the element before calling the function; use the - * oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - * @see \`{@link https://api.jquery.com/html/ }\` - * @since 1.0 - * @since 1.4 - */ - html(htmlString: JQuery.htmlString | ((this: TElement, index: number, oldhtml: JQuery.htmlString) => JQuery.htmlString)): this; - /** - * Get the HTML contents of the first element in the set of matched elements. - * - * @see \`{@link https://api.jquery.com/html/ }\` - * @since 1.0 - */ - html(): string; - /** - * Search for a given element from among the matched elements. - * - * @param element The DOM element or first element within the jQuery object to look for. - * A selector representing a jQuery collection in which to look for an element. - * @see \`{@link https://api.jquery.com/index/ }\` - * @since 1.0 - * @since 1.4 - */ - index(element?: JQuery.Selector | Element | JQuery): number; - /** - * Set the CSS inner height of each element in the set of matched elements. - * - * @param value A number representing the number of pixels, or a number along with an optional unit of measure - * appended (as a string). - * A function returning the inner height (including padding but not border) to set. Receives the index - * position of the element in the set and the old inner height as arguments. Within the function, this - * refers to the current element in the set. - * @see \`{@link https://api.jquery.com/innerHeight/ }\` - * @since 1.8.0 - */ - innerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; - /** - * Get the current computed height for the first element in the set of matched elements, including - * padding but not border. - * - * @see \`{@link https://api.jquery.com/innerHeight/ }\` - * @since 1.2.6 - */ - innerHeight(): number | undefined; - /** - * Set the CSS inner width of each element in the set of matched elements. - * - * @param value A number representing the number of pixels, or a number along with an optional unit of measure - * appended (as a string). - * A function returning the inner width (including padding but not border) to set. Receives the index - * position of the element in the set and the old inner width as arguments. Within the function, this - * refers to the current element in the set. - * @see \`{@link https://api.jquery.com/innerWidth/ }\` - * @since 1.8.0 - */ - innerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; - /** - * Get the current computed inner width for the first element in the set of matched elements, including - * padding but not border. - * - * @see \`{@link https://api.jquery.com/innerWidth/ }\` - * @since 1.2.6 - */ - innerWidth(): number | undefined; - /** - * Insert every element in the set of matched elements after the target. - * - * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements - * will be inserted after the element(s) specified by this parameter. - * @see \`{@link https://api.jquery.com/insertAfter/ }\` - * @since 1.0 - */ - insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; - /** - * Insert every element in the set of matched elements before the target. - * - * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements - * will be inserted before the element(s) specified by this parameter. - * @see \`{@link https://api.jquery.com/insertBefore/ }\` - * @since 1.0 - */ - insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return - * true if at least one of these elements matches the given arguments. - * - * @param selector A string containing a selector expression to match elements against. - * A function used as a test for every element in the set. It accepts two arguments, index, which is - * the element's index in the jQuery collection, and element, which is the DOM element. Within the - * function, this refers to the current DOM element. - * An existing jQuery object to match the current set of elements against. - * One or more elements to match the current set of elements against. - * @see \`{@link https://api.jquery.com/is/ }\` - * @since 1.0 - * @since 1.6 - */ - is(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): boolean; - /** - * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/keydown/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - keydown(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/keydown/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - keydown(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/keypress/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - keypress(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/keypress/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - keypress(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/keyup/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - keyup(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/keyup/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - keyup(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Reduce the set of matched elements to the final one in the set. - * - * @see \`{@link https://api.jquery.com/last/ }\` - * @since 1.4 - */ - last(): this; - /** - * Load data from the server and place the returned HTML into the matched element. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param complete A callback function that is executed when the request completes. - * @see \`{@link https://api.jquery.com/load/ }\` - * @since 1.0 - */ - load(url: string, - data: string | JQuery.PlainObject, - complete: (this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void): this; - /** - * Load data from the server and place the returned HTML into the matched element. - * - * @param url A string containing the URL to which the request is sent. - * @param complete_data A callback function that is executed when the request completes. - * A plain object or string that is sent to the server with the request. - * @see \`{@link https://api.jquery.com/load/ }\` - * @since 1.0 - */ - load(url: string, - complete_data?: ((this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void) | string | JQuery.PlainObject): this; - /** - * Pass each element in the current matched set through a function, producing a new jQuery object - * containing the return values. - * - * @param callback A function object that will be invoked for each element in the current set. - * @see \`{@link https://api.jquery.com/map/ }\` - * @since 1.2 - */ - map(callback: (this: TElement, index: number, domElement: TElement) => JQuery.TypeOrArray | null | undefined): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mousedown/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mousedown(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mousedown/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mousedown(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseenter/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseenter(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseenter/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseenter(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseleave/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseleave(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseleave/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseleave(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mousemove/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mousemove(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mousemove/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mousemove(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseout/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseout(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseout/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseout(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseover/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseover(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseover/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseover(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseup/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseup(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/mouseup/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - mouseup(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Get the immediately following sibling of each element in the set of matched elements. If a selector - * is provided, it retrieves the next sibling only if it matches that selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/next/ }\` - * @since 1.0 - */ - next(selector?: JQuery.Selector): this; - /** - * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/nextAll/ }\` - * @since 1.2 - */ - nextAll(selector?: string): this; - /** - * Get all following siblings of each element up to but not including the element matched by the - * selector, DOM node, or jQuery object passed. - * - * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. - * A DOM node or jQuery object indicating where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/nextUntil/ }\` - * @since 1.4 - * @since 1.6 - */ - nextUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; - /** - * Remove elements from the set of matched elements. - * - * @param selector A string containing a selector expression, a DOM element, or an array of elements to match against the set. - * A function used as a test for each element in the set. It accepts two arguments, index, which is the - * element's index in the jQuery collection, and element, which is the DOM element. Within the - * function, this refers to the current DOM element. - * An existing jQuery object to match the current set of elements against. - * @see \`{@link https://api.jquery.com/not/ }\` - * @since 1.0 - * @since 1.4 - */ - not(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): this; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as - * "click", "keydown.myPlugin", or ".myPlugin". - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/off/ }\` - * @since 1.7 - */ - off(events: string, selector: JQuery.Selector, handler: JQuery.EventHandlerBase> | false): this; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as - * "click", "keydown.myPlugin", or ".myPlugin". - * @param selector_handler A selector which should match the one originally passed to .on() when attaching event handlers. - * A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/off/ }\` - * @since 1.7 - */ - off(events: string, selector_handler?: JQuery.Selector | JQuery.EventHandlerBase> | false): this; - /** - * Remove an event handler. - * - * @param events An object where the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent handler functions previously attached for the event(s). - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @see \`{@link https://api.jquery.com/off/ }\` - * @since 1.7 - */ - off(events: JQuery.PlainObject> | false>, selector?: JQuery.Selector): this; - /** - * Remove an event handler. - * - * @param event A jQuery.Event object. - * @see \`{@link https://api.jquery.com/off/ }\` - * @since 1.7 - */ - off(event?: JQuery.Event): this; - /** - * Set the current coordinates of every element in the set of matched elements, relative to the document. - * - * @param coordinates An object containing the properties top and left, which are numbers indicating the new top and left - * coordinates for the elements. - * A function to return the coordinates to set. Receives the index of the element in the collection as - * the first argument and the current coordinates as the second argument. The function should return an - * object with the new top and left properties. - * @see \`{@link https://api.jquery.com/offset/ }\` - * @since 1.4 - */ - offset(coordinates: JQuery.CoordinatesPartial | ((this: TElement, index: number, coords: JQuery.Coordinates) => JQuery.CoordinatesPartial)): this; - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the document. - * - * @see \`{@link https://api.jquery.com/offset/ }\` - * @since 1.2 - */ - offset(): JQuery.Coordinates | undefined; - /** - * Get the closest ancestor element that is positioned. - * - * @see \`{@link https://api.jquery.com/offsetParent/ }\` - * @since 1.2.6 - */ - offsetParent(): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the - * selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - selector: JQuery.Selector | null, - data: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the - * selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - selector: JQuery.Selector | null, - data: any, - handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the - * selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand - * for a function that simply does return false. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - selector: JQuery.Selector, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the - * selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - selector: JQuery.Selector, - handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - data: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - data: any, // tslint:disable-line:unified-signatures - handler: ((event: JQueryEventObject) => void)): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand - * for a function that simply does return false. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: string, - handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If - * the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, - selector: JQuery.Selector | null, - data: TData): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If - * the selector is null or omitted, the handler is always called when it reaches the selected element. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, - selector: JQuery.Selector): this; // tslint:disable-line:unified-signatures - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, - data: TData): this; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @see \`{@link https://api.jquery.com/on/ }\` - * @since 1.7 - */ - on(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the - * selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: string, - selector: JQuery.Selector | null, - data: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the - * selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand - * for a function that simply does return false. - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: string, - selector: JQuery.Selector, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: string, - data: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand - * for a function that simply does return false. - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: string, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If - * the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, - selector: JQuery.Selector | null, - data: TData): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If - * the selector is null or omitted, the handler is always called when it reaches the selected element. - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, - selector: JQuery.Selector): this; // tslint:disable-line:unified-signatures - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>, - data: TData): this; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional - * namespaces, and the values represent a handler function to be called for the event(s). - * @see \`{@link https://api.jquery.com/one/ }\` - * @since 1.7 - */ - one(events: JQuery.PlainObject | JQuery.EventHandlerBase> | false>): this; - /** - * Set the CSS outer height of each element in the set of matched elements. - * - * @param value A number representing the number of pixels, or a number along with an optional unit of measure - * appended (as a string). - * @see \`{@link https://api.jquery.com/outerHeight/ }\` - * @since 1.8.0 - */ - outerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; - /** - * Get the current computed outer height (including padding, border, and optionally margin) for the - * first element in the set of matched elements. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see \`{@link https://api.jquery.com/outerHeight/ }\` - * @since 1.2.6 - */ - outerHeight(includeMargin?: boolean): number | undefined; - /** - * Set the CSS outer width of each element in the set of matched elements. - * - * @param value A number representing the number of pixels, or a number along with an optional unit of measure - * appended (as a string). - * A function returning the outer width to set. Receives the index position of the element in the set - * and the old outer width as arguments. Within the function, this refers to the current element in the set. - * @see \`{@link https://api.jquery.com/outerWidth/ }\` - * @since 1.8.0 - */ - outerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; - /** - * Get the current computed outer width (including padding, border, and optionally margin) for the - * first element in the set of matched elements. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see \`{@link https://api.jquery.com/outerWidth/ }\` - * @since 1.2.6 - */ - outerWidth(includeMargin?: boolean): number | undefined; - /** - * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/parent/ }\` - * @since 1.0 - */ - parent(selector?: JQuery.Selector): this; - /** - * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/parents/ }\` - * @since 1.0 - */ - parents(selector?: JQuery.Selector): this; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including - * the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. - * A DOM node or jQuery object indicating where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/parentsUntil/ }\` - * @since 1.4 - * @since 1.6 - */ - parentsUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. - * - * @see \`{@link https://api.jquery.com/position/ }\` - * @since 1.2 - */ - position(): JQuery.Coordinates; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or - * jQuery objects to insert at the beginning of each element in the set of matched elements. - * @see \`{@link https://api.jquery.com/prepend/ }\` - * @since 1.0 - */ - prepend(...contents: Array>>): this; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at - * the beginning of each element in the set of matched elements. Receives the index position of the - * element in the set and the old HTML value of the element as arguments. Within the function, this - * refers to the current element in the set. - * @see \`{@link https://api.jquery.com/prepend/ }\` - * @since 1.4 - */ - prepend(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray>): this; - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements - * will be inserted at the beginning of the element(s) specified by this parameter. - * @see \`{@link https://api.jquery.com/prependTo/ }\` - * @since 1.0 - */ - prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; - /** - * Get the immediately preceding sibling of each element in the set of matched elements. If a selector - * is provided, it retrieves the previous sibling only if it matches that selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/prev/ }\` - * @since 1.0 - */ - prev(selector?: JQuery.Selector): this; - /** - * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/prevAll/ }\` - * @since 1.2 - */ - prevAll(selector?: JQuery.Selector): this; - /** - * Get all preceding siblings of each element up to but not including the element matched by the - * selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. - * A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/prevUntil/ }\` - * @since 1.4 - * @since 1.6 - */ - prevUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; - /** - * Return a Promise object to observe when all actions of a certain type bound to the collection, - * queued or not, have finished. - * - * @param type The type of queue that needs to be observed. - * @param target Object onto which the promise methods have to be attached - * @see \`{@link https://api.jquery.com/promise/ }\` - * @since 1.6 - */ - promise(type: string, target: T): T & JQuery.Promise; - /** - * Return a Promise object to observe when all actions of a certain type bound to the collection, - * queued or not, have finished. - * - * @param target Object onto which the promise methods have to be attached - * @see \`{@link https://api.jquery.com/promise/ }\` - * @since 1.6 - */ - promise(target: T): T & JQuery.Promise; - /** - * Return a Promise object to observe when all actions of a certain type bound to the collection, - * queued or not, have finished. - * - * @param type The type of queue that needs to be observed. - * @see \`{@link https://api.jquery.com/promise/ }\` - * @since 1.6 - */ - promise(type?: string): JQuery.Promise; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A function returning the value to set. Receives the index position of the element in the set and the - * old property value as arguments. Within the function, the keyword this refers to the current element. - * @see \`{@link https://api.jquery.com/prop/ }\` - * @since 1.6 - */ - prop(propertyName: string, value: (this: TElement, index: number, oldPropertyValue: any) => any): this; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A value to set for the property. - * @see \`{@link https://api.jquery.com/prop/ }\` - * @since 1.6 - */ - prop(propertyName: string, value: any): this; // tslint:disable-line:unified-signatures - /** - * Set one or more properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - * @see \`{@link https://api.jquery.com/prop/ }\` - * @since 1.6 - */ - prop(properties: JQuery.PlainObject): this; - /** - * Get the value of a property for the first element in the set of matched elements. - * - * @param propertyName The name of the property to get. - * @see \`{@link https://api.jquery.com/prop/ }\` - * @since 1.6 - */ - prop(propertyName: string): any | undefined; - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - * @param name The name of a jQuery method that generated the array of elements. - * @param args The arguments that were passed in to the jQuery method (for serialization). - * @see \`{@link https://api.jquery.com/pushStack/ }\` - * @since 1.3 - */ - pushStack(elements: ArrayLike, name: string, args: any[]): this; - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - * @see \`{@link https://api.jquery.com/pushStack/ }\` - * @since 1.0 - */ - pushStack(elements: ArrayLike): this; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. - * An array of functions to replace the current queue contents. - * @see \`{@link https://api.jquery.com/queue/ }\` - * @since 1.2 - */ - queue(queueName: string, newQueue: JQuery.TypeOrArray>): this; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. - * An array of functions to replace the current queue contents. - * @see \`{@link https://api.jquery.com/queue/ }\` - * @since 1.2 - */ - queue(newQueue: JQuery.TypeOrArray>): this; - /** - * Show the queue of functions to be executed on the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see \`{@link https://api.jquery.com/queue/ }\` - * @since 1.2 - */ - queue(queueName?: string): JQuery.Queue; - /** - * Specify a function to execute when the DOM is fully loaded. - * - * @param handler A function to execute after the DOM is ready. - * @see \`{@link https://api.jquery.com/ready/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.0. Use `jQuery(function() { })`. - */ - ready(handler: ($: JQueryStatic) => void): this; - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - * @see \`{@link https://api.jquery.com/remove/ }\` - * @since 1.0 - */ - remove(selector?: string): this; - /** - * Remove an attribute from each element in the set of matched elements. - * - * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. - * @see \`{@link https://api.jquery.com/removeAttr/ }\` - * @since 1.0 - */ - removeAttr(attributeName: string): this; - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param className One or more space-separated classes to be removed from the class attribute of each matched element. - * An array of classes to be removed from the class attribute of each matched element. - * A function returning one or more space-separated class names to be removed. Receives the index - * position of the element in the set and the old class value as arguments. - * @see \`{@link https://api.jquery.com/removeClass/ }\` - * @since 1.0 - * @since 1.4 - * @since 3.3 - */ - removeClass(className?: JQuery.TypeOrArray | ((this: TElement, index: number, className: string) => string)): this; - /** - * Remove a previously-stored piece of data. - * - * @param name A string naming the piece of data to delete. - * An array or space-separated string naming the pieces of data to delete. - * @see \`{@link https://api.jquery.com/removeData/ }\` - * @since 1.2.3 - * @since 1.7 - */ - removeData(name?: JQuery.TypeOrArray): this; - /** - * Remove a property for the set of matched elements. - * - * @param propertyName The name of the property to remove. - * @see \`{@link https://api.jquery.com/removeProp/ }\` - * @since 1.6 - */ - removeProp(propertyName: string): this; - /** - * Replace each target element with the set of matched elements. - * - * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - * @see \`{@link https://api.jquery.com/replaceAll/ }\` - * @since 1.2 - */ - replaceAll(target: JQuery.Selector | JQuery | JQuery.TypeOrArray): this; - /** - * Replace each element in the set of matched elements with the provided new content and return the set - * of elements that was removed. - * - * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - * A function that returns content with which to replace the set of matched elements. - * @see \`{@link https://api.jquery.com/replaceWith/ }\` - * @since 1.2 - * @since 1.4 - */ - replaceWith(newContent: JQuery.htmlString | JQuery | JQuery.TypeOrArray | ((this: TElement) => any)): this; - /** - * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/resize/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - resize(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/resize/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - resize(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/scroll/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - scroll(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/scroll/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - scroll(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Set the current horizontal position of the scroll bar for each of the set of matched elements. - * - * @param value An integer indicating the new position to set the scroll bar to. - * @see \`{@link https://api.jquery.com/scrollLeft/ }\` - * @since 1.2.6 - */ - scrollLeft(value: number): this; - /** - * Get the current horizontal position of the scroll bar for the first element in the set of matched elements. - * - * @see \`{@link https://api.jquery.com/scrollLeft/ }\` - * @since 1.2.6 - */ - scrollLeft(): number | undefined; - /** - * Set the current vertical position of the scroll bar for each of the set of matched elements. - * - * @param value A number indicating the new position to set the scroll bar to. - * @see \`{@link https://api.jquery.com/scrollTop/ }\` - * @since 1.2.6 - */ - scrollTop(value: number): this; - /** - * Get the current vertical position of the scroll bar for the first element in the set of matched - * elements or set the vertical position of the scroll bar for every matched element. - * - * @see \`{@link https://api.jquery.com/scrollTop/ }\` - * @since 1.2.6 - */ - scrollTop(): number | undefined; - /** - * Bind an event handler to the "select" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/select/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - select(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "select" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/select/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - select(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Encode a set of form elements as a string for submission. - * - * @see \`{@link https://api.jquery.com/serialize/ }\` - * @since 1.0 - */ - serialize(): string; - /** - * Encode a set of form elements as an array of names and values. - * - * @see \`{@link https://api.jquery.com/serializeArray/ }\` - * @since 1.2 - */ - serializeArray(): JQuery.NameValuePair[]; - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/show/ }\` - * @since 1.4.3 - */ - show(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing_complete A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/show/ }\` - * @since 1.0 - * @since 1.4.3 - */ - show(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; - /** - * Display the matched elements. - * - * @param duration_complete_options A string or number determining how long the animation will run. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/show/ }\` - * @since 1.0 - */ - show(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see \`{@link https://api.jquery.com/siblings/ }\` - * @since 1.0 - */ - siblings(selector?: JQuery.Selector): this; - /** - * Reduce the set of matched elements to a subset specified by a range of indices. - * - * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, - * it indicates an offset from the end of the set. - * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, - * it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. - * @see \`{@link https://api.jquery.com/slice/ }\` - * @since 1.1.4 - */ - slice(start: number, end?: number): this; - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/slideDown/ }\` - * @since 1.4.3 - */ - slideDown(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; - /** - * Display the matched elements with a sliding motion. - * - * @param duration_easing A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/slideDown/ }\` - * @since 1.0 - * @since 1.4.3 - */ - slideDown(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; - /** - * Display the matched elements with a sliding motion. - * - * @param duration_easing_complete_options A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/slideDown/ }\` - * @since 1.0 - * @since 1.4.3 - */ - slideDown(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/slideToggle/ }\` - * @since 1.4.3 - */ - slideToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration_easing A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/slideToggle/ }\` - * @since 1.0 - * @since 1.4.3 - */ - slideToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration_easing_complete_options A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/slideToggle/ }\` - * @since 1.0 - * @since 1.4.3 - */ - slideToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/slideUp/ }\` - * @since 1.4.3 - */ - slideUp(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration_easing A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/slideUp/ }\` - * @since 1.0 - * @since 1.4.3 - */ - slideUp(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration_easing_complete_options A string or number determining how long the animation will run. - * A string indicating which easing function to use for the transition. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * @see \`{@link https://api.jquery.com/slideUp/ }\` - * @since 1.0 - * @since 1.4.3 - */ - slideUp(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; - /** - * Stop the currently-running animation on the matched elements. - * - * @param queue The name of the queue in which to stop animations. - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - * @see \`{@link https://api.jquery.com/stop/ }\` - * @since 1.7 - */ - stop(queue: string, clearQueue?: boolean, jumpToEnd?: boolean): this; - /** - * Stop the currently-running animation on the matched elements. - * - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - * @see \`{@link https://api.jquery.com/stop/ }\` - * @since 1.2 - */ - stop(clearQueue?: boolean, jumpToEnd?: boolean): this; - /** - * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/submit/ }\` - * @since 1.4.3 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - submit(eventData: TData, - handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** - * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. - * - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/submit/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.3. Use \`{@link JQuery.on }\` or \`{@link JQuery.trigger }\`. - */ - submit(handler?: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will - * be converted to a String representation. - * A function returning the text content to set. Receives the index position of the element in the set - * and the old text value as arguments. - * @see \`{@link https://api.jquery.com/text/ }\` - * @since 1.0 - * @since 1.4 - */ - text(text: string | number | boolean | ((this: TElement, index: number, text: string) => string | number | boolean)): this; - /** - * Get the combined text contents of each element in the set of matched elements, including their descendants. - * - * @see \`{@link https://api.jquery.com/text/ }\` - * @since 1.0 - */ - text(): string; - /** - * Retrieve all the elements contained in the jQuery set, as an array. - * - * @see \`{@link https://api.jquery.com/toArray/ }\` - * @since 1.4 - */ - toArray(): TElement[]; - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/toggle/ }\` - * @since 1.4.3 - */ - toggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete, called once per matched element. - * @see \`{@link https://api.jquery.com/toggle/ }\` - * @since 1.0 - */ - toggle(duration: JQuery.Duration, complete: (this: TElement) => void): this; - /** - * Display or hide the matched elements. - * - * @param duration_complete_options_display A string or number determining how long the animation will run. - * A function to call once the animation is complete, called once per matched element. - * A map of additional options to pass to the method. - * Use true to show the element or false to hide it. - * @see \`{@link https://api.jquery.com/toggle/ }\` - * @since 1.0 - * @since 1.3 - */ - toggle(duration_complete_options_display?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions | boolean): this; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on - * either the class's presence or the value of the state argument. - * - * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. - * An array of classes to be toggled for each element in the matched set. - * A function that returns class names to be toggled in the class attribute of each element in the - * matched set. Receives the index position of the element in the set, the old class value, and the state as arguments. - * @param state A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - * @see \`{@link https://api.jquery.com/toggleClass/ }\` - * @since 1.0 - * @since 1.3 - * @since 1.4 - * @since 3.3 - */ - toggleClass(className: JQuery.TypeOrArray | ((this: TElement, index: number, className: string, state: TState) => string), - state?: TState): this; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on - * either the class's presence or the value of the state argument. - * - * @param state A boolean value to determine whether the class should be added or removed. - * @see \`{@link https://api.jquery.com/toggleClass/ }\` - * @since 1.4 - * - * @deprecated Deprecated since 3.0. See \`{@link https://github.com/jquery/jquery/pull/2618 }\`. - */ - toggleClass(state?: boolean): this; - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * A jQuery.Event object. - * @param extraParameters Additional parameters to pass along to the event handler. - * @see \`{@link https://api.jquery.com/trigger/ }\` - * @since 1.0 - * @since 1.3 - */ - trigger(eventType: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject | string | number): this; - /** - * Execute all handlers attached to an element for an event. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * A jQuery.Event object. - * @param extraParameters Additional parameters to pass along to the event handler. - * @see \`{@link https://api.jquery.com/triggerHandler/ }\` - * @since 1.2 - * @since 1.3 - */ - triggerHandler(eventType: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject | string | number): undefined | any; - /** - * Remove a previously-attached event handler from the elements. - * - * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/unbind/ }\` - * @since 1.0 - * @since 1.4.3 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.off }\`. - */ - unbind(event: string, handler: JQuery.EventHandlerBase> | false): this; - /** - * Remove a previously-attached event handler from the elements. - * - * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * A jQuery.Event object. - * @see \`{@link https://api.jquery.com/unbind/ }\` - * @since 1.0 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.off }\`. - */ - unbind(event?: string | JQuery.Event): this; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a - * specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" - * @param handler A function to execute each time the event is triggered. - * @see \`{@link https://api.jquery.com/undelegate/ }\` - * @since 1.4.2 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.off }\`. - */ - undelegate(selector: JQuery.Selector, eventType: string, handler: JQuery.EventHandlerBase> | false): this; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a - * specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param eventTypes A string containing a JavaScript event type, such as "click" or "keydown" - * An object of one or more event types and previously bound functions to unbind from them. - * @see \`{@link https://api.jquery.com/undelegate/ }\` - * @since 1.4.2 - * @since 1.4.3 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.off }\`. - */ - undelegate(selector: JQuery.Selector, eventTypes: string | JQuery.PlainObject> | false>): this; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a - * specific set of root elements. - * - * @param namespace A selector which will be used to filter the event results. - * @see \`{@link https://api.jquery.com/undelegate/ }\` - * @since 1.4.2 - * @since 1.6 - * - * @deprecated Deprecated since 3.0. Use \`{@link JQuery.off }\`. - */ - undelegate(namespace?: string): this; - /** - * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. - * - * @param selector A selector to check the parent element against. If an element's parent does not match the selector, - * the element won't be unwrapped. - * @see \`{@link https://api.jquery.com/unwrap/ }\` - * @since 1.4 - * @since 3.0 - */ - unwrap(selector?: string): this; - /** - * Set the value of each element in the set of matched elements. - * - * @param value A string of text, a number, or an array of strings corresponding to the value of each matched - * element to set as selected/checked. - * A function returning the value to set. this is the current element. Receives the index position of - * the element in the set and the old value as arguments. - * @see \`{@link https://api.jquery.com/val/ }\` - * @since 1.0 - * @since 1.4 - */ - val(value: string | number | string[] | ((this: TElement, index: number, value: string) => string)): this; - /** - * Get the current value of the first element in the set of matched elements. - * - * @see \`{@link https://api.jquery.com/val/ }\` - * @since 1.0 - */ - val(): string | number | string[] | undefined; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure - * appended (as a string). - * A function returning the width to set. Receives the index position of the element in the set and the - * old width as arguments. Within the function, this refers to the current element in the set. - * @see \`{@link https://api.jquery.com/width/ }\` - * @since 1.0 - * @since 1.4.1 - */ - width(value: string | number | ((this: TElement, index: number, value: number) => string | number)): this; - /** - * Get the current computed width for the first element in the set of matched elements. - * - * @see \`{@link https://api.jquery.com/width/ }\` - * @since 1.0 - */ - width(): number | undefined; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the - * matched elements. When you pass a jQuery collection containing more than one element, or a selector - * matching more than one element, the first element will be used. - * A callback function returning the HTML content or jQuery object to wrap around the matched elements. - * Receives the index position of the element in the set as an argument. Within the function, this - * refers to the current element in the set. - * @see \`{@link https://api.jquery.com/wrap/ }\` - * @since 1.0 - * @since 1.4 - */ - wrap(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery)): this; - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - * A callback function returning the HTML content or jQuery object to wrap around all the matched - * elements. Within the function, this refers to the first element in the set. Prior to jQuery 3.0, the - * callback was incorrectly called for every element in the set and received the index position of the - * element in the set as an argument. - * @see \`{@link https://api.jquery.com/wrapAll/ }\` - * @since 1.2 - * @since 1.4 - */ - wrapAll(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement) => string | JQuery)): this; - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap - * around the content of the matched elements. - * A callback function which generates a structure to wrap around the content of the matched elements. - * Receives the index position of the element in the set as an argument. Within the function, this - * refers to the current element in the set. - * @see \`{@link https://api.jquery.com/wrapInner/ }\` - * @since 1.2 - * @since 1.4 - */ - wrapInner(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery | Element)): this; - - [n: number]: TElement; -} - -// #region ES5 compatibility - -// tslint:disable-next-line:no-empty-interface -interface Iterable { } - -interface SymbolConstructor { - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; -} - -declare var Symbol: SymbolConstructor; - -// #endregion - -declare namespace JQuery { - type TypeOrArray = T | T[]; - type Node = Element | Text | Comment | DocumentFragment; - - /** - * A string is designated htmlString in jQuery documentation when it is used to represent one or more - * DOM elements, typically to be created and inserted in the document. When passed as an argument of - * the jQuery() function, the string is identified as HTML if it starts with ) and is parsed - * as such until the final > character. Prior to jQuery 1.9, a string was considered to be HTML if it - * contained anywhere within the string. - */ - type htmlString = string; - /** - * A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most - * cases, the DOM document present in all browsers, but can also be an XML document received via Ajax. - */ - type Selector = string; - - /** - * The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain - * object is, in other words, an Object object. It is designated "plain" in jQuery documentation to - * distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and - * host objects such as document, all of which have a typeof value of "object." - */ - interface PlainObject { - [key: string]: T; - } - - // #region Ajax - - interface AjaxSettings extends Ajax.AjaxSettingsBase { - /** - * A string containing the URL to which the request is sent. - */ - url?: string; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, - * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and - * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend - * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless - * of the type of request. - */ - beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettings): false | void; - } - - interface UrlAjaxSettings extends Ajax.AjaxSettingsBase { - /** - * A string containing the URL to which the request is sent. - */ - url: string; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, - * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and - * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend - * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless - * of the type of request. - */ - beforeSend?(this: TContext, jqXHR: jqXHR, settings: UrlAjaxSettings): false | void; - } - - namespace Ajax { - type SuccessTextStatus = 'success' | 'notmodified' | 'nocontent'; - type ErrorTextStatus = 'timeout' | 'error' | 'abort' | 'parsererror'; - type TextStatus = SuccessTextStatus | ErrorTextStatus; - - interface SuccessCallback { - (this: TContext, data: any, textStatus: SuccessTextStatus, jqXHR: jqXHR): void; - } - - interface ErrorCallback { - (this: TContext, jqXHR: jqXHR, textStatus: ErrorTextStatus, errorThrown: string): void; - } - - interface CompleteCallback { - (this: TContext, jqXHR: jqXHR, textStatus: TextStatus): void; - } - - /** - * @see \`{@link http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings }\` - */ - interface AjaxSettingsBase { - /** - * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept - * request header. This header tells the server what kind of response it will accept in return. - */ - accepts?: PlainObject; - /** - * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need - * synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests - * do not support synchronous operation. Note that synchronous requests may temporarily lock the - * browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: - * false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback - * options instead of the corresponding methods of the jqXHR object such as jqXHR.done(). - */ - async?: boolean; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, - * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and - * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend - * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless - * of the type of request. - */ - beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettingsBase): false | void; - /** - * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache - * to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" - * to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a - * POST is made to a URL that has already been requested by a GET. - */ - cache?: boolean; - /** - * A function to be called when the request finishes (after success and error callbacks are executed). - * The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a - * string categorizing the status of the request ("success", "notmodified", "nocontent", "error", - * "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of - * functions. Each function will be called in turn. This is an Ajax Event. - */ - complete?: TypeOrArray>; - /** - * An object of string/regular-expression pairs that determine how jQuery will parse the response, - * given its content type. - */ - contents?: PlainObject; - /** - * When sending data to the server, use this content type. Default is - * "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly - * pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). - * As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C - * XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset - * will not force the browser to change the encoding. Note: For cross-domain requests, setting the - * content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or - * text/plain will trigger the browser to send a preflight OPTIONS request to the server. - */ - contentType?: string | false; - /** - * This object will be the context of all Ajax-related callbacks. By default, the context is an object - * that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). - */ - context?: TContext; - /** - * An object containing dataType-to-dataType converters. Each converter's value is a function that - * returns the transformed value of the response. - */ - converters?: PlainObject<((value: any) => any) | true>; - /** - * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of - * crossDomain to true. This allows, for example, server-side redirection to another domain. - */ - crossDomain?: boolean; - /** - * Data to be sent to the server. It is converted to a query string, if not already a string. It's - * appended to the url for GET-requests. See processData option to prevent this automatic processing. - * Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same - * key based on the value of the traditional setting (described below). - */ - data?: PlainObject | string; - /** - * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering - * function to sanitize the response. You should return the sanitized data. The function accepts two - * arguments: The raw data returned from the server and the 'dataType' parameter. - */ - dataFilter?(data: string, type: string): any; - /** - * The type of data that you're expecting back from the server. If none is specified, jQuery will try - * to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON - * will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be - * returned as a string). The available types (and the result passed as the first argument to your - * success callback) are: - * - * "xml": Returns a XML document that can be processed via jQuery. - * - * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM. - * - * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by - * appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to - * true. Note: This will turn POSTs into GETs for remote-domain requests. - * - * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests - * are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON - * data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of - * jQuery 1.9, an empty response is also rejected; the server should return a response of null or {} - * instead. (See json.org for more information on proper JSON formatting.) - * - * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to - * specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to - * the URL unless the cache option is set to true. - * - * "text": A plain text string. - * - * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it - * received in the Content-Type header to what you require. For example, if you want a text response to - * be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it - * received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string - * such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from - * jsonp to text, and then from text to xml. - */ - dataType?: 'xml' | 'html' | 'script' | 'json' | 'jsonp' | 'text' | string; - /** - * A function to be called if the request fails. The function receives three arguments: The jqXHR (in - * jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an - * optional exception object, if one occurred. Possible values for the second argument (besides null) - * are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives - * the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery - * 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: - * This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. - */ - error?: TypeOrArray>; - /** - * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to - * prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to - * control various Ajax Events. - */ - global?: boolean; - /** - * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest - * transport. The header X-Requested-With: XMLHttpRequest is always added, but its default - * XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from - * within the beforeSend function. - */ - headers?: PlainObject; - /** - * Allow the request to be successful only if the response has changed since the last request. This is - * done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery - * 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. - */ - ifModified?: boolean; - /** - * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery - * does not recognize it as such by default. The following protocols are currently recognized as local: - * file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so - * once in the $.ajaxSetup() method. - */ - isLocal?: boolean; - /** - * Override the callback function name in a JSONP request. This value will be used instead of - * 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would - * result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false - * prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for - * transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, - * { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax - * requests, consider setting the jsonp property to false for security reasons. - */ - jsonp?: string | false; - /** - * Specify the callback function name for a JSONP request. This value will be used instead of the - * random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name - * as it'll make it easier to manage the requests and provide callbacks and error handling. You may - * want to specify the callback when you want to enable better browser caching of GET requests. As of - * jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback - * is set to the return value of that function. - */ - jsonpCallback?: string | ((this: TContext) => string); - /** - * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). - */ - method?: string; - /** - * A mime type to override the XHR mime type. - */ - mimeType?: string; - /** - * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - password?: string; - /** - * By default, data passed in to the data option as an object (technically, anything other than a - * string) will be processed and transformed into a query string, fitting to the default content-type - * "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, - * set this option to false. - */ - processData?: boolean; - /** - * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or - * "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. - * Used when the character set on the local page is not the same as the one on the remote script. - */ - scriptCharset?: string; - /** - * An object of numeric HTTP codes and functions to be called when the response has the corresponding - * code. - * - * If the request is successful, the status code functions take the same parameters as the success - * callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. - */ - statusCode?: StatusCodeCallbacks; - /** - * A function to be called if the request succeeds. The function gets passed three arguments: The data - * returned from the server, formatted according to the dataType parameter or the dataFilter callback - * function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, - * XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each - * function will be called in turn. This is an Ajax Event. - */ - success?: TypeOrArray>; - /** - * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This - * will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the - * $.ajax call is made; if several other requests are in progress and the browser has no connections - * available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and - * below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any - * object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be - * cancelled by a timeout; the script will run even if it arrives after the timeout period. - */ - timeout?: number; - /** - * Set this to true if you wish to use the traditional style of param serialization. - */ - traditional?: boolean; - /** - * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0. - */ - type?: string; - /** - * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - username?: string; - // ActiveXObject requires "lib": ["scripthost"] which consumers would also require - /** - * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), - * the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or - * enhancements to the factory. - */ - xhr?(): XMLHttpRequest; - /** - * An object of fieldName-fieldValue pairs to set on the native XHR object. - * - * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS - * requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ - * should you require the use of it. - */ - xhrFields?: XHRFields; - } - - type StatusCodeCallbacks = { - // #region Success Status Codes - - // jQuery treats 2xx and 304 status codes as a success - - 200?: SuccessCallback; - 201?: SuccessCallback; - 202?: SuccessCallback; - 203?: SuccessCallback; - 204?: SuccessCallback; - 205?: SuccessCallback; - 206?: SuccessCallback; - 207?: SuccessCallback; - 208?: SuccessCallback; - 209?: SuccessCallback; - 210?: SuccessCallback; - 211?: SuccessCallback; - 212?: SuccessCallback; - 213?: SuccessCallback; - 214?: SuccessCallback; - 215?: SuccessCallback; - 216?: SuccessCallback; - 217?: SuccessCallback; - 218?: SuccessCallback; - 219?: SuccessCallback; - 220?: SuccessCallback; - 221?: SuccessCallback; - 222?: SuccessCallback; - 223?: SuccessCallback; - 224?: SuccessCallback; - 225?: SuccessCallback; - 226?: SuccessCallback; - 227?: SuccessCallback; - 228?: SuccessCallback; - 229?: SuccessCallback; - 230?: SuccessCallback; - 231?: SuccessCallback; - 232?: SuccessCallback; - 233?: SuccessCallback; - 234?: SuccessCallback; - 235?: SuccessCallback; - 236?: SuccessCallback; - 237?: SuccessCallback; - 238?: SuccessCallback; - 239?: SuccessCallback; - 240?: SuccessCallback; - 241?: SuccessCallback; - 242?: SuccessCallback; - 243?: SuccessCallback; - 244?: SuccessCallback; - 245?: SuccessCallback; - 246?: SuccessCallback; - 247?: SuccessCallback; - 248?: SuccessCallback; - 249?: SuccessCallback; - 250?: SuccessCallback; - 251?: SuccessCallback; - 252?: SuccessCallback; - 253?: SuccessCallback; - 254?: SuccessCallback; - 255?: SuccessCallback; - 256?: SuccessCallback; - 257?: SuccessCallback; - 258?: SuccessCallback; - 259?: SuccessCallback; - 260?: SuccessCallback; - 261?: SuccessCallback; - 262?: SuccessCallback; - 263?: SuccessCallback; - 264?: SuccessCallback; - 265?: SuccessCallback; - 266?: SuccessCallback; - 267?: SuccessCallback; - 268?: SuccessCallback; - 269?: SuccessCallback; - 270?: SuccessCallback; - 271?: SuccessCallback; - 272?: SuccessCallback; - 273?: SuccessCallback; - 274?: SuccessCallback; - 275?: SuccessCallback; - 276?: SuccessCallback; - 277?: SuccessCallback; - 278?: SuccessCallback; - 279?: SuccessCallback; - 280?: SuccessCallback; - 281?: SuccessCallback; - 282?: SuccessCallback; - 283?: SuccessCallback; - 284?: SuccessCallback; - 285?: SuccessCallback; - 286?: SuccessCallback; - 287?: SuccessCallback; - 288?: SuccessCallback; - 289?: SuccessCallback; - 290?: SuccessCallback; - 291?: SuccessCallback; - 292?: SuccessCallback; - 293?: SuccessCallback; - 294?: SuccessCallback; - 295?: SuccessCallback; - 296?: SuccessCallback; - 297?: SuccessCallback; - 298?: SuccessCallback; - 299?: SuccessCallback; - 304?: SuccessCallback; - - // #endregion - - // #region Error Status Codes - - 300?: ErrorCallback; - 301?: ErrorCallback; - 302?: ErrorCallback; - 303?: ErrorCallback; - 305?: ErrorCallback; - 306?: ErrorCallback; - 307?: ErrorCallback; - 308?: ErrorCallback; - 309?: ErrorCallback; - 310?: ErrorCallback; - 311?: ErrorCallback; - 312?: ErrorCallback; - 313?: ErrorCallback; - 314?: ErrorCallback; - 315?: ErrorCallback; - 316?: ErrorCallback; - 317?: ErrorCallback; - 318?: ErrorCallback; - 319?: ErrorCallback; - 320?: ErrorCallback; - 321?: ErrorCallback; - 322?: ErrorCallback; - 323?: ErrorCallback; - 324?: ErrorCallback; - 325?: ErrorCallback; - 326?: ErrorCallback; - 327?: ErrorCallback; - 328?: ErrorCallback; - 329?: ErrorCallback; - 330?: ErrorCallback; - 331?: ErrorCallback; - 332?: ErrorCallback; - 333?: ErrorCallback; - 334?: ErrorCallback; - 335?: ErrorCallback; - 336?: ErrorCallback; - 337?: ErrorCallback; - 338?: ErrorCallback; - 339?: ErrorCallback; - 340?: ErrorCallback; - 341?: ErrorCallback; - 342?: ErrorCallback; - 343?: ErrorCallback; - 344?: ErrorCallback; - 345?: ErrorCallback; - 346?: ErrorCallback; - 347?: ErrorCallback; - 348?: ErrorCallback; - 349?: ErrorCallback; - 350?: ErrorCallback; - 351?: ErrorCallback; - 352?: ErrorCallback; - 353?: ErrorCallback; - 354?: ErrorCallback; - 355?: ErrorCallback; - 356?: ErrorCallback; - 357?: ErrorCallback; - 358?: ErrorCallback; - 359?: ErrorCallback; - 360?: ErrorCallback; - 361?: ErrorCallback; - 362?: ErrorCallback; - 363?: ErrorCallback; - 364?: ErrorCallback; - 365?: ErrorCallback; - 366?: ErrorCallback; - 367?: ErrorCallback; - 368?: ErrorCallback; - 369?: ErrorCallback; - 370?: ErrorCallback; - 371?: ErrorCallback; - 372?: ErrorCallback; - 373?: ErrorCallback; - 374?: ErrorCallback; - 375?: ErrorCallback; - 376?: ErrorCallback; - 377?: ErrorCallback; - 378?: ErrorCallback; - 379?: ErrorCallback; - 380?: ErrorCallback; - 381?: ErrorCallback; - 382?: ErrorCallback; - 383?: ErrorCallback; - 384?: ErrorCallback; - 385?: ErrorCallback; - 386?: ErrorCallback; - 387?: ErrorCallback; - 388?: ErrorCallback; - 389?: ErrorCallback; - 390?: ErrorCallback; - 391?: ErrorCallback; - 392?: ErrorCallback; - 393?: ErrorCallback; - 394?: ErrorCallback; - 395?: ErrorCallback; - 396?: ErrorCallback; - 397?: ErrorCallback; - 398?: ErrorCallback; - 399?: ErrorCallback; - 400?: ErrorCallback; - 401?: ErrorCallback; - 402?: ErrorCallback; - 403?: ErrorCallback; - 404?: ErrorCallback; - 405?: ErrorCallback; - 406?: ErrorCallback; - 407?: ErrorCallback; - 408?: ErrorCallback; - 409?: ErrorCallback; - 410?: ErrorCallback; - 411?: ErrorCallback; - 412?: ErrorCallback; - 413?: ErrorCallback; - 414?: ErrorCallback; - 415?: ErrorCallback; - 416?: ErrorCallback; - 417?: ErrorCallback; - 418?: ErrorCallback; - 419?: ErrorCallback; - 420?: ErrorCallback; - 421?: ErrorCallback; - 422?: ErrorCallback; - 423?: ErrorCallback; - 424?: ErrorCallback; - 425?: ErrorCallback; - 426?: ErrorCallback; - 427?: ErrorCallback; - 428?: ErrorCallback; - 429?: ErrorCallback; - 430?: ErrorCallback; - 431?: ErrorCallback; - 432?: ErrorCallback; - 433?: ErrorCallback; - 434?: ErrorCallback; - 435?: ErrorCallback; - 436?: ErrorCallback; - 437?: ErrorCallback; - 438?: ErrorCallback; - 439?: ErrorCallback; - 440?: ErrorCallback; - 441?: ErrorCallback; - 442?: ErrorCallback; - 443?: ErrorCallback; - 444?: ErrorCallback; - 445?: ErrorCallback; - 446?: ErrorCallback; - 447?: ErrorCallback; - 448?: ErrorCallback; - 449?: ErrorCallback; - 450?: ErrorCallback; - 451?: ErrorCallback; - 452?: ErrorCallback; - 453?: ErrorCallback; - 454?: ErrorCallback; - 455?: ErrorCallback; - 456?: ErrorCallback; - 457?: ErrorCallback; - 458?: ErrorCallback; - 459?: ErrorCallback; - 460?: ErrorCallback; - 461?: ErrorCallback; - 462?: ErrorCallback; - 463?: ErrorCallback; - 464?: ErrorCallback; - 465?: ErrorCallback; - 466?: ErrorCallback; - 467?: ErrorCallback; - 468?: ErrorCallback; - 469?: ErrorCallback; - 470?: ErrorCallback; - 471?: ErrorCallback; - 472?: ErrorCallback; - 473?: ErrorCallback; - 474?: ErrorCallback; - 475?: ErrorCallback; - 476?: ErrorCallback; - 477?: ErrorCallback; - 478?: ErrorCallback; - 479?: ErrorCallback; - 480?: ErrorCallback; - 481?: ErrorCallback; - 482?: ErrorCallback; - 483?: ErrorCallback; - 484?: ErrorCallback; - 485?: ErrorCallback; - 486?: ErrorCallback; - 487?: ErrorCallback; - 488?: ErrorCallback; - 489?: ErrorCallback; - 490?: ErrorCallback; - 491?: ErrorCallback; - 492?: ErrorCallback; - 493?: ErrorCallback; - 494?: ErrorCallback; - 495?: ErrorCallback; - 496?: ErrorCallback; - 497?: ErrorCallback; - 498?: ErrorCallback; - 499?: ErrorCallback; - 500?: ErrorCallback; - 501?: ErrorCallback; - 502?: ErrorCallback; - 503?: ErrorCallback; - 504?: ErrorCallback; - 505?: ErrorCallback; - 506?: ErrorCallback; - 507?: ErrorCallback; - 508?: ErrorCallback; - 509?: ErrorCallback; - 510?: ErrorCallback; - 511?: ErrorCallback; - 512?: ErrorCallback; - 513?: ErrorCallback; - 514?: ErrorCallback; - 515?: ErrorCallback; - 516?: ErrorCallback; - 517?: ErrorCallback; - 518?: ErrorCallback; - 519?: ErrorCallback; - 520?: ErrorCallback; - 521?: ErrorCallback; - 522?: ErrorCallback; - 523?: ErrorCallback; - 524?: ErrorCallback; - 525?: ErrorCallback; - 526?: ErrorCallback; - 527?: ErrorCallback; - 528?: ErrorCallback; - 529?: ErrorCallback; - 530?: ErrorCallback; - 531?: ErrorCallback; - 532?: ErrorCallback; - 533?: ErrorCallback; - 534?: ErrorCallback; - 535?: ErrorCallback; - 536?: ErrorCallback; - 537?: ErrorCallback; - 538?: ErrorCallback; - 539?: ErrorCallback; - 540?: ErrorCallback; - 541?: ErrorCallback; - 542?: ErrorCallback; - 543?: ErrorCallback; - 544?: ErrorCallback; - 545?: ErrorCallback; - 546?: ErrorCallback; - 547?: ErrorCallback; - 548?: ErrorCallback; - 549?: ErrorCallback; - 550?: ErrorCallback; - 551?: ErrorCallback; - 552?: ErrorCallback; - 553?: ErrorCallback; - 554?: ErrorCallback; - 555?: ErrorCallback; - 556?: ErrorCallback; - 557?: ErrorCallback; - 558?: ErrorCallback; - 559?: ErrorCallback; - 560?: ErrorCallback; - 561?: ErrorCallback; - 562?: ErrorCallback; - 563?: ErrorCallback; - 564?: ErrorCallback; - 565?: ErrorCallback; - 566?: ErrorCallback; - 567?: ErrorCallback; - 568?: ErrorCallback; - 569?: ErrorCallback; - 570?: ErrorCallback; - 571?: ErrorCallback; - 572?: ErrorCallback; - 573?: ErrorCallback; - 574?: ErrorCallback; - 575?: ErrorCallback; - 576?: ErrorCallback; - 577?: ErrorCallback; - 578?: ErrorCallback; - 579?: ErrorCallback; - 580?: ErrorCallback; - 581?: ErrorCallback; - 582?: ErrorCallback; - 583?: ErrorCallback; - 584?: ErrorCallback; - 585?: ErrorCallback; - 586?: ErrorCallback; - 587?: ErrorCallback; - 588?: ErrorCallback; - 589?: ErrorCallback; - 590?: ErrorCallback; - 591?: ErrorCallback; - 592?: ErrorCallback; - 593?: ErrorCallback; - 594?: ErrorCallback; - 595?: ErrorCallback; - 596?: ErrorCallback; - 597?: ErrorCallback; - 598?: ErrorCallback; - 599?: ErrorCallback; - - // #endregion - } & { - // Status codes not listed require type annotations when defining the callback - [index: number]: SuccessCallback | ErrorCallback; - }; - - // Writable properties on XMLHttpRequest - interface XHRFields extends Partial> { - msCaching?: string; - } - } - - interface Transport { - send(headers: PlainObject, completeCallback: Transport.SuccessCallback): void; - abort(): void; - } - - namespace Transport { - interface SuccessCallback { - (status: number, statusText: Ajax.TextStatus, responses?: PlainObject, headers?: string): void; - } - } - - /** - * @see \`{@link http://api.jquery.com/jquery.ajax/#jqXHR }\` - */ - interface jqXHR extends Promise3, never, - Ajax.SuccessTextStatus, Ajax.ErrorTextStatus, never, - jqXHR, string, never>, - Pick, - Partial> { - responseJSON?: any; - - /** - * Determine the current state of a Deferred object. - * - * @see \`{@link https://api.jquery.com/deferred.state/ }\` - * @since 1.7 - */ - state(): 'pending' | 'resolved' | 'rejected'; - statusCode(map: Ajax.StatusCodeCallbacks): void; - } - - namespace jqXHR { - interface DoneCallback> extends Deferred.Callback3 { } - - interface FailCallback extends Deferred.Callback3 { } - - interface AlwaysCallback> extends Deferred.Callback3 { } - } - - // #endregion - - // #region Callbacks - - // tslint:disable-next-line:ban-types - interface Callbacks { - /** - * Add a callback or a collection of callbacks to a callback list. - * - * @param callback A function, or array of functions, that are to be added to the callback list. - * @param callbacks A function, or array of functions, that are to be added to the callback list. - * @see \`{@link https://api.jquery.com/callbacks.add/ }\` - * @since 1.7 - */ - add(callback: TypeOrArray, ...callbacks: Array>): this; - /** - * Disable a callback list from doing anything more. - * - * @see \`{@link https://api.jquery.com/callbacks.disable/ }\` - * @since 1.7 - */ - disable(): this; - /** - * Determine if the callbacks list has been disabled. - * - * @see \`{@link https://api.jquery.com/callbacks.disabled/ }\` - * @since 1.7 - */ - disabled(): boolean; - /** - * Remove all of the callbacks from a list. - * - * @see \`{@link https://api.jquery.com/callbacks.empty/ }\` - * @since 1.7 - */ - empty(): this; - /** - * Call all of the callbacks with the given arguments. - * - * @param args The argument or list of arguments to pass back to the callback list. - * @see \`{@link https://api.jquery.com/callbacks.fire/ }\` - * @since 1.7 - */ - fire(...args: any[]): this; - /** - * Call all callbacks in a list with the given context and arguments. - * - * @param context A reference to the context in which the callbacks in the list should be fired. - * @param args An argument, or array of arguments, to pass to the callbacks in the list. - * @see \`{@link https://api.jquery.com/callbacks.fireWith/ }\` - * @since 1.7 - */ - fireWith(context: object, args?: ArrayLike): this; - /** - * Determine if the callbacks have already been called at least once. - * - * @see \`{@link https://api.jquery.com/callbacks.fired/ }\` - * @since 1.7 - */ - fired(): boolean; - /** - * Determine whether or not the list has any callbacks attached. If a callback is provided as an - * argument, determine whether it is in a list. - * - * @param callback The callback to search for. - * @see \`{@link https://api.jquery.com/callbacks.has/ }\` - * @since 1.7 - */ - has(callback?: T): boolean; - /** - * Lock a callback list in its current state. - * - * @see \`{@link https://api.jquery.com/callbacks.lock/ }\` - * @since 1.7 - */ - lock(): this; - /** - * Determine if the callbacks list has been locked. - * - * @see \`{@link https://api.jquery.com/callbacks.locked/ }\` - * @since 1.7 - */ - locked(): boolean; - /** - * Remove a callback or a collection of callbacks from a callback list. - * - * @param callbacks A function, or array of functions, that are to be removed from the callback list. - * @see \`{@link https://api.jquery.com/callbacks.remove/ }\` - * @since 1.7 - */ - remove(...callbacks: T[]): this; - } - - // #endregion - - // #region CSS - - interface CSSHook { - get(this: this, elem: TElement, computed: any, extra: any): any; - set(this: this, elem: TElement, value: any): void; - } - - // #endregion - - // #region Deferred - - /** - * Any object that has a then method. - */ - interface Thenable extends PromiseLike { } - - // NOTE: This is a private copy of the global Promise interface. It is used by JQuery.PromiseBase to indicate compatibility with other Promise implementations. - // The global Promise interface cannot be used directly as it may be modified, as in the case of @types/bluebird-global. - /** - * Represents the completion of an asynchronous operation - */ - interface _Promise { - readonly [Symbol.toStringTag]: "Promise"; - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): _Promise; - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): _Promise; - } - - // Type parameter guide - // -------------------- - // Each type parameter represents a parameter in one of the three possible callbacks. - // - // The first letter indicates which position the parameter is in. - // - // T = A = 1st position - // U = B = 2nd position - // V = C = 3rd position - // S = R = rest position - // - // The second letter indicates which whether it is a [R]esolve, Re[J]ect, or [N]otify value. - // - // The third letter indicates whether the value is returned in the [D]one filter, [F]ail filter, or [P]rogress filter. - - /** - * This object provides a subset of the methods of the Deferred object (then, done, fail, always, - * pipe, progress, state and promise) to prevent users from changing the state of the Deferred. - * - * @see \`{@link http://api.jquery.com/Types/#Promise }\` - */ - interface PromiseBase extends _Promise, PromiseLike { - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - * @see \`{@link https://api.jquery.com/deferred.always/ }\` - * @since 1.6 - */ - always(alwaysCallback: TypeOrArray>, - ...alwaysCallbacks: Array>>): this; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see \`{@link https://api.jquery.com/deferred.done/ }\` - * @since 1.5 - */ - done(doneCallback: TypeOrArray>, - ...doneCallbacks: Array>>): this; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see \`{@link https://api.jquery.com/deferred.fail/ }\` - * @since 1.5 - */ - fail(failCallback: TypeOrArray>, - ...failCallbacks: Array>>): this; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. - * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates - * progress notifications. - * @see \`{@link https://api.jquery.com/deferred.progress/ }\` - * @since 1.7 - */ - progress(progressCallback: TypeOrArray>, - ...progressCallbacks: Array>>): this; - /** - * Return a Deferred's Promise object. - * - * @param target Object onto which the promise methods have to be attached - * @see \`{@link https://api.jquery.com/deferred.promise/ }\` - * @since 1.5 - */ - promise(target: TTarget): this & TTarget; - /** - * Return a Deferred's Promise object. - * - * @see \`{@link https://api.jquery.com/deferred.promise/ }\` - * @since 1.5 - */ - promise(): this; - /** - * Determine the current state of a Deferred object. - * - * @see \`{@link https://api.jquery.com/deferred.state/ }\` - * @since 1.7 - */ - state(): 'pending' | 'resolved' | 'rejected'; - - // #region pipe - - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link then JQuery.PromiseBase.then }\`. - */ - pipe( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, - progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link then JQuery.PromiseBase.then }\`. - */ - pipe( - doneFilter: null, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, - progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link then JQuery.PromiseBase.then }\`. - */ - pipe( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter: null, - progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link then JQuery.PromiseBase.then }\`. - */ - pipe( - doneFilter: null, - failFilter: null, - progressFilter?: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link then JQuery.PromiseBase.then }\`. - */ - pipe( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, - progressFilter?: null): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link then JQuery.PromiseBase.then }\`. - */ - pipe( - doneFilter: null, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, - progressFilter?: null): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link then JQuery.PromiseBase.then }\`. - */ - pipe( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter?: null, - progressFilter?: null): PromiseBase; - - // #endregion - - // #region then - - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, - progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: null, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, - progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter: null, - progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: null, - failFilter: null, - progressFilter?: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, - progressFilter?: null): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: null, - failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, - progressFilter?: null): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, - failFilter?: null, - progressFilter?: null): PromiseBase; - - // #endregion - - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failFilter A function that is called when the Deferred is rejected. - * @see \`{@link https://api.jquery.com/deferred.catch/ }\` - * @since 3.0 - */ - catch( - failFilter?: ((t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF) | null): PromiseBase; - } - - /** - * This object provides a subset of the methods of the Deferred object (then, done, fail, always, - * pipe, progress, state and promise) to prevent users from changing the state of the Deferred. - * - * @see \`{@link http://api.jquery.com/Types/#Promise }\` - */ - interface Promise3 extends PromiseBase { } - - /** - * This object provides a subset of the methods of the Deferred object (then, done, fail, always, - * pipe, progress, state and promise) to prevent users from changing the state of the Deferred. - * - * @see \`{@link http://api.jquery.com/Types/#Promise }\` - */ - interface Promise2 extends PromiseBase { } - - /** - * This object provides a subset of the methods of the Deferred object (then, done, fail, always, - * pipe, progress, state and promise) to prevent users from changing the state of the Deferred. - * - * @see \`{@link http://api.jquery.com/Types/#Promise }\` - */ - interface Promise extends PromiseBase { } - - interface DeferredStatic { - // https://jquery.com/upgrade-guide/3.0/#callback-exit - exceptionHook: any; - (beforeStart?: (this: Deferred, deferred: Deferred) => void): Deferred; - } - - interface Deferred { - /** - * Call the progressCallbacks on a Deferred object with the given args. - * - * @param args Optional arguments that are passed to the progressCallbacks. - * @see \`{@link https://api.jquery.com/deferred.notify/ }\` - * @since 1.7 - */ - notify(...args: TN[]): this; - /** - * Call the progressCallbacks on a Deferred object with the given context and args. - * - * @param context Context passed to the progressCallbacks as the this object. - * @param args An optional array of arguments that are passed to the progressCallbacks. - * @see \`{@link https://api.jquery.com/deferred.notifyWith/ }\` - * @since 1.7 - */ - notifyWith(context: object, args?: ArrayLike): this; - /** - * Reject a Deferred object and call any failCallbacks with the given args. - * - * @param args Optional arguments that are passed to the failCallbacks. - * @see \`{@link https://api.jquery.com/deferred.reject/ }\` - * @since 1.5 - */ - reject(...args: TJ[]): this; - /** - * Reject a Deferred object and call any failCallbacks with the given context and args. - * - * @param context Context passed to the failCallbacks as the this object. - * @param args An optional array of arguments that are passed to the failCallbacks. - * @see \`{@link https://api.jquery.com/deferred.rejectWith/ }\` - * @since 1.5 - */ - rejectWith(context: object, args?: ArrayLike): this; - /** - * Resolve a Deferred object and call any doneCallbacks with the given args. - * - * @param args Optional arguments that are passed to the doneCallbacks. - * @see \`{@link https://api.jquery.com/deferred.resolve/ }\` - * @since 1.5 - */ - resolve(...args: TR[]): this; - /** - * Resolve a Deferred object and call any doneCallbacks with the given context and args. - * - * @param context Context passed to the doneCallbacks as the this object. - * @param args An optional array of arguments that are passed to the doneCallbacks. - * @see \`{@link https://api.jquery.com/deferred.resolveWith/ }\` - * @since 1.5 - */ - resolveWith(context: object, args?: ArrayLike): this; - - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - * @see \`{@link https://api.jquery.com/deferred.always/ }\` - * @since 1.6 - */ - always(alwaysCallback: TypeOrArray>, - ...alwaysCallbacks: Array>>): this; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see \`{@link https://api.jquery.com/deferred.done/ }\` - * @since 1.5 - */ - done(doneCallback: TypeOrArray>, - ...doneCallbacks: Array>>): this; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see \`{@link https://api.jquery.com/deferred.fail/ }\` - * @since 1.5 - */ - fail(failCallback: TypeOrArray>, - ...failCallbacks: Array>>): this; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. - * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates - * progress notifications. - * @see \`{@link https://api.jquery.com/deferred.progress/ }\` - * @since 1.7 - */ - progress(progressCallback: TypeOrArray>, - ...progressCallbacks: Array>>): this; - /** - * Return a Deferred's Promise object. - * - * @param target Object onto which the promise methods have to be attached - * @see \`{@link https://api.jquery.com/deferred.promise/ }\` - * @since 1.5 - */ - promise(target: TTarget): Promise & TTarget; - /** - * Return a Deferred's Promise object. - * - * @see \`{@link https://api.jquery.com/deferred.promise/ }\` - * @since 1.5 - */ - promise(): Promise; - /** - * Determine the current state of a Deferred object. - * - * @see \`{@link https://api.jquery.com/deferred.state/ }\` - * @since 1.7 - */ - state(): 'pending' | 'resolved' | 'rejected'; - - // #region pipe - - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link JQuery.Deferred.then }\`. - */ - pipe( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, - progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link JQuery.Deferred.then }\`. - */ - pipe( - doneFilter: null, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, - progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link JQuery.Deferred.then }\`. - */ - pipe( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter: null, - progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link JQuery.Deferred.then }\`. - */ - pipe( - doneFilter: null, - failFilter: null, - progressFilter?: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link JQuery.Deferred.then }\`. - */ - pipe( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, - progressFilter?: null): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link JQuery.Deferred.then }\`. - */ - pipe( - doneFilter: null, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, - progressFilter?: null): PromiseBase; - /** - * Utility method to filter and/or chain Deferreds. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` - * @since 1.6 - * @since 1.7 - * - * @deprecated Deprecated since 1.8. Use \`{@link JQuery.Deferred.then }\`. - */ - pipe( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter?: null, - progressFilter?: null): PromiseBase; - - // #endregion - - // #region then - - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, - progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: null, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, - progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter: null, - progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: null, - failFilter: null, - progressFilter?: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, - progressFilter?: null): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: null, - failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, - progressFilter?: null): PromiseBase; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter An optional function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - * @see \`{@link https://api.jquery.com/deferred.then/ }\` - * @since 1.8 - */ - then( - doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, - failFilter?: null, - progressFilter?: null): PromiseBase; - - // #endregion - - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failFilter A function that is called when the Deferred is rejected. - * @see \`{@link https://api.jquery.com/deferred.catch/ }\` - * @since 3.0 - */ - catch( - failFilter?: ((...t: TJ[]) => PromiseBase | Thenable | ARF) | null): PromiseBase; - } - - namespace Deferred { - interface CallbackBase { - (t: T, u: U, v: V, ...r: R[]): void; - } - - interface Callback3 extends CallbackBase { } - - interface Callback { - (...args: T[]): void; - } - - /** - * @deprecated Use \`{@link JQuery.Deferred.Callback }\`. - */ - interface DoneCallback extends Callback { } - - /** - * @deprecated Use \`{@link JQuery.Deferred.Callback }\`. - */ - interface FailCallback extends Callback { } - - /** - * @deprecated Use \`{@link JQuery.Deferred.Callback }\`. - */ - interface AlwaysCallback extends Callback { } - - /** - * @deprecated Use \`{@link JQuery.Deferred.Callback }\`. - */ - interface ProgressCallback extends Callback { } - } - - // #endregion - - // #region Effects - - type Duration = number | 'fast' | 'slow'; - // TODO: Is the first element always a string or is that specific to the 'fx' queue? - type Queue = { 0: string; } & Array>; - - interface QueueFunction { - (this: TElement, next: () => void): void; - } - - /** - * @see \`{@link https://api.jquery.com/animate/#animate-properties-options }\` - */ - interface EffectsOptions { - /** - * A function to be called when the animation on an element completes or stops without completing (its - * Promise object is either resolved or rejected). - */ - always?(this: TElement, animation: Promise, jumpedToEnd: boolean): void; - /** - * A function that is called once the animation on an element is complete. - */ - complete?(this: TElement): void; - /** - * A function to be called when the animation on an element completes (its Promise object is resolved). - */ - done?(this: TElement, animation: Promise, jumpedToEnd: boolean): void; - /** - * A string or number determining how long the animation will run. - */ - duration?: Duration; - /** - * A string indicating which easing function to use for the transition. - */ - easing?: string; - /** - * A function to be called when the animation on an element fails to complete (its Promise object is rejected). - */ - fail?(this: TElement, animation: Promise, jumpedToEnd: boolean): void; - /** - * A function to be called after each step of the animation, only once per animated element regardless - * of the number of animated properties. - */ - progress?(this: TElement, animation: Promise, progress: number, remainingMs: number): void; - /** - * A Boolean indicating whether to place the animation in the effects queue. If false, the animation - * will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case - * the animation is added to the queue represented by that string. When a custom queue name is used the - * animation does not automatically start; you must call .dequeue("queuename") to start it. - */ - queue?: boolean | string; - /** - * An object containing one or more of the CSS properties defined by the properties argument and their - * corresponding easing functions. - */ - specialEasing?: PlainObject; - /** - * A function to call when the animation on an element begins. - */ - start?(this: TElement, animation: Promise): void; - /** - * A function to be called for each animated property of each animated element. This function provides - * an opportunity to modify the Tween object to change the value of the property before it is set. - */ - step?(this: TElement, now: number, tween: Tween): void; - } - - interface SpeedSettings { - /** - * A string or number determining how long the animation will run. - */ - duration?: Duration; - /** - * A string indicating which easing function to use for the transition. - */ - easing?: string; - /** - * A function to call once the animation is complete. - */ - complete?(this: TElement): void; - } - - // This should be a class but doesn't work correctly under the JQuery namespace. Tween should be an inner class of jQuery. - // Undocumented - // https://github.com/jquery/api.jquery.com/issues/391 - // https://github.com/jquery/api.jquery.com/issues/61 - interface Tween { - easing: string; - elem: TElement; - end: number; - now: number; - options: EffectsOptions; - pos: number; - prop: string; - start: number; - unit: string; - } - - interface AnimationHook { - (fx: Tween): void; - } - - // #endregion - - // #region Events - - // #region Event - - // This should be a class but doesn't work correctly under the JQuery namespace. Event should be an inner class of jQuery. - - // Static members - interface EventStatic { - // tslint:disable-next-line:no-unnecessary-generics - (event: string, properties?: T): Event & T; - // tslint:disable-next-line:no-unnecessary-generics - (properties: T): Event & T; - // tslint:disable-next-line:no-unnecessary-generics - new (event: string, properties?: T): Event & T; - // tslint:disable-next-line:no-unnecessary-generics - new (properties: T): Event & T; - } - - // Instance members - interface Event { - /** - * Indicates whether the META key was pressed when the event fired. - * - * @see \`{@link https://api.jquery.com/event.metaKey/ }\` - * @since 1.0.4 - */ - metaKey: boolean; - /** - * The namespace specified when the event was triggered. - * - * @see \`{@link https://api.jquery.com/event.namespace/ }\` - * @since 1.4.3 - */ - namespace: string; - /** - * The mouse position relative to the left edge of the document. - * - * @see \`{@link https://api.jquery.com/event.pageX/ }\` - * @since 1.0.4 - */ - pageX: number; - /** - * The mouse position relative to the top edge of the document. - * - * @see \`{@link https://api.jquery.com/event.pageY/ }\` - * @since 1.0.4 - */ - pageY: number; - /** - * The last value returned by an event handler that was triggered by this event, unless the value was undefined. - * - * @see \`{@link https://api.jquery.com/event.result/ }\` - * @since 1.3 - */ - result: any; - /** - * The difference in milliseconds between the time the browser created the event and January 1, 1970. - * - * @see \`{@link https://api.jquery.com/event.timeStamp/ }\` - * @since 1.2.6 - */ - timeStamp: number; - /** - * Describes the nature of the event. - * - * @see \`{@link https://api.jquery.com/event.type/ }\` - * @since 1.0 - */ - type: string; - /** - * For key or mouse events, this property indicates the specific key or button that was pressed. - * - * @see \`{@link https://api.jquery.com/event.which/ }\` - * @since 1.1.3 - */ - which: number; - /** - * Returns whether event.preventDefault() was ever called on this event object. - * - * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\` - * @since 1.3 - */ - isDefaultPrevented(): boolean; - /** - * Returns whether event.stopImmediatePropagation() was ever called on this event object. - * - * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\` - * @since 1.3 - */ - isImmediatePropagationStopped(): boolean; - /** - * Returns whether event.stopPropagation() was ever called on this event object. - * - * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\` - * @since 1.3 - */ - isPropagationStopped(): boolean; - /** - * If this method is called, the default action of the event will not be triggered. - * - * @see \`{@link https://api.jquery.com/event.preventDefault/ }\` - * @since 1.0 - */ - preventDefault(): void; - /** - * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. - * - * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\` - * @since 1.3 - */ - stopImmediatePropagation(): void; - /** - * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. - * - * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\` - * @since 1.0 - */ - stopPropagation(): void; - } - - // Generic members - interface Event extends Partial> { - /** - * The current DOM element within the event bubbling phase. - * - * @see \`{@link https://api.jquery.com/event.currentTarget/ }\` - * @since 1.3 - */ - currentTarget: TTarget; - /** - * An optional object of data passed to an event method when the current executing handler is bound. - * - * @see \`{@link https://api.jquery.com/event.data/ }\` - * @since 1.1 - */ - data: TData; - /** - * The element where the currently-called jQuery event handler was attached. - * - * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\` - * @since 1.7 - */ - delegateTarget: TTarget; - originalEvent: _Event; - /** - * The other DOM element involved in the event, if any. - * - * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\` - * @since 1.1.4 - */ - relatedTarget: TTarget | null; - /** - * The DOM element that initiated the event. - * - * @see \`{@link https://api.jquery.com/event.target/ }\` - * @since 1.0 - */ - target: TTarget; - } - - interface EventLike { - type: string; - } - - // #endregion - - interface EventHandler extends EventHandlerBase> { } - - interface EventHandlerBase { - // Extra parameters can be passed from trigger() - (this: TContext, t: T, ...args: any[]): void | false | any; - } - - // #endregion - - interface NameValuePair { - name: string; - value: string; - } - - interface Coordinates { - left: number; - top: number; - } - - // Workaround for TypeScript 2.3 which does not have support for weak types handling. - type CoordinatesPartial = - Pick | - Pick | - { [key: string]: never; }; - - interface ValHook { - get?(elem: TElement): any; - set?(elem: TElement, value: any): any; - } -} - -// #region Legacy types - -// tslint:disable-next-line:no-empty-interface -interface JQueryCallback extends JQuery.Callbacks { } -interface JQueryDeferred extends JQuery.Deferred { } -// tslint:disable-next-line:no-empty-interface -interface JQueryEventConstructor extends JQuery.EventStatic { } -interface JQueryDeferred extends JQuery.Deferred { } -// tslint:disable-next-line:no-empty-interface -interface JQueryAjaxSettings extends JQuery.AjaxSettings { } -interface JQueryAnimationOptions extends JQuery.EffectsOptions { } -// tslint:disable-next-line:no-empty-interface -interface JQueryCoordinates extends JQuery.Coordinates { } -interface JQueryGenericPromise extends JQuery.Thenable { } -// tslint:disable-next-line:no-empty-interface -interface JQueryXHR extends JQuery.jqXHR { } -interface JQueryPromise extends JQuery.Promise { } -// tslint:disable-next-line:no-empty-interface -interface JQuerySerializeArrayElement extends JQuery.NameValuePair { } - -/** - * @deprecated Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`. - */ -// tslint:disable-next-line:no-empty-interface -interface JQuerySupport extends JQuery.PlainObject { } - -// Legacy types that are not represented in the current type definitions are marked deprecated. - -/** - * @deprecated Use \`{@link JQuery.Deferred.Callback }\` or \`{@link JQuery.Deferred.CallbackBase }\`. - */ -interface JQueryPromiseCallback { - (value?: T, ...args: any[]): void; -} -/** - * @deprecated Use \`{@link JQueryStatic.param JQueryStatic['param']}\`. - */ -interface JQueryParam { - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. - */ - (obj: any, traditional?: boolean): string; -} -/** - * @deprecated Use \`{@link JQuery.Event }\`. - */ -interface BaseJQueryEventObject extends Event { - /** - * The current DOM element within the event bubbling phase. - * @see \`{@link https://api.jquery.com/event.currentTarget/ }\` - */ - currentTarget: Element; - /** - * An optional object of data passed to an event method when the current executing handler is bound. - * @see \`{@link https://api.jquery.com/event.data/ }\` - */ - data: any; - /** - * The element where the currently-called jQuery event handler was attached. - * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\` - */ - delegateTarget: Element; - /** - * Returns whether event.preventDefault() was ever called on this event object. - * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\` - */ - isDefaultPrevented(): boolean; - /** - * Returns whether event.stopImmediatePropagation() was ever called on this event object. - * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\` - */ - isImmediatePropagationStopped(): boolean; - /** - * Returns whether event.stopPropagation() was ever called on this event object. - * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\` - */ - isPropagationStopped(): boolean; - /** - * The namespace specified when the event was triggered. - * @see \`{@link https://api.jquery.com/event.namespace/ }\` - */ - namespace: string; - /** - * The browser's original Event object. - * @see \`{@link https://api.jquery.com/category/events/event-object/ }\` - */ - originalEvent: Event; - /** - * If this method is called, the default action of the event will not be triggered. - * @see \`{@link https://api.jquery.com/event.preventDefault/ }\` - */ - preventDefault(): any; - /** - * The other DOM element involved in the event, if any. - * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\` - */ - relatedTarget: Element; - /** - * The last value returned by an event handler that was triggered by this event, unless the value was undefined. - * @see \`{@link https://api.jquery.com/event.result/ }\` - */ - result: any; - /** - * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. - * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\` - */ - stopImmediatePropagation(): void; - /** - * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. - * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\` - */ - stopPropagation(): void; - /** - * The DOM element that initiated the event. - * @see \`{@link https://api.jquery.com/event.target/ }\` - */ - target: Element; - /** - * The mouse position relative to the left edge of the document. - * @see \`{@link https://api.jquery.com/event.pageX/ }\` - */ - pageX: number; - /** - * The mouse position relative to the top edge of the document. - * @see \`{@link https://api.jquery.com/event.pageY/ }\` - */ - pageY: number; - /** - * For key or mouse events, this property indicates the specific key or button that was pressed. - * @see \`{@link https://api.jquery.com/event.which/ }\` - */ - which: number; - /** - * Indicates whether the META key was pressed when the event fired. - * @see \`{@link https://api.jquery.com/event.metaKey/ }\` - */ - metaKey: boolean; -} -/** - * @deprecated Use \`{@link JQuery.Event }\`. - */ -interface JQueryInputEventObject extends BaseJQueryEventObject { - altKey: boolean; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; -} -/** - * @deprecated Use \`{@link JQuery.Event }\`. - */ -interface JQueryMouseEventObject extends JQueryInputEventObject { - button: number; - clientX: number; - clientY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; -} -/** - * @deprecated Use \`{@link JQuery.Event }\`. - */ -interface JQueryKeyEventObject extends JQueryInputEventObject { - char: any; - charCode: number; - key: any; - keyCode: number; -} -/** - * @deprecated Use \`{@link JQuery.Event }\`. - */ -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { } -/** - * @deprecated - */ -interface JQueryPromiseOperator { - (callback1: JQuery.TypeOrArray>, - ...callbacksN: Array>>): JQueryPromise; -} -/** - * @deprecated Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`. - */ -interface JQueryEasingFunction { - (percent: number): number; -} -/** - * @deprecated Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`. - */ -interface JQueryEasingFunctions { - [name: string]: JQueryEasingFunction; - linear: JQueryEasingFunction; - swing: JQueryEasingFunction; -} - -// #endregion +export = jQuery; diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 43371f96c3..515715bf14 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -3,6 +3,91 @@ function JQueryStatic() { const jq: JQueryStatic = $; } + function ajaxSettings() { + // $ExpectType AjaxSettings + $.ajaxSettings; + } + + function Animation() { + // $ExpectType AnimationStatic + $.Animation; + } + + function Callbacks() { + // $ExpectType CallbacksStatic + $.Callbacks; + } + + function cssHooks() { + // $ExpectType CSSHooks + $.cssHooks; + } + + function cssNumber() { + // $ExpectType PlainObject + $.cssNumber; + } + + function Deferred() { + // $ExpectType DeferredStatic + $.Deferred; + } + + function easing() { + // $ExpectType Easings + $.easing; + } + + function Event() { + // $ExpectType EventStatic + $.Event; + } + + function event() { + // $ExpectType EventExtensions + $.event; + } + + function expr() { + // $ExpectType Selectors + $.expr; + } + + function fn() { + // $ExpectType JQuery + $.fn; + } + + function fx() { + // $ExpectType Effects + $.fx; + } + + function ready() { + // $ExpectType Thenable + $.ready; + } + + function support() { + // $ExpectType PlainObject + $.support; + } + + function timers() { + // $ExpectType TickFunction[] + $.timers; + } + + function Tween() { + // $ExpectType TweenStatic + $.Tween; + } + + function valHooks() { + // $ExpectType ValHooks + $.valHooks; + } + function call_signature() { // $ExpectType JQuery $('

      ', new Document()); @@ -111,123 +196,6 @@ function JQueryStatic() { } } - function ajaxSettings() { - // $ExpectType AjaxSettings - $.ajaxSettings; - } - - function Event() { - // $ExpectType EventStatic - $.Event; - } - - function cssHooks() { - // $ExpectType PlainObject> - $.cssHooks; - } - - function cssNumber() { - // $ExpectType PlainObject - $.cssNumber; - } - - function fn() { - // $ExpectType JQuery - $.fn; - } - - function fx() { - function interval() { - // $ExpectType number - $.fx.interval; - } - - function off() { - // $ExpectType boolean - $.fx.off; - } - - function step() { - // $ExpectType PlainObject> - $.fx.step; - } - } - - function ready() { - // $ExpectType Thenable - $.ready; - } - - function support() { - // $ExpectType PlainObject - $.support; - } - - function valHooks() { - // $ExpectType PlainObject> - $.valHooks; - } - - function Callbacks() { - // $ExpectType Callbacks - $.Callbacks('once'); - - // $ExpectType Callbacks - $.Callbacks(); - } - - function Deferred() { - function call_signature() { - // $ExpectType Deferred - $.Deferred(function(deferred) { - // $ExpectType Deferred - this; - // $ExpectType Deferred - deferred; - }); - - // $ExpectType Deferred - $.Deferred(); - - // $ExpectType Deferred - $.Deferred(function(deferred) { - // $ExpectType Deferred - this; - // $ExpectType Deferred - deferred; - }); - - // $ExpectType Deferred - $.Deferred(); - - // $ExpectType Deferred - $.Deferred(function(deferred) { - // $ExpectType Deferred - this; - // $ExpectType Deferred - deferred; - }); - - // $ExpectType Deferred - $.Deferred(); - - // $ExpectType Deferred - $.Deferred(function(deferred) { - // $ExpectType Deferred - this; - // $ExpectType Deferred - deferred; - }); - - // $ExpectType Deferred - $.Deferred(); - } - - function exceptionHook() { - $.Deferred.exceptionHook = undefined; - } - } - function ajax() { // $ExpectType jqXHR $.ajax('url', { @@ -325,6 +293,13 @@ function JQueryStatic() { $.camelCase('foo-bar'); } + function cleanData() { + const elems: ArrayLike = {} as any; + + // $ExpectType void + $.cleanData(elems); + } + function contains() { // $ExpectType boolean $.contains(new HTMLElement(), new HTMLElement()); @@ -332,21 +307,27 @@ function JQueryStatic() { function css() { // $ExpectType any - $.css(new HTMLElement(), {}); + $.css(new HTMLElement(), 'borderRadius'); } function data() { - // $ExpectType any - $.data(new HTMLElement(), 'myKey', undefined); + const element: Element | Document | Window | JQuery.PlainObject = {} as any; + + const value: string | undefined = {} as any; + // $ExpectError + $.data(element, 'myKey', value); // $ExpectType "myValue" - $.data(new HTMLElement(), 'myKey', 'myValue'); + $.data(element, 'myKey', 'myValue'); // $ExpectType any - $.data(new HTMLElement(), 'myKey'); + $.data(element, 'myKey', undefined); // $ExpectType any - $.data(new HTMLElement()); + $.data(element, 'myKey'); + + // $ExpectType any + $.data(element); } function dequeue() { @@ -482,6 +463,9 @@ function JQueryStatic() { // $ExpectType { name: string; } & EventTarget $.extend(true, t, u); + // $ExpectType JQueryStatic & { name: string; } + $.extend(true, t); + // $ExpectType any $.extend(true, t, u, v, w, x, y, z, a); @@ -503,6 +487,9 @@ function JQueryStatic() { // $ExpectType { name: string; } & EventTarget $.extend(t, u); + // $ExpectType JQueryStatic & { name: string; } + $.extend(t); + // $ExpectType any $.extend(t, u, v, w, x, y, z, a); } @@ -624,6 +611,11 @@ function JQueryStatic() { // $ExpectType jqXHR jqXHR; }); + + // $ExpectType jqXHR + $.getScript({ + url: 'url', + }); } function globalEval() { @@ -654,8 +646,10 @@ function JQueryStatic() { } function hasData() { + const element: Element | Document | Window | JQuery.PlainObject = {} as any; + // $ExpectType boolean - $.hasData(new HTMLElement()); + $.hasData(element); } function holdReady() { @@ -706,24 +700,31 @@ function JQueryStatic() { } function isNumeric() { - function type_guard(obj: boolean | number) { - if ($.isNumeric(obj)) { - // $ExpectType number - obj; - } else { - // $ExpectType boolean - obj; - } - } + // $ExpectType boolean + $.isNumeric(123); // true + + // $ExpectType boolean + $.isNumeric(0 / 0); // false + + // $ExpectType boolean + $.isNumeric('123'); // true + + // $ExpectType boolean + $.isNumeric('1s3'); // false } function isPlainObject() { - function type_guard(obj: object) { - if ($.isPlainObject(obj)) { - // $ExpectType PlainObject - obj; - } - } + // $ExpectType boolean + $.isPlainObject({}); // true + + // $ExpectType boolean + $.isPlainObject(new Object()); // true + + // $ExpectType boolean + $.isPlainObject(document); // false + + // $ExpectType boolean + $.isPlainObject(Object.create(null)); // true } function isWindow() { @@ -892,6 +893,13 @@ function JQueryStatic() { $.noConflict(); } + function nodeName() { + const node: Node = undefined!; + + // $ExpectType boolean + $.nodeName(node, 'name'); + } + function noop() { // $ExpectType undefined $.noop(); @@ -1031,23 +1039,25 @@ function JQueryStatic() { } function proxy() { - interface I1 { kind: 'I1'; } - interface I2 { kind: 'I2'; } - interface I3 { kind: 'I3'; } - interface I4 { kind: 'I4'; } - interface I5 { kind: 'I5'; } - interface I6 { kind: 'I6'; } - interface I7 { kind: 'I7'; } - interface I8 { kind: 'I8'; } + interface JContext { kind: 'JContext'; } + interface J1 { kind: 'J1'; } + interface J2 { kind: 'J2'; } + interface J3 { kind: 'J3'; } + interface J4 { kind: 'J4'; } + interface J5 { kind: 'J5'; } + interface J6 { kind: 'J6'; } + interface J7 { kind: 'J7'; } + interface J8 { kind: 'J8'; } - const a: I8 = {} as any; - const b: I7 = {} as any; - const c: I6 = {} as any; - const d: I5 = {} as any; - const e: I4 = {} as any; - const f: I3 = {} as any; - const g: I2 = {} as any; - const h: I2 = {} as any; + const context: JContext = {} as any; + const a: J8 = {} as any; + const b: J7 = {} as any; + const c: J6 = {} as any; + const d: J5 = {} as any; + const e: J4 = {} as any; + const f: J3 = {} as any; + const g: J2 = {} as any; + const h: J1 = {} as any; type A = typeof a; type B = typeof b; @@ -1056,9 +1066,8 @@ function JQueryStatic() { type E = typeof e; type F = typeof f; type G = typeof g; - type H = typeof h; - // (fn, null) + // (funсtion, null) { // $ExpectType () => void $.proxy((a, b, c, d, e, f, g) => { }, null, a, b, c, d, e, f, g); @@ -1084,203 +1093,203 @@ function JQueryStatic() { // $ExpectType () => void $.proxy(() => { }, null); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1) => { }, null, a, b, c, d); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1) => { }, null, a, b, c, d); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, t: I1) => { }, null, a, b, c); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, t: J1) => { }, null, a, b, c); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, t: I1) => { }, null, a, b); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, t: J1) => { }, null, a, b); - // $ExpectType (t: I1) => void - $.proxy((a: A, t: I1) => { }, null, a); + // $ExpectType (t: J1) => void + $.proxy((a: A, t: J1) => { }, null, a); - // $ExpectType (t: I1) => void - $.proxy((t: I1) => { }, null); + // $ExpectType (t: J1) => void + $.proxy((t: J1) => { }, null); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2) => { }, null, a, b, c, d); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2) => { }, null, a, b, c, d); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2) => { }, null, a, b, c); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2) => { }, null, a, b, c); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, t: I1, u: I2) => { }, null, a, b); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, t: J1, u: J2) => { }, null, a, b); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, t: I1, u: I2) => { }, null, a); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, t: J1, u: J2) => { }, null, a); - // $ExpectType (t: I1, u: I2) => void - $.proxy((t: I1, u: I2) => { }, null); + // $ExpectType (t: J1, u: J2) => void + $.proxy((t: J1, u: J2) => { }, null); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3) => { }, null, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3) => { }, null, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3) => { }, null, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3) => { }, null, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3) => { }, null, a, b); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3) => { }, null, a, b); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, t: I1, u: I2, v: I3) => { }, null, a); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, t: J1, u: J2, v: J3) => { }, null, a); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((t: I1, u: I2, v: I3) => { }, null); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((t: J1, u: J2, v: J3) => { }, null); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4) => { }, null, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4) => { }, null, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4) => { }, null, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4) => { }, null, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4) => { }, null, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((t: I1, u: I2, v: I3, w: I4) => { }, null); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((t: J1, u: J2, v: J3, w: J4) => { }, null); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5) => { }, null); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, null); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, null); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null); // $ExpectType (...args: any[]) => void - $.proxy((a, b, c, d, e, f, g, h, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, null, a, b, c, d, e, f, g, h); + $.proxy((a, b, c, d, e, f, g, h, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e, f, g, h); } - // (fn, undefined) + // (funсtion, undefined) { // $ExpectType () => void $.proxy((a, b, c, d, e, f, g) => { }, undefined, a, b, c, d, e, f, g); @@ -1306,428 +1315,647 @@ function JQueryStatic() { // $ExpectType () => void $.proxy(() => { }, undefined); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, c: C, t: I1) => { }, undefined, a, b, c); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, c: C, t: J1) => { }, undefined, a, b, c); - // $ExpectType (t: I1) => void - $.proxy((a: A, b: B, t: I1) => { }, undefined, a, b); + // $ExpectType (t: J1) => void + $.proxy((a: A, b: B, t: J1) => { }, undefined, a, b); - // $ExpectType (t: I1) => void - $.proxy((a: A, t: I1) => { }, undefined, a); + // $ExpectType (t: J1) => void + $.proxy((a: A, t: J1) => { }, undefined, a); - // $ExpectType (t: I1) => void - $.proxy((t: I1) => { }, undefined); + // $ExpectType (t: J1) => void + $.proxy((t: J1) => { }, undefined); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2) => { }, undefined, a, b, c); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2) => { }, undefined, a, b, c); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, b: B, t: I1, u: I2) => { }, undefined, a, b); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, b: B, t: J1, u: J2) => { }, undefined, a, b); - // $ExpectType (t: I1, u: I2) => void - $.proxy((a: A, t: I1, u: I2) => { }, undefined, a); + // $ExpectType (t: J1, u: J2) => void + $.proxy((a: A, t: J1, u: J2) => { }, undefined, a); - // $ExpectType (t: I1, u: I2) => void - $.proxy((t: I1, u: I2) => { }, undefined); + // $ExpectType (t: J1, u: J2) => void + $.proxy((t: J1, u: J2) => { }, undefined); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3) => { }, undefined, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3) => { }, undefined, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3) => { }, undefined, a, b); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3) => { }, undefined, a, b); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((a: A, t: I1, u: I2, v: I3) => { }, undefined, a); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((a: A, t: J1, u: J2, v: J3) => { }, undefined, a); - // $ExpectType (t: I1, u: I2, v: I3) => void - $.proxy((t: I1, u: I2, v: I3) => { }, undefined); + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy((t: J1, u: J2, v: J3) => { }, undefined); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4) => { }, undefined, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4) => { }, undefined, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4) => { }, undefined, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4) => void - $.proxy((t: I1, u: I2, v: I3, w: I4) => { }, undefined); + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy((t: J1, u: J2, v: J3, w: J4) => { }, undefined); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5) => { }, undefined); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, undefined); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, undefined); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a, b, c, d, e, f, g); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e, f, g); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a, b, c, d, e, f); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e, f); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a, b, c, d, e); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a, b, c, d); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a, b, c); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a, b); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a); - // $ExpectType (t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined); + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined); // $ExpectType (...args: any[]) => void - $.proxy((a, b, c, d, e, f, g, h, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, undefined, a, b, c, d, e, f, g, h); + $.proxy((a, b, c, d, e, f, g, h, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e, f, g, h); } - // (fn, context) + // (funсtion, context) { - // $ExpectType (this: {}) => void - $.proxy((a, b, c, d, e, f, g) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}) => void - $.proxy((a, b, c, d, e, f) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}) => void - $.proxy((a, b, c, d, e) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}) => void - $.proxy((a, b, c, d) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}) => void - $.proxy((a, b, c) => { }, {}, a, b, c); - - // $ExpectType (this: {}) => void - $.proxy((a, b) => { }, {}, a, b); - - // $ExpectType (this: {}) => void - $.proxy((a) => { }, {}, a); - - // $ExpectType (this: {}) => void - $.proxy(() => { }, {}); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((a: A, b: B, c: C, t: I1) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((a: A, b: B, t: I1) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((a: A, t: I1) => { }, {}, a); - - // $ExpectType (this: {}, t: I1) => void - $.proxy((t: I1) => { }, {}); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((a: A, b: B, t: I1, u: I2) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((a: A, t: I1, u: I2) => { }, {}, a); - - // $ExpectType (this: {}, t: I1, u: I2) => void - $.proxy((t: I1, u: I2) => { }, {}); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((a: A, t: I1, u: I2, v: I3) => { }, {}, a); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3) => void - $.proxy((t: I1, u: I2, v: I3) => { }, {}); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4) => { }, {}, a); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4) => void - $.proxy((t: I1, u: I2, v: I3, w: I4) => { }, {}); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}, a); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5) => { }, {}); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}, a); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6) => { }, {}); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}, a); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7) => { }, {}); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a, b, c, d, e, f, g); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a, b, c, d, e, f); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, e: E, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a, b, c, d, e); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, d: D, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a, b, c, d); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, c: C, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a, b, c); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, b: B, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a, b); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((a: A, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a); - - // $ExpectType (this: {}, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, ...args: any[]) => void - $.proxy((t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}); - - // $ExpectType (this: {}, ...args: any[]) => void - $.proxy((a, b, c, d, e, f, g, h, t: I1, u: I2, v: I3, w: I4, x: I5, y: I6, z: I7, _: I8) => { }, {}, a, b, c, d, e, f, g, h); + // $ExpectType () => void + $.proxy(function(a, b, c, d, e, f, g) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType () => void + $.proxy(function(a, b, c, d, e, f) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType () => void + $.proxy(function(a, b, c, d, e) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType () => void + $.proxy(function(a, b, c, d) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType () => void + $.proxy(function(a, b, c) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType () => void + $.proxy(function(a, b) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType () => void + $.proxy(function(a) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType () => void + $.proxy(function() { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1) => void + $.proxy(function(a: A, b: B, c: C, t: J1) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1) => void + $.proxy(function(a: A, b: B, t: J1) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1) => void + $.proxy(function(a: A, t: J1) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1) => void + $.proxy(function(t: J1) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(a: A, b: B, c: C, t: J1, u: J2) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(a: A, b: B, t: J1, u: J2) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(a: A, t: J1, u: J2) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1, u: J2) => void + $.proxy(function(t: J1, u: J2) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(a: A, t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1, u: J2, v: J3) => void + $.proxy(function(t: J1, u: J2, v: J3) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void + $.proxy(function(t: J1, u: J2, v: J3, w: J4) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void + $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void + $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a, b, c, d); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a, b, c); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a, b); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a); + + // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void + $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context); + + // $ExpectType (...args: any[]) => void + $.proxy(function(a, b, c, d, e, f, g, h, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { + // $ExpectType JContext + this; + }, context, a, b, c, d, e, f, g, h); } - // $ExpectType (this: { myFunc: () => undefined; }, ...args: any[]) => any + // $ExpectType (...args: any[]) => any $.proxy({ myFunc: $.noop }, 'myFunc', 1, 2); - // $ExpectType (this: { myFunc: () => undefined; }, ...args: any[]) => any + // $ExpectType (...args: any[]) => any $.proxy({ myFunc: $.noop }, 'myFunc'); } @@ -1762,11 +1990,13 @@ function JQueryStatic() { } function removeData() { - // $ExpectType void - $.removeData(new HTMLElement(), 'test1'); + const element: Element | Document | Window | JQuery.PlainObject = {} as any; // $ExpectType void - $.removeData(new HTMLElement()); + $.removeData(element, 'test1'); + + // $ExpectType void + $.removeData(element); } function speed() { @@ -1804,6 +2034,10 @@ function JQueryStatic() { } }); + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + $.speed(false); + // $ExpectType EffectsOptions $.speed(); } @@ -1829,15 +2063,15 @@ function JQueryStatic() { } function when() { - interface I1 { kind: 'I1'; } - interface I2 { kind: 'I2'; } - interface I3 { kind: 'I3'; } - interface I4 { kind: 'I4'; } - interface I5 { kind: 'I5'; } - interface I6 { kind: 'I6'; } - interface I7 { kind: 'I7'; } - interface I8 { kind: 'I8'; } - interface I9 { kind: 'I9'; } + interface J1 { kind: 'J1'; } + interface J2 { kind: 'J2'; } + interface J3 { kind: 'J3'; } + interface J4 { kind: 'J4'; } + interface J5 { kind: 'J5'; } + interface J6 { kind: 'J6'; } + interface J7 { kind: 'J7'; } + interface J8 { kind: 'J8'; } + interface J9 { kind: 'J9'; } function Promise3() { const t = $.ajax() as JQuery.jqXHR; @@ -1987,22 +2221,22 @@ function JQueryStatic() { } function Promise() { - const p1: JQuery.Promise = {} as any; - const p2: JQuery.Promise = {} as any; - const p3: JQuery.Promise = {} as any; + const p1: JQuery.Promise = {} as any; + const p2: JQuery.Promise = {} as any; + const p3: JQuery.Promise = {} as any; // 3 parameters { const w = $.when(p1, p2, p3); w.then((a, b, c) => { - a; // $ExpectType I1 - b; // $ExpectType I2 - c; // $ExpectType I3 + a; // $ExpectType J1 + b; // $ExpectType J2 + c; // $ExpectType J3 }, (a, b, c) => { - a; // $ExpectType I2 - b; // $ExpectType I3 - c; // $ExpectType I4 + a; // $ExpectType J2 + b; // $ExpectType J3 + c; // $ExpectType J4 }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never @@ -2015,11 +2249,11 @@ function JQueryStatic() { const w = $.when(p1, p2); w.then((a, b) => { - a; // $ExpectType I1 - b; // $ExpectType I2 + a; // $ExpectType J1 + b; // $ExpectType J2 }, (a, b) => { - a; // $ExpectType I2 - b; // $ExpectType I3 + a; // $ExpectType J2 + b; // $ExpectType J3 }, (a, b) => { a; // $ExpectType never b; // $ExpectType never @@ -2031,9 +2265,9 @@ function JQueryStatic() { const w = $.when(p1); w.then(a => { - a; // $ExpectType I1 + a; // $ExpectType J1 }, a => { - a; // $ExpectType I2 + a; // $ExpectType J2 }, a => { a; // $ExpectType never }); @@ -2041,18 +2275,18 @@ function JQueryStatic() { } function Thenable() { - const t1: JQuery.Thenable = {} as any; - const t2: JQuery.Thenable = {} as any; - const t3: JQuery.Thenable = {} as any; + const t1: JQuery.Thenable = {} as any; + const t2: JQuery.Thenable = {} as any; + const t3: JQuery.Thenable = {} as any; // 3 parameters { const w = $.when(t1, t2, t3); w.then((a, b, c) => { - a; // $ExpectType I1 - b; // $ExpectType I2 - c; // $ExpectType I3 + a; // $ExpectType J1 + b; // $ExpectType J2 + c; // $ExpectType J3 }, (a, b, c) => { a; // $ExpectType any b; // $ExpectType any @@ -2069,8 +2303,8 @@ function JQueryStatic() { const w = $.when(t1, t2); w.then((a, b) => { - a; // $ExpectType I1 - b; // $ExpectType I2 + a; // $ExpectType J1 + b; // $ExpectType J2 }, (a, b) => { a; // $ExpectType any b; // $ExpectType any @@ -2085,7 +2319,7 @@ function JQueryStatic() { const w = $.when(t1); w.then(a => { - a; // $ExpectType I1 + a; // $ExpectType J1 }, a => { a; // $ExpectType any }, a => { @@ -2610,12 +2844,29 @@ function JQuery() { } function outerHeight() { + const value: string | number = undefined!; + + // $ExpectType JQuery + $('p').outerHeight(value, true); + // $ExpectType JQuery $('p').outerHeight('200px'); // $ExpectType JQuery $('p').outerHeight(400); + // $ExpectType JQuery + $('p').outerHeight(function(index, height) { + // $ExpectType HTMLElement + this; + // $ExpectType number + index; + // $ExpectType number + height; + + return '200px'; + }, false); + // $ExpectType JQuery $('p').outerHeight(function(index, height) { // $ExpectType HTMLElement @@ -2718,12 +2969,29 @@ function JQuery() { } function outerWidth() { + const value: string | number = undefined!; + + // $ExpectType JQuery + $('p').outerWidth(value, true); + // $ExpectType JQuery $('p').outerWidth('200px'); // $ExpectType JQuery $('p').outerWidth(400); + // $ExpectType JQuery + $('p').outerWidth(function(index, width) { + // $ExpectType HTMLElement + this; + // $ExpectType number + index; + // $ExpectType number + width; + + return '200px'; + }, false); + // $ExpectType JQuery $('p').outerWidth(function(index, width) { // $ExpectType HTMLElement @@ -2930,8 +3198,9 @@ function JQuery() { function data() { function data() { - // $ExpectType any - $('p').data('myData', undefined); + const value: string | undefined = {} as any; + // $ExpectError + $('p').data('myData', value); // $ExpectType JQuery $('p').data('myData', {}); @@ -2942,6 +3211,9 @@ function JQuery() { myData2: false }); + // $ExpectType any + $('p').data('myData', undefined); + // $ExpectType any $('p').data('myData'); @@ -3611,7 +3883,7 @@ function JQuery() { function events() { // [bind() overloads] https://github.com/jquery/api.jquery.com/issues/1048 function bind() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').bind('myEvent', 'myData', function(event) { @@ -3622,8 +3894,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').bind('myEvent', 'myData', function(this: I1, event) { - // $ExpectType I1 + $('p').bind('myEvent', 'myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3638,8 +3910,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').bind('myEvent', function(this: I1, event) { - // $ExpectType I1 + $('p').bind('myEvent', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3657,8 +3929,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3673,7 +3945,7 @@ function JQuery() { } function delegate() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('table').delegate('td', 'myEvent', 'myData', function(event) { @@ -3684,8 +3956,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').delegate('td', 'myEvent', 'myData', function(this: I1, event) { - // $ExpectType I1 + $('table').delegate('td', 'myEvent', 'myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3700,8 +3972,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').delegate('td', 'myEvent', function(this: I1, event) { - // $ExpectType I1 + $('table').delegate('td', 'myEvent', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3719,8 +3991,8 @@ function JQuery() { event; }, myEvent2: false, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3733,11 +4005,11 @@ function JQuery() { function defaultContext_customData(this: HTMLElement, event: JQuery.Event) { } - function customContext_defaultData(this: I1, event: JQuery.Event) { } + function customContext_defaultData(this: J1, event: JQuery.Event) { } - function customContext_customData(this: I1, event: JQuery.Event) { } + function customContext_customData(this: J1, event: JQuery.Event) { } - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('table').off('myEvent', 'td', defaultContext_defaultData); @@ -3801,7 +4073,7 @@ function JQuery() { } function on() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('table').on('myEvent', 'td', 'myData', function(event) { @@ -3820,8 +4092,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').on('myEvent', 'td', 'myData', function(this: I1, event) { - // $ExpectType I1 + $('table').on('myEvent', 'td', 'myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3844,8 +4116,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').on('myEvent', null, 'myData', function(this: I1, event) { - // $ExpectType I1 + $('table').on('myEvent', null, 'myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3868,8 +4140,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').on('myEvent', 'td', function(this: I1, event) { - // $ExpectType I1 + $('table').on('myEvent', 'td', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3895,8 +4167,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').on('myEvent', 3, function(this: I1, event) { - // $ExpectType I1 + $('table').on('myEvent', 3, function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3943,8 +4215,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').on('myEvent', function(this: I1, event) { - // $ExpectType I1 + $('table').on('myEvent', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3962,8 +4234,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3979,8 +4251,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -3996,8 +4268,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4013,8 +4285,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4030,8 +4302,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4040,7 +4312,7 @@ function JQuery() { } function one() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('table').one('myEvent', 'td', 'myData', function(event) { @@ -4051,8 +4323,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').one('myEvent', 'td', 'myData', function(this: I1, event) { - // $ExpectType I1 + $('table').one('myEvent', 'td', 'myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4067,8 +4339,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').one('myEvent', null, 'myData', function(this: I1, event) { - // $ExpectType I1 + $('table').one('myEvent', null, 'myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4083,8 +4355,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').one('myEvent', 'td', function(this: I1, event) { - // $ExpectType I1 + $('table').one('myEvent', 'td', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4102,8 +4374,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').one('myEvent', 3, function(this: I1, event) { - // $ExpectType I1 + $('table').one('myEvent', 3, function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4118,8 +4390,8 @@ function JQuery() { }); // $ExpectType JQuery - $('table').one('myEvent', function(this: I1, event) { - // $ExpectType I1 + $('table').one('myEvent', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4137,8 +4409,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4154,8 +4426,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4171,8 +4443,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4188,8 +4460,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4205,8 +4477,8 @@ function JQuery() { // $ExpectType Event event; }, - myEvent3(this: I1, event) { - // $ExpectType I1 + myEvent3(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4227,6 +4499,9 @@ function JQuery() { // $ExpectType JQuery $('p').trigger('myEvent', 3); + // $ExpectType JQuery + $('p').trigger('myEvent', true); + // $ExpectType JQuery $('p').trigger($.Event('myEvent'), ['Custom', 'Event']); @@ -4238,6 +4513,9 @@ function JQuery() { // $ExpectType JQuery $('p').trigger($.Event('myEvent'), 3); + + // $ExpectType JQuery + $('p').trigger($.Event('myEvent'), true); } function triggerHandler() { @@ -4253,6 +4531,9 @@ function JQuery() { // $ExpectType any $('p').triggerHandler('myEvent', 3); + // $ExpectType any + $('p').triggerHandler('myEvent', true); + // $ExpectType any $('p').triggerHandler($.Event('myEvent'), ['Custom', 'Event']); @@ -4264,6 +4545,9 @@ function JQuery() { // $ExpectType any $('p').triggerHandler($.Event('myEvent'), 3); + + // $ExpectType any + $('p').triggerHandler($.Event('myEvent'), true); } function unbind() { @@ -4271,11 +4555,11 @@ function JQuery() { function defaultContext_customData(this: HTMLElement, event: JQuery.Event) { } - function customContext_defaultData(this: I1, event: JQuery.Event) { } + function customContext_defaultData(this: J1, event: JQuery.Event) { } - function customContext_customData(this: I1, event: JQuery.Event) { } + function customContext_customData(this: J1, event: JQuery.Event) { } - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').unbind('myEvent', defaultContext_defaultData); @@ -4307,11 +4591,11 @@ function JQuery() { function defaultContext_customData(this: HTMLElement, event: JQuery.Event) { } - function customContext_defaultData(this: I1, event: JQuery.Event) { } + function customContext_defaultData(this: J1, event: JQuery.Event) { } - function customContext_customData(this: I1, event: JQuery.Event) { } + function customContext_customData(this: J1, event: JQuery.Event) { } - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('table').undelegate('td', 'click', defaultContext_defaultData); @@ -4348,7 +4632,7 @@ function JQuery() { } function blur() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').blur('myData', function(event) { @@ -4359,8 +4643,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').blur('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').blur('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4375,8 +4659,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').blur(function(this: I1, event) { - // $ExpectType I1 + $('p').blur(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4390,7 +4674,7 @@ function JQuery() { } function change() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').change('myData', function(event) { @@ -4401,8 +4685,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').change('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').change('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4417,8 +4701,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').change(function(this: I1, event) { - // $ExpectType I1 + $('p').change(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4432,7 +4716,7 @@ function JQuery() { } function click() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').click('myData', function(event) { @@ -4443,8 +4727,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').click('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').click('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4459,8 +4743,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').click(function(this: I1, event) { - // $ExpectType I1 + $('p').click(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4474,7 +4758,7 @@ function JQuery() { } function contextmenu() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').contextmenu('myData', function(event) { @@ -4485,8 +4769,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').contextmenu('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').contextmenu('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4501,8 +4785,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').contextmenu(function(this: I1, event) { - // $ExpectType I1 + $('p').contextmenu(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4516,7 +4800,7 @@ function JQuery() { } function dblclick() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').dblclick('myData', function(event) { @@ -4527,8 +4811,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').dblclick('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').dblclick('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4543,8 +4827,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').dblclick(function(this: I1, event) { - // $ExpectType I1 + $('p').dblclick(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4558,7 +4842,7 @@ function JQuery() { } function focus() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').focus('myData', function(event) { @@ -4569,8 +4853,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').focus('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').focus('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4585,8 +4869,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').focus(function(this: I1, event) { - // $ExpectType I1 + $('p').focus(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4600,7 +4884,7 @@ function JQuery() { } function focusin() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').focusin('myData', function(event) { @@ -4611,8 +4895,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').focusin('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').focusin('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4627,8 +4911,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').focusin(function(this: I1, event) { - // $ExpectType I1 + $('p').focusin(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4642,7 +4926,7 @@ function JQuery() { } function focusout() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').focusout('myData', function(event) { @@ -4653,8 +4937,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').focusout('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').focusout('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4669,8 +4953,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').focusout(function(this: I1, event) { - // $ExpectType I1 + $('p').focusout(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4684,7 +4968,7 @@ function JQuery() { } function keydown() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').keydown('myData', function(event) { @@ -4695,8 +4979,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').keydown('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').keydown('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4711,8 +4995,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').keydown(function(this: I1, event) { - // $ExpectType I1 + $('p').keydown(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4726,7 +5010,7 @@ function JQuery() { } function keypress() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').keypress('myData', function(event) { @@ -4737,8 +5021,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').keypress('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').keypress('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4753,8 +5037,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').keypress(function(this: I1, event) { - // $ExpectType I1 + $('p').keypress(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4768,7 +5052,7 @@ function JQuery() { } function keyup() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').keyup('myData', function(event) { @@ -4779,8 +5063,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').keyup('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').keyup('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4795,8 +5079,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').keyup(function(this: I1, event) { - // $ExpectType I1 + $('p').keyup(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4810,7 +5094,7 @@ function JQuery() { } function mousedown() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').mousedown('myData', function(event) { @@ -4821,8 +5105,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mousedown('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').mousedown('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4837,8 +5121,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mousedown(function(this: I1, event) { - // $ExpectType I1 + $('p').mousedown(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4852,7 +5136,7 @@ function JQuery() { } function mouseenter() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').mouseenter('myData', function(event) { @@ -4863,8 +5147,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseenter('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').mouseenter('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4879,8 +5163,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseenter(function(this: I1, event) { - // $ExpectType I1 + $('p').mouseenter(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4894,7 +5178,7 @@ function JQuery() { } function mouseleave() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').mouseleave('myData', function(event) { @@ -4905,8 +5189,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseleave('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').mouseleave('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4921,8 +5205,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseleave(function(this: I1, event) { - // $ExpectType I1 + $('p').mouseleave(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4936,7 +5220,7 @@ function JQuery() { } function mousemove() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').mousemove('myData', function(event) { @@ -4947,8 +5231,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mousemove('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').mousemove('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4963,8 +5247,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mousemove(function(this: I1, event) { - // $ExpectType I1 + $('p').mousemove(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -4978,7 +5262,7 @@ function JQuery() { } function mouseout() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').mouseout('myData', function(event) { @@ -4989,8 +5273,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseout('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').mouseout('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5005,8 +5289,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseout(function(this: I1, event) { - // $ExpectType I1 + $('p').mouseout(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5020,7 +5304,7 @@ function JQuery() { } function mouseover() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').mouseover('myData', function(event) { @@ -5031,8 +5315,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseover('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').mouseover('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5047,8 +5331,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseover(function(this: I1, event) { - // $ExpectType I1 + $('p').mouseover(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5062,7 +5346,7 @@ function JQuery() { } function mouseup() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').mouseup('myData', function(event) { @@ -5073,8 +5357,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseup('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').mouseup('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5089,8 +5373,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').mouseup(function(this: I1, event) { - // $ExpectType I1 + $('p').mouseup(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5104,7 +5388,7 @@ function JQuery() { } function resize() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').resize('myData', function(event) { @@ -5115,8 +5399,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').resize('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').resize('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5131,8 +5415,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').resize(function(this: I1, event) { - // $ExpectType I1 + $('p').resize(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5146,7 +5430,7 @@ function JQuery() { } function scroll() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').scroll('myData', function(event) { @@ -5157,8 +5441,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').scroll('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').scroll('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5173,8 +5457,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').scroll(function(this: I1, event) { - // $ExpectType I1 + $('p').scroll(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5188,7 +5472,7 @@ function JQuery() { } function select() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').select('myData', function(event) { @@ -5199,8 +5483,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').select('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').select('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5215,8 +5499,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').select(function(this: I1, event) { - // $ExpectType I1 + $('p').select(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5230,7 +5514,7 @@ function JQuery() { } function submit() { - interface I1 { kind: 'I1'; } + interface J1 { kind: 'J1'; } // $ExpectType JQuery $('p').submit('myData', function(event) { @@ -5241,8 +5525,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').submit('myData', function(this: I1, event) { - // $ExpectType I1 + $('p').submit('myData', function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5257,8 +5541,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').submit(function(this: I1, event) { - // $ExpectType I1 + $('p').submit(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5272,8 +5556,8 @@ function JQuery() { } function hover() { - interface I1 { kind: 'I1'; } - interface I2 { kind: 'I2'; } + interface J1 { kind: 'J1'; } + interface J2 { kind: 'J2'; } // $ExpectType JQuery $('p').hover(function(event) { @@ -5289,8 +5573,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').hover(function(this: I1, event) { - // $ExpectType I1 + $('p').hover(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5307,21 +5591,21 @@ function JQuery() { this; // $ExpectType Event event; - }, function(this: I1, event) { - // $ExpectType I1 + }, function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; }); // $ExpectType JQuery - $('p').hover(function(this: I1, event) { - // $ExpectType I1 + $('p').hover(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; - }, function(this: I2, event) { - // $ExpectType I2 + }, function(this: J2, event) { + // $ExpectType J2 this; // $ExpectType Event event; @@ -5336,8 +5620,8 @@ function JQuery() { }, false); // $ExpectType JQuery - $('p').hover(function(this: I1, event) { - // $ExpectType I1 + $('p').hover(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5352,8 +5636,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').hover(false, function(this: I1, event) { - // $ExpectType I1 + $('p').hover(false, function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -5371,8 +5655,8 @@ function JQuery() { }); // $ExpectType JQuery - $('p').hover(function(this: I1, event) { - // $ExpectType I1 + $('p').hover(function(this: J1, event) { + // $ExpectType J1 this; // $ExpectType Event event; @@ -6526,6 +6810,25 @@ function JQuery() { } } +function JQuery_Selectors() { + function pseudos_colon() { + // $ExpectType PseudoFunctions + $.expr[':']; + } + + function filter() { + // $ExpectType FilterFunctions + $.expr.filter; + } + + function stackoverflow_50727144() { + $.extend($.expr[":"], { + containsCaseInsensitive: (elem: any, i: number, match: any, array: any) => + (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0 + }); + } +} + function JQuery_AjaxSettings() { $.ajax({ accepts: { @@ -6692,172 +6995,6 @@ function JQuery_AjaxSettings() { }); } -function JQuery_Callbacks() { - function add() { - const callbacks = $.Callbacks(); - - // $ExpectType Callbacks - callbacks.add(() => { }, [() => { }], () => { }); - - // $ExpectType Callbacks - callbacks.add(() => { }, [() => { }]); - - // $ExpectType Callbacks - callbacks.add(() => { }, () => { }); - - // $ExpectType Callbacks - callbacks.add(() => { }); - - // $ExpectType Callbacks - callbacks.add([() => { }]); - } - - function disable() { - // $ExpectType Callbacks - $.Callbacks().disable(); - } - - function disabled() { - // $ExpectType boolean - $.Callbacks().disabled(); - } - - function empty() { - // $ExpectType Callbacks - $.Callbacks().empty(); - } - - function fire() { - // $ExpectType Callbacks - $.Callbacks().fire(1); - - // $ExpectType Callbacks - $.Callbacks().fire(); - } - - function fireWith() { - // $ExpectType Callbacks - $.Callbacks().fireWith(window, [1]); - - // $ExpectType Callbacks - $.Callbacks().fireWith(window); - } - - function fired() { - // $ExpectType boolean - $.Callbacks().fired(); - } - - function has() { - // $ExpectType boolean - $.Callbacks().has(() => { }); - - // $ExpectType boolean - $.Callbacks().has(); - } - - function lock() { - // $ExpectType Callbacks - $.Callbacks().lock(); - } - - function locked() { - // $ExpectType boolean - $.Callbacks().locked(); - } - - function remove() { - // $ExpectType Callbacks - $.Callbacks().remove(() => { }, () => { }); - } -} - -function JQuery_EffectsOptions() { - $('p').show({ - always(animation, jumpToEnd) { - // $ExpectType HTMLElement - this; - // $ExpectType Promise - animation; - // $ExpectType boolean - jumpToEnd; - }, - complete() { - // $ExpectType HTMLElement - this; - }, - done(animation, jumpToEnd) { - // $ExpectType HTMLElement - this; - // $ExpectType Promise - animation; - // $ExpectType boolean - jumpToEnd; - }, - duration: 5000, - easing: 'linear', - fail(animation, jumpToEnd) { - // $ExpectType HTMLElement - this; - // $ExpectType Promise - animation; - // $ExpectType boolean - jumpToEnd; - }, - progress(animation, progress, remainingMs) { - // $ExpectType HTMLElement - this; - // $ExpectType Promise - animation; - // $ExpectType number - progress; - // $ExpectType number - remainingMs; - }, - queue: true, - specialEasing: { - width: 'linear', - height: 'easeOutBounce' - }, - start(animation) { - // $ExpectType HTMLElement - this; - // $ExpectType Promise - animation; - }, - step(now, tween) { - // $ExpectType HTMLElement - this; - // $ExpectType number - now; - // $ExpectType Tween - tween; - } - }); -} - -function JQuery_Event() { - function call_signature() { - // $ExpectType Event & Coordinates - $.Event('keydown', $('p').offset()); - - // $ExpectType Event & { type: string; } - $.Event({ - type: 'keydown' - }); - } - - function constructor() { - // $ExpectType Event & Coordinates - new $.Event('keydown', $('p').offset()); - - // $ExpectType Event & { type: string; } - new $.Event({ - type: 'keydown' - }); - } -} - function JQuery_jqXHR() { const p: JQuery.jqXHR = {} as any; @@ -7126,26 +7263,158 @@ function JQuery_jqXHR() { } } +function JQuery_CallbacksStatic() { + // $ExpectType Callbacks + $.Callbacks('once'); + + // $ExpectType Callbacks + $.Callbacks(); +} + +function JQuery_Callbacks() { + function add() { + const callbacks = $.Callbacks(); + + // $ExpectType Callbacks + callbacks.add(() => { }, [() => { }], () => { }); + + // $ExpectType Callbacks + callbacks.add(() => { }, [() => { }]); + + // $ExpectType Callbacks + callbacks.add(() => { }, () => { }); + + // $ExpectType Callbacks + callbacks.add(() => { }); + + // $ExpectType Callbacks + callbacks.add([() => { }]); + } + + function disable() { + // $ExpectType Callbacks + $.Callbacks().disable(); + } + + function disabled() { + // $ExpectType boolean + $.Callbacks().disabled(); + } + + function empty() { + // $ExpectType Callbacks + $.Callbacks().empty(); + } + + function fire() { + // $ExpectType Callbacks + $.Callbacks().fire(1); + + // $ExpectType Callbacks + $.Callbacks().fire(); + } + + function fired() { + // $ExpectType boolean + $.Callbacks().fired(); + } + + function fireWith() { + // $ExpectType Callbacks + $.Callbacks().fireWith(window, [1]); + + // $ExpectType Callbacks + $.Callbacks().fireWith(window); + } + + function has() { + // $ExpectType boolean + $.Callbacks().has(() => { }); + + // $ExpectType boolean + $.Callbacks().has(); + } + + function lock() { + // $ExpectType Callbacks + $.Callbacks().lock(); + } + + function locked() { + // $ExpectType boolean + $.Callbacks().locked(); + } + + function remove() { + // $ExpectType Callbacks + $.Callbacks().remove(() => { }, () => { }); + } +} + +function JQuery_CSSHooks() { + $.cssHooks.borderRadius = { + get(elem, computed, extra) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + computed; + // $ExpectedType any + extra; + }, + set(elem, value) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + value; + } + }; + + $.cssHooks.borderRadius = { + get(elem, computed, extra) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + computed; + // $ExpectedType any + extra; + } + }; + + $.cssHooks.borderRadius = { + set(elem, value) { + // $ExpectedType HTMLElement + elem; + // $ExpectedType any + value; + } + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + $.cssHooks.borderRadius = function get(elem: HTMLElement, computed: any, extra: any) { + return 1; + }; +} + function JQuery_Promise3() { - interface I1 { kind: 'I1'; } - interface I2 { kind: 'I2'; } - interface I3 { kind: 'I3'; } - interface I4 { kind: 'I4'; } - interface I5 { kind: 'I5'; } - interface I6 { kind: 'I6'; } - interface I7 { kind: 'I7'; } - interface I8 { kind: 'I8'; } - interface I9 { kind: 'I9'; } + interface J1 { kind: 'J1'; } + interface J2 { kind: 'J2'; } + interface J3 { kind: 'J3'; } + interface J4 { kind: 'J4'; } + interface J5 { kind: 'J5'; } + interface J6 { kind: 'J6'; } + interface J7 { kind: 'J7'; } + interface J8 { kind: 'J8'; } + interface J9 { kind: 'J9'; } - // tslint:disable-next-line:ban-types - const p: JQuery.Promise3 = {} as any; - const p1: JQuery.Promise3 = {} as any; - const p2: JQuery.Promise3 = {} as any; - const p3: JQuery.Promise3 = {} as any; + const p: JQuery.Promise3 = {} as any; + const p1: JQuery.Promise3 = {} as any; + const p2: JQuery.Promise3 = {} as any; + const p3: JQuery.Promise3 = {} as any; - const t1: JQuery.Thenable = {} as any; - const t2: JQuery.Thenable = {} as any; - const t3: JQuery.Thenable = {} as any; + const t1: JQuery.Thenable = {} as any; + const t2: JQuery.Thenable = {} as any; + const t3: JQuery.Thenable = {} as any; function then() { p.then((a, b, c) => { @@ -7155,7 +7424,7 @@ function JQuery_Promise3() { }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean @@ -7165,7 +7434,7 @@ function JQuery_Promise3() { p.then(null, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean @@ -7195,7 +7464,7 @@ function JQuery_Promise3() { }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }, null); p.then((a, b, c) => { @@ -7205,19 +7474,19 @@ function JQuery_Promise3() { }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }); p.then(null, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }, null); p.then(null, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }); p.then((a, b, c) => { @@ -7260,7 +7529,7 @@ function JQuery_Promise3() { }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean @@ -7290,7 +7559,7 @@ function JQuery_Promise3() { }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string - c; // $ExpectType Function + c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean @@ -7327,7 +7596,7 @@ function JQuery_Promise3() { }); q.then((a) => { - a; // $ExpectType I1 | I2 + a; // $ExpectType J1 | J2 }, (a) => { a; // $ExpectType never }, (a, b, c) => { @@ -7346,17 +7615,17 @@ function JQuery_Promise3() { }); q.then((a, b, c) => { - a; // $ExpectType I1 | I2 - b; // $ExpectType I4 | I5 - c; // $ExpectType I7 | I8 + a; // $ExpectType J1 | J2 + b; // $ExpectType J4 | J5 + c; // $ExpectType J7 | J8 }, (a, b, c) => { - a; // $ExpectType I2 | I3 - b; // $ExpectType I5 | I6 - c; // $ExpectType I8 | I9 + a; // $ExpectType J2 | J3 + b; // $ExpectType J5 | J6 + c; // $ExpectType J8 | J9 }, (a, b, c) => { - a; // $ExpectType I3 | I4 - b; // $ExpectType I6 | I7 - c; // $ExpectType I1 | I9 + a; // $ExpectType J3 | J4 + b; // $ExpectType J6 | J7 + c; // $ExpectType J1 | J9 }); } @@ -7369,7 +7638,7 @@ function JQuery_Promise3() { }); q.then((a) => { - a; // $ExpectType number | I1 + a; // $ExpectType number | J1 }, (a) => { a; // never }, (a, b, c) => { @@ -7388,7 +7657,7 @@ function JQuery_Promise3() { }); q.then((a) => { - a; // $ExpectType number | I1 + a; // $ExpectType number | J1 }, (a) => { a; // never }, (a, b, c) => { @@ -7407,17 +7676,17 @@ function JQuery_Promise3() { }); q.then((a, b, c) => { - a; // $ExpectType number | I1 - b; // $ExpectType I4 - c; // $ExpectType I7 + a; // $ExpectType number | J1 + b; // $ExpectType J4 + c; // $ExpectType J7 }, (a, b, c) => { - a; // $ExpectType I2 - b; // $ExpectType I5 - c; // $ExpectType I8 + a; // $ExpectType J2 + b; // $ExpectType J5 + c; // $ExpectType J8 }, (a, b, c) => { - a; // $ExpectType I3 - b; // $ExpectType I6 - c; // $ExpectType I9 + a; // $ExpectType J3 + b; // $ExpectType J6 + c; // $ExpectType J9 }); } @@ -7430,17 +7699,17 @@ function JQuery_Promise3() { }); q.then((a, b, c) => { - a; // $ExpectType number | I1 - b; // $ExpectType I4 - c; // $ExpectType I7 + a; // $ExpectType number | J1 + b; // $ExpectType J4 + c; // $ExpectType J7 }, (a, b, c) => { - a; // $ExpectType I2 - b; // $ExpectType I5 - c; // $ExpectType I8 + a; // $ExpectType J2 + b; // $ExpectType J5 + c; // $ExpectType J8 }, (a, b, c) => { - a; // $ExpectType I3 - b; // $ExpectType I6 - c; // $ExpectType I9 + a; // $ExpectType J3 + b; // $ExpectType J6 + c; // $ExpectType J9 }); } @@ -7453,17 +7722,17 @@ function JQuery_Promise3() { }); q.then((a, b, c) => { - a; // $ExpectType I1 | I2 - b; // $ExpectType I5 - c; // $ExpectType I8 + a; // $ExpectType J1 | J2 + b; // $ExpectType J5 + c; // $ExpectType J8 }, (a, b, c) => { - a; // $ExpectType I3 - b; // $ExpectType I6 - c; // $ExpectType I9 + a; // $ExpectType J3 + b; // $ExpectType J6 + c; // $ExpectType J9 }, (a, b, c) => { - a; // $ExpectType I4 - b; // $ExpectType I7 - c; // $ExpectType I1 + a; // $ExpectType J4 + b; // $ExpectType J7 + c; // $ExpectType J1 }); } @@ -7476,17 +7745,17 @@ function JQuery_Promise3() { }); q.then((a, b, c) => { - a; // $ExpectType I1 | I2 - b; // $ExpectType I4 - c; // $ExpectType I7 + a; // $ExpectType J1 | J2 + b; // $ExpectType J4 + c; // $ExpectType J7 }, (a, b, c) => { - a; // $ExpectType I2 - b; // $ExpectType I5 - c; // $ExpectType I8 + a; // $ExpectType J2 + b; // $ExpectType J5 + c; // $ExpectType J8 }, (a, b, c) => { - a; // $ExpectType I3 - b; // $ExpectType I6 - c; // $ExpectType I9 + a; // $ExpectType J3 + b; // $ExpectType J6 + c; // $ExpectType J9 }); } } @@ -7505,9 +7774,9 @@ function JQuery_Promise3() { const a = $.ajax('/echo/json').catch(() => { return t1; }); - // $ExpectType PromiseBase + // $ExpectType PromiseBase a; - const b: JQuery.Promise3 = a; + const b: JQuery.Promise3 = a; } { const a = $.ajax('/echo/json').catch(() => { @@ -7812,18 +8081,474 @@ function JQuery_Promise(p: JQuery.Promise) { } } -function JQuery_Deferred() { - interface I1 { kind: 'I1'; } - interface I2 { kind: 'I2'; } - interface I3 { kind: 'I3'; } +function JQuery_DeferredStatic() { + function exceptionHook() { + $.Deferred.exceptionHook = undefined; + } - const d1 = $.Deferred(); + function call_signature() { + // $ExpectType Deferred + $.Deferred(function(deferred) { + // $ExpectType Deferred + this; + // $ExpectType Deferred + deferred; + }); - function promise() { - const target: I1 = {} as any; + // $ExpectType Deferred + $.Deferred(); - d1.promise(target); // $ExpectType Promise & I1 + // $ExpectType Deferred + $.Deferred(function(deferred) { + // $ExpectType Deferred + this; + // $ExpectType Deferred + deferred; + }); - d1.promise(); // $ExpectType Promise + // $ExpectType Deferred + $.Deferred(); + + // $ExpectType Deferred + $.Deferred(function(deferred) { + // $ExpectType Deferred + this; + // $ExpectType Deferred + deferred; + }); + + // $ExpectType Deferred + $.Deferred(); + + // $ExpectType Deferred + $.Deferred(function(deferred) { + // $ExpectType Deferred + this; + // $ExpectType Deferred + deferred; + }); + + // $ExpectType Deferred + $.Deferred(); } } + +function JQuery_Deferred() { + interface J1 { kind: 'J1'; } + interface J2 { kind: 'J2'; } + interface J3 { kind: 'J3'; } + + const d1 = $.Deferred(); + + function promise() { + const target: J1 = {} as any; + + d1.promise(target); // $ExpectType Promise & J1 + + d1.promise(); // $ExpectType Promise + } +} + +function JQuery_EffectsOptions() { + $('p').show({ + always(animation, jumpToEnd) { + // $ExpectType HTMLElement + this; + // $ExpectType Animation + animation; + // $ExpectType boolean + jumpToEnd; + }, + complete() { + // $ExpectType HTMLElement + this; + }, + done(animation, jumpToEnd) { + // $ExpectType HTMLElement + this; + // $ExpectType Animation + animation; + // $ExpectType boolean + jumpToEnd; + }, + duration: 5000, + easing: 'linear', + fail(animation, jumpToEnd) { + // $ExpectType HTMLElement + this; + // $ExpectType Animation + animation; + // $ExpectType boolean + jumpToEnd; + }, + progress(animation, progress, remainingMs) { + // $ExpectType HTMLElement + this; + // $ExpectType Animation + animation; + // $ExpectType number + progress; + // $ExpectType number + remainingMs; + }, + queue: true, + specialEasing: { + width: 'linear', + height: 'easeOutBounce' + }, + start(animation) { + // $ExpectType HTMLElement + this; + // $ExpectType Animation + animation; + }, + step(now, tween) { + // $ExpectType HTMLElement + this; + // $ExpectType number + now; + // $ExpectType Tween + tween; + } + }); +} + +function JQuery_AnimationStatic() { + function call_signature() { + const element: HTMLElement = undefined!; + + // $ExpectType Animation + $.Animation(element, {}, {}); + } + + function prefilter() { + // https://github.com/jquery/api.jquery.com/issues/256 -> http://jsfiddle.net/y4L35/ + { + // $ExpectType void + $.Animation.prefilter(function(element: HTMLElement, properties, options) { + // $ExpectType Animation + this; + // $ExpectType HTMLElement + element; + // $ExpectType PlainObject + properties; + // $ExpectType EffectsOptions + options; + // $ExpectType any + options.removeAfter; + + if (options.removeAfter) { + this.done(() => { + $(element).remove(); + }); + } + }); + + $("#element").hide({ + duration: 500, + removeAfter: true, + complete() { + // 0, because the prefilter done happens first! + console.log($(this).parent().length); + } + }); + } + } + + function tweener() { + // $ExpectType void + $.Animation.tweener('*', function(propName, finalValue) { + // $ExpectType Animation + this; + // $ExpectType string + propName; + // $ExpectType number + finalValue; + + return this.createTween(propName, finalValue); + }); + } +} + +function JQuery_Animation() { + const element: Element = undefined!; + + const animation = $.Animation(element, {}, {}); + + animation.done((anim, jumpedToEnd) => { + // $ExpectType Animation + anim; + // $ExpectType true | undefined + jumpedToEnd; + }); + + animation.fail((anim, jumpedToEnd) => { + // $ExpectType Animation + anim; + // $ExpectType false + jumpedToEnd; + }); + + animation.always((anim, jumpedToEnd) => { + // $ExpectType Animation + anim; + // $ExpectType boolean | undefined + jumpedToEnd; + }); + + animation.progress((anim, progress, remainingMs) => { + // $ExpectType Animation + anim; + // $ExpectType number + progress; + // $ExpectType number + remainingMs; + }); +} + +function JQuery_TweenStatic() { + function propHooks() { + $.Tween.propHooks['myProp'] = { + get(tween) { + // $ExpectType Tween + tween; + + return tween.elem[tween.prop as keyof typeof tween.elem]; + }, + set(tween) { + // $ExpectType Tween + tween; + }, + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + $.Tween.propHooks['myProp'] = 1; + } + + function call_signature() { + const elem: HTMLElement = undefined!; + + // $ExpectType Tween + $.Tween(elem, {}, 'myProp', 1, 'myEasing', 'myUnit'); + + // $ExpectType Tween + $.Tween(elem, {}, 'myProp', 1, 'myEasing'); + + // $ExpectType Tween + $.Tween(elem, {}, 'myProp', 1); + } +} + +function JQuery_Easings() { + jQuery.easing.easeInCubic = (p) => { + return Math.pow(p, 3); + }; +} + +function JQuery_Effects() { + function interval() { + // $ExpectType number + $.fx.interval; + } + + function off() { + // $ExpectType boolean + $.fx.off; + } + + function step() { + // $ExpectType PlainObject> + $.fx.step; + } + + function stop() { + // $ExpectType () => void + $.fx.stop; + + function override() { + let animating: boolean; + + jQuery.fx.stop = () => { + animating = false; + }; + } + } + + function timer() { + // $ExpectType (tickFunction: TickFunction) => void + $.fx.timer; + + function override() { + let animating: boolean; + const raf: () => void = {} as any; + + jQuery.fx.timer = (timer) => { + // $ExpectType TickFunction + timer; + + if (timer() && jQuery.timers.push(timer) && !animating) { + animating = true; + raf(); + } + }; + } + } +} + +function JQuery_Event() { + function call_signature() { + // $ExpectType Event & Coordinates + $.Event('keydown', $('p').offset()); + + // $ExpectType Event & { type: string; } + $.Event({ + type: 'keydown' + }); + } + + function constructor() { + // $ExpectType Event & Coordinates + new $.Event('keydown', $('p').offset()); + + // $ExpectType Event & { type: string; } + new $.Event({ + type: 'keydown' + }); + } + + // https://stackoverflow.com/questions/49892574/trigger-a-jquery-3-event-with-ctrlkey-set + function stackoverflow_49892574() { + const event = $.Event("keydown"); + event.which = 77; + event.ctrlKey = true; + $(window).trigger(event); + } +} + +function JQuery_EventExtensions() { + function fixHooks() { + jQuery.event.fixHooks.drop = { + props: ['dataTransfer'], + filter(event, originalEvent) { + // $ExpectType Event + event; + // $ExpectType Event + originalEvent; + }, + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + jQuery.event.fixHooks.drop = ['dataTransfer']; + } + + function special() { + jQuery.event.special.multiclick = { + noBubble: true, + bindType: 'click', + delegateType: 'click', + setup(data, namespaces, eventHandle) { + // $ExpectType EventTarget + this; + // $ExpectType any + data; + // $ExpectType string + namespaces; + // $ExpectType EventHandler + eventHandle; + + return false; + }, + teardown() { + // $ExpectType EventTarget + this; + + return false; + }, + add(handleObj) { + // $ExpectType EventTarget + this; + // $ExpectType HandleObject + handleObj; + }, + remove(handleObj) { + // $ExpectType EventTarget + this; + // $ExpectType HandleObject + handleObj; + }, + trigger(event, data) { + // $ExpectType EventTarget + this; + // $ExpectType Event + event; + // $ExpectType any + data; + + return false; + }, + _default(event, data) { + // $ExpectType Event + event; + // $ExpectType any + data; + + return false; + }, + handle(event, data) { + // $ExpectType Event & { handleObj: HandleObject; } + event; + // $ExpectType any + data; + }, + preDispatch(event) { + // $ExpectType EventTarget + this; + // $ExpectType Event + event; + + return false; + }, + postDispatch(event) { + // $ExpectType EventTarget + this; + // $ExpectType Event + event; + } + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + jQuery.event.special.multiclick = 1; + } +} + +declare namespace JQuery { + interface ValHooks { + textarea: ValHook; + } +} + +function JQuery_ValHooks() { + jQuery.valHooks.textarea = { + get(elem) { + // $ExpectType HTMLTextAreaElement + elem; + + return elem.value.replace(/\r?\n/g, "\r\n"); + }, + set(elem) { + // $ExpectType HTMLTextAreaElement + elem; + + return elem.value; + } + }; + + // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. + // $ExpectError + jQuery.valHooks.textarea = function get(elem: HTMLTextAreaElement) { + return elem.value.replace(/\r?\n/g, "\r\n"); + }; +} diff --git a/types/jquery/legacy.d.ts b/types/jquery/legacy.d.ts new file mode 100644 index 0000000000..a3a98b936c --- /dev/null +++ b/types/jquery/legacy.d.ts @@ -0,0 +1,201 @@ +// tslint:disable:no-irregular-whitespace + +// tslint:disable-next-line:no-empty-interface +interface JQueryCallback extends JQuery.Callbacks { } +interface JQueryDeferred extends JQuery.Deferred { } +// tslint:disable-next-line:no-empty-interface +interface JQueryEventConstructor extends JQuery.EventStatic { } +interface JQueryDeferred extends JQuery.Deferred { } +// tslint:disable-next-line:no-empty-interface +interface JQueryAjaxSettings extends JQuery.AjaxSettings { } +interface JQueryAnimationOptions extends JQuery.EffectsOptions { } +// tslint:disable-next-line:no-empty-interface +interface JQueryCoordinates extends JQuery.Coordinates { } +interface JQueryGenericPromise extends JQuery.Thenable { } +// tslint:disable-next-line:no-empty-interface +interface JQueryXHR extends JQuery.jqXHR { } +interface JQueryPromise extends JQuery.Promise { } +// tslint:disable-next-line:no-empty-interface +interface JQuerySerializeArrayElement extends JQuery.NameValuePair { } + +/** + * @deprecated ​ Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`. + */ +// tslint:disable-next-line:no-empty-interface +interface JQuerySupport extends JQuery.PlainObject { } + +// Legacy types that are not represented in the current type definitions are marked deprecated. + +/** + * @deprecated ​ Deprecated. Use \`{@link JQuery.Deferred.Callback }\` or \`{@link JQuery.Deferred.CallbackBase }\`. + */ +interface JQueryPromiseCallback { + // tslint:disable-next-line:callable-types + (value?: T, ...args: any[]): void; +} +/** + * @deprecated ​ Deprecated. Use \`{@link JQueryStatic.param JQueryStatic['param']}\`. + */ +interface JQueryParam { + /** + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. + * @param obj An array or object to serialize. + * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. + */ + // tslint:disable-next-line:callable-types + (obj: any, traditional?: boolean): string; +} +/** + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\`. + */ +interface BaseJQueryEventObject extends Event { + /** + * The current DOM element within the event bubbling phase. + * @see \`{@link https://api.jquery.com/event.currentTarget/ }\` + */ + currentTarget: Element; + /** + * An optional object of data passed to an event method when the current executing handler is bound. + * @see \`{@link https://api.jquery.com/event.data/ }\` + */ + data: any; + /** + * The element where the currently-called jQuery event handler was attached. + * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\` + */ + delegateTarget: Element; + /** + * Returns whether event.preventDefault() was ever called on this event object. + * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\` + */ + isDefaultPrevented(): boolean; + /** + * Returns whether event.stopImmediatePropagation() was ever called on this event object. + * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\` + */ + isImmediatePropagationStopped(): boolean; + /** + * Returns whether event.stopPropagation() was ever called on this event object. + * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\` + */ + isPropagationStopped(): boolean; + /** + * The namespace specified when the event was triggered. + * @see \`{@link https://api.jquery.com/event.namespace/ }\` + */ + namespace: string; + /** + * The browser's original Event object. + * @see \`{@link https://api.jquery.com/category/events/event-object/ }\` + */ + originalEvent: Event; + /** + * If this method is called, the default action of the event will not be triggered. + * @see \`{@link https://api.jquery.com/event.preventDefault/ }\` + */ + preventDefault(): any; + /** + * The other DOM element involved in the event, if any. + * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\` + */ + relatedTarget: Element; + /** + * The last value returned by an event handler that was triggered by this event, unless the value was undefined. + * @see \`{@link https://api.jquery.com/event.result/ }\` + */ + result: any; + /** + * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. + * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\` + */ + stopImmediatePropagation(): void; + /** + * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. + * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\` + */ + stopPropagation(): void; + /** + * The DOM element that initiated the event. + * @see \`{@link https://api.jquery.com/event.target/ }\` + */ + target: Element; + /** + * The mouse position relative to the left edge of the document. + * @see \`{@link https://api.jquery.com/event.pageX/ }\` + */ + pageX: number; + /** + * The mouse position relative to the top edge of the document. + * @see \`{@link https://api.jquery.com/event.pageY/ }\` + */ + pageY: number; + /** + * For key or mouse events, this property indicates the specific key or button that was pressed. + * @see \`{@link https://api.jquery.com/event.which/ }\` + */ + which: number; + /** + * Indicates whether the META key was pressed when the event fired. + * @see \`{@link https://api.jquery.com/event.metaKey/ }\` + */ + metaKey: boolean; +} +/** + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\`. + */ +interface JQueryInputEventObject extends BaseJQueryEventObject { + altKey: boolean; + ctrlKey: boolean; + metaKey: boolean; + shiftKey: boolean; +} +/** + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\`. + */ +interface JQueryMouseEventObject extends JQueryInputEventObject { + button: number; + clientX: number; + clientY: number; + offsetX: number; + offsetY: number; + pageX: number; + pageY: number; + screenX: number; + screenY: number; +} +/** + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\`. + */ +interface JQueryKeyEventObject extends JQueryInputEventObject { + char: any; + charCode: number; + key: any; + keyCode: number; +} +/** + * @deprecated ​ Deprecated. Use \`{@link JQuery.Event }\`. + */ +interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { } +/** + * @deprecated ​ Deprecated. + */ +interface JQueryPromiseOperator { + // tslint:disable-next-line:callable-types + (callback1: JQuery.TypeOrArray>, + ...callbacksN: Array>>): JQueryPromise; +} +/** + * @deprecated ​ Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`. + */ +interface JQueryEasingFunction { + // tslint:disable-next-line:callable-types + (percent: number): number; +} +/** + * @deprecated ​ Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`. + */ +interface JQueryEasingFunctions { + [name: string]: JQueryEasingFunction; + linear: JQueryEasingFunction; + swing: JQueryEasingFunction; +} diff --git a/types/jquery/misc.d.ts b/types/jquery/misc.d.ts new file mode 100644 index 0000000000..7b09b6a4dc --- /dev/null +++ b/types/jquery/misc.d.ts @@ -0,0 +1,5012 @@ +// tslint:disable:jsdoc-format +// tslint:disable:max-line-length +// tslint:disable:no-irregular-whitespace + +declare namespace JQuery { + type TypeOrArray = T | T[]; + type Node = Element | Text | Comment | DocumentFragment; + + /** + * A string is designated htmlString in jQuery documentation when it is used to represent one or more DOM elements, typically to be created and inserted in the document. When passed as an argument of the jQuery() function, the string is identified as HTML if it starts with ) and is parsed as such until the final > character. Prior to jQuery 1.9, a string was considered to be HTML if it contained anywhere within the string. + */ + type htmlString = string; + /** + * A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most cases, the DOM document present in all browsers, but can also be an XML document received via Ajax. + */ + type Selector = string; + + /** + * The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain object is, in other words, an Object object. It is designated "plain" in jQuery documentation to distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and host objects such as document, all of which have a typeof value of "object." + * + * **Note**: The type declaration of PlainObject is imprecise. It includes host objects and user-defined arrays which do not match jQuery's definition. + */ + interface PlainObject { + [key: string]: T; + } + + interface Selectors extends Sizzle.Selectors { + /** + * @deprecated ​ Deprecated since 3.0. Use \`{@link Selectors#pseudos }\`. + * + * **Cause**: The standard way to add new custom selectors through jQuery is `jQuery.expr.pseudos`. These two other aliases are deprecated, although they still work as of jQuery 3.0. + * + * **Solution**: Rename any of the older usage to `jQuery.expr.pseudos`. The functionality is identical. + */ + ':': Sizzle.Selectors.PseudoFunctions; + /** + * @deprecated ​ Deprecated since 3.0. Use \`{@link Selectors#pseudos }\`. + * + * **Cause**: The standard way to add new custom selectors through jQuery is `jQuery.expr.pseudos`. These two other aliases are deprecated, although they still work as of jQuery 3.0. + * + * **Solution**: Rename any of the older usage to `jQuery.expr.pseudos`. The functionality is identical. + */ + filter: Sizzle.Selectors.FilterFunctions; + } + + // region Ajax + // #region Ajax + + interface AjaxSettings extends Ajax.AjaxSettingsBase { + /** + * A string containing the URL to which the request is sent. + */ + url?: string; + } + + interface UrlAjaxSettings extends Ajax.AjaxSettingsBase { + /** + * A string containing the URL to which the request is sent. + */ + url: string; + } + + namespace Ajax { + type SuccessTextStatus = 'success' | 'notmodified' | 'nocontent'; + type ErrorTextStatus = 'timeout' | 'error' | 'abort' | 'parsererror'; + type TextStatus = SuccessTextStatus | ErrorTextStatus; + + type SuccessCallback = (this: TContext, data: any, textStatus: SuccessTextStatus, jqXHR: jqXHR) => void; + + type ErrorCallback = (this: TContext, jqXHR: jqXHR, textStatus: ErrorTextStatus, errorThrown: string) => void; + + type CompleteCallback = (this: TContext, jqXHR: jqXHR, textStatus: TextStatus) => void; + + /** + * @see \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings }\` + */ + interface AjaxSettingsBase { + /** + * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept request header. This header tells the server what kind of response it will accept in return. + */ + accepts?: PlainObject; + /** + * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done(). + */ + async?: boolean; + /** + * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. + */ + beforeSend?(this: TContext, jqXHR: jqXHR, settings: this): false | void; + /** + * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. + */ + cache?: boolean; + /** + * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "nocontent", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. + */ + complete?: TypeOrArray>; + /** + * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. + */ + contents?: PlainObject; + /** + * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. Note: For cross-domain requests, setting the content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or text/plain will trigger the browser to send a preflight OPTIONS request to the server. + */ + contentType?: string | false; + /** + * This object will be the context of all Ajax-related callbacks. By default, the context is an object that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). + */ + context?: TContext; + /** + * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. + */ + converters?: PlainObject<((value: any) => any) | true>; + /** + * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. + */ + crossDomain?: boolean; + /** + * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). + */ + data?: PlainObject | string; + /** + * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. + */ + dataFilter?(data: string, type: string): any; + /** + * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). The available types (and the result passed as the first argument to your success callback) are: + * + * "xml": Returns a XML document that can be processed via jQuery. + * + * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM. + * + * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to true. Note: This will turn POSTs into GETs for remote-domain requests. + * + * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null or {} instead. (See json.org for more information on proper JSON formatting.) + * + * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true. + * + * "text": A plain text string. + * + * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it received in the Content-Type header to what you require. For example, if you want a text response to be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from jsonp to text, and then from text to xml. + */ + dataType?: 'xml' | 'html' | 'script' | 'json' | 'jsonp' | 'text' | string; + /** + * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. + */ + error?: TypeOrArray>; + /** + * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. + */ + global?: boolean; + /** + * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. + */ + headers?: PlainObject; + /** + * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. + */ + ifModified?: boolean; + /** + * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. + */ + isLocal?: boolean; + /** + * Override the callback function name in a JSONP request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax requests, consider setting the jsonp property to false for security reasons. + */ + jsonp?: string | false; + /** + * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. + */ + jsonpCallback?: string | ((this: TContext) => string); + /** + * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). + */ + method?: string; + /** + * A mime type to override the XHR mime type. + */ + mimeType?: string; + /** + * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + password?: string; + /** + * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. + */ + processData?: boolean; + /** + * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. + */ + scriptCharset?: string; + /** + * An object of numeric HTTP codes and functions to be called when the response has the corresponding code. + * + * If the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. + */ + statusCode?: StatusCodeCallbacks; + /** + * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter or the dataFilter callback function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. + */ + success?: TypeOrArray>; + /** + * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. + */ + timeout?: number; + /** + * Set this to true if you wish to use the traditional style of param serialization. + */ + traditional?: boolean; + /** + * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0. + */ + type?: string; + /** + * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + username?: string; + // ActiveXObject requires "lib": ["scripthost"] which consumers would also require + /** + * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory. + */ + xhr?(): XMLHttpRequest; + /** + * An object of fieldName-fieldValue pairs to set on the native XHR object. + * + * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. + */ + xhrFields?: XHRFields; + } + + // region StatusCodeCallbacks + // #region StatusCodeCallbacks + + type StatusCodeCallbacks = { + // region Success Status Codes + // #region Success Status Codes + + // jQuery treats 2xx and 304 status codes as a success + + 200?: SuccessCallback; + 201?: SuccessCallback; + 202?: SuccessCallback; + 203?: SuccessCallback; + 204?: SuccessCallback; + 205?: SuccessCallback; + 206?: SuccessCallback; + 207?: SuccessCallback; + 208?: SuccessCallback; + 209?: SuccessCallback; + 210?: SuccessCallback; + 211?: SuccessCallback; + 212?: SuccessCallback; + 213?: SuccessCallback; + 214?: SuccessCallback; + 215?: SuccessCallback; + 216?: SuccessCallback; + 217?: SuccessCallback; + 218?: SuccessCallback; + 219?: SuccessCallback; + 220?: SuccessCallback; + 221?: SuccessCallback; + 222?: SuccessCallback; + 223?: SuccessCallback; + 224?: SuccessCallback; + 225?: SuccessCallback; + 226?: SuccessCallback; + 227?: SuccessCallback; + 228?: SuccessCallback; + 229?: SuccessCallback; + 230?: SuccessCallback; + 231?: SuccessCallback; + 232?: SuccessCallback; + 233?: SuccessCallback; + 234?: SuccessCallback; + 235?: SuccessCallback; + 236?: SuccessCallback; + 237?: SuccessCallback; + 238?: SuccessCallback; + 239?: SuccessCallback; + 240?: SuccessCallback; + 241?: SuccessCallback; + 242?: SuccessCallback; + 243?: SuccessCallback; + 244?: SuccessCallback; + 245?: SuccessCallback; + 246?: SuccessCallback; + 247?: SuccessCallback; + 248?: SuccessCallback; + 249?: SuccessCallback; + 250?: SuccessCallback; + 251?: SuccessCallback; + 252?: SuccessCallback; + 253?: SuccessCallback; + 254?: SuccessCallback; + 255?: SuccessCallback; + 256?: SuccessCallback; + 257?: SuccessCallback; + 258?: SuccessCallback; + 259?: SuccessCallback; + 260?: SuccessCallback; + 261?: SuccessCallback; + 262?: SuccessCallback; + 263?: SuccessCallback; + 264?: SuccessCallback; + 265?: SuccessCallback; + 266?: SuccessCallback; + 267?: SuccessCallback; + 268?: SuccessCallback; + 269?: SuccessCallback; + 270?: SuccessCallback; + 271?: SuccessCallback; + 272?: SuccessCallback; + 273?: SuccessCallback; + 274?: SuccessCallback; + 275?: SuccessCallback; + 276?: SuccessCallback; + 277?: SuccessCallback; + 278?: SuccessCallback; + 279?: SuccessCallback; + 280?: SuccessCallback; + 281?: SuccessCallback; + 282?: SuccessCallback; + 283?: SuccessCallback; + 284?: SuccessCallback; + 285?: SuccessCallback; + 286?: SuccessCallback; + 287?: SuccessCallback; + 288?: SuccessCallback; + 289?: SuccessCallback; + 290?: SuccessCallback; + 291?: SuccessCallback; + 292?: SuccessCallback; + 293?: SuccessCallback; + 294?: SuccessCallback; + 295?: SuccessCallback; + 296?: SuccessCallback; + 297?: SuccessCallback; + 298?: SuccessCallback; + 299?: SuccessCallback; + 304?: SuccessCallback; + + // #endregion + + // region Error Status Codes + // #region Error Status Codes + + 300?: ErrorCallback; + 301?: ErrorCallback; + 302?: ErrorCallback; + 303?: ErrorCallback; + 305?: ErrorCallback; + 306?: ErrorCallback; + 307?: ErrorCallback; + 308?: ErrorCallback; + 309?: ErrorCallback; + 310?: ErrorCallback; + 311?: ErrorCallback; + 312?: ErrorCallback; + 313?: ErrorCallback; + 314?: ErrorCallback; + 315?: ErrorCallback; + 316?: ErrorCallback; + 317?: ErrorCallback; + 318?: ErrorCallback; + 319?: ErrorCallback; + 320?: ErrorCallback; + 321?: ErrorCallback; + 322?: ErrorCallback; + 323?: ErrorCallback; + 324?: ErrorCallback; + 325?: ErrorCallback; + 326?: ErrorCallback; + 327?: ErrorCallback; + 328?: ErrorCallback; + 329?: ErrorCallback; + 330?: ErrorCallback; + 331?: ErrorCallback; + 332?: ErrorCallback; + 333?: ErrorCallback; + 334?: ErrorCallback; + 335?: ErrorCallback; + 336?: ErrorCallback; + 337?: ErrorCallback; + 338?: ErrorCallback; + 339?: ErrorCallback; + 340?: ErrorCallback; + 341?: ErrorCallback; + 342?: ErrorCallback; + 343?: ErrorCallback; + 344?: ErrorCallback; + 345?: ErrorCallback; + 346?: ErrorCallback; + 347?: ErrorCallback; + 348?: ErrorCallback; + 349?: ErrorCallback; + 350?: ErrorCallback; + 351?: ErrorCallback; + 352?: ErrorCallback; + 353?: ErrorCallback; + 354?: ErrorCallback; + 355?: ErrorCallback; + 356?: ErrorCallback; + 357?: ErrorCallback; + 358?: ErrorCallback; + 359?: ErrorCallback; + 360?: ErrorCallback; + 361?: ErrorCallback; + 362?: ErrorCallback; + 363?: ErrorCallback; + 364?: ErrorCallback; + 365?: ErrorCallback; + 366?: ErrorCallback; + 367?: ErrorCallback; + 368?: ErrorCallback; + 369?: ErrorCallback; + 370?: ErrorCallback; + 371?: ErrorCallback; + 372?: ErrorCallback; + 373?: ErrorCallback; + 374?: ErrorCallback; + 375?: ErrorCallback; + 376?: ErrorCallback; + 377?: ErrorCallback; + 378?: ErrorCallback; + 379?: ErrorCallback; + 380?: ErrorCallback; + 381?: ErrorCallback; + 382?: ErrorCallback; + 383?: ErrorCallback; + 384?: ErrorCallback; + 385?: ErrorCallback; + 386?: ErrorCallback; + 387?: ErrorCallback; + 388?: ErrorCallback; + 389?: ErrorCallback; + 390?: ErrorCallback; + 391?: ErrorCallback; + 392?: ErrorCallback; + 393?: ErrorCallback; + 394?: ErrorCallback; + 395?: ErrorCallback; + 396?: ErrorCallback; + 397?: ErrorCallback; + 398?: ErrorCallback; + 399?: ErrorCallback; + 400?: ErrorCallback; + 401?: ErrorCallback; + 402?: ErrorCallback; + 403?: ErrorCallback; + 404?: ErrorCallback; + 405?: ErrorCallback; + 406?: ErrorCallback; + 407?: ErrorCallback; + 408?: ErrorCallback; + 409?: ErrorCallback; + 410?: ErrorCallback; + 411?: ErrorCallback; + 412?: ErrorCallback; + 413?: ErrorCallback; + 414?: ErrorCallback; + 415?: ErrorCallback; + 416?: ErrorCallback; + 417?: ErrorCallback; + 418?: ErrorCallback; + 419?: ErrorCallback; + 420?: ErrorCallback; + 421?: ErrorCallback; + 422?: ErrorCallback; + 423?: ErrorCallback; + 424?: ErrorCallback; + 425?: ErrorCallback; + 426?: ErrorCallback; + 427?: ErrorCallback; + 428?: ErrorCallback; + 429?: ErrorCallback; + 430?: ErrorCallback; + 431?: ErrorCallback; + 432?: ErrorCallback; + 433?: ErrorCallback; + 434?: ErrorCallback; + 435?: ErrorCallback; + 436?: ErrorCallback; + 437?: ErrorCallback; + 438?: ErrorCallback; + 439?: ErrorCallback; + 440?: ErrorCallback; + 441?: ErrorCallback; + 442?: ErrorCallback; + 443?: ErrorCallback; + 444?: ErrorCallback; + 445?: ErrorCallback; + 446?: ErrorCallback; + 447?: ErrorCallback; + 448?: ErrorCallback; + 449?: ErrorCallback; + 450?: ErrorCallback; + 451?: ErrorCallback; + 452?: ErrorCallback; + 453?: ErrorCallback; + 454?: ErrorCallback; + 455?: ErrorCallback; + 456?: ErrorCallback; + 457?: ErrorCallback; + 458?: ErrorCallback; + 459?: ErrorCallback; + 460?: ErrorCallback; + 461?: ErrorCallback; + 462?: ErrorCallback; + 463?: ErrorCallback; + 464?: ErrorCallback; + 465?: ErrorCallback; + 466?: ErrorCallback; + 467?: ErrorCallback; + 468?: ErrorCallback; + 469?: ErrorCallback; + 470?: ErrorCallback; + 471?: ErrorCallback; + 472?: ErrorCallback; + 473?: ErrorCallback; + 474?: ErrorCallback; + 475?: ErrorCallback; + 476?: ErrorCallback; + 477?: ErrorCallback; + 478?: ErrorCallback; + 479?: ErrorCallback; + 480?: ErrorCallback; + 481?: ErrorCallback; + 482?: ErrorCallback; + 483?: ErrorCallback; + 484?: ErrorCallback; + 485?: ErrorCallback; + 486?: ErrorCallback; + 487?: ErrorCallback; + 488?: ErrorCallback; + 489?: ErrorCallback; + 490?: ErrorCallback; + 491?: ErrorCallback; + 492?: ErrorCallback; + 493?: ErrorCallback; + 494?: ErrorCallback; + 495?: ErrorCallback; + 496?: ErrorCallback; + 497?: ErrorCallback; + 498?: ErrorCallback; + 499?: ErrorCallback; + 500?: ErrorCallback; + 501?: ErrorCallback; + 502?: ErrorCallback; + 503?: ErrorCallback; + 504?: ErrorCallback; + 505?: ErrorCallback; + 506?: ErrorCallback; + 507?: ErrorCallback; + 508?: ErrorCallback; + 509?: ErrorCallback; + 510?: ErrorCallback; + 511?: ErrorCallback; + 512?: ErrorCallback; + 513?: ErrorCallback; + 514?: ErrorCallback; + 515?: ErrorCallback; + 516?: ErrorCallback; + 517?: ErrorCallback; + 518?: ErrorCallback; + 519?: ErrorCallback; + 520?: ErrorCallback; + 521?: ErrorCallback; + 522?: ErrorCallback; + 523?: ErrorCallback; + 524?: ErrorCallback; + 525?: ErrorCallback; + 526?: ErrorCallback; + 527?: ErrorCallback; + 528?: ErrorCallback; + 529?: ErrorCallback; + 530?: ErrorCallback; + 531?: ErrorCallback; + 532?: ErrorCallback; + 533?: ErrorCallback; + 534?: ErrorCallback; + 535?: ErrorCallback; + 536?: ErrorCallback; + 537?: ErrorCallback; + 538?: ErrorCallback; + 539?: ErrorCallback; + 540?: ErrorCallback; + 541?: ErrorCallback; + 542?: ErrorCallback; + 543?: ErrorCallback; + 544?: ErrorCallback; + 545?: ErrorCallback; + 546?: ErrorCallback; + 547?: ErrorCallback; + 548?: ErrorCallback; + 549?: ErrorCallback; + 550?: ErrorCallback; + 551?: ErrorCallback; + 552?: ErrorCallback; + 553?: ErrorCallback; + 554?: ErrorCallback; + 555?: ErrorCallback; + 556?: ErrorCallback; + 557?: ErrorCallback; + 558?: ErrorCallback; + 559?: ErrorCallback; + 560?: ErrorCallback; + 561?: ErrorCallback; + 562?: ErrorCallback; + 563?: ErrorCallback; + 564?: ErrorCallback; + 565?: ErrorCallback; + 566?: ErrorCallback; + 567?: ErrorCallback; + 568?: ErrorCallback; + 569?: ErrorCallback; + 570?: ErrorCallback; + 571?: ErrorCallback; + 572?: ErrorCallback; + 573?: ErrorCallback; + 574?: ErrorCallback; + 575?: ErrorCallback; + 576?: ErrorCallback; + 577?: ErrorCallback; + 578?: ErrorCallback; + 579?: ErrorCallback; + 580?: ErrorCallback; + 581?: ErrorCallback; + 582?: ErrorCallback; + 583?: ErrorCallback; + 584?: ErrorCallback; + 585?: ErrorCallback; + 586?: ErrorCallback; + 587?: ErrorCallback; + 588?: ErrorCallback; + 589?: ErrorCallback; + 590?: ErrorCallback; + 591?: ErrorCallback; + 592?: ErrorCallback; + 593?: ErrorCallback; + 594?: ErrorCallback; + 595?: ErrorCallback; + 596?: ErrorCallback; + 597?: ErrorCallback; + 598?: ErrorCallback; + 599?: ErrorCallback; + + // #endregion + } & { + // Status codes not listed require type annotations when defining the callback + [index: number]: SuccessCallback | ErrorCallback; + }; + + // #endregion + + // Writable properties on XMLHttpRequest + interface XHRFields extends Partial> { + msCaching?: string; + } + } + + interface Transport { + send(headers: PlainObject, completeCallback: Transport.SuccessCallback): void; + abort(): void; + } + + namespace Transport { + type SuccessCallback = (status: number, statusText: Ajax.TextStatus, responses?: PlainObject, headers?: string) => void; + } + + /** + * @see \`{@link https://api.jquery.com/jquery.ajax/#jqXHR }\` + */ + interface jqXHR extends Promise3, never, + Ajax.SuccessTextStatus, Ajax.ErrorTextStatus, never, + jqXHR, string, never>, + Pick, + Partial> { + responseJSON?: any; + + /** + * Determine the current state of a Deferred object. + * @see \`{@link https://api.jquery.com/deferred.state/ }\` + * @since 1.7 + */ + state(): 'pending' | 'resolved' | 'rejected'; + statusCode(map: Ajax.StatusCodeCallbacks): void; + } + + namespace jqXHR { + interface DoneCallback> extends Deferred.Callback3 { } + + interface FailCallback extends Deferred.Callback3 { } + + interface AlwaysCallback> extends Deferred.Callback3 { } + } + + // #endregion + + // region Callbacks + // #region Callbacks + + interface CallbacksStatic { + /** + * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. + * @param flags An optional list of space-separated flags that change how the callback list behaves. + * @see \`{@link https://api.jquery.com/jQuery.Callbacks/ }\` + * @since 1.7 + */ + // tslint:disable-next-line:ban-types callable-types no-unnecessary-generics + (flags?: string): Callbacks; + } + + // tslint:disable-next-line:ban-types + interface Callbacks { + /** + * Add a callback or a collection of callbacks to a callback list. + * @param callback A function, or array of functions, that are to be added to the callback list. + * @param callbacks A function, or array of functions, that are to be added to the callback list. + * @see \`{@link https://api.jquery.com/callbacks.add/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.add() to add new callbacks to a callback list: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( "foo: " + value ); +}; +​ +// Another function to also be added to the list +var bar = function( value ) { + console.log( "bar: " + value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the function "foo" to the list +callbacks.add( foo ); +​ +// Fire the items on the list +callbacks.fire( "hello" ); +// Outputs: "foo: hello" +​ +// Add the function "bar" to the list +callbacks.add( bar ); +​ +// Fire the items on the list again +callbacks.fire( "world" ); +​ +// Outputs: +// "foo: world" +// "bar: world" +``` + */ + add(callback: TypeOrArray, ...callbacks: Array>): this; + /** + * Disable a callback list from doing anything more. + * @see \`{@link https://api.jquery.com/callbacks.disable/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.disable() to disable further calls to a callback list: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the above function to the list +callbacks.add( foo ); +​ +// Fire the items on the list +callbacks.fire( "foo" ); +// Outputs: foo +​ +// Disable further calls being possible +callbacks.disable(); +​ +// Attempt to fire with "foobar" as an argument +callbacks.fire( "foobar" ); +// foobar isn't output +``` + */ + disable(): this; + /** + * Determine if the callbacks list has been disabled. + * @see \`{@link https://api.jquery.com/callbacks.disabled/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.disabled() to determine if the callbacks list has been disabled: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( "foo:" + value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the logging function to the callback list +callbacks.add( foo ); +​ +// Fire the items on the list, passing an argument +callbacks.fire( "hello" ); +// Outputs "foo: hello" +​ +// Disable the callbacks list +callbacks.disable(); +​ +// Test the disabled state of the list +console.log ( callbacks.disabled() ); +// Outputs: true +``` + */ + disabled(): boolean; + /** + * Remove all of the callbacks from a list. + * @see \`{@link https://api.jquery.com/callbacks.empty/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.empty() to empty a list of callbacks: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value1, value2 ) { + console.log( "foo: " + value1 + "," + value2 ); +}; +​ +// Another function to also be added to the list +var bar = function( value1, value2 ) { + console.log( "bar: " + value1 + "," + value2 ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the two functions +callbacks.add( foo ); +callbacks.add( bar ); +​ +// Empty the callbacks list +callbacks.empty(); +​ +// Check to ensure all callbacks have been removed +console.log( callbacks.has( foo ) ); +// false +console.log( callbacks.has( bar ) ); +// false +``` + */ + empty(): this; + /** + * Call all of the callbacks with the given arguments. + * @param args The argument or list of arguments to pass back to the callback list. + * @see \`{@link https://api.jquery.com/callbacks.fire/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.fire() to invoke the callbacks in a list with any arguments that have been passed: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( "foo:" + value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the function "foo" to the list +callbacks.add( foo ); +​ +// Fire the items on the list +callbacks.fire( "hello" ); // Outputs: "foo: hello" +callbacks.fire( "world" ); // Outputs: "foo: world" +​ +// Add another function to the list +var bar = function( value ){ + console.log( "bar:" + value ); +}; +​ +// Add this function to the list +callbacks.add( bar ); +​ +// Fire the items on the list again +callbacks.fire( "hello again" ); +// Outputs: +// "foo: hello again" +// "bar: hello again" +``` + */ + fire(...args: any[]): this; + /** + * Determine if the callbacks have already been called at least once. + * @see \`{@link https://api.jquery.com/callbacks.fired/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.fired() to determine if the callbacks in a list have been called at least once: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( "foo:" + value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the function "foo" to the list +callbacks.add( foo ); +​ +// Fire the items on the list +callbacks.fire( "hello" ); // Outputs: "foo: hello" +callbacks.fire( "world" ); // Outputs: "foo: world" +​ +// Test to establish if the callbacks have been called +console.log( callbacks.fired() ); +``` + */ + fired(): boolean; + /** + * Call all callbacks in a list with the given context and arguments. + * @param context A reference to the context in which the callbacks in the list should be fired. + * @param args An argument, or array of arguments, to pass to the callbacks in the list. + * @see \`{@link https://api.jquery.com/callbacks.fireWith/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.fireWith() to fire a list of callbacks with a specific context and an array of arguments: +```javascript +// A sample logging function to be added to a callbacks list +var log = function( value1, value2 ) { + console.log( "Received: " + value1 + "," + value2 ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the log method to the callbacks list +callbacks.add( log ); +​ +// Fire the callbacks on the list using the context "window" +// and an arguments array +​ +callbacks.fireWith( window, [ "foo","bar" ] ); +// Outputs: "Received: foo, bar" +``` + */ + fireWith(context: object, args?: ArrayLike): this; + /** + * Determine whether or not the list has any callbacks attached. If a callback is provided as an argument, determine whether it is in a list. + * @param callback The callback to search for. + * @see \`{@link https://api.jquery.com/callbacks.has/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.has() to check if a callback list contains a specific callback: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value1, value2 ) { + console.log( "Received: " + value1 + "," + value2 ); +}; +​ +// A second function which will not be added to the list +var bar = function( value1, value2 ) { + console.log( "foobar" ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the log method to the callbacks list +callbacks.add( foo ); +​ +// Determine which callbacks are in the list +console.log( callbacks.has( foo ) ); +// true +console.log( callbacks.has( bar ) ); +// false +``` + */ + has(callback?: T): boolean; + /** + * Lock a callback list in its current state. + * @see \`{@link https://api.jquery.com/callbacks.lock/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.lock() to lock a callback list to avoid further changes being made to the list state: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( "foo:" + value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the logging function to the callback list +callbacks.add( foo ); +​ +// Fire the items on the list, passing an argument +callbacks.fire( "hello" ); +// Outputs "foo: hello" +​ +// Lock the callbacks list +callbacks.lock(); +​ +// Try firing the items again +callbacks.fire( "world" ); +​ +// As the list was locked, no items were called, +// so "world" isn't logged +``` + * @example ​ ````Use callbacks.lock() to lock a callback list with "memory," and then resume using the list: +```html + + + + + callbacks.lock demo + + + +​ +
      +​ + +​ + + +``` + */ + lock(): this; + /** + * Determine if the callbacks list has been locked. + * @see \`{@link https://api.jquery.com/callbacks.locked/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.locked() to determine the lock-state of a callback list: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( "foo: " + value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the logging function to the callback list +callbacks.add( foo ); +​ +// Fire the items on the list, passing an argument +callbacks.fire( "hello" ); +// Outputs "foo: hello" +​ +// Lock the callbacks list +callbacks.lock(); +​ +// Test the lock-state of the list +console.log ( callbacks.locked() ); +// true +``` + */ + locked(): boolean; + /** + * Remove a callback or a collection of callbacks from a callback list. + * @param callbacks A function, or array of functions, that are to be removed from the callback list. + * @see \`{@link https://api.jquery.com/callbacks.remove/ }\` + * @since 1.7 + * @example ​ ````Use callbacks.remove() to remove callbacks from a callback list: +```javascript +// A sample logging function to be added to a callbacks list +var foo = function( value ) { + console.log( "foo: " + value ); +}; +​ +var callbacks = $.Callbacks(); +​ +// Add the function "foo" to the list +callbacks.add( foo ); +​ +// Fire the items on the list +callbacks.fire( "hello" ); +// Outputs: "foo: hello" +​ +// Remove "foo" from the callback list +callbacks.remove( foo ); +​ +// Fire the items on the list again +callbacks.fire( "world" ); +​ +// Nothing output as "foo" is no longer in the list +``` + */ + remove(...callbacks: T[]): this; + } + + // #endregion + + // region CSS hooks + // #region CSS hooks + + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type CSSHook = + Partial<_CSSHook> & ( + Pick<_CSSHook, 'get'> | + Pick<_CSSHook, 'set'> + ); + + interface _CSSHook { + get(elem: TElement, computed: any, extra: any): any; + set(elem: TElement, value: any): void; + } + + interface CSSHooks { + // Set to HTMLElement to minimize breaks but should probably be Element. + [propertyName: string]: CSSHook; + } + + // #endregion + + // region Deferred + // #region Deferred + + /** + * Any object that has a then method. + */ + interface Thenable extends PromiseLike { } + + // NOTE: This is a private copy of the global Promise interface. It is used by JQuery.PromiseBase to indicate compatibility with other Promise implementations. + // The global Promise interface cannot be used directly as it may be modified, as in the case of @types/bluebird-global. + /** + * Represents the completion of an asynchronous operation + */ + interface _Promise { + readonly [Symbol.toStringTag]: "Promise"; + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): _Promise; + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): _Promise; + } + + // Type parameter guide + // -------------------- + // Each type parameter represents a parameter in one of the three possible callbacks. + // + // The first letter indicates which position the parameter is in. + // + // T = A = 1st position + // U = B = 2nd position + // V = C = 3rd position + // S = R = rest position + // + // The second letter indicates which whether it is a [R]esolve, Re[J]ect, or [N]otify value. + // + // The third letter indicates whether the value is returned in the [D]one filter, [F]ail filter, or [P]rogress filter. + + /** + * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. + * @see \`{@link https://api.jquery.com/Types/#Promise }\` + */ + interface PromiseBase extends _Promise, PromiseLike { + /** + * Add handlers to be called when the Deferred object is either resolved or rejected. + * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * @see \`{@link https://api.jquery.com/deferred.always/ }\` + * @since 1.6 + * @example ​ ````Since the jQuery.get() method returns a jqXHR object, which is derived from a Deferred object, we can attach a callback for both success and error using the deferred.always() method. +```javascript +$.get( "test.php" ).always(function() { + alert( "$.get completed with success or error callback arguments" ); +}); +``` + */ + always(alwaysCallback: TypeOrArray>, + ...alwaysCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is resolved. + * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * @see \`{@link https://api.jquery.com/deferred.done/ }\` + * @since 1.5 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach a success callback using the .done() method. +```javascript +$.get( "test.php" ).done(function() { + alert( "$.get succeeded" ); +}); +``` + * @example ​ ````Resolve a Deferred object when the user clicks a button, triggering a number of callback functions: +```html + + + + + deferred.done demo + + + +​ + +

      Ready...

      +​ + +​ + + +``` + */ + done(doneCallback: TypeOrArray>, + ...doneCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * @see \`{@link https://api.jquery.com/deferred.fail/ }\` + * @since 1.5 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred, you can attach a success and failure callback using the deferred.done() and deferred.fail() methods. +```javascript +$.get( "test.php" ) + .done(function() { + alert( "$.get succeeded" ); + }) + .fail(function() { + alert( "$.get failed!" ); + }); +``` + */ + fail(failCallback: TypeOrArray>, + ...failCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. + * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates + * progress notifications. + * @see \`{@link https://api.jquery.com/deferred.progress/ }\` + * @since 1.7 + */ + progress(progressCallback: TypeOrArray>, + ...progressCallbacks: Array>>): this; + /** + * Return a Deferred's Promise object. + * @param target Object onto which the promise methods have to be attached + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` + * @since 1.5 + * @example ​ ````Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first "wins" and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds "working..." to the document body. +```javascript +function asyncEvent() { + var dfd = jQuery.Deferred(); +​ + // Resolve after a random interval + setTimeout(function() { + dfd.resolve( "hurray" ); + }, Math.floor( 400 + Math.random() * 2000 ) ); +​ + // Reject after a random interval + setTimeout(function() { + dfd.reject( "sorry" ); + }, Math.floor( 400 + Math.random() * 2000 ) ); +​ + // Show a "working..." message every half-second + setTimeout(function working() { + if ( dfd.state() === "pending" ) { + dfd.notify( "working... " ); + setTimeout( working, 500 ); + } + }, 1 ); +​ + // Return the Promise so caller can't change the Deferred + return dfd.promise(); +} +​ +// Attach a done, fail, and progress handler for the asyncEvent +$.when( asyncEvent() ).then( + function( status ) { + alert( status + ", things are going well" ); + }, + function( status ) { + alert( status + ", you fail this time" ); + }, + function( status ) { + $( "body" ).append( status ); + } +); +``` + */ + promise(target: TTarget): this & TTarget; + /** + * Return a Deferred's Promise object. + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` + * @since 1.5 + * @example ​ ````Use the target argument to promote an existing object to a Promise: +```javascript +// Existing object +var obj = { + hello: function( name ) { + alert( "Hello " + name ); + } + }, + // Create a Deferred + defer = $.Deferred(); +​ +// Set object as a promise +defer.promise( obj ); +​ +// Resolve the deferred +defer.resolve( "John" ); +​ +// Use the object as a Promise +obj.done(function( name ) { + obj.hello( name ); // Will alert "Hello John" +}).hello( "Karl" ); // Will alert "Hello Karl" +``` + */ + promise(): this; + /** + * Determine the current state of a Deferred object. + * @see \`{@link https://api.jquery.com/deferred.state/ }\` + * @since 1.7 + */ + state(): 'pending' | 'resolved' | 'rejected'; + + // region pipe + // #region pipe + + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, + progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: null, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, + progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter: null, + progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: null, + failFilter: null, + progressFilter?: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, + progressFilter?: null): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: null, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | AJF, + progressFilter?: null): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter?: null, + progressFilter?: null): PromiseBase; + + // #endregion + + // region then + // #region then + + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method. +```javascript +$.get( "test.php" ).then( + function() { + alert( "$.get succeeded" ); + }, function() { + alert( "$.get failed!" ); + } +); +``` + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, + progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: null, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, + progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter: null, + progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: null, + failFilter: null, + progressFilter?: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method. +```javascript +$.get( "test.php" ).then( + function() { + alert( "$.get succeeded" ); + }, function() { + alert( "$.get failed!" ); + } +); +``` + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, + progressFilter?: null): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: null, + failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF, + progressFilter?: null): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase | Thenable | ARD, + failFilter?: null, + progressFilter?: null): PromiseBase; + + // #endregion + + /** + * Add handlers to be called when the Deferred object is rejected. + * @param failFilter A function that is called when the Deferred is rejected. + * @see \`{@link https://api.jquery.com/deferred.catch/ }\` + * @since 3.0 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method. +```javascript +$.get( "test.php" ) + .then( function() { + alert( "$.get succeeded" ); + } ) + .catch( function() { + alert( "$.get failed!" ); + } ); +``` + */ + catch( + failFilter?: ((t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF) | null): PromiseBase; + } + + /** + * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. + * @see \`{@link https://api.jquery.com/Types/#Promise }\` + */ + interface Promise3 extends PromiseBase { } + + /** + * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. + * @see \`{@link https://api.jquery.com/Types/#Promise }\` + */ + interface Promise2 extends PromiseBase { } + + /** + * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred. + * @see \`{@link https://api.jquery.com/Types/#Promise }\` + */ + interface Promise extends PromiseBase { } + + interface DeferredStatic { + // https://jquery.com/upgrade-guide/3.0/#callback-exit + exceptionHook: any; + /** + * A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. + * @param beforeStart A function that is called just before the constructor returns. + * @see \`{@link https://api.jquery.com/jQuery.Deferred/ }\` + * @since 1.5 + */ + (beforeStart?: (this: Deferred, deferred: Deferred) => void): Deferred; + } + + interface Deferred { + /** + * Call the progressCallbacks on a Deferred object with the given args. + * @param args Optional arguments that are passed to the progressCallbacks. + * @see \`{@link https://api.jquery.com/deferred.notify/ }\` + * @since 1.7 + */ + notify(...args: TN[]): this; + /** + * Call the progressCallbacks on a Deferred object with the given context and args. + * @param context Context passed to the progressCallbacks as the this object. + * @param args An optional array of arguments that are passed to the progressCallbacks. + * @see \`{@link https://api.jquery.com/deferred.notifyWith/ }\` + * @since 1.7 + */ + notifyWith(context: object, args?: ArrayLike): this; + /** + * Reject a Deferred object and call any failCallbacks with the given args. + * @param args Optional arguments that are passed to the failCallbacks. + * @see \`{@link https://api.jquery.com/deferred.reject/ }\` + * @since 1.5 + */ + reject(...args: TJ[]): this; + /** + * Reject a Deferred object and call any failCallbacks with the given context and args. + * @param context Context passed to the failCallbacks as the this object. + * @param args An optional array of arguments that are passed to the failCallbacks. + * @see \`{@link https://api.jquery.com/deferred.rejectWith/ }\` + * @since 1.5 + */ + rejectWith(context: object, args?: ArrayLike): this; + /** + * Resolve a Deferred object and call any doneCallbacks with the given args. + * @param args Optional arguments that are passed to the doneCallbacks. + * @see \`{@link https://api.jquery.com/deferred.resolve/ }\` + * @since 1.5 + */ + resolve(...args: TR[]): this; + /** + * Resolve a Deferred object and call any doneCallbacks with the given context and args. + * @param context Context passed to the doneCallbacks as the this object. + * @param args An optional array of arguments that are passed to the doneCallbacks. + * @see \`{@link https://api.jquery.com/deferred.resolveWith/ }\` + * @since 1.5 + */ + resolveWith(context: object, args?: ArrayLike): this; + + /** + * Add handlers to be called when the Deferred object is either resolved or rejected. + * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * @see \`{@link https://api.jquery.com/deferred.always/ }\` + * @since 1.6 + * @example ​ ````Since the jQuery.get() method returns a jqXHR object, which is derived from a Deferred object, we can attach a callback for both success and error using the deferred.always() method. +```javascript +$.get( "test.php" ).always(function() { + alert( "$.get completed with success or error callback arguments" ); +}); +``` + */ + always(alwaysCallback: TypeOrArray>, + ...alwaysCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is resolved. + * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * @see \`{@link https://api.jquery.com/deferred.done/ }\` + * @since 1.5 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach a success callback using the .done() method. +```javascript +$.get( "test.php" ).done(function() { + alert( "$.get succeeded" ); +}); +``` + * @example ​ ````Resolve a Deferred object when the user clicks a button, triggering a number of callback functions: +```html + + + + + deferred.done demo + + + +​ + +

      Ready...

      +​ + +​ + + +``` + */ + done(doneCallback: TypeOrArray>, + ...doneCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * @see \`{@link https://api.jquery.com/deferred.fail/ }\` + * @since 1.5 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred, you can attach a success and failure callback using the deferred.done() and deferred.fail() methods. +```javascript +$.get( "test.php" ) + .done(function() { + alert( "$.get succeeded" ); + }) + .fail(function() { + alert( "$.get failed!" ); + }); +``` + */ + fail(failCallback: TypeOrArray>, + ...failCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. + * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates + * progress notifications. + * @see \`{@link https://api.jquery.com/deferred.progress/ }\` + * @since 1.7 + */ + progress(progressCallback: TypeOrArray>, + ...progressCallbacks: Array>>): this; + /** + * Return a Deferred's Promise object. + * @param target Object onto which the promise methods have to be attached + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` + * @since 1.5 + * @example ​ ````Use the target argument to promote an existing object to a Promise: +```javascript +// Existing object +var obj = { + hello: function( name ) { + alert( "Hello " + name ); + } + }, + // Create a Deferred + defer = $.Deferred(); +​ +// Set object as a promise +defer.promise( obj ); +​ +// Resolve the deferred +defer.resolve( "John" ); +​ +// Use the object as a Promise +obj.done(function( name ) { + obj.hello( name ); // Will alert "Hello John" +}).hello( "Karl" ); // Will alert "Hello Karl" +``` + */ + promise(target: TTarget): Promise & TTarget; + /** + * Return a Deferred's Promise object. + * @see \`{@link https://api.jquery.com/deferred.promise/ }\` + * @since 1.5 + * @example ​ ````Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first "wins" and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds "working..." to the document body. +```javascript +function asyncEvent() { + var dfd = jQuery.Deferred(); +​ + // Resolve after a random interval + setTimeout(function() { + dfd.resolve( "hurray" ); + }, Math.floor( 400 + Math.random() * 2000 ) ); +​ + // Reject after a random interval + setTimeout(function() { + dfd.reject( "sorry" ); + }, Math.floor( 400 + Math.random() * 2000 ) ); +​ + // Show a "working..." message every half-second + setTimeout(function working() { + if ( dfd.state() === "pending" ) { + dfd.notify( "working... " ); + setTimeout( working, 500 ); + } + }, 1 ); +​ + // Return the Promise so caller can't change the Deferred + return dfd.promise(); +} +​ +// Attach a done, fail, and progress handler for the asyncEvent +$.when( asyncEvent() ).then( + function( status ) { + alert( status + ", things are going well" ); + }, + function( status ) { + alert( status + ", you fail this time" ); + }, + function( status ) { + $( "body" ).append( status ); + } +); +``` + */ + promise(): Promise; + /** + * Determine the current state of a Deferred object. + * @see \`{@link https://api.jquery.com/deferred.state/ }\` + * @since 1.7 + */ + state(): 'pending' | 'resolved' | 'rejected'; + + // region pipe + // #region pipe + + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, + progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: null, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, + progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter: null, + progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: null, + failFilter: null, + progressFilter?: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, + progressFilter?: null): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: null, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | AJF, + progressFilter?: null): PromiseBase; + /** + * Utility method to filter and/or chain Deferreds. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.pipe/ }\` + * @since 1.6 + * @since 1.7 + * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`. + * + * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function. + * + * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0. + * @example ​ ````Filter resolve value: +```javascript +var defer = $.Deferred(), + filtered = defer.pipe(function( value ) { + return value * 2; + }); +​ +defer.resolve( 5 ); +filtered.done(function( value ) { + alert( "Value is ( 2*5 = ) 10: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.pipe(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + pipe( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter?: null, + progressFilter?: null): PromiseBase; + + // #endregion + + // region then + // #region then + + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method. +```javascript +$.get( "test.php" ).then( + function() { + alert( "$.get succeeded" ); + }, function() { + alert( "$.get failed!" ); + } +); +``` + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, + progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: null, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, + progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter: null, + progressFilter: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: null, + failFilter: null, + progressFilter?: (...t: TN[]) => PromiseBase | Thenable | ANP): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method. +```javascript +$.get( "test.php" ).then( + function() { + alert( "$.get succeeded" ); + }, function() { + alert( "$.get failed!" ); + } +); +``` + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, + progressFilter?: null): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter reject value: +```javascript +var defer = $.Deferred(), + filtered = defer.then( null, function( value ) { + return value * 3; + }); +​ +defer.reject( 6 ); +filtered.fail(function( value ) { + alert( "Value is ( 3*6 = ) 18: " + value ); +}); +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: null, + failFilter: (...t: TJ[]) => PromiseBase | Thenable | ARF, + progressFilter?: null): PromiseBase; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see \`{@link https://api.jquery.com/deferred.then/ }\` + * @since 1.8 + * @example ​ ````Filter the resolve value: +```html + + + + + deferred.then demo + + + +​ + +

      +​ + +​ + + +``` + * @example ​ ````Chain tasks: +```javascript +var request = $.ajax( url, { dataType: "json" } ), + chained = request.then(function( data ) { + return $.ajax( url2, { data: { user: data.userId } } ); + }); +​ +chained.done(function( data ) { + // data retrieved from url2 as provided by the first request +}); +``` + */ + then( + doneFilter: (...t: TR[]) => PromiseBase | Thenable | ARD, + failFilter?: null, + progressFilter?: null): PromiseBase; + + // #endregion + + /** + * Add handlers to be called when the Deferred object is rejected. + * @param failFilter A function that is called when the Deferred is rejected. + * @see \`{@link https://api.jquery.com/deferred.catch/ }\` + * @since 3.0 + * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method. +```javascript +$.get( "test.php" ) + .then( function() { + alert( "$.get succeeded" ); + } ) + .catch( function() { + alert( "$.get failed!" ); + } ); +``` + */ + catch( + failFilter?: ((...t: TJ[]) => PromiseBase | Thenable | ARF) | null): PromiseBase; + } + + namespace Deferred { + type CallbackBase = (t: T, u: U, v: V, ...r: R[]) => void; + + interface Callback3 extends CallbackBase { } + + type Callback = (...args: T[]) => void; + + /** + * @deprecated ​ Deprecated. Use \`{@link Callback }\`. + */ + interface DoneCallback extends Callback { } + + /** + * @deprecated ​ Deprecated. Use \`{@link Callback }\`. + */ + interface FailCallback extends Callback { } + + /** + * @deprecated ​ Deprecated. Use \`{@link Callback }\`. + */ + interface AlwaysCallback extends Callback { } + + /** + * @deprecated ​ Deprecated. Use \`{@link Callback }\`. + */ + interface ProgressCallback extends Callback { } + } + + // #endregion + + // region Effects + // #region Effects + + type Duration = number | 'fast' | 'slow'; + + /** + * @see \`{@link https://api.jquery.com/animate/#animate-properties-options }\` + */ + interface EffectsOptions extends PlainObject { + /** + * A function to be called when the animation on an element completes or stops without completing (its Promise object is either resolved or rejected). + */ + always?(this: TElement, animation: Animation, jumpedToEnd: boolean): void; + /** + * A function that is called once the animation on an element is complete. + */ + complete?(this: TElement): void; + /** + * A function to be called when the animation on an element completes (its Promise object is resolved). + */ + done?(this: TElement, animation: Animation, jumpedToEnd: boolean): void; + /** + * A string or number determining how long the animation will run. + */ + duration?: Duration; + /** + * A string indicating which easing function to use for the transition. + */ + easing?: string; + /** + * A function to be called when the animation on an element fails to complete (its Promise object is rejected). + */ + fail?(this: TElement, animation: Animation, jumpedToEnd: boolean): void; + /** + * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. + */ + progress?(this: TElement, animation: Animation, progress: number, remainingMs: number): void; + /** + * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. + */ + queue?: boolean | string; + /** + * An object containing one or more of the CSS properties defined by the properties argument and their corresponding easing functions. + */ + specialEasing?: PlainObject; + /** + * A function to call when the animation on an element begins. + */ + start?(this: TElement, animation: Animation): void; + /** + * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. + */ + step?(this: TElement, now: number, tween: Tween): void; + } + + // region Animation + // #region Animation + + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + interface AnimationStatic { + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + (element: TElement, props: PlainObject, opts: EffectsOptions): Animation; + /** + * During the initial setup, `jQuery.Animation` will call any callbacks that have been registered through `jQuery.Animation.prefilter( function( element, props, opts ) )`. + * @param callback The prefilter will have `this` set to an animation object, and you can modify any of the `props` or + * `opts` however you need. The prefilter _may_ return its own promise which also implements `stop()`, + * in which case, processing of prefilters stops. If the prefilter is not trying to override the animation + * entirely, it should return `undefined` or some other falsy value. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#prefilters }\` + * @since 1.8 + */ + prefilter( + callback: (this: Animation, element: TElement, props: PlainObject, opts: EffectsOptions) => Animation | _Falsy | void, + prepend?: boolean + ): void; + /** + * A "Tweener" is a function responsible for creating a tween object, and you might want to override these if you want to implement complex values ( like a clip/transform array matrix ) in a single property. + * + * You can override the default process for creating a tween in order to provide your own tween object by using `jQuery.Animation.tweener( props, callback( prop, value ) )`. + * @param props A space separated list of properties to be passed to your tweener, or `"*"` if it should be called + * for all properties. + * @param callback The callback will be called with `this` being an `Animation` object. The tweener function will + * generally start with `var tween = this.createTween( prop, value );`, but doesn't nessecarily need to + * use the `jQuery.Tween()` factory. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweeners }\` + * @since 1.8 + */ + tweener(props: string, callback: Tweener): void; + } + + /** + * The promise will be resolved when the animation reaches its end, and rejected when terminated early. The context of callbacks attached to the promise will be the element, and the arguments will be the `Animation` object and a boolean `jumpedToEnd` which when true means the animation was stopped with `gotoEnd`, when `undefined` the animation completed naturally. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + interface Animation extends Promise3< + Animation, Animation, Animation, + true | undefined, false, number, + never, never, number + > { + /** + * The duration specified in ms + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + duration: number; + /** + * The element being animatied + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + elem: TElement; + /** + * The final value of each property animating + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + props: PlainObject; + /** + * The animation options + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + opts: EffectsOptions; + /** + * The original properties before being filtered + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + originalProps: PlainObject; + /** + * The original options before being filtered + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + originalOpts: EffectsOptions; + /** + * The numeric value of `new Date()` when the animation began + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + startTime: number; + /** + * The animations tweens. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + tweens: Array>; + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + createTween(propName: string, finalValue: number): Tween; + /** + * Stops the animation early, optionally going to the end. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\` + * @since 1.8 + */ + stop(gotoEnd: boolean): this; + } + + /** + * A "Tweener" is a function responsible for creating a tween object, and you might want to override these if you want to implement complex values ( like a clip/transform array matrix ) in a single property. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweeners }\` + * @since 1.8 + */ + type Tweener = (this: Animation, propName: string, finalValue: number) => Tween; + + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + interface TweenStatic { + /** + * `jQuery.Tween.propHooks[ prop ]` is a hook point that replaces `jQuery.fx.step[ prop ]` (which is being deprecated.) These hooks are used by the tween to get and set values on elements. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\` + * @since 1.8 + * @example +```javascript +jQuery.Tween.propHooks[ property ] = { + get: function( tween ) { + // get tween.prop from tween.elem and return it + }, + set: function( tween ) { + // set tween.prop on tween.elem to tween.now + tween.unit + } +} +``` + */ + propHooks: PropHooks; + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + (elem: TElement, options: EffectsOptions, prop: string, end: number, easing?: string, unit?: string): Tween; + } + + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + // This should be a class but doesn't work correctly under the JQuery namespace. Tween should be an inner class of jQuery. + interface Tween { + /** + * The easing used + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + easing: string; + /** + * The element being animated + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + elem: TElement; + /** + * The ending value of the tween + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + end: number; + /** + * The current value of the tween + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + now: number; + /** + * A reference to the animation options + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + options: EffectsOptions; + // Undocumented. Is this intended to be public? + pos?: number; + /** + * The property being animated + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + prop: string; + /** + * The starting value of the tween + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + start: number; + /** + * The CSS unit for the tween + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + unit: string; + /** + * Reads the current value for property from the element + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + cur(): any; + /** + * Updates the value for the property on the animated elemd. + * @param progress A number from 0 to 1. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\` + * @since 1.8 + */ + run(progress: number): this; + } + + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\` + * @since 1.8 + */ + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type PropHook = { + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\` + * @since 1.8 + */ + get(tween: Tween): any; + } | { + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\` + * @since 1.8 + */ + set(tween: Tween): void; + } | { + [key: string]: never; + }; + + /** + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\` + * @since 1.8 + */ + interface PropHooks { + [property: string]: PropHook; + } + + // #endregion + + // region Easing + // #region Easing + + type EasingMethod = (percent: number) => number; + + interface Easings { + [name: string]: EasingMethod; + } + + // #endregion + + // region Effects (fx) + // #region Effects (fx) + + interface Effects { + /** + * The rate (in milliseconds) at which animations fire. + * @see \`{@link https://api.jquery.com/jQuery.fx.interval/ }\` + * @since 1.4.3 + * @deprecated ​ Deprecated since 3.0. See \`{@link https://api.jquery.com/jQuery.fx.interval/ }\`. + * + * **Cause**: As of jQuery 3.0 the `jQuery.fx.interval` property can be used to change the animation interval only on browsers that do not support the `window.requestAnimationFrame()` method. That is currently only Internet Explorer 9 and the Android Browser. Once support is dropped for these browsers, the property will serve no purpose and it will be removed. + * + * **Solution**: Find and remove code that changes or uses `jQuery.fx.interval`. If the value is being used by code in your page or a plugin, the code may be making assumptions that are no longer valid. The default value of `jQuery.fx.interval` is `13` (milliseconds), which could be used instead of accessing this property. + * @example ​ ````Cause all animations to run with less frames. +```html + + + + + jQuery.fx.interval demo + + + + +​ +

      +
      +​ + + + +``` + */ + interval: number; + /** + * Globally disable all animations. + * @see \`{@link https://api.jquery.com/jQuery.fx.off/ }\` + * @since 1.3 + * @example ​ ````Toggle animation on and off +```html + + + + + jQuery.fx.off demo + + + + +​ + + +
      +​ + + + +``` + */ + off: boolean; + /** + * @deprecated ​ Deprecated since 1.8. Use \`{@link Tween.propHooks jQuery.Tween.propHooks}\`. + * + * `jQuery.fx.step` functions are being replaced by `jQuery.Tween.propHooks` and may eventually be removed, but are still supported via the default tween propHook. + */ + step: PlainObject>; + /** + * _overridable_ Clears up the `setInterval` + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\` + * @since 1.8 + */ + stop(): void; + /** + * Calls `.run()` on each object in the `jQuery.timers` array, removing it from the array if `.run()` returns a falsy value. Calls `jQuery.fx.stop()` whenever there are no timers remaining. + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\` + * @since 1.8 + */ + tick(): void; + /** + * _overridable_ Creates a `setInterval` if one doesn't already exist, and pushes `tickFunction` to the `jQuery.timers` array. `tickFunction` should also have `anim`, `elem`, and `queue` properties that reference the animation object, animated element, and queue option to facilitate `jQuery.fn.stop()` + * + * By overriding `fx.timer` and `fx.stop` you should be able to implement any animation tick behaviour you desire. (like using `requestAnimationFrame` instead of `setTimeout`.) + * + * There is an example of overriding the timer loop in \`{@link https://github.com/gnarf37/jquery-requestAnimationFrame jquery.requestAnimationFrame}\` + * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\` + * @since 1.8 + */ + timer(tickFunction: TickFunction): void; + } + + /** + * @deprecated ​ Deprecated since 1.8. Use \`{@link Tween.propHooks jQuery.Tween.propHooks}\`. + * + * `jQuery.fx.step` functions are being replaced by `jQuery.Tween.propHooks` and may eventually be removed, but are still supported via the default tween propHook. + */ + type AnimationHook = (fx: Tween) => void; + + interface TickFunction { + anim: Animation; + elem: TElement; + queue: boolean | string; + (): any; + } + + // #endregion + + // region Queue + // #region Queue + + // TODO: Is the first element always a string or is that specific to the 'fx' queue? + type Queue = { 0: string; } & Array>; + + type QueueFunction = (this: TElement, next: () => void) => void; + + // #endregion + + // region Speed + // #region Speed + + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type SpeedSettings = { + /** + * A string or number determining how long the animation will run. + */ + duration: Duration; + } | { + /** + * A string indicating which easing function to use for the transition. + */ + easing: string; + } | { + /** + * A function to call once the animation is complete. + */ + complete(this: TElement): void; + } | { + [key: string]: never; + }; + + // #endregion + + // #endregion + + // region Events + // #region Events + + // region Event + // #region Event + + // This should be a class but doesn't work correctly under the JQuery namespace. Event should be an inner class of jQuery. + + // Static members + interface EventStatic { + // tslint:disable-next-line:no-unnecessary-generics + (event: string, properties?: T): Event & T; + // tslint:disable-next-line:no-unnecessary-generics + (properties: T): Event & T; + // tslint:disable-next-line:no-unnecessary-generics + new (event: string, properties?: T): Event & T; + // tslint:disable-next-line:no-unnecessary-generics + new (properties: T): Event & T; + } + + // Instance members + interface Event { + // region Copied properties + // #region Copied properties + + // region Event + // #region Event + + bubbles?: boolean; + cancelable?: boolean; + eventPhase?: number; + + // #endregion + + // region UIEvent + // #region UIEvent + + detail?: number; + view?: Window; + + // #endregion + + // region MouseEvent + // #region MouseEvent + + button?: number; + buttons?: number; + clientX?: number; + clientY?: number; + offsetX?: number; + offsetY?: number; + /** + * The mouse position relative to the left edge of the document. + * @see \`{@link https://api.jquery.com/event.pageX/ }\` + * @since 1.0.4 + * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe). +```html + + + + + event.pageX demo + + + + +​ +
      +​ + +​ + + +``` + */ + pageX: number; + /** + * The mouse position relative to the top edge of the document. + * @see \`{@link https://api.jquery.com/event.pageY/ }\` + * @since 1.0.4 + * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe). +```html + + + + + event.pageY demo + + + + +​ +
      +​ + +​ + + +``` + */ + pageY: number; + screenX?: number; + screenY?: number; + /** @deprecated */ + toElement?: Element; + + // #endregion + + // region PointerEvent + // #region PointerEvent + + pointerId?: number; + pointerType?: string; + + // #endregion + + // region KeyboardEvent + // #region KeyboardEvent + + /** @deprecated */ + char?: string; + /** @deprecated */ + charCode?: number; + key?: string; + /** @deprecated */ + keyCode?: number; + + // #endregion + + // region TouchEvent + // #region TouchEvent + + changedTouches?: TouchList; + targetTouches?: TouchList; + touches?: TouchList; + + // #endregion + + // region MouseEvent, KeyboardEvent, TouchEvent + // #region MouseEvent, KeyboardEvent, TouchEvent + + altKey?: boolean; + ctrlKey?: boolean; + /** + * Indicates whether the META key was pressed when the event fired. + * @see \`{@link https://api.jquery.com/event.metaKey/ }\` + * @since 1.0.4 + * @example ​ ````Determine whether the META key was pressed when the event fired. +```html + + + + + event.metaKey demo + + + + +​ + +
      +​ + +​ + + +``` + */ + metaKey: boolean; + shiftKey?: boolean; + + // #endregion + + // #endregion + + /** + * The namespace specified when the event was triggered. + * @see \`{@link https://api.jquery.com/event.namespace/ }\` + * @since 1.4.3 + * @example ​ ````Determine the event namespace used. +```html + + + + + event.namespace demo + + + +​ + +

      +​ + +​ + + +``` + */ + namespace: string; + /** + * The last value returned by an event handler that was triggered by this event, unless the value was undefined. + * @see \`{@link https://api.jquery.com/event.result/ }\` + * @since 1.3 + * @example ​ ````Display previous handler's return value +```html + + + + + event.result demo + + + +​ + +

      +​ + +​ + + +``` + */ + result: any; + /** + * The difference in milliseconds between the time the browser created the event and January 1, 1970. + * @see \`{@link https://api.jquery.com/event.timeStamp/ }\` + * @since 1.2.6 + * @example ​ ````Display the time since the click handler last executed. +```html + + + + + event.timeStamp demo + + + + +​ +
      Click.
      +​ + +​ + + +``` + */ + timeStamp: number; + /** + * Describes the nature of the event. + * @see \`{@link https://api.jquery.com/event.type/ }\` + * @since 1.0 + * @example ​ ````On all anchor clicks, alert the event type. +```javascript +$( "a" ).click(function( event ) { + alert( event.type ); // "click" +}); +``` + */ + type: string; + /** + * For key or mouse events, this property indicates the specific key or button that was pressed. + * @see \`{@link https://api.jquery.com/event.which/ }\` + * @since 1.1.3 + * @example ​ ````Log which key was depressed. +```html + + + + + event.which demo + + + +​ + +
      +​ + +​ + + +``` + * @example ​ ````Log which mouse button was depressed. +```html + + + + + event.which demo + + + +​ + +
      +​ + +​ + + +``` + */ + which: number; + /** + * Returns whether event.preventDefault() was ever called on this event object. + * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\` + * @since 1.3 + * @example ​ ````Checks whether event.preventDefault() was called. +```javascript +$( "a" ).click(function( event ) { + alert( event.isDefaultPrevented() ); // false + event.preventDefault(); + alert( event.isDefaultPrevented() ); // true +}); +``` + */ + isDefaultPrevented(): boolean; + /** + * Returns whether event.stopImmediatePropagation() was ever called on this event object. + * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\` + * @since 1.3 + * @example ​ ````Checks whether event.stopImmediatePropagation() was called. +```html + + + + + event.isImmediatePropagationStopped demo + + + +​ + +
      + ​ + +​ + + +``` + */ + isImmediatePropagationStopped(): boolean; + /** + * Returns whether event.stopPropagation() was ever called on this event object. + * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\` + * @since 1.3 + * @example ​ ````Checks whether event.stopPropagation() was called +```html + + + + + event.isPropagationStopped demo + + + +​ + +
      + ​ + +​ + + +``` + */ + isPropagationStopped(): boolean; + /** + * If this method is called, the default action of the event will not be triggered. + * @see \`{@link https://api.jquery.com/event.preventDefault/ }\` + * @since 1.0 + * @example ​ ````Cancel the default action (navigation) of the click. +```html + + + + + event.preventDefault demo + + + +​ +default click action is prevented +
      +​ + +​ + + +``` + */ + preventDefault(): void; + /** + * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. + * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\` + * @since 1.3 + * @example ​ ````Prevents other event handlers from being called. +```html + + + + + event.stopImmediatePropagation demo + + + + +​ +

      paragraph

      +
      division
      +​ + +​ + + +``` + */ + stopImmediatePropagation(): void; + /** + * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. + * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\` + * @since 1.0 + * @example ​ ````Kill the bubbling on the click event. +```javascript +$( "p" ).click(function( event ) { + event.stopPropagation(); + // Do something +}); +``` + */ + stopPropagation(): void; + } + + // Generic members + interface Event< + TTarget = EventTarget, + TData = null + > { + /** + * The current DOM element within the event bubbling phase. + * @see \`{@link https://api.jquery.com/event.currentTarget/ }\` + * @since 1.3 + * @example ​ ````Alert that currentTarget matches the `this` keyword. +```javascript +$( "p" ).click(function( event ) { + alert( event.currentTarget === this ); // true +}); +``` + */ + currentTarget: TTarget; + /** + * An optional object of data passed to an event method when the current executing handler is bound. + * @see \`{@link https://api.jquery.com/event.data/ }\` + * @since 1.1 + * @example ​ ````Within a for loop, pass the value of i to the .on() method so that the current iteration's value is preserved. +```html + + + + + event.data demo + + + +​ + + + + + +​ +
      +​ + +​ + + +``` + */ + data: TData; + /** + * The element where the currently-called jQuery event handler was attached. + * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\` + * @since 1.7 + * @example ​ ````When a button in any box class is clicked, change the box's background color to red. +```javascript +$( ".box" ).on( "click", "button", function( event ) { + $( event.delegateTarget ).css( "background-color", "red" ); +}); +``` + */ + delegateTarget: TTarget; + originalEvent: _Event; + /** + * The other DOM element involved in the event, if any. + * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\` + * @since 1.1.4 + * @example ​ ````On mouseout of anchors, alert the element type being entered. +```javascript +$( "a" ).mouseout(function( event ) { + alert( event.relatedTarget.nodeName ); // "DIV" +}); +``` + */ + relatedTarget: TTarget | null; + /** + * The DOM element that initiated the event. + * @see \`{@link https://api.jquery.com/event.target/ }\` + * @since 1.0 + * @example ​ ````Display the tag's name on click +```html + + + + + event.target demo + + + + +​ +
      +
      +

      + click +

      +
      +​ + +​ + + +``` + * @example ​ ````Implements a simple event delegation: The click handler is added to an unordered list, and the children of its li children are hidden. Clicking one of the li children toggles (see toggle()) their children. +```html + + + + + event.target demo + + + +​ +
        +
      • item 1 +
          +
        • sub item 1-a
        • +
        • sub item 1-b
        • +
        +
      • +
      • item 2 +
          +
        • sub item 2-a
        • +
        • sub item 2-b
        • +
        +
      • +
      +​ + +​ + + +``` + */ + target: TTarget; + } + + interface EventLike { + type: string; + } + + // #endregion + + interface EventHandler extends EventHandlerBase> { } + + // Extra parameters can be passed from trigger() + type EventHandlerBase = (this: TContext, t: T, ...args: any[]) => any; + + // region Event extensions + // #region Event extensions + + interface EventExtensions { + /** + * jQuery defines an \`{@link https://api.jquery.com/category/events/event-object/ Event object}\` that represents a cross-browser subset of the information available when an event occurs. The `jQuery.event.props` property is an array of string names for properties that are always copied when jQuery processes a native browser event. (Events fired in code by `.trigger()` do not use this list, since the code can construct a `jQuery.Event` object with the needed values and trigger using that object.) + * + * To add a property name to this list, use `jQuery.event.props.push( "newPropertyName" )`. However, be aware that every event processed by jQuery will now attempt to copy this property name from the native browser event to jQuery's constructed event. If the property does not exist for that event type, it will get an undefined value. Adding many properties to this list can significantly reduce event delivery performance, so for infrequently-needed properties it is more efficient to use the value directly from `event.originalEvent` instead. If properties must be copied, you are strongly advised to use `jQuery.event.fixHooks` as of version 1.7. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#jquery-event-props-array }\` + */ + props: string[]; + /** + * The `fixHooks` interface provides a per-event-type way to extend or normalize the event object that jQuery creates when it processes a _native_ browser event. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#jquery-event-fixhooks-object }\` + */ + fixHooks: FixHooks; + /** + * The jQuery special event hooks are a set of per-event-name functions and properties that allow code to control the behavior of event processing within jQuery. The mechanism is similar to `fixHooks` in that the special event information is stored in `jQuery.event.special.NAME`, where `NAME` is the name of the special event. Event names are case sensitive. + * + * As with `fixHooks`, the special event hooks design assumes it will be very rare that two unrelated pieces of code want to process the same event name. Special event authors who need to modify events with existing hooks will need to take precautions to avoid introducing unwanted side-effects by clobbering those hooks. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#special-event-hooks }\` + */ + special: SpecialEventHooks; + } + + // region Fix hooks + // #region Fix hooks + + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type FixHook = { + /** + * Strings representing properties that should be copied from the browser's event object to the jQuery event object. If omitted, no additional properties are copied beyond the standard ones that jQuery copies and normalizes (e.g. `event.target` and `event.relatedTarget`). + */ + props: string[]; + } | { + /** + * jQuery calls this function after it constructs the `jQuery.Event` object, copies standard properties from `jQuery.event.props`, and copies the `fixHooks`-specific props (if any) specified above. The function can create new properties on the event object or modify existing ones. The second argument is the browser's native event object, which is also available in `event.originalEvent`. + * + * Note that for all events, the browser's native event object is available in `event.originalEvent`; if the jQuery event handler examines the properties there instead of jQuery's normalized `event` object, there is no need to create a `fixHooks` entry to copy or modify the properties. + * @example ​ ````For example, to set a hook for the "drop" event that copies the `dataTransfer` property, assign an object to `jQuery.event.fixHooks.drop`: +```javascript +jQuery.event.fixHooks.drop = { + props: [ "dataTransfer" ] +}; +``` + +Since fixHooks is an advanced feature and rarely used externally, jQuery does not include code or +interfaces to deal with conflict resolution. If there is a chance that some other code may be assigning +`fixHooks` to the same events, the code should check for an existing hook and take appropriate measures. +A simple solution might look like this: + +```javascript +if ( jQuery.event.fixHooks.drop ) { + throw new Error( "Someone else took the jQuery.event.fixHooks.drop hook!" ); +} + +jQuery.event.fixHooks.drop = { + props: [ "dataTransfer" ] +}; +``` + +When there are known cases of different plugins wanting to attach to the drop hook, this solution might be more appropriate: + +```javascript +var existingHook = jQuery.event.fixHooks.drop; + +if ( !existingHook ) { + jQuery.event.fixHooks.drop = { + props: [ "dataTransfer" ] + }; +} else { + if ( existingHook.props ) { + existingHook.props.push( "dataTransfer" ); + } else { + existingHook.props = [ "dataTransfer" ]; + } +} +``` + */ + filter(event: Event, originalEvent: _Event): void; + } | { + [key: string]: never; + }; + + /** + * The `fixHooks` interface provides a per-event-type way to extend or normalize the event object that jQuery creates when it processes a _native_ browser event. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#jquery-event-fixhooks-object }\` + */ + interface FixHooks { + [event: string]: FixHook; + } + + // #endregion + + // region Special event hooks + // #region Special event hooks + + /** + * The jQuery special event hooks are a set of per-event-name functions and properties that allow code to control the behavior of event processing within jQuery. The mechanism is similar to `fixHooks` in that the special event information is stored in `jQuery.event.special.NAME`, where `NAME` is the name of the special event. Event names are case sensitive. + * + * As with `fixHooks`, the special event hooks design assumes it will be very rare that two unrelated pieces of code want to process the same event name. Special event authors who need to modify events with existing hooks will need to take precautions to avoid introducing unwanted side-effects by clobbering those hooks. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#special-event-hooks }\` + */ + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type SpecialEventHook = { + /** + * Indicates whether this event type should be bubbled when the `.trigger()` method is called; by default it is `false`, meaning that a triggered event will bubble to the element's parents up to the document (if attached to a document) and then to the window. Note that defining `noBubble` on an event will effectively prevent that event from being used for delegated events with `.trigger()`. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#nobubble-boolean }\` + */ + noBubble: boolean; + } | { + /** + * When defined, these string properties specify that a special event should be handled like another event type until the event is delivered. The `bindType` is used if the event is attached directly, and the `delegateType` is used for delegated events. These types are generally DOM event types, and _should not_ be a special event themselves. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\` + */ + bindType: string; + } | { + /** + * When defined, these string properties specify that a special event should be handled like another event type until the event is delivered. The `bindType` is used if the event is attached directly, and the `delegateType` is used for delegated events. These types are generally DOM event types, and _should not_ be a special event themselves. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\` + */ + delegateType: string; + } | { + /** + * The setup hook is called the first time an event of a particular type is attached to an element; this provides the hook an opportunity to do processing that will apply to all events of this type on this element. The `this` keyword will be a reference to the element where the event is being attached and `eventHandle` is jQuery's event handler function. In most cases the `namespaces` argument should not be used, since it only represents the namespaces of the _first_ event being attached; subsequent events may not have this same namespaces. + * + * This hook can perform whatever processing it desires, including attaching its own event handlers to the element or to other elements and recording setup information on the element using the `jQuery.data()` method. If the setup hook wants jQuery to add a browser event (via `addEventListener` or `attachEvent`, depending on browser) it should return `false`. In all other cases, jQuery will not add the browser event, but will continue all its other bookkeeping for the event. This would be appropriate, for example, if the event was never fired by the browser but invoked by `.trigger()`. To attach the jQuery event handler in the setup hook, use the `eventHandle` argument. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#setup-function-data-object-namespaces-eventhandle-function }\` + */ + setup(this: TTarget, data: TData, namespaces: string, eventHandle: EventHandler): void | false; + } | { + /** + * The teardown hook is called when the final event of a particular type is removed from an element. The `this` keyword will be a reference to the element where the event is being cleaned up. This hook should return `false` if it wants jQuery to remove the event from the browser's event system (via `removeEventListener` or `detachEvent`). In most cases, the setup and teardown hooks should return the same value. + * + * If the setup hook attached event handlers or added data to an element through a mechanism such as `jQuery.data()`, the teardown hook should reverse the process and remove them. jQuery will generally remove the data and events when an element is totally removed from the document, but failing to remove data or events on teardown will cause a memory leak if the element stays in the document. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#teardown-function }\` + */ + teardown(this: TTarget): void | false; + } | { + /** + * Each time an event handler is added to an element through an API such as `.on()`, jQuery calls this hook. The `this` keyword will be the element to which the event handler is being added, and the `handleObj` argument is as described in the section above. The return value of this hook is ignored. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#add-function-handleobj }\` + */ + add(this: TTarget, handleObj: HandleObject): void; + } | { + /** + * When an event handler is removed from an element using an API such as `.off()`, this hook is called. The `this` keyword will be the element where the handler is being removed, and the `handleObj` argument is as described in the section above. The return value of this hook is ignored. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#remove-function-handleobj }\` + */ + remove(this: TTarget, handleObj: HandleObject): void; + } | { + /** + * Called when the `.trigger()` or `.triggerHandler()` methods are used to trigger an event for the special type from code, as opposed to events that originate from within the browser. The `this` keyword will be the element being triggered, and the event argument will be a `jQuery.Event` object constructed from the caller's input. At minimum, the event type, data, namespace, and target properties are set on the event. The data argument represents additional data passed by `.trigger()` if present. + * + * The trigger hook is called early in the process of triggering an event, just after the `jQuery.Event` object is constructed and before any handlers have been called. It can process the triggered event in any way, for example by calling `event.stopPropagation()` or `event.preventDefault()` before returning. If the hook returns `false`, jQuery does not perform any further event triggering actions and returns immediately. Otherwise, it performs the normal trigger processing, calling any event handlers for the element and bubbling the event (unless propagation is stopped in advance or `noBubble` was specified for the special event) to call event handlers attached to parent elements. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#trigger-function-event-jquery-event-data-object }\` + */ + trigger(this: TTarget, event: Event, data: TData): void | false; + } | { + /** + * When the `.trigger()` method finishes running all the event handlers for an event, it also looks for and runs any method on the target object by the same name unless of the handlers called `event.preventDefault()`. So, `.trigger( "submit" )` will execute the `submit()` method on the element if one exists. When a `_default` hook is specified, the hook is called just prior to checking for and executing the element's default method. If this hook returns the value `false` the element's default method will be called; otherwise it is not. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#_default-function-event-jquery-event-data-object }\` + */ + _default(event: Event, data: TData): void | false; + } | { + /** + * jQuery calls a handle hook when the event has occurred and jQuery would normally call the user's event handler specified by `.on()` or another event binding method. If the hook exists, jQuery calls it _instead_ of that event handler, passing it the event and any data passed from `.trigger()` if it was not a native event. The `this` keyword is the DOM element being handled, and `event.handleObj` property has the detailed event information. + * + * Based in the information it has, the handle hook should decide whether to call the original handler function which is in `event.handleObj.handler`. It can modify information in the event object before calling the original handler, but _must restore_ that data before returning or subsequent unrelated event handlers may act unpredictably. In most cases, the handle hook should return the result of the original handler, but that is at the discretion of the hook. The handle hook is unique in that it is the only special event function hook that is called under its original special event name when the type is mapped using `bindType` and `delegateType`. For that reason, it is almost always an error to have anything other than a handle hook present if the special event defines a `bindType` and `delegateType`, since those other hooks will never be called. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#handle-function-event-jquery-event-data-object }\` + */ + handle(this: TTarget, event: Event & { handleObj: HandleObject; }, ...data: TData[]): void; + } | { + preDispatch(this: TTarget, event: Event): false | void; + } | { + postDispatch(this: TTarget, event: Event): void; + } | { + [key: string]: never; + }; + + interface SpecialEventHooks { + [event: string]: SpecialEventHook; + } + + /** + * Many of the special event hook functions below are passed a `handleObj` object that provides more information about the event, how it was attached, and its current state. This object and its contents should be treated as read-only data, and only the properties below are documented for use by special event handlers. + * @see \`{@link https://learn.jquery.com/events/event-extensions/#the-handleobj-object }\` + */ + interface HandleObject { + /** + * The type of event, such as `"click"`. When special event mapping is used via `bindType` or `delegateType`, this will be the mapped type. + */ + readonly type: string; + /** + * The original type name regardless of whether it was mapped via `bindType` or `delegateType`. So when a "pushy" event is mapped to "click" its `origType` would be "pushy". + */ + readonly origType: string; + /** + * Namespace(s), if any, provided when the event was attached, such as `"myPlugin"`. When multiple namespaces are given, they are separated by periods and sorted in ascending alphabetical order. If no namespaces are provided, this property is an empty string. + */ + readonly namespace: string; + /** + * For delegated events, this is the selector used to filter descendant elements and determine if the handler should be called. For directly bound events, this property is `null`. + */ + readonly selector: string | undefined | null; + /** + * The data, if any, passed to jQuery during event binding, e.g. `{ myData: 42 }`. If the data argument was omitted or `undefined`, this property is `undefined` as well. + */ + readonly data: TData; + /** + * Event handler function passed to jQuery during event binding. If `false` was passed during event binding, the handler refers to a single shared function that simply returns `false`. + */ + readonly handler: EventHandler; + } + + // #endregion + + // #endregion + + // #endregion + + interface NameValuePair { + name: string; + value: string; + } + + // region Coordinates + // #region Coordinates + + interface Coordinates { + left: number; + top: number; + } + + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type CoordinatesPartial = + Pick | + Pick | + { [key: string]: never; }; + + // #endregion + + // region Val hooks + // #region Val hooks + + // Workaround for TypeScript 2.3 which does not have support for weak types handling. + type ValHook = { + get(elem: TElement): any; + } | { + set(elem: TElement, value: any): any; + } | { + [key: string]: never; + }; + + interface ValHooks { + // Set to HTMLElement to minimize breaks but should probably be Element. + [nodeName: string]: ValHook; + } + + // #endregion + + type _Falsy = false | null | undefined | 0 | '' | typeof document.all; +} + +declare const jQuery: JQueryStatic; +declare const $: JQueryStatic; + +// Used by JQuery.Event +type _Event = Event; + +// region ES5 compatibility +// #region ES5 compatibility + +// Forward declaration of `Iterable`. +// tslint:disable-next-line:no-empty-interface +interface Iterable { } + +interface SymbolConstructor { + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; +} + +declare var Symbol: SymbolConstructor; + +// #endregion diff --git a/types/jquery/test/example-tests.ts b/types/jquery/test/example-tests.ts index 60fbd431bb..7ecb1733a7 100644 --- a/types/jquery/test/example-tests.ts +++ b/types/jquery/test/example-tests.ts @@ -2334,7 +2334,9 @@ function examples() { } function jQuery_contains_0() { + // tslint:disable-next-line no-unnecessary-type-assertion $.contains(document.documentElement!, document.body); // true + // tslint:disable-next-line no-unnecessary-type-assertion $.contains(document.body, document.documentElement!); // false } diff --git a/types/jquery/test/learn-tests.ts b/types/jquery/test/learn-tests.ts index ef52084da5..8ef5eb2cfa 100644 --- a/types/jquery/test/learn-tests.ts +++ b/types/jquery/test/learn-tests.ts @@ -7,7 +7,8 @@ interface JQuery { } interface GreenifyPlugin { - (this: JQuery): void; + // tslint:disable-next-line:callable-types + (this: JQuery): void; } jQuery.fn.greenify = function() { @@ -15,3 +16,63 @@ jQuery.fn.greenify = function() { }; jQuery("a").greenify(); // Makes all the links green. + +// https://learn.jquery.com/events/event-extensions/ + +// Events + +function fixHooks() { + function setHook() { + jQuery.event.fixHooks.drop = { + props: ["dataTransfer"] + }; + } + + function conflictResolution() { + if (jQuery.event.fixHooks.drop) { + throw new Error("Someone else took the jQuery.event.fixHooks.drop hook!"); + } + + jQuery.event.fixHooks.drop = { + props: ["dataTransfer"] + }; + } +} + +function special() { + function defineSpecialEvent() { + jQuery.event.special.pushy = { + bindType: "click", + delegateType: "click" + }; + } + + function handleObj() { + jQuery.event.special.multiclick = { + delegateType: "click", + bindType: "click", + handle(event) { + const handleObj = event.handleObj; + const targetData = jQuery.data(event.target); + let ret = null; + + // If a multiple of the click count, run the handler + targetData.clicks = (targetData.clicks || 0) + 1; + + if (targetData.clicks % event.data.clicks === 0) { + event.type = handleObj.origType; + ret = handleObj.handler.apply(this, arguments); + event.type = handleObj.type; + return ret; + } + } + }; + + // Sample usage + $("p").on("multiclick", { + clicks: 3 + }, () => { + alert("clicked 3 times"); + }); + } +} diff --git a/types/jquery/test/longdesc-tests.ts b/types/jquery/test/longdesc-tests.ts index 5275191b5b..bb3bb4c83c 100644 --- a/types/jquery/test/longdesc-tests.ts +++ b/types/jquery/test/longdesc-tests.ts @@ -1,3 +1,4 @@ +// tslint:disable:ban-types // tslint:disable:no-var-keyword // tslint:disable:object-literal-key-quotes // tslint:disable:object-literal-shorthand @@ -951,8 +952,10 @@ function longdesc() { function jquery_ajax_transport_2() { $.ajaxTransport('script', function(options, originalOptions, jqXHR) { + let transport: JQuery.Transport = undefined!; + // Will only be called for script requests - return {} as JQuery.Transport; + return transport; }); } @@ -1291,7 +1294,7 @@ function longdesc() { if (borderRadius && borderRadius !== 'borderRadius') { $.cssHooks.borderRadius = { get: function(elem, computed, extra) { - return $.css(elem, borderRadius); + return $.css(elem, borderRadius!); }, set: function(elem, value) { ( elem.style)[borderRadius!] = value; @@ -1341,7 +1344,7 @@ function longdesc() { function jquery_css_hooks_6() { $.fx.step.someCSSProp = function(fx) { - $.cssHooks.someCSSProp.set(fx.elem as HTMLElement, fx.now + fx.unit); + $.cssHooks.someCSSProp.set!(fx.elem as HTMLElement, fx.now + fx.unit); }; } diff --git a/types/jquery/tsconfig.json b/types/jquery/tsconfig.json index 86c99c452f..8b159bc81f 100644 --- a/types/jquery/tsconfig.json +++ b/types/jquery/tsconfig.json @@ -20,6 +20,7 @@ }, "files": [ "index.d.ts", + "dist/jquery.slim.d.ts", "jquery-tests.ts", "test/example-tests.ts", "test/longdesc-tests.ts", diff --git a/types/jquery/tslint.json b/types/jquery/tslint.json index 93e1f3e072..f93cf8562a 100644 --- a/types/jquery/tslint.json +++ b/types/jquery/tslint.json @@ -1,12 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "callable-types": false, - "interface-name": false, - "no-any-union": false, - "no-declare-current-package": false, - - "ban-types": false, - "no-object-literal-type-assertion": false - } + "extends": "dtslint/dt.json" } diff --git a/types/jquery/v1/jquery-tests.ts b/types/jquery/v1/jquery-tests.ts index d00c075125..bb13b8c215 100644 --- a/types/jquery/v1/jquery-tests.ts +++ b/types/jquery/v1/jquery-tests.ts @@ -2715,7 +2715,7 @@ function test_fn_extend() { } function test_jquery() { - var a = { what: "A regular JS object" }, + var a: any = { what: "A regular JS object" }, b = $('body'); if (a.jquery) { alert(' a is a jQuery object! '); diff --git a/types/jquery/v2/index.d.ts b/types/jquery/v2/index.d.ts index 15709d6357..1b1d9cf75f 100644 --- a/types/jquery/v2/index.d.ts +++ b/types/jquery/v2/index.d.ts @@ -824,7 +824,7 @@ interface JQueryStatic { * @see {@link https://api.jquery.com/jQuery.ajaxTransport/} */ ajaxTransport(dataType: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - + ajaxSettings: JQueryAjaxSettings; /** @@ -1403,16 +1403,6 @@ interface JQueryStatic { */ unique(array: T[]): T[]; - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - * @see {@link https://api.jquery.com/jQuery.parseHTML/} - */ - parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; - /** * Parses a string into an array of DOM nodes. * @@ -3286,7 +3276,7 @@ interface JQuery { * @name toArray * @see {@link https://api.jquery.com/toArray/} */ - toArray(): HTMLElement[]; + toArray(): Element[]; /** * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. @@ -3353,13 +3343,13 @@ interface JQuery { * @param index A zero-based integer indicating which element to retrieve. * @see {@link https://api.jquery.com/get/#get-index} */ - get(index: number): HTMLElement; + get(index: number): Element; /** * Retrieve the elements matched by the jQuery object. * @alias toArray * @see {@link https://api.jquery.com/get/#get} */ - get(): HTMLElement[]; + get(): Element[]; /** * Search for a given element from among the matched elements. diff --git a/types/jquery/v2/jquery-tests.ts b/types/jquery/v2/jquery-tests.ts index d00c075125..01a06c62a8 100644 --- a/types/jquery/v2/jquery-tests.ts +++ b/types/jquery/v2/jquery-tests.ts @@ -2715,7 +2715,7 @@ function test_fn_extend() { } function test_jquery() { - var a = { what: "A regular JS object" }, + var a: any = { what: "A regular JS object" }, b = $('body'); if (a.jquery) { alert(' a is a jQuery object! '); @@ -3554,3 +3554,11 @@ function test_promise_then_not_return_deferred() { promise = promise.fail(); promise = promise.always(); } + +function test_element() { + const itemEl = $('#item')[0]; + $('li').toArray().indexOf(itemEl); + $('li').get().indexOf(itemEl); + let otherItemEl = $('li').get(0); + otherItemEl = itemEl; +} diff --git a/types/jqueryui/index.d.ts b/types/jqueryui/index.d.ts index 7dca429ce4..cc164360c0 100644 --- a/types/jqueryui/index.d.ts +++ b/types/jqueryui/index.d.ts @@ -64,6 +64,7 @@ declare namespace JQueryUI { * The item selected from the menu, if any. Otherwise the property is null */ item?: any; + content?: any; } interface AutocompleteEvent { @@ -1856,7 +1857,9 @@ interface JQuery { tabs(): JQuery; tabs(methodName: 'destroy'): void; tabs(methodName: 'disable'): void; + tabs(methodName: 'disable', index: number): void; tabs(methodName: 'enable'): void; + tabs(methodName: 'enable', index: number): void; tabs(methodName: 'load', index: number): void; tabs(methodName: 'refresh'): void; tabs(methodName: 'widget'): JQuery; diff --git a/types/jqueryui/tslint.json b/types/jqueryui/tslint.json index 22ecc7ce6f..ca9116c788 100644 --- a/types/jqueryui/tslint.json +++ b/types/jqueryui/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/js-beautify/js-beautify-tests.ts b/types/js-beautify/js-beautify-tests.ts index f421052503..34cd9d8f13 100644 --- a/types/js-beautify/js-beautify-tests.ts +++ b/types/js-beautify/js-beautify-tests.ts @@ -4,9 +4,9 @@ bCss = js_beautify.css_beautify("body{display:none;}"); let bHtml = js_beautify.html("
      "); bHtml = js_beautify.html_beautify("
      "); -let optHtml = {}; -let optCss = {}; -let optjs = {}; +let optHtml: HTMLBeautifyOptions = {}; +let optCss: CSSBeautifyOptions = {}; +let optjs: JsBeautifyOptions = {}; var simple: string = js_beautify("console.log('Hello world!');"); var full: string = js_beautify( diff --git a/types/js-money/tslint.json b/types/js-money/tslint.json index 3db14f85ea..42522eff7e 100644 --- a/types/js-money/tslint.json +++ b/types/js-money/tslint.json @@ -1 +1,9 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // All are TODOs + "dt-header": false, + "eofline": false, + "no-unnecessary-qualifier": false + } +} diff --git a/types/js-search/tslint.json b/types/js-search/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/js-search/tslint.json +++ b/types/js-search/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/js-url/index.d.ts b/types/js-url/index.d.ts index d5bf93257d..69583e1553 100644 --- a/types/js-url/index.d.ts +++ b/types/js-url/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for url v1.8.6 // Project: https://github.com/websanova/js-url -// Definitions by: MIZUNE Pine +// Definitions by: Pine Mizune // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface UrlStatic { diff --git a/types/jschannel/index.d.ts b/types/jschannel/index.d.ts index 42145531ea..ba1ce6f61d 100644 --- a/types/jschannel/index.d.ts +++ b/types/jschannel/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for jschannel 1.0 // Project: https://github.com/yochannah/jschannel // Definitions by: Yitzchok Gottlieb +// McFlat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -25,7 +26,7 @@ export interface Message { } export interface ChannelConfiguration { - window: any; + window: Window; origin: string; scope: string; debugOutput?: boolean; diff --git a/types/jschannel/jschannel-tests.ts b/types/jschannel/jschannel-tests.ts index eabd150bf2..c618eea253 100644 --- a/types/jschannel/jschannel-tests.ts +++ b/types/jschannel/jschannel-tests.ts @@ -1,3 +1,3 @@ import { build } from 'jschannel'; -build({ window: null, origin: "*", scope: "testScope"}); +build({ window, origin: "*", scope: "testScope"}); diff --git a/types/jschannel/tsconfig.json b/types/jschannel/tsconfig.json index 58b8ca059e..e8988e8fe1 100644 --- a/types/jschannel/tsconfig.json +++ b/types/jschannel/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -20,4 +21,4 @@ "index.d.ts", "jschannel-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/jsdom/index.d.ts b/types/jsdom/index.d.ts index 1aa9750fbc..dec74af1ba 100644 --- a/types/jsdom/index.d.ts +++ b/types/jsdom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jsdom 11.12 +// Type definitions for jsdom 12.2 // Project: https://github.com/tmpvar/jsdom#readme // Definitions by: Leonard Thieu // Johan Palmfjord @@ -65,7 +65,7 @@ export interface Options { */ includeNodeLocations?: boolean; runScripts?: 'dangerously' | 'outside-only'; - resources?: 'usable'; + resources?: 'usable' | ResourceLoader; virtualConsole?: VirtualConsole; cookieJar?: CookieJar; beforeParse?(window: DOMWindow): void; @@ -287,3 +287,22 @@ export interface ReconfigureSettings { windowTop?: DOMWindow; url?: string; } + +export interface FetchOptions { + cookieJar?: CookieJar; + referrer?: string; + accept?: string; + element?: HTMLScriptElement | HTMLLinkElement | HTMLIFrameElement | HTMLImageElement; +} + +export interface ResourceLoaderConstructorOptions { + strictSSL?: boolean; + proxy?: string; + userAgent?: string; +} + +export class ResourceLoader { + fetch(url: string, options: FetchOptions): Promise | null; + + constructor(obj?: ResourceLoaderConstructorOptions); +} diff --git a/types/jsdom/jsdom-tests.ts b/types/jsdom/jsdom-tests.ts index da82b2db7c..1420723b8d 100644 --- a/types/jsdom/jsdom-tests.ts +++ b/types/jsdom/jsdom-tests.ts @@ -1,4 +1,4 @@ -import { JSDOM, VirtualConsole, CookieJar, FromUrlOptions, FromFileOptions, DOMWindow } from 'jsdom'; +import { JSDOM, VirtualConsole, CookieJar, FromUrlOptions, FromFileOptions, DOMWindow, ResourceLoader, FetchOptions } from 'jsdom'; import { CookieJar as ToughCookieJar, MemoryCookieStore } from 'tough-cookie'; import { Script } from 'vm'; @@ -82,6 +82,7 @@ function test_serialize() { dom.serialize() === 'hello'; // Contrast with: + // tslint:disable-next-line no-unnecessary-type-assertion dom.window.document.documentElement!.outerHTML === 'hello'; } @@ -119,7 +120,7 @@ function test_runVMScript() { dom.runVMScript(s); dom.runVMScript(s); - ( dom.window).ran === 3; + (dom.window as any).ran === 3; } function test_reconfigure() { @@ -168,3 +169,16 @@ function test_fragment_serialization() { } } } + +function test_custom_resource_loader() { + class CustomResourceLoader extends ResourceLoader { + fetch(url: string, options: FetchOptions) { + if (options.element) { + console.log(`Element ${options.element.localName} is requesting the url ${url}`); + } + + return super.fetch(url, options); + } + } + new JSDOM('', { resources: new CustomResourceLoader() }); +} diff --git a/types/jsen/jsen-tests.ts b/types/jsen/jsen-tests.ts index 16cded3688..20264b8818 100644 --- a/types/jsen/jsen-tests.ts +++ b/types/jsen/jsen-tests.ts @@ -2238,7 +2238,7 @@ const doesNotThrow = (func: Function) => { { let schema = { format: 'custom' }, callCount = 0, - options = { + options = { formats: { custom: () => { callCount++; @@ -2275,7 +2275,7 @@ const doesNotThrow = (func: Function) => { maximum: 10 }, callCount = 0, - options = { + options = { formats: { custom: () => { callCount++; @@ -2311,7 +2311,7 @@ const doesNotThrow = (func: Function) => { }, format: 'passwordsMatch' }, - options = { + options = { formats: { passwordsMatch: (obj: any) => { callCount++; diff --git a/types/jsforce/connection.d.ts b/types/jsforce/connection.d.ts index 60716753ae..3bd0ea177b 100644 --- a/types/jsforce/connection.d.ts +++ b/types/jsforce/connection.d.ts @@ -12,6 +12,7 @@ import { Bulk } from './bulk'; import { Cache } from './cache' import { OAuth2, Streaming } from '.'; import { HttpApiOptions } from './http-api' +import { LimitsInfo } from './limits-info'; export type Callback = (err: Error | null, result: T) => void; // The type for these options was determined by looking at the usage @@ -160,9 +161,13 @@ export class Connection extends BaseConnection { login(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; loginByOAuth2(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; loginBySoap(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; + logout(revoke: boolean, callback?: (err: Error, res: undefined) => void): Promise; logout(callback?: (err: Error, res: undefined) => void): Promise; + logoutByOAuth2(revoke: boolean, callback?: (err: Error, res: undefined) => void): Promise; logoutByOAuth2(callback?: (err: Error, res: undefined) => void): Promise; + logoutBySoap(revoke: boolean, callback?: (err: Error, res: undefined) => void): Promise; logoutBySoap(callback?: (err: Error, res: undefined) => void): Promise; + limits(callback?: (err: Error, res: undefined) => void): Promise; } export class Tooling extends BaseConnection { diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts index c36f39095a..65d5159f61 100644 --- a/types/jsforce/index.d.ts +++ b/types/jsforce/index.d.ts @@ -30,3 +30,4 @@ export * from './salesforce-id'; export * from './salesforce-object'; export * from './streaming'; export * from './topic'; +export * from './limits-info'; diff --git a/types/jsforce/limits-info.d.ts b/types/jsforce/limits-info.d.ts new file mode 100644 index 0000000000..bfeeabe0c3 --- /dev/null +++ b/types/jsforce/limits-info.d.ts @@ -0,0 +1,48 @@ +export interface Limit { + Max: number; + Remaining: number; +} + +export interface PermissionSets extends Limit { + CreateCustom: Limit; +} + +export interface DailyApiRequests extends Limit { + 'Chatter Desktop': Limit; + 'Chatter Mobile for BlackBerry': Limit; + 'Salesforce Files': Limit; + 'Salesforce Marketing Cloud': Limit; + 'Salesforce for Android': Limit; + 'Salesforce for iOS': Limit; + 'SalesforceA': Limit; +} + +export interface LimitsInfo { + ConcurrentAsyncGetReportInstances: Limit; + ConcurrentSyncReportRuns: Limit; + DailyAnalyticsDataflowJobExecutions: Limit; + DailyApiRequests: DailyApiRequests; + DailyAsyncApexExecutions: Limit; + DailyBulkApiRequests: DailyApiRequests; + DailyDurableGenericStreamingApiEvents: Limit; + DailyDurableStreamingApiEvents: Limit; + DailyGenericStreamingApiEvents: DailyApiRequests; + DailyStreamingApiEvents: DailyApiRequests; + DailyWorkflowEmails: Limit; + DataStorageMB: Limit; + DurableStreamingApiConcurrentClients: Limit; + FileStorageMB: Limit; + HourlyAsyncReportRuns: Limit; + HourlyDashboardRefreshes: Limit; + HourlyDashboardResults: Limit; + HourlyDashboardStatuses: Limit; + HourlyODataCallout: Limit; + HourlySyncReportRuns: Limit; + HourlyTimeBasedWorkflow: Limit; + MassEmail: Limit; + MonthlyPlatformEvents: Limit; + Package2VersionCreates: Limit; + PermissionSets: PermissionSets; + SingleEmail: Limit; + StreamingApiConcurrentClients: Limit; +} diff --git a/types/jsforce/tslint.json b/types/jsforce/tslint.json index 3b1f082eb2..43829466b8 100644 --- a/types/jsforce/tslint.json +++ b/types/jsforce/tslint.json @@ -2,9 +2,19 @@ "extends": "dtslint/dt.json", "rules": { // TODOs + "array-type": false, "ban-types": false, + "eofline": false, + "max-line-length": false, "no-any-union": false, + "no-empty-interface": false, + "no-redundant-undefined": false, "no-unnecessary-class": false, - "no-unnecessary-generics": false + "no-unnecessary-generics": false, + "semicolon": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "typedef-whitespace": false, + "whitespace": false } } diff --git a/types/json-rpc-random-id/index.d.ts b/types/json-rpc-random-id/index.d.ts new file mode 100644 index 0000000000..14b5ba0ff0 --- /dev/null +++ b/types/json-rpc-random-id/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for json-rpc-random-id 1.0 +// Project: https://github.com/kumavis/json-rpc-random-id#readme +// Definitions by: Micah Riggan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** + * Returns a function that generates a random number + * This number is to be used with web3 rpc + */ +declare function IdIterator(options?: { + max?: number; + start?: number; +}): () => number; + +export = IdIterator; diff --git a/types/json-rpc-random-id/json-rpc-random-id-tests.ts b/types/json-rpc-random-id/json-rpc-random-id-tests.ts new file mode 100644 index 0000000000..c71a7581e8 --- /dev/null +++ b/types/json-rpc-random-id/json-rpc-random-id-tests.ts @@ -0,0 +1,2 @@ +import jsonRPCRandomID = require("json-rpc-random-id"); +const generateId = jsonRPCRandomID(); diff --git a/types/json-rpc-random-id/tsconfig.json b/types/json-rpc-random-id/tsconfig.json new file mode 100644 index 0000000000..c39a0a4e2b --- /dev/null +++ b/types/json-rpc-random-id/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes":true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "json-rpc-random-id-tests.ts" + ] +} diff --git a/types/json-rpc-random-id/tslint.json b/types/json-rpc-random-id/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/json-rpc-random-id/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/json2csv/tslint.json b/types/json2csv/tslint.json index 3db14f85ea..389fc5f08e 100644 --- a/types/json2csv/tslint.json +++ b/types/json2csv/tslint.json @@ -1 +1,15 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // All are TODOs + "array-type": false, + "ban-types": false, + "callable-types": false, + "jsdoc-format": false, + "member-access": false, + "no-duplicate-imports": false, + "no-redundant-jsdoc-2": false, + "strict-export-declare-modifiers": false, + "typedef-whitespace": false + } +} diff --git a/types/jsonquery/index.d.ts b/types/jsonquery/index.d.ts new file mode 100644 index 0000000000..48afcf8d0a --- /dev/null +++ b/types/jsonquery/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for jsonquery 0.1 +// Project: https://github.com/eugeneware/jsonquery +// Definitions by: Jim Buck +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +declare function jsonquery(query: jsonquery.Query): NodeJS.ReadWriteStream; + +declare namespace jsonquery { + function match(haystack: T, predicate: Query): boolean; + + type Query = BinaryQueryCondition | QueryValue | PathQuery; + + interface OrQueryCondition { + $or: ReadonlyArray>; + } + + interface AndQueryCondition { + $and: ReadonlyArray>; + } + + type BinaryQueryCondition = OrQueryCondition | AndQueryCondition; + + interface BaseCondition

      { + $lt: P; + $lte: P; + $gt: P; + $gte: P; + $mod: [number, number]; + $ne: P; + $in: ReadonlyArray

      ; + $nin: ReadonlyArray

      ; + $all: ReadonlyArray

      ; + $elemMatch: Partial

      ; + } + + interface PathQuery { + [path: string]: any; + } + + type QueryValue = { + [P in keyof T]?: T[P] | BaseCondition; + }; +} + +export = jsonquery; diff --git a/types/jsonquery/jsonquery-tests.ts b/types/jsonquery/jsonquery-tests.ts new file mode 100644 index 0000000000..904f61d01c --- /dev/null +++ b/types/jsonquery/jsonquery-tests.ts @@ -0,0 +1,120 @@ +import jsonquery = require('jsonquery'); + +interface TestData { + name: string; + number: string; + val: number; + favorites: number[]; + awesome: boolean; + nullify: null; + tree: { + a: number; + b: number; + }; +} + +const testDataInstance: TestData = { + name: "Name 1", + number: "Number 1", + val: 10, + favorites: [10, 20], + awesome: true, + nullify: null, + tree: { + a: 1, + b: 2, + } +}; + +// $ExpectType ReadWriteStream +jsonquery({ number: 'Number 7' }); + +// $ExpectType ReadWriteStream +jsonquery({ number: 'Number 7', val: 70 }); + +// $ExpectType ReadWriteStream +jsonquery({ $or: [ { number: 'Number 7' }, { val: 50 } ] }); + +// $ExpectType ReadWriteStream +jsonquery({ $and: [ { number: 'Number 7' }, { val: 70 } ] }); + +// $ExpectType ReadWriteStream +jsonquery({ $or: [ { $and: [ { number: 'Number 7' }, { val: 70 } ] }, { val: 50 } ] }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $in: [ 70, 50 ] } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $or: [ { $in: [ 70, 50 ] }, { $in: [ 60, 20 ] } ] } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $gt: 900 } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $lt: 900 } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $or: [ { $lt: 20 }, { $gt: 950 } ] } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $and: [ { $gt: 970 }, { $gt: 950 } ] } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $ne: 900 } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $lte: 900 } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $gte: 900 } }); + +// $ExpectType ReadWriteStream +jsonquery({ favorites: { $all: [50, 60] } }); + +// $ExpectType ReadWriteStream +jsonquery({ tree: { $elemMatch: { a: 1, b: 2 } } }); + +// $ExpectType ReadWriteStream +jsonquery({ 'tree.a': 1 }); + +// $ExpectType ReadWriteStream +jsonquery({ 'tree.a': { $in: [1, 5] } }); + +// $ExpectType ReadWriteStream +jsonquery({ number: /er 7$/ }); + +// $ExpectType ReadWriteStream +jsonquery({ number: { $in: [ /er 7$/, /er 5$/ ] } }); + +// $ExpectType ReadWriteStream +jsonquery({ favorites: { $all: [/^50$/, /^60$/] } }); + +// $ExpectType ReadWriteStream +jsonquery({ tree: { $elemMatch: { a: /^1$/, b: 2 } } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $nin: [ 70, 50 ] } }); + +// $ExpectType ReadWriteStream +jsonquery({ val: { $mod: [ 7, 1 ] } }); + +// $ExpectType ReadWriteStream +jsonquery({ favorites: { $size: 2 } }); + +// $ExpectType ReadWriteStream +jsonquery({ $and: [ { tree: { $exists: true } }, { missing: { $exists: false } } ] }); + +// $ExpectType ReadWriteStream +jsonquery({ $not: { number: 'Number 7', val: 70 } }); + +// $ExpectType ReadWriteStream +jsonquery({ number: { $not: { $nin: ['Number 7'] } } }); + +// $ExpectType ReadWriteStream +jsonquery({ foo: { $all: ['bar'] } }); + +// $ExpectType boolean +jsonquery.match(testDataInstance, { val: 7 }); + +// $ExpectType boolean +jsonquery.match(testDataInstance, { 'tree.a': { $in: [1, 5] } }); diff --git a/types/jsonquery/tsconfig.json b/types/jsonquery/tsconfig.json new file mode 100644 index 0000000000..ffb3eb6209 --- /dev/null +++ b/types/jsonquery/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jsonquery-tests.ts" + ] +} diff --git a/types/jsonquery/tslint.json b/types/jsonquery/tslint.json new file mode 100644 index 0000000000..02db66c29b --- /dev/null +++ b/types/jsonquery/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules":{ + "no-unnecessary-generics": false + } +} diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index f54d3862c9..d1c3aeee5f 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for jsonwebtoken 7.2.2 +// Type definitions for jsonwebtoken 8.3 // Project: https://github.com/auth0/node-jsonwebtoken // Definitions by: Maxime LUCE , // Daniel Heim , // Brice BERNARD , -// Veli-Pekka Kestilä +// Veli-Pekka Kestilä , +// Daniel Parker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -43,9 +44,9 @@ export interface SignOptions { */ algorithm?: string; keyid?: string; - /** @member {string} - expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */ + /** expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */ expiresIn?: string | number; - /** @member {string} - expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */ + /** expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */ notBefore?: string | number; audience?: string | string[]; subject?: string; @@ -67,8 +68,8 @@ export interface VerifyOptions { jwtid?: string; subject?: string; /** - *@deprecated - *@member {string} - Max age of token + * @deprecated + * Max age of token */ maxAge?: string; } @@ -77,28 +78,45 @@ export interface DecodeOptions { complete?: boolean; json?: boolean; } -export type VerifyErrors=JsonWebTokenError | NotBeforeError | TokenExpiredError; -export interface VerifyCallback { - ( - err: VerifyErrors, - decoded: object | string, - ): void; +export type VerifyErrors= JsonWebTokenError | NotBeforeError | TokenExpiredError; +export type VerifyCallback = ( + err: VerifyErrors, + decoded: object | string, +) => void; + +export type SignCallback = ( + err: Error, encoded: string +) => void; + +export interface JwtHeader { + alg: string; + typ?: string; + kid?: string; + jku?: string; + x5u?: string; + x5t?: string; } -export interface SignCallback { - (err: Error, encoded: string): void; -} +export type SigningKeyCallback = ( + err: any, + signingKey?: Secret, +) => void; + +export type GetPublicKeyOrSecret = ( + header: JwtHeader, + callback: SigningKeyCallback +) => void; export type Secret = string | Buffer | { key: string; passphrase: string }; /** * Synchronously sign the given payload into a JSON Web Token string - * @param {String|Object|Buffer} payload - Payload to sign, could be an literal, buffer or string - * @param {String|Buffer} secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA. - * @param {SignOptions} [options] - Options for the signature - * @returns {String} The JSON Web Token string + * payload - Payload to sign, could be an literal, buffer or string + * secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA. + * [options] - Options for the signature + * returns - The JSON Web Token string */ -export declare function sign( +export function sign( payload: string | Buffer | object, secretOrPrivateKey: Secret, options?: SignOptions, @@ -106,17 +124,17 @@ export declare function sign( /** * Sign the given payload into a JSON Web Token string - * @param {String|Object|Buffer} payload - Payload to sign, could be an literal, buffer or string - * @param {String|Buffer} secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA. - * @param {SignOptions} [options] - Options for the signature - * @param {Function} callback - Callback to get the encoded token on + * payload - Payload to sign, could be an literal, buffer or string + * secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA. + * [options] - Options for the signature + * callback - Callback to get the encoded token on */ -export declare function sign( +export function sign( payload: string | Buffer | object, secretOrPrivateKey: Secret, callback: SignCallback, ): void; -export declare function sign( +export function sign( payload: string | Buffer | object, secretOrPrivateKey: Secret, options: SignOptions, @@ -125,16 +143,12 @@ export declare function sign( /** * Synchronously verify given token using a secret or a public key to get a decoded token - * @param {String} token - JWT string to verify - * @param {String|Buffer} secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA. - * @param {VerifyOptions} [options] - Options for the verification - * @returns The decoded token. + * token - JWT string to verify + * secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA. + * [options] - Options for the verification + * returns - The decoded token. */ -export declare function verify( - token: string, - secretOrPublicKey: string | Buffer, -): object | string; -export declare function verify( +export function verify( token: string, secretOrPublicKey: string | Buffer, options?: VerifyOptions, @@ -142,31 +156,32 @@ export declare function verify( /** * Asynchronously verify given token using a secret or a public key to get a decoded token - * @param {String} token - JWT string to verify - * @param {String|Buffer} secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA. - * @param {VerifyOptions} [options] - Options for the verification - * @param {Function} callback - Callback to get the decoded token on + * token - JWT string to verify + * secretOrPublicKey - A string or buffer containing either the secret for HMAC algorithms, + * or the PEM encoded public key for RSA and ECDSA. If jwt.verify is called asynchronous, + * secretOrPublicKey can be a function that should fetch the secret or public key + * [options] - Options for the verification + * callback - Callback to get the decoded token on */ -export declare function verify( +export function verify( token: string, - secretOrPublicKey: string | Buffer, + secretOrPublicKey: string | Buffer | GetPublicKeyOrSecret, callback?: VerifyCallback, ): void; -export declare function verify( +export function verify( token: string, - secretOrPublicKey: string | Buffer, + secretOrPublicKey: string | Buffer | GetPublicKeyOrSecret, options?: VerifyOptions, callback?: VerifyCallback, ): void; /** * Returns the decoded payload without verifying if the signature is valid. - * @param {String} token - JWT string to decode - * @param {DecodeOptions} [options] - Options for decoding - * @returns {Object} The decoded Token + * token - JWT string to decode + * [options] - Options for decoding + * returns - The decoded Token */ -export declare function decode( +export function decode( token: string, options?: DecodeOptions, ): null | { [key: string]: any } | string; - diff --git a/types/jsonwebtoken/jsonwebtoken-tests.ts b/types/jsonwebtoken/jsonwebtoken-tests.ts index f20fbba5cc..5884ff6d63 100644 --- a/types/jsonwebtoken/jsonwebtoken-tests.ts +++ b/types/jsonwebtoken/jsonwebtoken-tests.ts @@ -7,10 +7,10 @@ import jwt = require("jsonwebtoken"); import fs = require("fs"); -var token: string; -var cert: Buffer; +let token: string; +let cert: Buffer; -interface ITestObject { +interface TestObject { foo: string; } @@ -44,10 +44,10 @@ const secret = { key: privKey.toString(), passphrase: "keypwd" }; token = jwt.sign(testObject, secret, { algorithm: "RS256" }); // the algorithm option is mandatory in this case // sign asynchronously -jwt.sign(testObject, cert, { algorithm: "RS256" }, function( +jwt.sign(testObject, cert, { algorithm: "RS256" }, ( err: Error, token: string, -) { +) => { console.log(token); }); @@ -56,57 +56,70 @@ jwt.sign(testObject, cert, { algorithm: "RS256" }, function( * https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback */ // verify a token symmetric -jwt.verify(token, "shhhhh", function(err, decoded) { - const result = decoded as ITestObject; +jwt.verify(token, "shhhhh", (err, decoded) => { + const result = decoded as TestObject; console.log(result.foo); // bar }); // use external time for verifying -jwt.verify(token, 'shhhhh', { clockTimestamp: 1 }, function(err, decoded) { - const result = decoded as ITestObject +jwt.verify(token, 'shhhhh', { clockTimestamp: 1 }, (err, decoded) => { + const result = decoded as TestObject; - console.log(result.foo) // bar + console.log(result.foo); // bar }); // invalid token -jwt.verify(token, "wrong-secret", function(err, decoded) { +jwt.verify(token, "wrong-secret", (err, decoded) => { // err // decoded undefined }); // verify a token asymmetric cert = fs.readFileSync("public.pem"); // get public key -jwt.verify(token, cert, function(err, decoded) { - const result = decoded as ITestObject; +jwt.verify(token, cert, (err, decoded) => { + const result = decoded as TestObject; + + console.log(result.foo); // bar +}); + +// verify a token assymetric with async key fetch function +function getKey(header: jwt.JwtHeader, callback: jwt.SigningKeyCallback) { + cert = fs.readFileSync("public.pem"); + + callback(null, cert); +} + +jwt.verify(token, getKey, (err, decoded) => { + const result = decoded as TestObject; console.log(result.foo); // bar }); // verify audience cert = fs.readFileSync("public.pem"); // get public key -jwt.verify(token, cert, { audience: "urn:foo" }, function(err, decoded) { +jwt.verify(token, cert, { audience: "urn:foo" }, (err, decoded) => { // if audience mismatch, err == invalid audience }); // verify issuer cert = fs.readFileSync("public.pem"); // get public key -jwt.verify(token, cert, { audience: "urn:foo", issuer: "urn:issuer" }, function( +jwt.verify(token, cert, { audience: "urn:foo", issuer: "urn:issuer" }, ( err, decoded, -) { +) => { // if issuer mismatch, err == invalid issuer }); // verify algorithm cert = fs.readFileSync("public.pem"); // get public key -jwt.verify(token, cert, { algorithms: ["RS256"] }, function(err, decoded) { +jwt.verify(token, cert, { algorithms: ["RS256"] }, (err, decoded) => { // if algorithm mismatch, err == invalid algorithm }); // verify without expiration check cert = fs.readFileSync("public.pem"); // get public key -jwt.verify(token, cert, { ignoreExpiration: true }, function(err, decoded) { +jwt.verify(token, cert, { ignoreExpiration: true }, (err, decoded) => { // if ignoreExpration == false and token is expired, err == expired token }); @@ -114,7 +127,7 @@ jwt.verify(token, cert, { ignoreExpiration: true }, function(err, decoded) { * jwt.decode * https://github.com/auth0/node-jsonwebtoken#jwtdecodetoken */ -var decoded = jwt.decode(token); +let decoded = jwt.decode(token); decoded = jwt.decode(token, { complete: false }); diff --git a/types/jsonwebtoken/tslint.json b/types/jsonwebtoken/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/jsonwebtoken/tslint.json +++ b/types/jsonwebtoken/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/jspath/index.d.ts b/types/jspath/index.d.ts new file mode 100644 index 0000000000..3c5ae53121 --- /dev/null +++ b/types/jspath/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for jspath 0.4 +// Project: https://github.com/dfilatov/jspath +// Definitions by: Piot Roszatycki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * @param path path expression + * @param data input JSON document + * @param replacement substitutions + */ +export function apply(path: string, data: any, replacement?: any): any[]; diff --git a/types/jspath/jspath-tests.ts b/types/jspath/jspath-tests.ts new file mode 100644 index 0000000000..84e6f1c0e4 --- /dev/null +++ b/types/jspath/jspath-tests.ts @@ -0,0 +1,62 @@ +import * as JSPath from 'jspath'; + +// tslint:disable:object-literal-key-quotes + +JSPath.apply( + '.automobiles{.maker === "Honda" && .year > 2009}.model', + { + "automobiles" : [ + { "maker" : "Nissan", "model" : "Teana", "year" : 2011 }, + { "maker" : "Honda", "model" : "Jazz", "year" : 2010 }, + { "maker" : "Honda", "model" : "Civic", "year" : 2007 }, + { "maker" : "Toyota", "model" : "Yaris", "year" : 2008 }, + { "maker" : "Honda", "model" : "Accord", "year" : 2011 } + ], + "motorcycles" : [{ "maker" : "Honda", "model" : "ST1300", "year" : 2012 }] + } +); + +const doc = { + "books" : [ + { + "id" : 1, + "title" : "Clean Code", + "author" : { "name" : "Robert C. Martin" }, + "price" : 17.96 + }, + { + "id" : 2, + "title" : "Maintainable JavaScript", + "author" : { "name" : "Nicholas C. Zakas" }, + "price" : 10 + }, + { + "id" : 3, + "title" : "Agile Software Development", + "author" : { "name" : "Robert C. Martin" }, + "price" : 20 + }, + { + "id" : 4, + "title" : "JavaScript: The Good Parts", + "author" : { "name" : "Douglas Crockford" }, + "price" : 15.67 + } + ] +}; + +JSPath.apply('.books.author', doc); + +JSPath.apply('.books.author.name', doc); + +JSPath.apply('.books..name', doc); + +JSPath.apply('.books{.author.name === "Robert C. Martin"}.title', doc); + +JSPath.apply('.books{.price < 17}.title', doc); + +const path = '.books{.author.name === $author}.title'; + +JSPath.apply(path, doc, { author : 'Nicholas C. Zakas' }); + +JSPath.apply(path, doc, { author : ['Robert C. Martin', 'Douglas Crockford'] }); diff --git a/types/jspath/tsconfig.json b/types/jspath/tsconfig.json new file mode 100644 index 0000000000..38ab91e172 --- /dev/null +++ b/types/jspath/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jspath-tests.ts" + ] +} diff --git a/types/jspath/tslint.json b/types/jspath/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jspath/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jspdf/index.d.ts b/types/jspdf/index.d.ts index e393e5fba1..63789a7093 100644 --- a/types/jspdf/index.d.ts +++ b/types/jspdf/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for jsPDF v1.1.135 +// Type definitions for jsPDF 1.2 // Project: https://github.com/MrRio/jsPDF // Definitions by: Amber Schühmacher +// Kevin Gonnord +// Jackie Weng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'jspdf' { @@ -32,7 +34,9 @@ declare module 'jspdf' { 'scaleFactor':number; 'pageSize': { width:number; + getWidth: () => number; height:number; + getHeight: () => number; }; 'output'(type:any, options:any):any; 'getNumberOfPages'():number; @@ -42,7 +46,7 @@ declare module 'jspdf' { 'getPageInfo'(pageNumberOneBased:number):any; 'getCurrentPageInfo'():any; }; - addPage(sizes?: number[]):jsPDF; + addPage(format?: string | number[], orientation?: 'p'|'portrait'|'l'|'landscape'): jsPDF; setPage(n:number):jsPDF; insertPage(beforePage:number):jsPDF; movePage(targetPage:number, beforePage:number):jsPDF; @@ -90,6 +94,7 @@ declare module 'jspdf' { * - split_text_to_size * - SVG * - total_pages + * - vfs */ // jsPDF plugin: addHTML @@ -201,8 +206,13 @@ declare module 'jspdf' { // jsPDF plugin: total_pages putTotalPages(pageExpression:string):jsPDF; + + // jsPDF plugin: vfs + existsFileInVFS(filename:string):boolean; + addFileToVFS(filename:string, filecontent:string):jsPDF; + getFileFromVFS(filename:string):string; } - + namespace jsPDF {} export = jsPDF; diff --git a/types/jspdf/jspdf-tests.ts b/types/jspdf/jspdf-tests.ts index 0f31005af9..ab6dd3a82a 100644 --- a/types/jspdf/jspdf-tests.ts +++ b/types/jspdf/jspdf-tests.ts @@ -13,6 +13,18 @@ function test_simple_two_page_document() { doc.save('Test.pdf'); } +function test_add_pages_with_different_format() { + var doc = new jsPDF(); + doc.text(20, 20, 'Hello world!'); + doc.addPage('a5', 'l'); + doc.text(20, 20, 'Do you like that?'); + doc.addPage('c6'); + doc.text(20, 20, 'Do you like that?'); + doc.addPage([595.28, 841.89]); + doc.text(20, 20, 'Do you like that?'); + doc.save('Test.pdf'); +} + function test_landscape() { var doc = new jsPDF('landscape'); doc.text(20, 20, 'Hello landscape world!'); diff --git a/types/jspdf/tslint.json b/types/jspdf/tslint.json index a41bf5d19a..a0357daa61 100644 --- a/types/jspdf/tslint.json +++ b/types/jspdf/tslint.json @@ -7,7 +7,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/jss/css.d.ts b/types/jss/css.d.ts index 2d5e89139a..9bed74d702 100644 --- a/types/jss/css.d.ts +++ b/types/jss/css.d.ts @@ -3,7 +3,7 @@ import { Observable } from 'indefinite-observable'; import * as csstype from 'csstype'; -type Length = string | number; +export type Length = string | number; export type ObservableProperties

      = { [K in keyof P]: P[K] | Observable diff --git a/types/just-debounce-it/index.d.ts b/types/just-debounce-it/index.d.ts new file mode 100644 index 0000000000..248f6a27f8 --- /dev/null +++ b/types/just-debounce-it/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for just-debounce-it 1.1 +// Project: https://github.com/angus-c/just#readme +// Definitions by: Aziz Khambati +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +type ArgumentTypes = F extends (...args: infer A) => any ? A : never; + +/*~ This declaration specifies that the function + *~ is the exported object from the file + */ +export = debounce; + +declare function debounce( + fn: T, + wait?: 0, + callFirst?: boolean +): T; + +declare function debounce( + fn: T, + wait: number, + callFirst: true +): T; + +declare function debounce( + fn: T, + wait: number, + callFirst?: false +): (...args: ArgumentTypes) => void; diff --git a/types/just-debounce-it/just-debounce-it-tests.ts b/types/just-debounce-it/just-debounce-it-tests.ts new file mode 100644 index 0000000000..32dd33c9e7 --- /dev/null +++ b/types/just-debounce-it/just-debounce-it-tests.ts @@ -0,0 +1,23 @@ +import debounce = require("just-debounce-it"); + +const doThings = () => 1; + +const num: number = debounce(doThings)(); +const num2: number = debounce(doThings, 0)(); +const num3: number = debounce(doThings, 0, true)(); +const num4: number = debounce(doThings, 0, false)(); +const num5: number = debounce(doThings, 1000, true)(); + +// $ExpectType void +debounce(doThings, 1000)(); + +const exclaim = (a: string) => a + '!'; + +const str: string = debounce(exclaim)('hey'); +const str2: string = debounce(exclaim, 0)('hi'); +const str3: string = debounce(exclaim, 0, true)('hi'); +const str4: string = debounce(exclaim, 0, false)('hi'); +const str5: string = debounce(exclaim, 1000, true)('hooray'); + +// $ExpectType void +debounce(exclaim, 1000)('hello'); diff --git a/types/just-debounce-it/tsconfig.json b/types/just-debounce-it/tsconfig.json new file mode 100644 index 0000000000..d1a7dbd8b0 --- /dev/null +++ b/types/just-debounce-it/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "just-debounce-it-tests.ts" + ] +} diff --git a/types/just-debounce-it/tslint.json b/types/just-debounce-it/tslint.json new file mode 100644 index 0000000000..5bc412fb1e --- /dev/null +++ b/types/just-debounce-it/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +} diff --git a/types/just-pick/index.d.ts b/types/just-pick/index.d.ts new file mode 100644 index 0000000000..04836648cc --- /dev/null +++ b/types/just-pick/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for just-pick 2.1 +// Project: https://github.com/angus-c/just#readme +// Definitions by: Peter Safranek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare function pick(obj: T, select: U[]): Pick; + +declare function pick(obj: T, select1: U, ...selectn: U[]): Pick; + +export = pick; diff --git a/types/just-pick/just-pick-tests.ts b/types/just-pick/just-pick-tests.ts new file mode 100644 index 0000000000..8f675a010c --- /dev/null +++ b/types/just-pick/just-pick-tests.ts @@ -0,0 +1,26 @@ +import pick = require("just-pick"); + +const a = "a"; +const b = "b"; +const c = "c"; +const obj = { a, b }; + +pick(obj, []); // $ExpectType Pick<{ a: string; b: string; }, never> +pick(obj, [a]); // $ExpectType Pick<{ a: string; b: string; }, "a"> +pick(obj, [a, a]); // $ExpectType Pick<{ a: string; b: string; }, "a"> +pick(obj, [a, b]); // $ExpectType Pick<{ a: string; b: string; }, "a" | "b"> +pick(obj, [a, b, c]); // $ExpectError + +pick(obj, a); // $ExpectType Pick<{ a: string; b: string; }, "a"> +pick(obj, a, a); // $ExpectType Pick<{ a: string; b: string; }, "a"> +pick(obj, a, b); // $ExpectType Pick<{ a: string; b: string; }, "a" | "b"> +pick(obj, a, b, c); // $ExpectError + +pick(); // $ExpectError +pick(obj); // $ExpectError +pick(obj, 0); // $ExpectError +pick(obj, false); // $ExpectError +pick(obj, null); // $ExpectError +pick(obj, undefined); // $ExpectError +pick(obj, {}); // $ExpectError +pick(obj, () => {}); // $ExpectError diff --git a/types/just-pick/tsconfig.json b/types/just-pick/tsconfig.json new file mode 100644 index 0000000000..860c7fa95d --- /dev/null +++ b/types/just-pick/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "just-pick-tests.ts" + ] +} diff --git a/types/just-pick/tslint.json b/types/just-pick/tslint.json new file mode 100644 index 0000000000..702f9354fc --- /dev/null +++ b/types/just-pick/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "file-name-casing": false + } +} diff --git a/types/jwt-express/tslint.json b/types/jwt-express/tslint.json index 3db14f85ea..1c36270d47 100644 --- a/types/jwt-express/tslint.json +++ b/types/jwt-express/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-angle-bracket-type-assertion": false + } +} diff --git a/types/karma-chai-sinon/index.d.ts b/types/karma-chai-sinon/index.d.ts index 1ce2672b23..0b14373a99 100644 --- a/types/karma-chai-sinon/index.d.ts +++ b/types/karma-chai-sinon/index.d.ts @@ -2,10 +2,10 @@ // Project: https://github.com/tubalmartin/karma-chai-sinon // Definitions by: Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 /// -import Sinon = require("sinon"); +import Sinon = require('sinon'); declare global { var should: Chai.Should; diff --git a/types/karma-fixture/index.d.ts b/types/karma-fixture/index.d.ts index 42af1d5d60..d443359d72 100644 --- a/types/karma-fixture/index.d.ts +++ b/types/karma-fixture/index.d.ts @@ -1,31 +1,28 @@ -// Type definitions for karma-fixture 0.2.7 +// Type definitions for karma-fixture 0.2 // Project: https://github.com/billtrik/karma-fixture // Definitions by: Ezekiel Victor // Afshawn Lotfi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace fixture { - export var el: HTMLElement; - export var json: any[]; + let el: HTMLElement; + let json: any[]; - export function load(...files: string[]): any; - export function load(file1: string, append?: boolean): any; - export function load(file1: string, file2: string, append?: boolean): any; - export function load(file1: string, file2: string, file3: string, append?: boolean): any; - export function load(file1: string, file2: string, file3: string, file4: string, append?: boolean): any; - export function load(file1: string, file2: string, file3: string, file4: string, file5: string, append?: boolean): any; + function load(...files: string[]): any; + function load(file1: string, append?: boolean): any; + function load(file1: string, file2: string, append?: boolean): any; + function load(file1: string, file2: string, file3: string, append?: boolean): any; + function load(file1: string, file2: string, file3: string, file4: string, append?: boolean): any; + function load(file1: string, file2: string, file3: string, file4: string, file5: string, append?: boolean): any; - export function set(...htmlStrs: string[]): HTMLElement|HTMLElement[]; - export function set(htmlStr1: string, append?: boolean): HTMLElement|HTMLElement[]; - export function set(htmlStr1: string, htmlStr2: string, append?: boolean): HTMLElement|HTMLElement[]; - export function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, append?: boolean): HTMLElement|HTMLElement[]; - export function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, append?: boolean): HTMLElement|HTMLElement[]; - export function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, htmlStr5: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(...htmlStrs: string[]): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, append?: boolean): HTMLElement|HTMLElement[]; + function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, htmlStr5: string, append?: boolean): HTMLElement|HTMLElement[]; - export function cleanup(): void; + function cleanup(): void; - export function setBase(fixtureBasePath: string): void; + function setBase(fixtureBasePath: string): void; } - -export = fixture; -export as namespace fixture; diff --git a/types/karma-fixture/karma-fixture-tests.ts b/types/karma-fixture/karma-fixture-tests.ts index d8ea8c8794..2096298eb9 100644 --- a/types/karma-fixture/karma-fixture-tests.ts +++ b/types/karma-fixture/karma-fixture-tests.ts @@ -1,4 +1,3 @@ - fixture.setBase('fixtures/base/path'); fixture.load('test1.html', 'test1.json', false); fixture.load('test1.html', 'test2.html', 'test1.json'); diff --git a/types/karma-fixture/tslint.json b/types/karma-fixture/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/karma-fixture/tslint.json +++ b/types/karma-fixture/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/karma-jasmine/index.d.ts b/types/karma-jasmine/index.d.ts index 46b7978251..73ca7a480e 100644 --- a/types/karma-jasmine/index.d.ts +++ b/types/karma-jasmine/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/karma-runner/karma-jasmine // Definitions by: Michel Salib // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.8 /// diff --git a/types/karma/index.d.ts b/types/karma/index.d.ts index 4b71c0a723..ba258f0997 100644 --- a/types/karma/index.d.ts +++ b/types/karma/index.d.ts @@ -1,15 +1,17 @@ -// Type definitions for karma 1.7 +// Type definitions for karma 3.0 // Project: https://github.com/karma-runner/karma // Definitions by: Tanguy Krotoff // James Garbutt +// Yaroslav Admin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 /// -// See Karma public API https://karma-runner.github.io/0.13/dev/public-api.html +// See Karma public API https://karma-runner.github.io/latest/dev/public-api.html import Promise = require('bluebird'); import https = require('https'); +import { Appender } from 'log4js'; declare namespace karma { interface Karma { @@ -57,17 +59,17 @@ declare namespace karma { interface LauncherStatic { generateId(): string; - //TODO: injector should be of type `di.Injector` + // TODO: injector should be of type `di.Injector` new (emitter: NodeJS.EventEmitter, injector: any): Launcher; } interface Launcher { Launcher: LauncherStatic; - //TODO: Can this return value ever be typified? + // TODO: Can this return value ever be typified? launch(names: string[], protocol: string, hostname: string, port: number, urlRoot: string): any[]; - kill(id: string, callback: Function): boolean; + kill(id: string, callback: () => void): boolean; restart(id: string): boolean; - killAll(callback: Function): void; + killAll(callback: () => void): void; areAllCaptured(): boolean; markCaptured(id: string): void; } @@ -80,15 +82,13 @@ declare namespace karma { run(options?: ConfigOptions | ConfigFile, callback?: ServerCallback): void; } - interface Stopper { /** - * This function will signal a running server to stop. The equivalent of karma stop. - */ + * This function will signal a running server to stop. The equivalent of karma stop. + */ stop(options?: ConfigOptions, callback?: ServerCallback): void; } - interface TestResults { disconnected: boolean; error: boolean; @@ -98,6 +98,8 @@ declare namespace karma { } interface Server extends NodeJS.EventEmitter { + // TODO: Figure out how to convert Server to class and remove suppression + // tslint:disable-next-line:no-misused-new new (options?: ConfigOptions | ConfigFile, callback?: ServerCallback): Server; /** * Start the server @@ -113,23 +115,21 @@ declare namespace karma { */ refreshFiles(): Promise; - on(event: string, listener: Function): this; + on(event: string, listener: (...args: any[]) => void): this; /** * Listen to the 'run_complete' event. */ on(event: 'run_complete', listener: (browsers: any, results: TestResults) => void): this; - ///** - // * Backward-compatibility with karma-intellij bundled with WebStorm. - // * Deprecated since version 0.13, to be removed in 0.14 - // */ - //static start(): void; + /** + * Backward-compatibility with karma-intellij bundled with WebStorm. + * Deprecated since version 0.13, to be removed in 0.14 + */ + // static start(): void; } - interface ServerCallback { - (exitCode: number): void; - } + type ServerCallback = (exitCode: number) => void; interface Config { set: (config: ConfigOptions) => void; @@ -144,16 +144,6 @@ declare namespace karma { configFile: string; } - // taken from log4js 1.x typings which are gone... - interface Log4jsAppenderConfigBase { - type: string; - category?: string; - layout?: { - type: string; - [key: string]: any - } - } - interface ConfigOptions { /** * @description Enable or disable watching files and executing the tests whenever one of these files changes. @@ -258,7 +248,7 @@ declare namespace karma { * @default [] * @description List of files/patterns to load in the browser. */ - files?: (FilePattern | string)[]; + files?: Array; /** * @default [] * @description List of test frameworks you want to use. Typically, you will set this to ['jasmine'], ['mocha'] or ['qunit']... @@ -294,7 +284,7 @@ declare namespace karma { * @default [{type: 'console'}] * @description A list of log appenders to be used. See the documentation for [log4js] for more information. */ - loggers?: Log4jsAppenderConfigBase[]; + loggers?: { [name: string]: Appender } | Appender[]; /** * @default [] * @description List of names of additional middleware you want the @@ -342,7 +332,7 @@ declare namespace karma { * but your interactive debugging does not. * */ - preprocessors?: { [name: string]: string | string[] } + preprocessors?: { [name: string]: string | string[] }; /** * @default 'http:' * Possible Values: @@ -359,7 +349,7 @@ declare namespace karma { * @default {} * @description A map of path-proxy pairs. */ - proxies?: { [path: string]: string } + proxies?: { [path: string]: string }; /** * @default true * @description Whether or not Karma or any browsers should raise an error when an inavlid SSL certificate is found. diff --git a/types/karma/karma-tests.ts b/types/karma/karma-tests.ts index a8adc36f45..4114a77b02 100644 --- a/types/karma/karma-tests.ts +++ b/types/karma/karma-tests.ts @@ -1,39 +1,34 @@ import gulp = require('gulp'); import karma = require('karma'); - function runKarma(singleRun: boolean): void { // MEMO: `start` method is deprecated since 0.13. It will be removed in 0.14. karma.server.start({ configFile: __dirname + '/karma.conf.js', - singleRun: singleRun + singleRun }); } gulp.task('test:unit:karma', gulp.parallel('build:test:unit', () => runKarma(true))); - - karma.server.start({port: 9876}, (exitCode: number) => { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); - karma.runner.run({port: 9876}, (exitCode: number) => { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); -karma.stopper.stop({port: 9876}, function(exitCode) { +karma.stopper.stop({port: 9876}, (exitCode) => { if (exitCode === 0) { - console.log('Server stop as initiated') + console.log('Server stop as initiated'); } - process.exit(exitCode) + process.exit(exitCode); }); -//var Server = require('karma').Server; => cannot use this syntax otherwise Server is of type any -var server = new karma.Server({logLevel: 'debug', port: 9876}, function(exitCode: number) { +const server = new karma.Server({logLevel: 'debug', port: 9876}, (exitCode: number) => { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); @@ -42,7 +37,7 @@ server.start(); server.refreshFiles(); -server.on('browser_register', function (browser: any) { +server.on('browser_register', (browser: any) => { console.log('A new browser was registered'); }); @@ -54,19 +49,15 @@ server.on('run_complete', (browsers, results) => { results.success = 10; }); -//var runner = require('karma').runner; => cannot use this syntax otherwise runner is of type any -karma.runner.run({port: 9876}, function(exitCode: number) { +karma.runner.run({port: 9876}, (exitCode: number) => { console.log('Karma has exited with ' + exitCode); process.exit(exitCode); }); -// +const captured: boolean = karma.launcher.areAllCaptured(); -var captured: boolean = karma.launcher.areAllCaptured(); - - -// Example of configuration file karma.conf.ts, see http://karma-runner.github.io/0.13/config/configuration-file.html -module.exports = function(config: karma.Config) { +// Example of configuration file karma.conf.ts, see http://karma-runner.github.io/latest/config/configuration-file.html +module.exports = (config: karma.Config) => { config.set({ logLevel: config.LOG_DEBUG, basePath: '..', @@ -83,6 +74,10 @@ module.exports = function(config: karma.Config) { } ], + loggers: { + custom: { type: 'file', filename: 'log.txt' } + }, + reporters: [ 'progress', 'coverage' diff --git a/types/http-proxy-middleware/package.json b/types/karma/package.json similarity index 65% rename from types/http-proxy-middleware/package.json rename to types/karma/package.json index 0aa4cf368f..3daac433d0 100644 --- a/types/http-proxy-middleware/package.json +++ b/types/karma/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "winston": "^3.0.0" + "log4js": "^3.0.0" } } diff --git a/types/karma/tslint.json b/types/karma/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/karma/tslint.json +++ b/types/karma/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/karma/v1/index.d.ts b/types/karma/v1/index.d.ts new file mode 100644 index 0000000000..4b71c0a723 --- /dev/null +++ b/types/karma/v1/index.d.ts @@ -0,0 +1,485 @@ +// Type definitions for karma 1.7 +// Project: https://github.com/karma-runner/karma +// Definitions by: Tanguy Krotoff +// James Garbutt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +// See Karma public API https://karma-runner.github.io/0.13/dev/public-api.html +import Promise = require('bluebird'); +import https = require('https'); + +declare namespace karma { + interface Karma { + /** + * `start` method is deprecated since 0.13. It will be removed in 0.14. + * Please use + * + * server = new Server(config, [done]) + * server.start() + * + * instead. + */ + server: DeprecatedServer; + Server: Server; + runner: Runner; + stopper: Stopper; + launcher: Launcher; + VERSION: string; + constants: Constants; + } + + interface Constants { + VERSION: string; + DEFAULT_PORT: number; + DEFAULT_HOSTNAME: string; + DEFAULT_LISTEN_ADDR: string; + LOG_DISABLE: string; + LOG_ERROR: string; + LOG_WARN: string; + LOG_INFO: string; + LOG_DEBUG: string; + LOG_LOG: string; + LOG_PRIORITIES: string[]; + COLOR_PATTERN: string; + NO_COLOR_PATTERN: string; + CONSOLE_APPENDER: { + type: string; + layout: { + type: string; + pattern: string; + }; + }; + EXIT_CODE: string; + } + + interface LauncherStatic { + generateId(): string; + //TODO: injector should be of type `di.Injector` + new (emitter: NodeJS.EventEmitter, injector: any): Launcher; + } + + interface Launcher { + Launcher: LauncherStatic; + //TODO: Can this return value ever be typified? + launch(names: string[], protocol: string, hostname: string, port: number, urlRoot: string): any[]; + kill(id: string, callback: Function): boolean; + restart(id: string): boolean; + killAll(callback: Function): void; + areAllCaptured(): boolean; + markCaptured(id: string): void; + } + + interface DeprecatedServer { + start(options?: any, callback?: ServerCallback): void; + } + + interface Runner { + run(options?: ConfigOptions | ConfigFile, callback?: ServerCallback): void; + } + + + interface Stopper { + /** + * This function will signal a running server to stop. The equivalent of karma stop. + */ + stop(options?: ConfigOptions, callback?: ServerCallback): void; + } + + + interface TestResults { + disconnected: boolean; + error: boolean; + exitCode: number; + failed: number; + success: number; + } + + interface Server extends NodeJS.EventEmitter { + new (options?: ConfigOptions | ConfigFile, callback?: ServerCallback): Server; + /** + * Start the server + */ + start(): void; + /** + * Get properties from the injector + * @param token + */ + get(token: string): any; + /** + * Force a refresh of the file list + */ + refreshFiles(): Promise; + + on(event: string, listener: Function): this; + + /** + * Listen to the 'run_complete' event. + */ + on(event: 'run_complete', listener: (browsers: any, results: TestResults) => void): this; + + ///** + // * Backward-compatibility with karma-intellij bundled with WebStorm. + // * Deprecated since version 0.13, to be removed in 0.14 + // */ + //static start(): void; + } + + interface ServerCallback { + (exitCode: number): void; + } + + interface Config { + set: (config: ConfigOptions) => void; + LOG_DISABLE: string; + LOG_ERROR: string; + LOG_WARN: string; + LOG_INFO: string; + LOG_DEBUG: string; + } + + interface ConfigFile { + configFile: string; + } + + // taken from log4js 1.x typings which are gone... + interface Log4jsAppenderConfigBase { + type: string; + category?: string; + layout?: { + type: string; + [key: string]: any + } + } + + interface ConfigOptions { + /** + * @description Enable or disable watching files and executing the tests whenever one of these files changes. + * @default true + */ + autoWatch?: boolean; + /** + * @description When Karma is watching the files for changes, it tries to batch multiple changes into a single run + * so that the test runner doesn't try to start and restart running tests more than it should. + * The configuration setting tells Karma how long to wait (in milliseconds) after any changes have occurred + * before starting the test process again. + * @default 250 + */ + autoWatchBatchDelay?: number; + /** + * @default '' + * @description The root path location that will be used to resolve all relative paths defined in files and exclude. + * If the basePath configuration is a relative path then it will be resolved to + * the __dirname of the configuration file. + */ + basePath?: string; + /** + * @default 2000 + * @description How long does Karma wait for a browser to reconnect (in ms). + *

      + * With a flaky connection it is pretty common that the browser disconnects, + * but the actual test execution is still running without any problems. Karma does not treat a disconnection + * as immediate failure and will wait browserDisconnectTimeout (ms). + * If the browser reconnects during that time, everything is fine. + *

      + */ + browserDisconnectTimeout?: number; + /** + * @default 0 + * @description The number of disconnections tolerated. + *

      + * The disconnectTolerance value represents the maximum number of tries a browser will attempt + * in the case of a disconnection. Usually any disconnection is considered a failure, + * but this option allows you to define a tolerance level when there is a flaky network link between + * the Karma server and the browsers. + *

      + */ + browserDisconnectTolerance?: number; + /** + * @default 10000 + * @description How long will Karma wait for a message from a browser before disconnecting from it (in ms). + *

      + * If, during test execution, Karma does not receive any message from a browser within + * browserNoActivityTimeout (ms), it will disconnect from the browser + *

      + */ + browserNoActivityTimeout?: number; + /** + * @default [] + * Possible Values: + *
        + *
      • Chrome (launcher comes installed with Karma)
      • + *
      • ChromeCanary (launcher comes installed with Karma)
      • + *
      • PhantomJS (launcher comes installed with Karma)
      • + *
      • Firefox (launcher requires karma-firefox-launcher plugin)
      • + *
      • Opera (launcher requires karma-opera-launcher plugin)
      • + *
      • Internet Explorer (launcher requires karma-ie-launcher plugin)
      • + *
      • Safari (launcher requires karma-safari-launcher plugin)
      • + *
      + * @description A list of browsers to launch and capture. When Karma starts up, it will also start up each browser + * which is placed within this setting. Once Karma is shut down, it will shut down these browsers as well. + * You can capture any browser manually by opening the browser and visiting the URL where + * the Karma web server is listening (by default it is http://localhost:9876/). + */ + browsers?: string[]; + /** + * @default 60000 + * @description Timeout for capturing a browser (in ms). + *

      + * The captureTimeout value represents the maximum boot-up time allowed for a + * browser to start and connect to Karma. If any browser does not get captured within the timeout, Karma + * will kill it and try to launch it again and, after three attempts to capture it, Karma will give up. + *

      + */ + captureTimeout?: number; + client?: ClientOptions; + /** + * @default true + * @description Enable or disable colors in the output (reporters and logs). + */ + colors?: boolean; + /** + * @default 'Infinity' + * @description How many browsers Karma launches in parallel. + * Especially on services like SauceLabs and Browserstack, it makes sense only to launch a limited + * amount of browsers at once, and only start more when those have finished. Using this configuration, + * you can specify how many browsers should be running at once at any given point in time. + */ + concurrency?: number; + customLaunchers?: { [key: string]: CustomLauncher }; + /** + * @default [] + * @description List of files/patterns to exclude from loaded files. + */ + exclude?: string[]; + /** + * @default [] + * @description List of files/patterns to load in the browser. + */ + files?: (FilePattern | string)[]; + /** + * @default [] + * @description List of test frameworks you want to use. Typically, you will set this to ['jasmine'], ['mocha'] or ['qunit']... + * Please note just about all frameworks in Karma require an additional plugin/framework library to be installed (via NPM). + */ + frameworks?: string[]; + /** + * @default 'localhost' + * @description Hostname to be used when capturing browsers. + */ + hostname?: string; + /** + * @default {} + * @description Options object to be used by Node's https class. + * Object description can be found in the + * [NodeJS.org API docs](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener) + */ + httpsServerOptions?: https.ServerOptions; + /** + * @default config.LOG_INFO + * Possible values: + *
        + *
      • config.LOG_DISABLE
      • + *
      • config.LOG_ERROR
      • + *
      • config.LOG_WARN
      • + *
      • config.LOG_INFO
      • + *
      • config.LOG_DEBUG
      • + *
      + * @description Level of logging. + */ + logLevel?: string; + /** + * @default [{type: 'console'}] + * @description A list of log appenders to be used. See the documentation for [log4js] for more information. + */ + loggers?: Log4jsAppenderConfigBase[]; + /** + * @default [] + * @description List of names of additional middleware you want the + * Karma server to use. Middleware will be used in the order listed. + * You must have installed the middleware via a plugin/framework + * (either inline or via NPM). Additional information can be found in + * [plugins](http://karma-runner.github.io/2.0/config/plugins.html). + * The plugin must provide an express/connect middleware function + * (details about this can be found in the + * [Express](http://expressjs.com/guide/using-middleware.html) docs). + */ + middleware?: string[]; + /** + * @default {} + * @description Redefine default mapping from file extensions to MIME-type. + * Set property name to required MIME, provide Array of extensions (without dots) as it's value. + */ + mime?: {[type: string]: string[]}; + /** + * @default ['karma-*'] + * @description List of plugins to load. A plugin can be a string (in which case it will be required + * by Karma) or an inlined plugin - Object. + * By default, Karma loads all sibling NPM modules which have a name starting with karma-*. + * Note: Just about all plugins in Karma require an additional library to be installed (via NPM). + */ + plugins?: any[]; + /** + * @default 9876 + * @description The port where the web server will be listening. + */ + port?: number; + /** + * @default {'**\/*.coffee': 'coffee'} + * @description A map of preprocessors to use. + * + * Preprocessors can be loaded through [plugins]. + * + * Note: Just about all preprocessors in Karma (other than CoffeeScript and some other defaults) + * require an additional library to be installed (via NPM). + * + * Be aware that preprocessors may be transforming the files and file types that are available at run time. For instance, + * if you are using the "coverage" preprocessor on your source files, if you then attempt to interactively debug + * your tests, you'll discover that your expected source code is completely changed from what you expected. Because + * of that, you'll want to engineer this so that your automated builds use the coverage entry in the "reporters" list, + * but your interactive debugging does not. + * + */ + preprocessors?: { [name: string]: string | string[] } + /** + * @default 'http:' + * Possible Values: + *
        + *
      • http:
      • + *
      • https:
      • + *
      + * @description Protocol used for running the Karma webserver. + * Determines the use of the Node http or https class. + * Note: Using 'https:' requires you to specify httpsServerOptions. + */ + protocol?: string; + /** + * @default {} + * @description A map of path-proxy pairs. + */ + proxies?: { [path: string]: string } + /** + * @default true + * @description Whether or not Karma or any browsers should raise an error when an inavlid SSL certificate is found. + */ + proxyValidateSSL?: boolean; + /** + * @default 0 + * @description Karma will report all the tests that are slower than given time limit (in ms). + * This is disabled by default (since the default value is 0). + */ + reportSlowerThan?: number; + /** + * @default ['progress'] + * Possible Values: + *
        + *
      • dots
      • + *
      • progress
      • + *
      + * @description A list of reporters to use. + * Additional reporters, such as growl, junit, teamcity or coverage can be loaded through plugins. + * Note: Just about all additional reporters in Karma (other than progress) require an additional library to be installed (via NPM). + */ + reporters?: string[]; + /** + * @default false + * @description Continuous Integration mode. + * If true, Karma will start and capture all configured browsers, run tests and then exit with an exit code of 0 or 1 depending + * on whether all tests passed or any tests failed. + */ + singleRun?: boolean; + /** + * @default ['polling', 'websocket'] + * @description An array of allowed transport methods between the browser and testing server. This configuration setting + * is handed off to [socket.io](http://socket.io/) (which manages the communication + * between browsers and the testing server). + */ + transports?: string[]; + /** + * @default '/' + * @description The base url, where Karma runs. + * All of Karma's urls get prefixed with the urlRoot. This is helpful when using proxies, as + * sometimes you might want to proxy a url that is already taken by Karma. + */ + urlRoot?: string; + } + + interface ClientOptions { + /** + * @default undefined + * @description When karma run is passed additional arguments on the command-line, they + * are passed through to the test adapter as karma.config.args (an array of strings). + * The client.args option allows you to set this value for actions other than run. + * How this value is used is up to your test adapter - you should check your adapter's + * documentation to see how (and if) it uses this value. + */ + args?: string[]; + /** + * @default true + * @description Run the tests inside an iFrame or a new window + * If true, Karma runs the tests inside an iFrame. If false, Karma runs the tests in a new window. Some tests may not run in an + * iFrame and may need a new window to run. + */ + useIframe?: boolean; + /** + * @default true + * @description Capture all console output and pipe it to the terminal. + */ + captureConsole?: boolean; + /** + * @default false + * @description Run the tests on the same window as the client, without using iframe or a new window + */ + runInParent?: boolean; + /** + * @default true + * @description Clear the context window + * If true, Karma clears the context window upon the completion of running the tests. + * If false, Karma does not clear the context window upon the completion of running the tests. + * Setting this to false is useful when embedding a Jasmine Spec Runner Template. + */ + clearContext?: boolean; + } + + interface FilePattern { + /** + * The pattern to use for matching. This property is mandatory. + */ + pattern: string; + /** + * @default true + * @description If autoWatch is true all files that have set watched to true will be watched + * for changes. + */ + watched?: boolean; + /** + * @default true + * @description Should the files be included in the browser using header necessary for Browser Monitoring. - * - * This script must be manually injected into your templates, as high as possible - * in the header, but _after_ any X-UA-COMPATIBLE HTTP-EQUIV meta tags. - * Otherwise you may hurt IE! - * - * This method must be called _during_ a transaction, and must be called every - * time you want to generate the headers. - * - * Do *not* reuse the headers between users, or even between requests. - */ - getBrowserTimingHeader(): string; +/** + * If the URL for a transaction matches the provided pattern, ignore the transaction attached to that URL. + * + * Useful for filtering socket.io connections and other long-polling requests out of your agents to keep + * them from distorting an app's apdex or mean response time. + * + * Example: + * + * newrelic.addIgnoringRule('^/socket\\.io/') + */ +export function addIgnoringRule(pattern: RegExp | string): void; - /** - * Instrument a particular method to improve visibility into a transaction, - * or optionally turn it into a metric. - * - * The name defines a name for the segment. This name will be visible in transaction traces and - * as a new metric in the New Relic UI. - * The record flag defines whether the segment should be recorded as a metric. - * The handler is the function you want to track as a segment. - * The optional callback is a function passed to the handler to fire after its work is done. - * - * The agent begins timing the segment when startSegment is called. - * The segment is ended when either the handler finishes executing, or callback is fired, if it is provided. - * If a promise is returned from the handler, the segment's ending will be tied to that promise resolving or rejecting. - */ - startSegment>(name: string, record: boolean, handler: T): T; - startSegment any>(name: string, record: boolean, handler: (cb?: C) => T, callback?: C): T; +/** + * Get the header necessary for Browser Monitoring. + * + * This script must be manually injected into your templates, as high as possible + * in the header, but _after_ any X-UA-COMPATIBLE HTTP-EQUIV meta tags. + * Otherwise you may hurt IE! + * + * This method must be called _during_ a transaction, and must be called every + * time you want to generate the headers. + * + * Do *not* reuse the headers between users, or even between requests. + */ +export function getBrowserTimingHeader(): string; - /** - * Instrument a particular callback to improve visibility into a transaction. - * - * Use this API call to improve instrumentation of a particular method, or to track work across asynchronous - * boundaries by calling createTracer() in both the target function and its parent asynchronous function. - * - * The name will be visible in transaction traces and as a new metric in the New Relic UI. - * - * The agent begins timing the segment when createTracer is called, and ends the segment when the callback - * defined by the callback argument finishes executing. - * - * @deprecated - * This method has been deprecated in favor of newrelic.startSegment() - */ - createTracer any>(name: string, handle: T): T; +/** + * Instrument a particular method to improve visibility into a transaction, + * or optionally turn it into a metric. + * + * The name defines a name for the segment. This name will be visible in transaction traces and + * as a new metric in the New Relic UI. + * The record flag defines whether the segment should be recorded as a metric. + * The handler is the function you want to track as a segment. + * The optional callback is a function passed to the handler to fire after its work is done. + * + * The agent begins timing the segment when startSegment is called. + * The segment is ended when either the handler finishes executing, or callback is fired, if it is provided. + * If a promise is returned from the handler, the segment's ending will be tied to that promise resolving or rejecting. + */ +export function startSegment>(name: string, record: boolean, handler: T): T; +export function startSegment any>(name: string, record: boolean, handler: (cb?: C) => T, callback?: C): T; - /** - * Creates and starts a web transaction to record work done in the handle supplied. - * - * This transaction will run until the handle - * synchronously returns UNLESS: - * 1. The handle function returns a promise, where the end of the - * transaction will be tied to the end of the promise returned. - * 2. `getTransaction` is called in the handle, flagging the - * transaction as externally handled. In this case the transaction - * will be ended when `TransactionHandle#end` is called in the user's code. - * - * @example - * var newrelic = require('newrelic') - * newrelic.startWebTransaction('/some/url/path', function() { - * var transaction = newrelic.getTransaction() - * setTimeout(function() { - * // do some work - * transaction.end() - * }, 100) - * }) - * - * The `url` is used to name and group related transactions in APM, - * so it should be a generic name and not include any variable parameters. - */ - startWebTransaction(url: string, handle: (...args: any[]) => any): any; +/** + * Instrument a particular callback to improve visibility into a transaction. + * + * Use this API call to improve instrumentation of a particular method, or to track work across asynchronous + * boundaries by calling createTracer() in both the target function and its parent asynchronous function. + * + * The name will be visible in transaction traces and as a new metric in the New Relic UI. + * + * The agent begins timing the segment when createTracer is called, and ends the segment when the callback + * defined by the callback argument finishes executing. + * + * @deprecated + * This method has been deprecated in favor of newrelic.startSegment() + */ +export function createTracer any>(name: string, handle: T): T; - /** - * Creates and starts a background transaction to record work done in the handle supplied. - * - * This transaction will run until the handle - * synchronously returns UNLESS: - * 1. The handle function returns a promise, where the end of the - * transaction will be tied to the end of the promise returned. - * 2. `API#getTransaction` is called in the handle, flagging the - * transaction as externally handled. In this case the transaction - * will be ended when `TransactionHandle#end` is called in the user's code. - * - * @example - * var newrelic = require('newrelic') - * newrelic.startBackgroundTransaction('Red October', 'Subs', function() { - * var transaction = newrelic.getTransaction() - * setTimeout(function() { - * // do some work - * transaction.end() - * }, 100) - * }) - * - * The `url` is used to name and group related transactions in APM, - * so it should be a generic name and not include any variable parameters. - * - * The optional `group can be used for grouping background transactions in APM. - * For more information see: - * https://docs.newrelic.com/docs/apm/applications-menu/monitoring/transactions-page#txn-type-dropdown - */ - startBackgroundTransaction(name: string, handle: (...args: any[]) => any): any; - startBackgroundTransaction(name: string, group: string, handle: (...args: any[]) => any): any; +/** + * Creates and starts a web transaction to record work done in the handle supplied. + * + * This transaction will run until the handle + * synchronously returns UNLESS: + * 1. The handle function returns a promise, where the end of the + * transaction will be tied to the end of the promise returned. + * 2. `getTransaction` is called in the handle, flagging the + * transaction as externally handled. In this case the transaction + * will be ended when `TransactionHandle#end` is called in the user's code. + * + * @example + * var newrelic = require('newrelic') + * newrelic.startWebTransaction('/some/url/path', function() { + * var transaction = newrelic.getTransaction() + * setTimeout(function() { + * // do some work + * transaction.end() + * }, 100) + * }) + * + * The `url` is used to name and group related transactions in APM, + * so it should be a generic name and not include any variable parameters. + */ +export function startWebTransaction(url: string, handle: (...args: any[]) => any): any; - /** - * End the current web or background custom transaction. - * - * This method requires being in the correct transaction context when called. - */ - endTransaction(): void; +/** + * Creates and starts a background transaction to record work done in the handle supplied. + * + * This transaction will run until the handle + * synchronously returns UNLESS: + * 1. The handle function returns a promise, where the end of the + * transaction will be tied to the end of the promise returned. + * 2. `API#getTransaction` is called in the handle, flagging the + * transaction as externally handled. In this case the transaction + * will be ended when `TransactionHandle#end` is called in the user's code. + * + * @example + * var newrelic = require('newrelic') + * newrelic.startBackgroundTransaction('Red October', 'Subs', function() { + * var transaction = newrelic.getTransaction() + * setTimeout(function() { + * // do some work + * transaction.end() + * }, 100) + * }) + * + * The `url` is used to name and group related transactions in APM, + * so it should be a generic name and not include any variable parameters. + * + * The optional `group can be used for grouping background transactions in APM. + * For more information see: + * https://docs.newrelic.com/docs/apm/applications-menu/monitoring/transactions-page#txn-type-dropdown + */ +export function startBackgroundTransaction(name: string, handle: (...args: any[]) => any): any; +export function startBackgroundTransaction(name: string, group: string, handle: (...args: any[]) => any): any; - /** - * Record an event-based metric, usually associated with a particular duration. - * - * The `name` must be a string following standard metric naming rules. The `value` will - * usually be a number, but it can also be an object. - * * When `value` is a numeric value, it should represent the magnitude of a measurement - * associated with an event; for example, the duration for a particular method call. - * * When `value` is an object, it must contain count, total, min, max, and sumOfSquares - * keys, all with number values. This form is useful to aggregate metrics on your own - * and report them periodically; for example, from a setInterval. These values will - * be aggregated with any previously collected values for the same metric. The names - * of these keys match the names of the keys used by the platform API. - */ - recordMetric(name: string, value: number | Metric): void; +/** + * End the current web or background custom transaction. + * + * This method requires being in the correct transaction context when called. + */ +export function endTransaction(): void; - /** - * Update a metric that acts as a simple counter. - * - * The count of the selected metric will be incremented by the specified amount, defaulting to 1. - */ - incrementMetric(name: string, value?: number): void; +/** + * Record an event-based metric, usually associated with a particular duration. + * + * The `name` must be a string following standard metric naming rules. The `value` will + * usually be a number, but it can also be an object. + * * When `value` is a numeric value, it should represent the magnitude of a measurement + * associated with an event; for example, the duration for a particular method call. + * * When `value` is an object, it must contain count, total, min, max, and sumOfSquares + * keys, all with number values. This form is useful to aggregate metrics on your own + * and report them periodically; for example, from a setInterval. These values will + * be aggregated with any previously collected values for the same metric. The names + * of these keys match the names of the keys used by the platform API. + */ +export function recordMetric(name: string, value: number | Metric): void; - /** - * Record an event-based metric, usually associated with a particular duration. - * - * `eventType` must be an alphanumeric string less than 255 characters. - * The keys of `attributes` must be shorter than 255 characters. - */ - recordCustomEvent(eventType: string, attributes: { [keys: string]: boolean | number | string }): void; +/** + * Update a metric that acts as a simple counter. + * + * The count of the selected metric will be incremented by the specified amount, defaulting to 1. + */ +export function incrementMetric(name: string, value?: number): void; - /** - * Registers an instrumentation function. - * - * The provided onRequire callback will be fired when the given module is loaded with require. - * The moduleName parameter should be the string that will be passed to require; - * for example, 'express' or 'amqplib/callback_api'. - * - * The optional onError callback is called if the onRequire parameters throws an error. - * This is useful for debugging your instrumentation. - * - * Use this method to: - * - Add instrumentation for modules not currently instrumented by New Relic. - * - Instrument your own code. - * - Replace the Node.js agent's built-in instrumentation with your own. - */ - instrument: Instrument; +/** + * Record an event-based metric, usually associated with a particular duration. + * + * `eventType` must be an alphanumeric string less than 255 characters. + * The keys of `attributes` must be shorter than 255 characters. + */ +export function recordCustomEvent(eventType: string, attributes: { [keys: string]: boolean | number | string }): void; - /** - * Sets an instrumentation callback for a datastore module. - * - * This method is just like `instrument`, except it provides a datastore-service-specialized shim. - */ - instrumentDatastore: Instrument; +/** + * Registers an instrumentation function. + * + * The provided onRequire callback will be fired when the given module is loaded with require. + * The moduleName parameter should be the string that will be passed to require; + * for example, 'express' or 'amqplib/callback_api'. + * + * The optional onError callback is called if the onRequire parameters throws an error. + * This is useful for debugging your instrumentation. + * + * Use this method to: + * - Add instrumentation for modules not currently instrumented by New Relic. + * - Instrument your own code. + * - Replace the Node.js agent's built-in instrumentation with your own. + */ +export const instrument: Instrument; - /** - * Sets an instrumentation callback for a web framework module. - * - * This method is just like `instrument`, except it provides a web-framework-specialized shim. - */ - instrumentWebframework: Instrument; +/** + * Sets an instrumentation callback for a datastore module. + * + * This method is just like `instrument`, except it provides a datastore-service-specialized shim. + */ +export const instrumentDatastore: Instrument; - /** - * Sets an instrumentation callback for a message service client module. - * - * This method is just like `instrument`, except it provides a message-service-specialized shim. - */ - instrumentMessages: Instrument; +/** + * Sets an instrumentation callback for a web framework module. + * + * This method is just like `instrument`, except it provides a web-framework-specialized shim. + */ +export const instrumentWebframework: Instrument; - /** - * Gracefully shuts down the agent. - * - * If `collectPendingData` is true, the agent will send any pending data to the collector - * before shutting down. Defaults to `false`. - */ - shutdown(cb?: (error?: Error) => void): void; - shutdown(options?: { collectPendingData?: boolean, timeout?: number }, cb?: (error?: Error) => void): void; - } +/** + * Sets an instrumentation callback for a message service client module. + * + * This method is just like `instrument`, except it provides a message-service-specialized shim. + */ +export const instrumentMessages: Instrument; - interface Instrument { - (opts: { moduleName: string, onRequire: () => void, onError?: (err: Error) => void }): void; - (moduleName: string, onRequire: () => void, onError?: (err: Error) => void): void; - } +/** + * Gracefully shuts down the agent. + * + * If `collectPendingData` is true, the agent will send any pending data to the collector + * before shutting down. Defaults to `false`. + */ +export function shutdown(cb?: (error?: Error) => void): void; +export function shutdown(options?: { collectPendingData?: boolean, timeout?: number }, cb?: (error?: Error) => void): void; - interface Metric { - count: number; - total: number; - min: number; - max: number; - sumOfSquares: number; - } +export interface Instrument { + (opts: { moduleName: string, onRequire: () => void, onError?: (err: Error) => void }): void; + (moduleName: string, onRequire: () => void, onError?: (err: Error) => void): void; +} - interface TransactionHandle { - /** - * End the transaction. - */ - end(callback?: () => any): void; +export interface Metric { + count: number; + total: number; + min: number; + max: number; + sumOfSquares: number; +} - /** - * Mark the transaction to be ignored. - */ - ignore(): void; - } +export interface TransactionHandle { + /** + * End the transaction. + */ + end(callback?: () => any): void; + + /** + * Mark the transaction to be ignored. + */ + ignore(): void; } -declare const api: newrelic.NewRelicAPI; -export = api; diff --git a/types/newrelic/newrelic-tests.ts b/types/newrelic/newrelic-tests.ts index 3f99152c66..29eabfeb21 100644 --- a/types/newrelic/newrelic-tests.ts +++ b/types/newrelic/newrelic-tests.ts @@ -14,7 +14,9 @@ newrelic.setDispatcher("foo", "42"); // $ExpectType void newrelic.setControllerName("foo", "GET"); // $ExpectType void newrelic.addCustomAttribute("foo", "bar"); // $ExpectType void +newrelic.addCustomAttribute("foo", 42); // $ExpectType void newrelic.addCustomAttributes({ foo: "bar", baz: "bang" }); // $ExpectType void +newrelic.addCustomAttributes({ foo: "bar", baz: 42 }); // $ExpectType void newrelic.setIgnoreTransaction(true); // $ExpectType void diff --git a/types/next-redux-saga/index.d.ts b/types/next-redux-saga/index.d.ts new file mode 100644 index 0000000000..b7575fba16 --- /dev/null +++ b/types/next-redux-saga/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for next-redux-saga 3.0 +// Project: https://github.com/bmealhouse/next-redux-saga +// Definitions by: Leo Cavalcante +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { ComponentType } from "react"; + +declare function nextReduxSaga

      (arg: { async: boolean }): ((BaseComponent: ComponentType

      ) => ComponentType

      ); +declare function nextReduxSaga

      (arg: ComponentType

      ): ComponentType

      ; + +export = nextReduxSaga; diff --git a/types/next-redux-saga/next-redux-saga-tests.tsx b/types/next-redux-saga/next-redux-saga-tests.tsx new file mode 100644 index 0000000000..c905971457 --- /dev/null +++ b/types/next-redux-saga/next-redux-saga-tests.tsx @@ -0,0 +1,65 @@ +import * as React from 'react'; +import withRedux from 'next-redux-wrapper'; +import withReduxSaga from 'next-redux-saga'; +import { createStore, Reducer, Store, AnyAction } from 'redux'; + +interface InitialState { + foo: string; +} + +const reducer: Reducer = (state: InitialState = { foo: '' }, action: AnyAction): InitialState => { + switch (action.type) { + case 'FOO': + return { ...state, foo: action.payload }; + default: + return state; + } +}; + +const makeStore = (initialState: InitialState): Store => { + return createStore(reducer, initialState); +}; + +interface OwnProps { + bar: string; +} + +interface Props { + foo: string; + custom: string; +} + +class Page extends React.Component { + static getInitialProps({ store, isServer, pathname, query }: any) { + store.dispatch({ type: 'FOO', payload: 'foo' }); + return { custom: 'custom' }; + } + render() { + return ( +

      +
      Prop from Redux {this.props.foo}
      +
      Prop from getInitialProps {this.props.custom}
      +
      + ); + } +} + +type ConnectStateProps = Props; +type DispatchProps = Props; +type MergedProps = Props; + +// Test various typings + +const Com1 = withRedux( + (initialState: InitialState, options) => { + if (options.isServer || options.req || options.query || options.res) { + const a = 1; + } + return createStore(reducer, initialState); + }, +)(withReduxSaga({ async: true })(Page)); + +const Com2 = withRedux(makeStore)(withReduxSaga(Page)); + +const com1Instance = (); +const com2Instance = (); diff --git a/types/next-redux-saga/package.json b/types/next-redux-saga/package.json new file mode 100644 index 0000000000..6d68bf2f9b --- /dev/null +++ b/types/next-redux-saga/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "redux": "^3.6.0" + } +} diff --git a/types/next-redux-saga/tsconfig.json b/types/next-redux-saga/tsconfig.json new file mode 100644 index 0000000000..2f57e82a4e --- /dev/null +++ b/types/next-redux-saga/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "next-redux-saga-tests.tsx" + ] +} diff --git a/types/next-redux-saga/tslint.json b/types/next-redux-saga/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/next-redux-saga/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/next-server/asset.d.ts b/types/next-server/asset.d.ts new file mode 100644 index 0000000000..d021de3929 --- /dev/null +++ b/types/next-server/asset.d.ts @@ -0,0 +1,2 @@ +export function setAssetPrefix(url: string): void; +export default function(path: string): string; diff --git a/types/next-server/config.d.ts b/types/next-server/config.d.ts new file mode 100644 index 0000000000..d2cc3cf6e2 --- /dev/null +++ b/types/next-server/config.d.ts @@ -0,0 +1,6 @@ +export interface RuntimeConfig { + serverRuntimeConfig: any; + publicRuntimeConfig?: any; +} +export function setConfig(configValue: any): void; +export default function(): RuntimeConfig; diff --git a/types/next-server/constants.d.ts b/types/next-server/constants.d.ts new file mode 100644 index 0000000000..d2dc74dad0 --- /dev/null +++ b/types/next-server/constants.d.ts @@ -0,0 +1,23 @@ +export const PHASE_EXPORT: string; +export const PHASE_PRODUCTION_BUILD: string; +export const PHASE_PRODUCTION_SERVER: string; +export const PHASE_DEVELOPMENT_SERVER: string; +export const PAGES_MANIFEST: string; +export const BUILD_MANIFEST: string; +export const REACT_LOADABLE_MANIFEST: string; +export const SERVER_DIRECTORY: string; +export const CONFIG_FILE: string; +export const BUILD_ID_FILE: string; +export const BLOCKED_PAGES: string[]; + +export const CLIENT_STATIC_FILES_PATH: string; +export const CLIENT_STATIC_FILES_RUNTIME: string; +export const CLIENT_STATIC_FILES_RUNTIME_PATH: string; +/** static/runtime/main.js */ +export const CLIENT_STATIC_FILES_RUNTIME_MAIN: string; +/** static/runtime/webpack.js */ +export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK: string; +/** matches static//pages/.js */ +export const IS_BUNDLED_PAGE_REGEX: RegExp; +/** matches static//pages/:page*.js */ +export const ROUTE_NAME_REGEX: RegExp; diff --git a/types/next-server/dynamic.d.ts b/types/next-server/dynamic.d.ts new file mode 100644 index 0000000000..38a85bf77e --- /dev/null +++ b/types/next-server/dynamic.d.ts @@ -0,0 +1,42 @@ +import * as React from "react"; +import { + LoadableComponent, + CommonOptions as LoadableOptions, + LoadingComponentProps as LoadableLoadingComponentProps +} from "react-loadable"; + +type Omit = Pick>; + +type AsyncComponent

      = Promise>; +type AsyncComponentLoader

      = () => AsyncComponent

      ; +type ModuleMapping = Record; +type LoadedModuleMapping = Record; + +interface NextDynamicOptions

      extends Omit { + modules?: () => ModuleMapping; // overridden + loading?: LoadableOptions["loading"]; // optional + loader?: AsyncComponentLoader

      ; // optional, overriden + render?: (props: P, loaded: LoadedModuleMapping) => React.ReactNode; // optional, overriden + ssr?: boolean; + loadableGenerated?: { + webpack?: any; + modules?: any; + }; +} + +type DynamicComponent

      = React.ComponentType

      & LoadableComponent; + +/** + * Overloaded dynamic function. + * https://github.com/zeit/next.js/blob/7.0.0/lib/dynamic.js#L55 + */ +declare function dynamic

      ( + options: AsyncComponent

      | NextDynamicOptions

      +): DynamicComponent

      ; +declare function dynamic

      ( + asyncModule: AsyncComponent

      , + options: NextDynamicOptions

      +): DynamicComponent

      ; + +export type LoadingComponentProps = LoadableLoadingComponentProps; +export default dynamic; diff --git a/types/next-server/head.d.ts b/types/next-server/head.d.ts new file mode 100644 index 0000000000..8a8be730f8 --- /dev/null +++ b/types/next-server/head.d.ts @@ -0,0 +1,8 @@ +import * as React from "react"; + +export function defaultHead(className?: string): JSX.Element[]; +export default class Head extends React.Component { + static canUseDOM: boolean; + static peek(): Array>; + static rewind(): Array>; +} diff --git a/types/next-server/index.d.ts b/types/next-server/index.d.ts new file mode 100644 index 0000000000..6e8fcd3ed6 --- /dev/null +++ b/types/next-server/index.d.ts @@ -0,0 +1,125 @@ +// Type definitions for next-server 7.0 +// Project: https://github.com/zeit/next.js/packages/next-server +// Definitions by: Drew Hays +// Brice BERNARD +// James Hegedus +// Resi Respati +// Scott Jones +// Joao Vieira +// AJ Livingston +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +import * as http from "http"; +import { NextConfig } from "./next-config"; +import { UrlLike, DefaultQuery } from "./router"; + +declare namespace next { + interface RenderOptions { + staticMarkup: boolean; + distDir: string; + buildId: string; + generateETags: boolean; + runtimeConfig?: Record; + } + + /** + * Options passed to the Server constructor in Node.js. + */ + interface ServerOptions { + dev?: boolean; + dir?: string; + staticMarkup?: boolean; + quiet?: boolean; + conf?: NextConfig; + } + + interface ServerRoute

      { + match(pathname: string, params?: Partial

      ): P | false; + fn(req: http.IncomingMessage, res: http.ServerResponse, params: P, parsedUrl: UrlLike): Promise; + } + + interface ServerRouter { + routes: ServerRoute[]; + add(route: ServerRoute): void; + match(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): (() => Promise) | undefined; + } + + /** + * Next.js server instance API. + */ + interface Server { + dir: string; + quiet: boolean; + router: ServerRouter; + nextConfig: NextConfig; + distDir: string; + buildId: string; + renderOpts: RenderOptions; + + currentPhase(): string; + handleRequest( + req: http.IncomingMessage, + res: http.ServerResponse, + parsedUrl?: UrlLike + ): Promise; + getRequestHandler(): ( + req: http.IncomingMessage, + res: http.ServerResponse, + parsedUrl?: UrlLike + ) => Promise; + + setAssetPrefix(prefix: string): void; + prepare(): Promise; + close(): Promise; + setImmutableAssetCacheControl(res: http.ServerResponse): void; + generateRoutes(): ServerRoute[]; + run(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): Promise; + + render( + req: http.IncomingMessage, + res: http.ServerResponse, + pathname: string, + query?: DefaultQuery, + parsedUrl?: UrlLike + ): Promise; + renderToHTML( + req: http.IncomingMessage, + res: http.ServerResponse, + pathname: string, + query?: DefaultQuery + ): Promise; + renderError( + err: any, + req: http.IncomingMessage, + res: http.ServerResponse, + pathname: string, + query?: DefaultQuery + ): Promise; + renderErrorToHTML( + err: any, + req: http.IncomingMessage, + res: http.ServerResponse, + pathname: string, + query?: DefaultQuery + ): Promise; + render404( + req: http.IncomingMessage, + res: http.ServerResponse, + parsedUrl?: UrlLike + ): Promise; + + serveStatic( + req: http.IncomingMessage, + res: http.ServerResponse, + path: string + ): Promise; + isServeableUrl(path: string): boolean; + readBuildId(): string; + } +} + +declare function next(options?: next.ServerOptions): next.Server; +export = next; diff --git a/types/next-server/link.d.ts b/types/next-server/link.d.ts new file mode 100644 index 0000000000..520868f05f --- /dev/null +++ b/types/next-server/link.d.ts @@ -0,0 +1,17 @@ +import * as url from "url"; +import * as React from "react"; +import { UrlLike } from "./router"; + +export interface LinkProps { + prefetch?: boolean; + shallow?: boolean; + scroll?: boolean; + replace?: boolean; + onError?(error: any): void; + href?: string | UrlLike; + as?: string | UrlLike; + passHref?: boolean; + children: React.ReactElement; +} + +export default class Link extends React.Component {} diff --git a/types/next-server/next-config.d.ts b/types/next-server/next-config.d.ts new file mode 100644 index 0000000000..5a542abf29 --- /dev/null +++ b/types/next-server/next-config.d.ts @@ -0,0 +1,23 @@ +/** + * Next.js config schema. + * https://github.com/zeit/next.js/blob/7.0.0/server/config.js#L9 + */ +export interface NextConfig { + webpack?: any; + webpackDevMiddleware?: any; + poweredByHeader?: boolean; + distDir?: string; + assetPrefix?: string; + configOrigin?: string; + useFileSystemPublicRoutes?: boolean; + generateBuildId?: () => string; + generateEtags?: boolean; + pageExtensions?: string[]; + publicRuntimeConfig?: object; + serverRuntimeConfig?: object; + + // Plugin can define their own keys. + [key: string]: any; +} + +export default function(phase: string, dir: string, customConfig?: NextConfig): NextConfig; diff --git a/types/next-server/router.d.ts b/types/next-server/router.d.ts new file mode 100644 index 0000000000..af946608df --- /dev/null +++ b/types/next-server/router.d.ts @@ -0,0 +1,100 @@ +import * as React from "react"; +import * as url from "url"; + +type EventName = + | "routeChangeStart" + | "routeChangeComplete" + | "routeChangeError" + | "beforeHistoryChange" + | "hashChangeStart" + | "hashChangeComplete"; + +interface RouteChangeError { + cancelled: boolean; +} + +type EventHandler = (url: string) => any; +type ErrorEventHandler = (err: RouteChangeError, url: string) => any; + +export type UrlLike = url.UrlObject | url.Url; + +export interface EventChangeOptions { + shallow?: boolean; + [key: string]: any; +} + +export type PopStateCallback = (state: any) => boolean | undefined; + +export type RouterCallback = () => void; + +export type DefaultQuery = Record; + +export interface RouterProps { + // url property fields + readonly pathname: string; + readonly route: string; + readonly asPath?: string; + readonly query?: Q; + + // property fields + readonly components: { + [key: string]: { Component: React.ComponentType; err: any }; + }; + + // core method fields + back(): void; + beforePopState(cb: PopStateCallback): boolean; + prefetch(url: string): Promise>; + push( + url: string | UrlLike, + as?: string | UrlLike, + options?: EventChangeOptions + ): Promise; + reload(route: string): Promise; + replace( + url: string | UrlLike, + as?: string | UrlLike, + options?: EventChangeOptions + ): Promise; + + // events (deprecated soonish) + onBeforeHistoryChange?(as: string): void; + onHashChangeStart?(url: string): void; + onHashChangeComplete?(url: string): void; + onRouteChangeComplete?(url: string): void; + onRouteChangeError?(error: RouteChangeError, url: string): void; + onRouteChangeStart?(url: string): void; + + // events API (6.1.1+) + readonly events: { + on: (eventName: EventName, handler: EventHandler | ErrorEventHandler) => void; + off: (eventName: EventName, handler: (url: string) => any) => void; + }; +} + +export interface SingletonRouter extends RouterProps { + router: RouterProps | null; + readyCallbacks: RouterCallback[]; + ready(cb: RouterCallback): void; +} + +export interface WithRouterProps { + router?: SingletonRouter; +} + +/** + * Remove properties `K` from `T`. + * + * @internal + */ +export type Omit = T extends any ? Pick> : never; + +// Manually disabling the no-unnecessary-generics rule so users can +// retain type inference if they wrap their component in withRouter +// without defining props explicitly +export function withRouter( + Component: React.ComponentType> +): React.ComponentType>>; + +declare const Router: SingletonRouter; +export default Router; diff --git a/types/next-server/test/next-server-constants-tests.ts b/types/next-server/test/next-server-constants-tests.ts new file mode 100644 index 0000000000..6ebade7c9f --- /dev/null +++ b/types/next-server/test/next-server-constants-tests.ts @@ -0,0 +1,30 @@ +import { + PHASE_DEVELOPMENT_SERVER, + IS_BUNDLED_PAGE_REGEX +} from "next-server/constants"; + +const isIndexPage = IS_BUNDLED_PAGE_REGEX.test( + "static/CjW0mFnyG80HdP4eSUiy7/pages/index.js" +); + +// Example taken from: https://github.com/cyrilwanner/next-compose-plugins/blob/a25b313899638912cc9defc0be072f4fe4a1e855/README.md +const config = (nextConfig: any = {}) => { + return { + ...nextConfig, + + // define in which phases this plugin should get applied. + // you can also use multiple phases or negate them. + // however, users can still overwrite them in their configuration if they really want to. + phases: [PHASE_DEVELOPMENT_SERVER], + + webpack(config: any, options: any) { + // do something here which only gets applied during development server phase + + if (typeof nextConfig.webpack === "function") { + return nextConfig.webpack(config, options); + } + + return config; + } + }; +}; diff --git a/types/next-server/test/next-server-dynamic-tests.tsx b/types/next-server/test/next-server-dynamic-tests.tsx new file mode 100644 index 0000000000..b6e0b86fe6 --- /dev/null +++ b/types/next-server/test/next-server-dynamic-tests.tsx @@ -0,0 +1,65 @@ +import * as React from "react"; +import dynamic, { LoadingComponentProps } from "next-server/dynamic"; + +// You'd typically do this via import('./MyComponent') +interface MyComponentProps { + foo: string; +} +const MyComponent: React.StatelessComponent = () =>

      I'm async!
      ; +const asyncComponent = Promise.resolve(MyComponent); + +// Examples from +// https://github.com/zeit/next.js/#dynamic-import + +const LoadingComponent: React.StatelessComponent = ({ + isLoading, + error +}) =>

      loading...

      ; + +// 1. Basic Usage (Also does SSR) +const DynamicComponent = dynamic(asyncComponent); +const dynamicComponentJSX = ; + +// 2. With Custom Loading Component +const DynamicComponentWithCustomLoading = dynamic(asyncComponent, { + loading: LoadingComponent +}); +const dynamicComponentWithCustomLoadingJSX = ; + +// 3. With No SSR +const DynamicComponentWithNoSSR = dynamic(asyncComponent, { + ssr: false +}); + +// 4. With Multiple Modules At Once +const HelloBundle = dynamic({ + modules: () => { + const components = { + Hello1: asyncComponent, + Hello2: asyncComponent + }; + + return components; + }, + render: (props, { Hello1, Hello2 }) => ( +
      +

      {props.foo}

      + + +
      + ) +}); +const helloBundleJSX = ; + +// 5. With plain Loadable options +const LoadableComponent = dynamic({ + loader: () => asyncComponent, + loading: LoadingComponent, + delay: 200, + timeout: 10000 +}); + +// 6. No loading +const DynamicComponentWithNoLoading = dynamic(asyncComponent, { + loading: () => null +}); diff --git a/types/next-server/test/next-server-head-tests.tsx b/types/next-server/test/next-server-head-tests.tsx new file mode 100644 index 0000000000..bea5643cad --- /dev/null +++ b/types/next-server/test/next-server-head-tests.tsx @@ -0,0 +1,11 @@ +import Head, * as head from "next-server/head"; +import * as React from "react"; + +const elements: JSX.Element[] = head.defaultHead(); +const jsx = {elements}; + +if (!Head.canUseDOM) { + Head.rewind().map(x => [x.key, x.props, x.type]); +} + +Head.peek().map(x => [x.key, x.props, x.type]); diff --git a/types/next-server/test/next-server-link-tests.tsx b/types/next-server/test/next-server-link-tests.tsx new file mode 100644 index 0000000000..3d34ac54b4 --- /dev/null +++ b/types/next-server/test/next-server-link-tests.tsx @@ -0,0 +1,23 @@ +import Link from "next-server/link"; +import * as React from "react"; + +const links = ( +
      + { + console.log("Handled error!", e); + }} + prefetch + replace + scroll + shallow + > + Gotta link to somewhere! + + + All props are optional! + +
      +); diff --git a/types/next-server/test/next-server-router-tests.tsx b/types/next-server/test/next-server-router-tests.tsx new file mode 100644 index 0000000000..356a3be559 --- /dev/null +++ b/types/next-server/test/next-server-router-tests.tsx @@ -0,0 +1,157 @@ +import Router, { withRouter, WithRouterProps } from "next-server/router"; +import * as React from "react"; +import * as qs from "querystring"; + +Router.readyCallbacks.push(() => { + console.log("I'll get called when the router initializes."); +}); +Router.ready(() => { + console.log( + "I'll get called immediately if the router initializes, or when it eventually does.", + ); +}); + +// Access readonly properties of the router. + +Object.keys(Router.components).forEach(key => { + const c = Router.components[key]; + c.err.isAnAny; + + return ; +}); + +function split(routeLike: string) { + routeLike.split("/").forEach(part => { + console.log("path part: ", part); + }); +} + +if (Router.asPath) { + split(Router.asPath); + split(Router.asPath); +} + +split(Router.pathname); + +const query = `?${qs.stringify(Router.query)}`; + +// Assign some callback methods. +Router.events.on('routeChangeStart', (url: string) => console.log("Route is starting to change.", url)); +Router.events.on('beforeHistoryChange', (as: string) => console.log("History hasn't changed yet.", as)); +Router.events.on('routeChangeComplete', (url: string) => console.log("Route change is complete.", url)); +Router.events.on('routeChangeError', (err: any, url: string) => console.log("Route change errored.", err, url)); + +// Call methods on the router itself. +Router.reload("/route").then(() => console.log("route was reloaded")); +Router.back(); +Router.beforePopState(({ url }) => !!url); + +Router.push("/route").then((success: boolean) => + console.log("route push success: ", success), +); +Router.push("/route", "/asRoute").then((success: boolean) => + console.log("route push success: ", success), +); +Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => + console.log("route push success: ", success), +); + +Router.replace("/route").then((success: boolean) => + console.log("route replace success: ", success), +); +Router.replace("/route", "/asRoute").then((success: boolean) => + console.log("route replace success: ", success), +); +Router.replace("/route", "/asRoute", { + shallow: false, +}).then((success: boolean) => console.log("route replace success: ", success)); + +Router.prefetch("/route").then(Component => { + const element = ; +}); + +interface TestComponentProps extends WithRouterProps { + testValue: string; +} + +class TestComponent extends React.Component { + state = { ready: false }; + + constructor(props: TestComponentProps) { + super(props); + if (props.router) { + props.router.ready(() => { + this.setState({ ready: true }); + }); + } + } + + render() { + return ( +
      +

      {this.state.ready ? 'Ready' : 'Not Ready'}

      +

      Route: {this.props.router ? this.props.router.route : ""}

      +

      Another prop: {this.props.testValue}

      +
      + ); + } +} + +withRouter(TestComponent); + +interface TestComponent2Props extends WithRouterProps { + testValue: string; +} + +class TestComponent2 extends React.Component { + state = { ready: false }; + + constructor(props: TestComponent2Props) { + super(props); + if (props.router) { + props.router.ready(() => { + this.setState({ ready: true }); + }); + } + } + + render() { + return ( +
      +

      {this.state.ready ? 'Ready' : 'Not Ready'}

      +

      Route: {this.props.router ? this.props.router.route : ""}

      +

      Another prop: {this.props.testValue}

      +
      + ); + } +} + +const TestComponent2WithRouter = withRouter(TestComponent2); +const res = ; + +interface TestSFCQuery { + test?: string; +} + +interface TestSFCProps extends WithRouterProps { + testProp: string; +} + +const TestSFC: React.SFC = ({ router }) => { + return
      {router && router.query && router.query.test}
      ; +}; +const TestSFCComponent = withRouter(TestSFC); + +const res2 = ; + +const TestSFC2 = withRouter(({ router }) => { + return
      {router && router.query && router.query.test}
      ; +}); + +const res3 = ; + +const TestSFC3 = withRouter(({ router }) => { + return
      {router && router.query && router.query.test}
      ; +}); + +const res4 = ; diff --git a/types/next-server/test/next-server-tests.ts b/types/next-server/test/next-server-tests.ts new file mode 100644 index 0000000000..7b4bfcca74 --- /dev/null +++ b/types/next-server/test/next-server-tests.ts @@ -0,0 +1,92 @@ +import createServer = require("next-server"); +import * as http from "http"; +import * as url from "url"; + +const defaultServer: createServer.Server = createServer(); +const server = createServer({ + dir: "..", + quiet: true, + conf: { + distDir: "./dist", + useFileSystemPublicRoutes: false, + anotherProperty: { + key: true + } + } +}); + +const devServer = createServer({ + dev: true, + dir: "..", + quiet: true, + conf: { + distDir: "./dist", + useFileSystemPublicRoutes: false, + anotherProperty: { + key: true + } + } +}); + +const { + dir, + quiet, + router, + nextConfig, + distDir, + buildId + } = server; + const { assetPrefix } = nextConfig; + const voidFunc = () => {}; + +server.prepare().then(voidFunc); +server.close().then(voidFunc); + +const parsedUrl = url.parse("https://www.example.com"); +const handler = server.getRequestHandler(); + +function handle(req: http.IncomingMessage, res: http.ServerResponse) { + handler(req, res); + handler(req, res, parsedUrl).then(voidFunc); + server.run(req, res, parsedUrl).then(voidFunc); + + server.render(req, res, "/path/to/resource").then(voidFunc); + server.render(req, res, "/path/to/resource", {}, parsedUrl).then(voidFunc); + server + .render(req, res, "/path/to/resource", { key: "value" }, parsedUrl) + .then(voidFunc); + server + .renderError(new Error(), req, res, "/path/to/resource") + .then(voidFunc); + server + .renderError(new Error(), req, res, "/path/to/resource", { + key: "value", + }) + .then(voidFunc); + server + .renderError( + "this can be an error, too!", + req, + res, + "/path/to/resource", + { key: "value" }, + ) + .then(voidFunc); + server.render404(req, res, parsedUrl).then(voidFunc); + + server + .renderToHTML(req, res, "/path/to/resource", { foo: "bar" }) + .then(x => x.split("\n")); + server + .renderErrorToHTML(new Error(), req, res, "/path/to/resource", { + foo: "bar", + }) + .then(x => x.split("\n")); + + server.serveStatic(req, res, "/path/to/thing").then(voidFunc); + + let b: boolean; + b = server.isServeableUrl("/path/to/thing"); + + const s: string = server.readBuildId(); +} diff --git a/types/next-server/tsconfig.json b/types/next-server/tsconfig.json new file mode 100644 index 0000000000..4d72dadef2 --- /dev/null +++ b/types/next-server/tsconfig.json @@ -0,0 +1,38 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es6", + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "asset.d.ts", + "config.d.ts", + "constants.d.ts", + "dynamic.d.ts", + "head.d.ts", + "link.d.ts", + "next-config.d.ts", + "router.d.ts", + "test/next-server-tests.ts", + "test/next-server-constants-tests.ts", + "test/next-server-head-tests.tsx", + "test/next-server-link-tests.tsx", + "test/next-server-dynamic-tests.tsx", + "test/next-server-router-tests.tsx" + ] +} diff --git a/types/next-server/tslint.json b/types/next-server/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/next-server/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/next/config.d.ts b/types/next/config.d.ts index 8466b60a4f..f9fea12cbd 100644 --- a/types/next/config.d.ts +++ b/types/next/config.d.ts @@ -1 +1,2 @@ -export default function(): { serverRuntimeConfig: any; publicRuntimeConfig: any }; +export * from 'next-server/config'; +export { default } from 'next-server/config'; diff --git a/types/next/constants.d.ts b/types/next/constants.d.ts new file mode 100644 index 0000000000..d0d2e2361e --- /dev/null +++ b/types/next/constants.d.ts @@ -0,0 +1 @@ +export * from 'next-server/constants'; diff --git a/types/next/document.d.ts b/types/next/document.d.ts index b76ed7b2b0..9ac8985cdf 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -37,7 +37,7 @@ export interface NextDocumentContext exte * https://github.com/zeit/next.js/blob/7.0.0/server/document.js#L16 */ export interface DefaultDocumentIProps extends RenderPageResponse { - styles?: Array>; + styles?: React.ReactNode; } /** @@ -55,6 +55,7 @@ export interface DocumentProps { runtimeConfig?: any; nextExport?: boolean; err?: any; + [key: string]: any; }; dev: boolean; dir?: string; @@ -104,5 +105,7 @@ export class NextScript extends React.Component {} export default class Document

      extends React.Component< P & DefaultDocumentIProps & DocumentProps > { - static getInitialProps(context: NextDocumentContext): DefaultDocumentIProps; + static getInitialProps( + context: NextDocumentContext + ): DefaultDocumentIProps | Promise; } diff --git a/types/next/dynamic.d.ts b/types/next/dynamic.d.ts index 38a85bf77e..0b10e6238e 100644 --- a/types/next/dynamic.d.ts +++ b/types/next/dynamic.d.ts @@ -1,42 +1,2 @@ -import * as React from "react"; -import { - LoadableComponent, - CommonOptions as LoadableOptions, - LoadingComponentProps as LoadableLoadingComponentProps -} from "react-loadable"; - -type Omit = Pick>; - -type AsyncComponent

      = Promise>; -type AsyncComponentLoader

      = () => AsyncComponent

      ; -type ModuleMapping = Record; -type LoadedModuleMapping = Record; - -interface NextDynamicOptions

      extends Omit { - modules?: () => ModuleMapping; // overridden - loading?: LoadableOptions["loading"]; // optional - loader?: AsyncComponentLoader

      ; // optional, overriden - render?: (props: P, loaded: LoadedModuleMapping) => React.ReactNode; // optional, overriden - ssr?: boolean; - loadableGenerated?: { - webpack?: any; - modules?: any; - }; -} - -type DynamicComponent

      = React.ComponentType

      & LoadableComponent; - -/** - * Overloaded dynamic function. - * https://github.com/zeit/next.js/blob/7.0.0/lib/dynamic.js#L55 - */ -declare function dynamic

      ( - options: AsyncComponent

      | NextDynamicOptions

      -): DynamicComponent

      ; -declare function dynamic

      ( - asyncModule: AsyncComponent

      , - options: NextDynamicOptions

      -): DynamicComponent

      ; - -export type LoadingComponentProps = LoadableLoadingComponentProps; -export default dynamic; +export * from 'next-server/dynamic'; +export { default } from 'next-server/dynamic'; diff --git a/types/next/error.d.ts b/types/next/error.d.ts index 09d7e31860..8ad2226f07 100644 --- a/types/next/error.d.ts +++ b/types/next/error.d.ts @@ -10,5 +10,5 @@ export interface DefaultErrorIProps { } export default class Error

      extends React.Component

      { - static getInitialProps(context: NextContext): DefaultErrorIProps; + static getInitialProps(context: NextContext): Promise | DefaultErrorIProps; } diff --git a/types/next/head.d.ts b/types/next/head.d.ts index d46b371d11..616f88775c 100644 --- a/types/next/head.d.ts +++ b/types/next/head.d.ts @@ -1,8 +1,2 @@ -import * as React from "react"; - -export function defaultHead(): JSX.Element[]; -export default class Head extends React.Component { - static canUseDOM: boolean; - static peek(): Array>; - static rewind(): Array>; -} +export * from 'next-server/head'; +export { default } from 'next-server/head'; diff --git a/types/next/index.d.ts b/types/next/index.d.ts index d788ddd941..4dc0b49d07 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -1,11 +1,12 @@ // Type definitions for next 7.0 -// Project: https://github.com/zeit/next.js +// Project: https://github.com/zeit/next.js/packages/next // Definitions by: Drew Hays // Brice BERNARD // James Hegedus // Resi Respati // Scott Jones // Joao Vieira +// AJ Livingston // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -13,10 +14,18 @@ import * as http from "http"; import * as url from "url"; +import { Server as NextServer, ServerOptions as NextServerOptions, RenderOptions } from 'next-server'; +import { NextConfig as NextServerConfig } from 'next-server/next-config'; import { Response as NodeResponse } from "node-fetch"; import { SingletonRouter, DefaultQuery, UrlLike } from "./router"; declare namespace next { + // Moved to next-server + type NextConfig = NextServerConfig; + type Server = NextServer; + type ServerOptions = NextServerOptions; + // End Moved to next-server + // Deprecated type QueryStringMapObject = DefaultQuery; type ServerConfig = NextConfig; @@ -47,126 +56,21 @@ declare namespace next { } /** - * Next.js config schema. - * https://github.com/zeit/next.js/blob/7.0.0/server/config.js#L9 + * Next.js dev server instance API. */ - interface NextConfig { - webpack?: any; - webpackDevMiddleware?: any; - poweredByHeader?: boolean; - distDir?: string; - assetPrefix?: string; - configOrigin?: string; - useFileSystemPublicRoutes?: boolean; - generateBuildId?: () => string; - generateEtags?: boolean; - pageExtensions?: string[]; - publicRuntimeConfig?: object; - serverRuntimeConfig?: object; - - // Plugin can define their own keys. - [key: string]: any; - } - - /** - * Options passed to the Server constructor in Node.js. - * https://github.com/zeit/next.js/blob/7.0.0/server/index.js#L25 - */ - interface ServerOptions { - dir?: string; - dev?: boolean; - staticMarkup?: boolean; - quiet?: boolean; - conf?: NextConfig; - } - - /** - * Next.js server instance API. - */ - interface Server { - // From constructor - // https://github.com/zeit/next.js/blob/7.0.0/server/index.js#L25 - dir: string; - dev: boolean; - quiet: boolean; - router: SingletonRouter; - http: null | http.Server; - nextConfig: NextConfig; - distDir: string; - buildId: string; + interface DevServer extends Server { hotReloader: any; - renderOpts: { - dev: string; - staticMarkup: boolean; - distDir: string; + renderOpts: RenderOptions & { + dev: true; hotReloader: any; - buildId: string; - generateETags: boolean; - runtimeConfig?: object; }; getHotReloader( dir: string, options: { quiet: boolean; config: NextConfig; buildId: string } ): any; - handleRequest( - req: http.IncomingMessage, - res: http.ServerResponse, - parsedUrl?: UrlLike - ): Promise; - getRequestHandler(): ( - req: http.IncomingMessage, - res: http.ServerResponse, - parsedUrl?: UrlLike - ) => Promise; - setAssetPrefix(prefix: string): void; - prepare(): Promise; - close(): Promise; - defineRoutes(): Promise; - start(): Promise; - run(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): Promise; - - render( - req: http.IncomingMessage, - res: http.ServerResponse, - pathname: string, - query?: DefaultQuery, - parsedUrl?: UrlLike - ): Promise; - renderToHTML( - req: http.IncomingMessage, - res: http.ServerResponse, - pathname: string, - query?: DefaultQuery - ): Promise; - renderError( - err: any, - req: http.IncomingMessage, - res: http.ServerResponse, - pathname: string, - query?: DefaultQuery - ): Promise; - renderErrorToHTML( - err: any, - req: http.IncomingMessage, - res: http.ServerResponse, - pathname: string, - query?: DefaultQuery - ): Promise; - render404( - req: http.IncomingMessage, - res: http.ServerResponse, - parsedUrl?: UrlLike - ): Promise; - - serveStatic( - req: http.IncomingMessage, - res: http.ServerResponse, - path: string - ): Promise; - isServeableUrl(path: string): boolean; - readBuildId(): string; + addExportPathMapRoutes(): Promise; getCompilationError(): Promise; } @@ -214,5 +118,6 @@ declare namespace next { } } +declare function next(options?: next.ServerOptions & { dev: true }): next.DevServer; declare function next(options?: next.ServerOptions): next.Server; export = next; diff --git a/types/next/link.d.ts b/types/next/link.d.ts index 12e3ee5419..04c383e914 100644 --- a/types/next/link.d.ts +++ b/types/next/link.d.ts @@ -1,21 +1,8 @@ -import * as url from "url"; -import * as React from "react"; -import { UrlLike } from "./router"; +import { LinkProps } from 'next-server/link'; // Deprecated export type LinkState = LinkProps; // End Deprecated -export interface LinkProps { - prefetch?: boolean; - shallow?: boolean; - scroll?: boolean; - replace?: boolean; - onError?(error: any): void; - href?: string | UrlLike; - as?: string | UrlLike; - passHref?: boolean; - children: React.ReactElement; -} - -export default class Link extends React.Component {} +export * from 'next-server/link'; +export { default } from 'next-server/link'; diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 4232f356c9..8fd3df698b 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -1,95 +1,2 @@ -import * as React from "react"; -import * as url from "url"; - -type EventName = - | "routeChangeStart" - | "routeChangeComplete" - | "routeChangeError" - | "beforeHistoryChange" - | "hashChangeStart" - | "hashChangeComplete"; - -interface RouteChangeError { - cancelled: boolean; -} - -type EventHandler = (url: string) => any; -type ErrorEventHandler = (err: RouteChangeError, url: string) => any; - -export type UrlLike = url.UrlObject | url.Url; - -export interface EventChangeOptions { - shallow?: boolean; - [key: string]: any; -} - -export type PopStateCallback = (state: any) => boolean | undefined; - -export type RouterCallback = () => void; - -export type DefaultQuery = Record; - -export interface RouterProps { - // url property fields - readonly pathname: string; - readonly route: string; - readonly asPath?: string; - readonly query?: Q; - - // property fields - readonly components: { - [key: string]: { Component: React.ComponentType; err: any }; - }; - - // core method fields - back(): void; - beforePopState(cb: PopStateCallback): boolean; - prefetch(url: string): Promise>; - push( - url: string | UrlLike, - as?: string | UrlLike, - options?: EventChangeOptions - ): Promise; - reload(route: string): Promise; - replace( - url: string | UrlLike, - as?: string | UrlLike, - options?: EventChangeOptions - ): Promise; - - // events (deprecated soonish) - onAppUpdated?(nextRoute: string): void; - onBeforeHistoryChange?(as: string): void; - onHashChangeStart?(url: string): void; - onHashChangeComplete?(url: string): void; - onRouteChangeComplete?(url: string): void; - onRouteChangeError?(error: RouteChangeError, url: string): void; - onRouteChangeStart?(url: string): void; - - // events API (6.1.1+) - readonly events: { - on: (eventName: EventName, handler: EventHandler | ErrorEventHandler) => void; - off: (eventName: EventName, handler: (url: string) => any) => void; - }; -} - -export interface SingletonRouter extends RouterProps { - router: RouterProps | null; - readyCallbacks: RouterCallback[]; - ready(cb: RouterCallback): void; -} - -export interface WithRouterProps { - router: SingletonRouter; -} - -// Manually disabling the no-unnecessary-generics rule so users can -// retain type inference if they warp their component in withRouter -// without defining props explicitly -export function withRouter( - // tslint:disable-next-line:no-unnecessary-generics - Component: React.ComponentType> -): React.ComponentType; - -declare const Router: SingletonRouter; -export default Router; +export * from 'next-server/router'; +export { default } from 'next-server/router'; diff --git a/types/next/test/next-constants-tests.ts b/types/next/test/next-constants-tests.ts new file mode 100644 index 0000000000..64413ea97c --- /dev/null +++ b/types/next/test/next-constants-tests.ts @@ -0,0 +1,30 @@ +import { + PHASE_DEVELOPMENT_SERVER, + IS_BUNDLED_PAGE_REGEX +} from "next/constants"; + +const isIndexPage = IS_BUNDLED_PAGE_REGEX.test( + "static/CjW0mFnyG80HdP4eSUiy7/pages/index.js" +); + +// Example taken from: https://github.com/cyrilwanner/next-compose-plugins/blob/a25b313899638912cc9defc0be072f4fe4a1e855/README.md +const config = (nextConfig: any = {}) => { + return { + ...nextConfig, + + // define in which phases this plugin should get applied. + // you can also use multiple phases or negate them. + // however, users can still overwrite them in their configuration if they really want to. + phases: [PHASE_DEVELOPMENT_SERVER], + + webpack(config: any, options: any) { + // do something here which only gets applied during development server phase + + if (typeof nextConfig.webpack === "function") { + return nextConfig.webpack(config, options); + } + + return config; + } + }; +}; diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index d25b340e64..bf7ccf036d 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -1,4 +1,5 @@ import Document, { + DocumentProps, Enhancer, Head, Main, @@ -12,6 +13,27 @@ interface WithUrlProps { url: string; } +class MyDocumentDefault extends Document { + static async getInitialProps(ctx: NextDocumentContext) { + const initialProps = await Document.getInitialProps(ctx); + return { ...initialProps }; + } + + render() { + return ( + + + + + +

      + + + + ); + } +} + class MyDoc extends Document { static getInitialProps({ req, renderPage }: NextDocumentContext) { // without callback @@ -29,6 +51,14 @@ class MyDoc extends Document { return { html, head, buildManifest, styles, url }; } + constructor(props: WithUrlProps & DocumentProps) { + super(props); + const { __NEXT_DATA__, url } = props; + + // Custom __NEXT_DATA__ attribute + __NEXT_DATA__.url = url; + } + render() { const { pathname, query } = this.props.__NEXT_DATA__; diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index 04fa50b912..28602ef097 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -79,16 +79,18 @@ class TestComponent extends React.Component { - this.setState({ ready: true }); - }); + if (props.router) { + props.router.ready(() => { + this.setState({ ready: true }); + }); + } } render() { return (

      {this.state.ready ? 'Ready' : 'Not Ready'}

      -

      Route: {this.props.router.route}

      +

      Route: {this.props.router ? this.props.router.route : ""}

      Another prop: {this.props.testValue}

      ); @@ -104,5 +106,5 @@ interface TestSFCQuery { interface TestSFCProps extends WithRouterProps { } const TestSFC: React.SFC = ({ router }) => { - return
      {router.query && router.query.test}
      ; + return
      {router && router.query && router.query.test}
      ; }; diff --git a/types/next/test/next-tests.ts b/types/next/test/next-tests.ts index 646b110c0d..3c8a403e46 100644 --- a/types/next/test/next-tests.ts +++ b/types/next/test/next-tests.ts @@ -15,9 +15,21 @@ const server = createServer({ } }); +const devServer = createServer({ + dev: true, + dir: "..", + quiet: true, + conf: { + distDir: "./dist", + useFileSystemPublicRoutes: false, + anotherProperty: { + key: true + } + } +}); + const { dir, - dev, quiet, router, nextConfig, @@ -29,8 +41,6 @@ const { server.prepare().then(voidFunc); server.close().then(voidFunc); -server.defineRoutes().then(voidFunc); -server.start().then(voidFunc); const parsedUrl = url.parse("https://www.example.com"); const handler = server.getRequestHandler(); @@ -79,5 +89,5 @@ function handle(req: http.IncomingMessage, res: http.ServerResponse) { b = server.isServeableUrl("/path/to/thing"); const s: string = server.readBuildId(); - server.getCompilationError().then(err => err.thisIsAnAny); + devServer.getCompilationError().then(err => err.thisIsAnAny); } diff --git a/types/next/tsconfig.json b/types/next/tsconfig.json index 125953fcd6..9981affbd3 100644 --- a/types/next/tsconfig.json +++ b/types/next/tsconfig.json @@ -20,6 +20,7 @@ }, "files": [ "index.d.ts", + "constants.d.ts", "app.d.ts", "document.d.ts", "dynamic.d.ts", @@ -29,6 +30,7 @@ "router.d.ts", "config.d.ts", "test/next-tests.ts", + "test/next-constants-tests.ts", "test/next-app-tests.tsx", "test/next-error-tests.tsx", "test/next-head-tests.tsx", diff --git a/types/ng-cordova/file.d.ts b/types/ng-cordova/file.d.ts index 8ebe777c14..c6c71972b4 100644 --- a/types/ng-cordova/file.d.ts +++ b/types/ng-cordova/file.d.ts @@ -36,7 +36,10 @@ declare namespace ngCordova { } export interface IFilePromise extends ng.IPromise { - then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; + then( + successCallback: (promiseValue: T) => ng.IPromise | TResult, + errorCallback?: (error: IFileError) => ng.IPromise | TResult2 + ): ng.IPromise; catch(onRejected: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; } diff --git a/types/ng-cordova/fileTransfer.d.ts b/types/ng-cordova/fileTransfer.d.ts index e4ef359c14..9c1d8bf3c2 100644 --- a/types/ng-cordova/fileTransfer.d.ts +++ b/types/ng-cordova/fileTransfer.d.ts @@ -14,7 +14,11 @@ declare namespace ngCordova { } export interface IFileTransferPromise extends ng.IPromise { - then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: FileTransferError) => ng.IPromise | TResult, notifyCallback?: (state: any) => any): ng.IPromise; + then( + successCallback: (promiseValue: T) => ng.IPromise | TResult, + errorCallback?: (error: FileTransferError) => ng.IPromise | TResult2, + notifyCallback?: (state: any) => any + ): ng.IPromise; catch(onRejected: (error: FileTransferError) => ng.IPromise | TResult): ng.IPromise; } diff --git a/types/ng-tags-input/tsconfig.json b/types/ng-tags-input/tsconfig.json index 42a59350cb..09cfc54e25 100644 --- a/types/ng-tags-input/tsconfig.json +++ b/types/ng-tags-input/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/ngprogress/ngprogress-tests.ts b/types/ngprogress/ngprogress-tests.ts index e250e9cb0e..f27bf8bf17 100644 --- a/types/ngprogress/ngprogress-tests.ts +++ b/types/ngprogress/ngprogress-tests.ts @@ -1,7 +1,7 @@ -var ngProgress: NgProgress.INgProgress = {}; +declare const ngProgress: NgProgress.INgProgress; ngProgress.start(); ngProgress.height('10px'); diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index d49d8b5932..5d6da26d2a 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -17,7 +17,7 @@ new Nightmare() .click('.searchsubmit') .wait('.url.breadcrumb') .evaluate(() => { - return (document.querySelector('.url.breadcrumb')).innerText; + return (document.querySelector('.url.breadcrumb') as HTMLElement).innerText; }, (breadcrumb: string) => { // expect(breadcrumb).to.equal('github.com'); }) @@ -165,7 +165,7 @@ new Nightmare() .goto('http://validator.w3.org/#validate_by_upload') .upload('#uploaded_file', 'test/files/jquery-2.1.1.min.js') .evaluate(function () { - return (document.getElementById('uploaded_file')).value; + return (document.getElementById('uploaded_file') as HTMLInputElement).value; }, function (value) { }) .run(done); @@ -214,7 +214,7 @@ new Nightmare() var seconds = function () { var gifs = document.querySelectorAll('img'); - var split = (gifs[gifs.length - 2]).src.split('.gif')[0]; + var split = (gifs[gifs.length - 2] as HTMLImageElement).src.split('.gif')[0]; var seconds = split.split('.com/c')[1]; return parseInt(seconds, 10); }; @@ -319,7 +319,7 @@ new Nightmare() .headers(headers) .goto('http://httpbin.org/headers') .evaluate(function () { - return (document.body.children[0]).innerHTML; + return (document.body.children[0] as HTMLElement).innerHTML; }, function (data: string) { }) .run(done); diff --git a/types/nightwatch/index.d.ts b/types/nightwatch/index.d.ts index b6930fe90a..01e1d99aa6 100644 --- a/types/nightwatch/index.d.ts +++ b/types/nightwatch/index.d.ts @@ -2,10 +2,11 @@ // Project: http://nightwatchjs.org/api // Definitions by: Rahul Kavalapara // Connor Schlesiger +// Clayton Astrom // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface NightwatchCustomPageObjects { - page: {[name: string]: () => NightwatchBrowser}; + page: {[name: string]: () => EnhancedPageObject}; } export interface NightwatchDesiredCapabilities { @@ -775,41 +776,13 @@ export interface NightwatchKeys { "COMMAND": string; } -export interface NightwatchAPI { +export interface NightwatchAPI extends SharedFunctions { assert: NightwatchAssertions; expect: Expect; verify: NightwatchAssertions; - /** - * Clear a textarea or a text input element's value. Uses elementIdValue protocol command. - * - * Usage: - * ``` - * this.demoTest = function (client) { - * client.clearValue('input[type=text]'); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - */ - clearValue(selector: string, callback?: () => void): this; - - /** - * Simulates a click event on the given DOM element. Uses elementIdClick protocol command. - * - * Usage: - * ``` - * this.demoTest = function (client) { - * client.click("#main ul li a.first"); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - */ - click(selector: string, callback?: () => void): this; - /** * Close the current window. This can be useful when you're working with multiple windows open (e.g. an OAuth login). Uses window protocol command. * @@ -867,26 +840,6 @@ export interface NightwatchAPI { */ end(callback?: () => void): this; - /** - * Retrieve the value of an attribute for a given DOM element. Uses elementIdAttribute protocol command. - * - * Usage: - * ``` - * this.demoTest = function (client) { - * client.getAttribute("#main ul li a.first", "href", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value, "#home"); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param attribute: The attribute name to inspect. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The value of the attribute - */ - getAttribute(selector: string, attribute: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - /** * Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined here. * Uses cookie protocol command. @@ -924,87 +877,6 @@ export interface NightwatchAPI { */ getCookies(callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - /** - * Retrieve the value of a css property for a given DOM element. Uses elementIdCssProperty protocol command. - * - * Usage: - * ``` - * this.demoTest = function (client) { - * client.getCssProperty("#main ul li a.first", "display", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value, 'inline'); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param cssProperty: The CSS property to inspect. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The value of the css property - */ - getCssProperty(selector: string, cssProperty: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - - /** - * Determine an element's size in pixels. Uses elementIdSize protocol command. - * - * Usage: - * ``` - * this.demoTest = function (client) { - * client.getElementSize("#main ul li a.first", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value.width, 500); - * this.assert.equal(result.value.height, 20); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The width and height of the element in pixels - */ - getElementSize(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - - /** - * Determine an element's location on the page. The point (0, 0) refers to the upper-left corner of the page. - * The element's coordinates are returned as a JSON object with x and y properties. Uses elementIdLocation protocol command. - * - * Usage: - * ``` - * this.demoTest = function (client) { - * client.getLocation("#main ul li a.first", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value.x, 200); - * this.assert.equal(result.value.y, 200); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The X and Y coordinates for the element on the page - */ - getLocation(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - - /** - * Determine an element's location on the screen once it has been scrolled into view. Uses elementIdLocationInView protocol command. - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.getLocationInView("#main ul li a.first", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value.x, 200); - * this.assert.equal(result.value.y, 200); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The X and Y coordinates for the element on the page. - */ - getLocationInView(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - /** * Gets a log from selenium * @@ -1040,44 +912,6 @@ export interface NightwatchAPI { */ getLogTypes(callback?: (result: NightwatchCallbackResult) => void): this; - /** - * Query for an element's tag name. Uses elementIdName protocol command. - * - * Usage: - * ``` - * this.demoTest = function (client) { - * client.getTagName("#main ul li .first", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value, "a"); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The element's tag name, as a lowercase string. - */ - getTagName(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - - /** - * Returns the visible text for the element. Uses elementIdText protocol command. - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.getText("#main ul li a.first", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value, "nightwatchjs.org"); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The element's visible text. - */ - getText(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - /** * Returns the title of the current page. Uses title protocol command. * @@ -1095,25 +929,6 @@ export interface NightwatchAPI { */ getTitle(callback?: (this: NightwatchAPI, result?: string) => void): this; - /** - * Returns a form element current value. Uses elementIdValue protocol command. - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.getValue("form.login input[type=text]", function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value, "enter username"); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - * @returns The element's value. - */ - getValue(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - /** * This command is an alias to url and also a convenience method when called without any arguments in the sense that it performs a call to .url() with passing the value of launch_url * field from the settings file. Uses url protocol command. @@ -1162,24 +977,6 @@ export interface NightwatchAPI { */ isLogAvailable(typeString: string, callback?: (result: NightwatchCallbackResult) => void): this; - /** - * Determine if an element is currently displayed. Uses elementIdDisplayed protocol command. - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.isVisible('#main', function(result) { - * this.assert.equal(typeof result, "object"); - * this.assert.equal(result.status, 0); - * this.assert.equal(result.value, true); - * }); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - */ - isVisible(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; - /** * Maximizes the current window. * @@ -1193,22 +990,6 @@ export interface NightwatchAPI { */ maximizeWindow(callback?: (result: NightwatchCallbackResult) => void): this; - /** - * Move the mouse by an offset of the specified element. Uses moveTo protocol command. - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.moveToElement('#main', 10, 10); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param xoffset: X offset to move to, relative to the top-left corner of the element. - * @param yoffset: Y offset to move to, relative to the top-left corner of the element. - * @param callback: Optional callback function to be called when the command finishes. - */ - moveToElement(selector: string, xoffset: number, yoffset: number, callback?: (result: NightwatchCallbackResult) => void): this; - /** * Suspends the test for the given time in milliseconds. If the milliseconds argument is missing it will suspend the test indefinitely * @@ -1368,30 +1149,6 @@ export interface NightwatchAPI { */ setCookie(cookie: any, callback?: () => void): this; - /** - * Sends some text to an element. Can be used to set the value of a form element or to send a sequence of key strokes to an element. Any UTF-8 character may be specified. - * An object map with available keys and their respective UTF-8 characters, as defined on W3C WebDriver draft spec (http://www.w3.org/TR/webdriver/#character-types), - * is loaded onto the main Nightwatch instance as client.Keys. - * - * Usage: - * ``` - * // send some simple text to an input - * this.demoTest = function (browser) { - * browser.setValue('input[type=text]', 'nightwatch'); - * }; - * - * // - * // send some text to an input and hit enter. - * this.demoTest = function (browser) { - * browser.setValue('input[type=text]', ['nightwatch', browser.Keys.ENTER]); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param inputValue: The text to send to the element or key strokes. - * @param callback: Optional callback function to be called when the command finishes. - */ - setValue(selector: string, inputValue: string, callback?: () => void): this; - /** * Sets the current window position. * @@ -1407,20 +1164,6 @@ export interface NightwatchAPI { */ setWindowPosition(OffsetX: number, OffsetY: number, callback?: () => void): this; - /** - * Submit a FORM element. The submit command may also be applied to any element that is a descendant of a FORM element. Uses submit protocol command. - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.submitForm('form.login'); - * }; - * ``` - * @param selector: The CSS/Xpath selector used to locate the element. - * @param callback: Optional callback function to be called when the command finishes. - */ - submitForm(selector: string, callback?: () => void): this; - /** * Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name attribute. * To find out the window handle use window_handles protocol action @@ -1455,116 +1198,6 @@ export interface NightwatchAPI { */ urlHash(hash: string): this; - /** - * Opposite of waitForElementPresent. Waits a given time in milliseconds for an element to be not present (i.e. removed) in the page before performing any other commands - * or assertions. If the element is still present after the specified amount of time, the test fails. You can change the polling interval by defining - * a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json or in your external globals file. - * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.waitForElementNotPresent('#dialog', 1000); - * }; - * ``` - * @param selector: The selector (CSS / Xpath) used to locate the element. - * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. - * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. - * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. - * @param callback: Optional callback function to be called when the command finishes. - * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time - * (e.g. Element %s was not in the page for %d ms). - */ - waitForElementNotPresent(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; - - /** - * Opposite of waitForElementVisible. Waits a given time in milliseconds for an element to be not visible (i.e. hidden but existing) in the page before performing - * any other commands or assertions. If the element fails to be hidden in the specified amount of time, the test fails. You can change the polling interval by - * defining a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json or in your external globals file. - * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.waitForElementNotVisible('#dialog', 1000); - * }; - * ``` - * @param selector: The selector (CSS / Xpath) used to locate the element. - * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. - * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. - * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. - * @param callback: Optional callback function to be called when the command finishes. - * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time - * (e.g. Element %s was not in the page for %d ms). - */ - waitForElementNotVisible(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; - - /** - * Waits a given time in milliseconds for an element to be present in the page before performing any other commands or assertions. - * If the element fails to be present in the specified amount of time, the test fails. You can change this by setting abortOnFailure to false. - * You can change the polling interval by defining a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json or in - * your external globals file. - * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.waitForElementPresent('body', 1000); - * // continue if failed - * browser.waitForElementPresent('body', 1000, false); - * // with callback - * browser.waitForElementPresent('body', 1000, function() { - * // do something while we're here - * }); - * // custom Spanish message - * browser.waitForElementPresent('body', 1000, 'elemento %s no era presente en %d ms'); - * // many combinations possible - the message is always the last argument - * browser.waitForElementPresent('body', 1000, false, function() {}, 'elemento %s no era presente en %d ms'); - * }; - * ``` - * @param selector: The selector (CSS / Xpath) used to locate the element. - * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. - * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. - * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. - * @param callback: Optional callback function to be called when the command finishes. - * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time - * (e.g. Element %s was not in the page for %d ms). - */ - waitForElementPresent(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; - - /** - * Waits a given time in milliseconds for an element to be visible in the page before performing any other commands or assertions. - * If the element fails to be present and visible in the specified amount of time, the test fails. You can change this by setting abortOnFailure to false. - * You can change the polling interval by defining a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json - * or in your external globals file. - * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). - * - * Usage: - * ``` - * this.demoTest = function (browser) { - * browser.waitForElementVisible('body', 1000); - * // continue if failed - * browser.waitForElementVisible('body', 1000, false); - * // with callback - * browser.waitForElementVisible('body', 1000, function() { - * // do something while we're here - * }); - * // custom Spanish message - * browser.waitForElementVisible('body', 1000, 'elemento %s no era visible en %d ms'); - * // many combinations possible - the message is always the last argument - * browser.waitForElementVisible('body', 1000, false, function() {}, 'elemento %s no era visible en %d ms'); - * }; - * ``` - * @param selector: The selector (CSS / Xpath) used to locate the element. - * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. - * @param abortOnFailure: By the default if the element is not found the test will fail. - * Set this to false if you wish for the test to continue even if the assertion fails. - * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. - * @param callback: Optional callback function to be called when the command finishes. - * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time (e.g. Element %s was not in the page for %d ms). - */ - waitForElementVisible(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; - /** * Accepts the currently displayed alert dialog. Usually, this is equivalent to clicking on the 'OK' button in the dialog. * @param callback: Optional callback function to be called when the command finishes. @@ -2173,6 +1806,7 @@ export interface NightwatchTestHooks { after?: NightwatchTestHook; beforeEach?: NightwatchTestHook; afterEach?: NightwatchTestHook; + '@disabled'?: boolean; } export type NightwatchTests = NightwatchTestFunctions | NightwatchTestHooks; @@ -2214,3 +1848,432 @@ export interface Nightwatch { api: NightwatchAPI; client: NightwatchClient; } + +/** + * #### [Enhanced Element Instances](https://github.com/nightwatchjs/nightwatch/wiki/Page-Object-API#enhanced-element-instances) + * Element instances encapsulate the definition used to handle element selectors. + * Generally you won't need to access them directly, + * instead referring to them using their `@`-prefixed names for selector arguments, + * but they are available through a page object or section's elements property. + */ +export interface EnhancedElementInstance { + /** + * The name of the element as defined by its key in the parent section or the page object's `elements` definition. + * This is the same name used with the `@` prefix in selector arguments for page object commands that refer to the element. + */ + name: string; + + /** + * The locate strategy to be used with `selector` when finding the element within the DOM. + */ + locateStrategy: string; + + /** + * A reference to the parent object instance. + * This is the parent section or the page object that contained the definition for this object. + */ + parent: EnhancedPageObject; + + /** + * The selector string used to find the element in the DOM. + */ + selector: string; +} + +/** + * #### [Enhanced Page Object Instances](https://github.com/nightwatchjs/nightwatch/wiki/Page-Object-API#enhanced-page-object-instances) + * Page object module definitions are used to define page object instances when their respective factory functions within the page reference of the standard command API is called. + * ``` + * var myPageObject = browser.page.MyPage(); // defined in MyPage.js module + * ``` + * Every time a factory function like MyPage above is called, a new instance of the page object is instantiated. + */ +export interface EnhancedPageObject extends SharedFunctions { + /** + * A reference providing access to the full Nightwatch command API, + * usually known as "client" or "browser" in test cases. + * This is used to access those commands that are not part of the subset of commands within the page object API. + */ + api: NightwatchAPI; + + /** + * A map of Element objects (see [Enhanced Element Instances](https://github.com/nightwatchjs/nightwatch/wiki/Page-Object-API#enhanced-element-instances)) used by element selectors. + */ + elements: {[name: string]: EnhancedElementInstance}; + + /** + * The name of the page object as defined by its module name (not including the extension). + * This is the same name used to access the `page` object factory from the page reference in the command API. + */ + name: string; +} + +export interface SharedFunctions { + /** + * Clear a textarea or a text input element's value. Uses elementIdValue protocol command. + * + * Usage: + * ``` + * this.demoTest = function (client) { + * client.clearValue('input[type=text]'); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + */ + clearValue(selector: string, callback?: () => void): this; + + /** + * Simulates a click event on the given DOM element. Uses elementIdClick protocol command. + * + * Usage: + * ``` + * this.demoTest = function (client) { + * client.click("#main ul li a.first"); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + */ + click(selector: string, callback?: () => void): this; + + /** + * Retrieve the value of an attribute for a given DOM element. Uses elementIdAttribute protocol command. + * + * Usage: + * ``` + * this.demoTest = function (client) { + * client.getAttribute("#main ul li a.first", "href", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value, "#home"); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param attribute: The attribute name to inspect. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The value of the attribute + */ + getAttribute(selector: string, attribute: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Retrieve the value of a css property for a given DOM element. Uses elementIdCssProperty protocol command. + * + * Usage: + * ``` + * this.demoTest = function (client) { + * client.getCssProperty("#main ul li a.first", "display", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value, 'inline'); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param cssProperty: The CSS property to inspect. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The value of the css property + */ + getCssProperty(selector: string, cssProperty: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Determine an element's size in pixels. Uses elementIdSize protocol command. + * + * Usage: + * ``` + * this.demoTest = function (client) { + * client.getElementSize("#main ul li a.first", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value.width, 500); + * this.assert.equal(result.value.height, 20); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The width and height of the element in pixels + */ + getElementSize(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Determine an element's location on the page. The point (0, 0) refers to the upper-left corner of the page. + * The element's coordinates are returned as a JSON object with x and y properties. Uses elementIdLocation protocol command. + * + * Usage: + * ``` + * this.demoTest = function (client) { + * client.getLocation("#main ul li a.first", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value.x, 200); + * this.assert.equal(result.value.y, 200); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The X and Y coordinates for the element on the page + */ + getLocation(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Determine an element's location on the screen once it has been scrolled into view. Uses elementIdLocationInView protocol command. + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.getLocationInView("#main ul li a.first", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value.x, 200); + * this.assert.equal(result.value.y, 200); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The X and Y coordinates for the element on the page. + */ + getLocationInView(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Query for an element's tag name. Uses elementIdName protocol command. + * + * Usage: + * ``` + * this.demoTest = function (client) { + * client.getTagName("#main ul li .first", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value, "a"); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The element's tag name, as a lowercase string. + */ + getTagName(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Returns the visible text for the element. Uses elementIdText protocol command. + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.getText("#main ul li a.first", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value, "nightwatchjs.org"); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The element's visible text. + */ + getText(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Returns a form element current value. Uses elementIdValue protocol command. + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.getValue("form.login input[type=text]", function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value, "enter username"); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + * @returns The element's value. + */ + getValue(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Determine if an element is currently displayed. Uses elementIdDisplayed protocol command. + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.isVisible('#main', function(result) { + * this.assert.equal(typeof result, "object"); + * this.assert.equal(result.status, 0); + * this.assert.equal(result.value, true); + * }); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + */ + isVisible(selector: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): this; + + /** + * Move the mouse by an offset of the specified element. Uses moveTo protocol command. + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.moveToElement('#main', 10, 10); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param xoffset: X offset to move to, relative to the top-left corner of the element. + * @param yoffset: Y offset to move to, relative to the top-left corner of the element. + * @param callback: Optional callback function to be called when the command finishes. + */ + moveToElement(selector: string, xoffset: number, yoffset: number, callback?: (result: NightwatchCallbackResult) => void): this; + + /** + * Sends some text to an element. Can be used to set the value of a form element or to send a sequence of key strokes to an element. Any UTF-8 character may be specified. + * An object map with available keys and their respective UTF-8 characters, as defined on W3C WebDriver draft spec (http://www.w3.org/TR/webdriver/#character-types), + * is loaded onto the main Nightwatch instance as client.Keys. + * + * Usage: + * ``` + * // send some simple text to an input + * this.demoTest = function (browser) { + * browser.setValue('input[type=text]', 'nightwatch'); + * }; + * + * // + * // send some text to an input and hit enter. + * this.demoTest = function (browser) { + * browser.setValue('input[type=text]', ['nightwatch', browser.Keys.ENTER]); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param inputValue: The text to send to the element or key strokes. + * @param callback: Optional callback function to be called when the command finishes. + */ + setValue(selector: string, inputValue: string, callback?: () => void): this; + + /** + * Submit a FORM element. The submit command may also be applied to any element that is a descendant of a FORM element. Uses submit protocol command. + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.submitForm('form.login'); + * }; + * ``` + * @param selector: The CSS/Xpath selector used to locate the element. + * @param callback: Optional callback function to be called when the command finishes. + */ + submitForm(selector: string, callback?: () => void): this; + + /** + * Opposite of waitForElementPresent. Waits a given time in milliseconds for an element to be not present (i.e. removed) in the page before performing any other commands + * or assertions. If the element is still present after the specified amount of time, the test fails. You can change the polling interval by defining + * a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json or in your external globals file. + * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.waitForElementNotPresent('#dialog', 1000); + * }; + * ``` + * @param selector: The selector (CSS / Xpath) used to locate the element. + * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. + * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. + * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. + * @param callback: Optional callback function to be called when the command finishes. + * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time + * (e.g. Element %s was not in the page for %d ms). + */ + waitForElementNotPresent(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; + + /** + * Opposite of waitForElementVisible. Waits a given time in milliseconds for an element to be not visible (i.e. hidden but existing) in the page before performing + * any other commands or assertions. If the element fails to be hidden in the specified amount of time, the test fails. You can change the polling interval by + * defining a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json or in your external globals file. + * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.waitForElementNotVisible('#dialog', 1000); + * }; + * ``` + * @param selector: The selector (CSS / Xpath) used to locate the element. + * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. + * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. + * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. + * @param callback: Optional callback function to be called when the command finishes. + * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time + * (e.g. Element %s was not in the page for %d ms). + */ + waitForElementNotVisible(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; + + /** + * Waits a given time in milliseconds for an element to be present in the page before performing any other commands or assertions. + * If the element fails to be present in the specified amount of time, the test fails. You can change this by setting abortOnFailure to false. + * You can change the polling interval by defining a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json or in + * your external globals file. + * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.waitForElementPresent('body', 1000); + * // continue if failed + * browser.waitForElementPresent('body', 1000, false); + * // with callback + * browser.waitForElementPresent('body', 1000, function() { + * // do something while we're here + * }); + * // custom Spanish message + * browser.waitForElementPresent('body', 1000, 'elemento %s no era presente en %d ms'); + * // many combinations possible - the message is always the last argument + * browser.waitForElementPresent('body', 1000, false, function() {}, 'elemento %s no era presente en %d ms'); + * }; + * ``` + * @param selector: The selector (CSS / Xpath) used to locate the element. + * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. + * @param abortOnFailure: By the default if the element is not found the test will fail. Set this to false if you wish for the test to continue even if the assertion fails. + * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. + * @param callback: Optional callback function to be called when the command finishes. + * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time + * (e.g. Element %s was not in the page for %d ms). + */ + waitForElementPresent(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; + + /** + * Waits a given time in milliseconds for an element to be visible in the page before performing any other commands or assertions. + * If the element fails to be present and visible in the specified amount of time, the test fails. You can change this by setting abortOnFailure to false. + * You can change the polling interval by defining a waitForConditionPollInterval property (in milliseconds) in as a global property in your nightwatch.json + * or in your external globals file. + * Similarly, a default timeout can be specified as a global waitForConditionTimeout property (in milliseconds). + * + * Usage: + * ``` + * this.demoTest = function (browser) { + * browser.waitForElementVisible('body', 1000); + * // continue if failed + * browser.waitForElementVisible('body', 1000, false); + * // with callback + * browser.waitForElementVisible('body', 1000, function() { + * // do something while we're here + * }); + * // custom Spanish message + * browser.waitForElementVisible('body', 1000, 'elemento %s no era visible en %d ms'); + * // many combinations possible - the message is always the last argument + * browser.waitForElementVisible('body', 1000, false, function() {}, 'elemento %s no era visible en %d ms'); + * }; + * ``` + * @param selector: The selector (CSS / Xpath) used to locate the element. + * @param time: The number of milliseconds to wait. The runner performs repeated checks every 500 ms. + * @param abortOnFailure: By the default if the element is not found the test will fail. + * Set this to false if you wish for the test to continue even if the assertion fails. + * To set this globally you can define a property `abortOnNightwatchAssertionsFailure` in your globals. + * @param callback: Optional callback function to be called when the command finishes. + * @param message: Optional message to be shown in the output; the message supports two placeholders: %s for current selector and %d for the time (e.g. Element %s was not in the page for %d ms). + */ + waitForElementVisible(selector: string, time?: number, abortOnFailure?: boolean, callback?: () => void, message?: string): this; +} diff --git a/types/nise/index.d.ts b/types/nise/index.d.ts new file mode 100644 index 0000000000..f054bad373 --- /dev/null +++ b/types/nise/index.d.ts @@ -0,0 +1,282 @@ +// Type definitions for nise 1.4 +// Project: https://github.com/sinonjs/nise#readme +// Definitions by: Alexander T. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export interface FakeUploadProgress { + eventListeners: { + progress: any[]; + load: any[]; + abort: any[]; + error: any[]; + }; + + addEventListener(event: string, listener: (e: Event) => any): void; + removeEventListener(event: string, listener: (e: Event) => any): void; + dispatchEvent(event: Event): void; +} + +export interface FakeXMLHttpRequest { + /** + * The URL set on the request object. + */ + url: string; + /** + * The request method as a string. + */ + method: string; + /** + * An object of all request headers, i.e.: + */ + requestHeaders: any; + /** + * The request body + */ + requestBody: string; + /** + * The request’s status code. + * undefined if the request has not been handled (see respond below) + */ + status: number; + /** + * Only populated if the respond method is called (see below). + */ + statusText: string; + /** + * Whether or not the request is asynchronous. + */ + async: boolean; + /** + * Username, if any. + */ + username: string; + /** + * Password, if any. + */ + password: string; + withCredentials: boolean; + upload: FakeUploadProgress; + /** + * When using respond, this property is populated with a parsed document if response headers indicate as much (see the spec) + */ + responseXML: Document; + /** + * The value of the given response header, if the request has been responded to (see respond). + * @param header + */ + getResponseHeader(header: string): string; + /** + * All response headers as an object. + */ + getAllResponseHeaders(): any; + + /** + * Sets response headers (e.g. { "Content-Type": "text/html", ... }, updates the readyState property and fires onreadystatechange. + * @param headers + */ + setResponseHeaders(headers: any): void; + /** + * Sets the respond body, updates the readyState property and fires onreadystatechange. + * Additionally, populates responseXML with a parsed document if response headers indicate as much. + */ + setResponseBody(body: string): void; + /** + * Calls the above three methods. + */ + respond(status: number, headers?: any, body?: string): void; + autoRespond(ms: number): void; + /** + * Simulates a network error on the request. The onerror handler will be called and the status will be 0. + */ + error(): void; + + onloadstart(e: Event): void; + onprogress(e: Event): void; + ontimeout(e: Event): void; + onloadend(e: Event): void; + onerror(e: Event): void; + onabort(e: Event): void; + onload(e: Event): void; +} + +export interface FakeServerOptions { + /** + * When set to true, causes the server to automatically respond to incoming requests after a timeout. + * The default timeout is 10ms but you can control it through the autoRespondAfter property. + * Note that this feature is intended to help during mockup development, and is not suitable for use in tests. + */ + autoRespond: boolean; + /** + * When autoRespond is true, respond to requests after this number of milliseconds. Default is 10. + */ + autoRespondAfter: number; + /** + * If set to true, server will find _method parameter in POST body and recognize that as the actual method. + * Supports a pattern common to Ruby on Rails applications. For custom HTTP method faking, override server.getHTTPMethod(request). + */ + fakeHTTPMethods: boolean; + /** + * If set, the server will respond to every request immediately and synchronously. + * This is ideal for faking the server from within a test without having to call server.respond() after each request made in that test. + * As this is synchronous and immediate, this is not suitable for simulating actual network latency in tests or mockups. + * To simulate network latency with automatic responses, see server.autoRespond and server.autoRespondAfter. + */ + respondImmediately: boolean; +} + +export interface FakeServer extends FakeServerOptions { + lastRequest: FakeXMLHttpRequest | undefined; + firstRequest: FakeXMLHttpRequest | undefined; + secondRequest: FakeXMLHttpRequest | undefined; + thirdRequest: FakeXMLHttpRequest | undefined; + + /** + * Used internally to determine the HTTP method used with the provided request. + * By default this method simply returns request.method. + * When server.fakeHTTPMethods is true, the method will return the value of the _method parameter if the method is “POST”. + * This method can be overridden to provide custom behavior. + * @param request + */ + getHTTPMethod(request: FakeXMLHttpRequest): string; + + /** + * You can inspect the server.requests to verify request ordering, find unmatched requests or check that no requests has been done. + * server.requests is an array of all the FakeXMLHttpRequest objects that have been created. + */ + requests: FakeXMLHttpRequest[]; + + /** + * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""]. + * A String representing the response body + * An Array with status, headers and response body, e.g. [200, { "Content-Type": "text/html", "Content-Length": 2 }, "OK"] + * A Function. + * Default status is 200 and default headers are none. + * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request. + * @param body A String representing the response body + */ + respondWith(body: string): void; + /** + * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""]. + * Default status is 200 and default headers are none. + * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request. + * @param response An Array with status, headers and response body, e.g. [200, { "Content-Type": "text/html", "Content-Length": 2 }, "OK"] + */ + respondWith(response: any[]): void; + /** + * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""]. + * Default status is 200 and default headers are none. + * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request. + * @param fn A Function. + */ + respondWith(fn: (xhr: FakeXMLHttpRequest) => void): void; + /** + * Responds to all requests to given URL, e.g. /posts/1. + */ + respondWith(url: string, body: string): void; + /** + * Responds to all requests to given URL, e.g. /posts/1. + */ + respondWith(url: string, response: any[]): void; + /** + * Responds to all requests to given URL, e.g. /posts/1. + */ + respondWith(url: string, fn: (xhr: FakeXMLHttpRequest) => void): void; + /** + * Responds to all method requests to the given URL with the given response. + * method is an HTTP verb. + */ + respondWith(method: string, url: string, body: string): void; + /** + * Responds to all method requests to the given URL with the given response. + * method is an HTTP verb. + */ + respondWith(method: string, url: string, response: any[]): void; + /** + * Responds to all method requests to the given URL with the given response. + * method is an HTTP verb. + */ + respondWith(method: string, url: string, fn: (xhr: FakeXMLHttpRequest) => void): void; + /** + * URL may be a regular expression, e.g. /\\/post\\//\\d+ + * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: + */ + respondWith(url: RegExp, body: string): void; + /** + * URL may be a regular expression, e.g. /\\/post\\//\\d+ + * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: + */ + respondWith(url: RegExp, response: any[]): void; + /** + * URL may be a regular expression, e.g. /\\/post\\//\\d+ + * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: + */ + respondWith(url: RegExp, fn: (xhr: FakeXMLHttpRequest) => void): void; + /** + * Responds to all method requests to URLs matching the regular expression. + */ + respondWith(method: string, url: RegExp, body: string): void; + /** + * Responds to all method requests to URLs matching the regular expression. + */ + respondWith(method: string, url: RegExp, response: any[]): void; + /** + * Responds to all method requests to URLs matching the regular expression. + */ + respondWith(method: string, url: RegExp, fn: (xhr: FakeXMLHttpRequest) => void): void; + respondWith(...args: any[]): void; + + /** + * Causes all queued asynchronous requests to receive a response. + * If none of the responses added through respondWith match, the default response is [404, {}, ""]. + * Synchronous requests are responded to immediately, so make sure to call respondWith upfront. + * If called with arguments, respondWith will be called with those arguments before responding to requests. + */ + respond(): void; + restore(): void; + + getRequest(): FakeXMLHttpRequest | undefined; + reset(): void; + resetBehavior(): void; + resetHistory(): void; +} + +export interface FakeXMLHttpRequestStatic { + new(): FakeXMLHttpRequest; + /** + * Default false. + * When set to true, Sinon will check added filters if certain requests should be “unfaked” + */ + useFilters: boolean; + /** + * Add a filter that will decide whether or not to fake a request. + * The filter will be called when xhr.open is called, with the exact same arguments (method, url, async, username, password). + * If the filter returns true, the request will not be faked. + * @param filter + */ + addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; + /** + * By assigning a function to the onCreate property of the returned object from useFakeXMLHttpRequest() + * you can subscribe to newly created FakeXMLHttpRequest objects. See below for the fake xhr object API. + * Using this observer means you can still reach objects created by e.g. jQuery.ajax (or other abstractions/frameworks). + * @param xhr + */ + onCreate(xhr: FakeXMLHttpRequest): void; + /** + * Restore original function(s). + */ + restore(): void; +} + +export interface FakeServerStatic { + create(options?: Partial): FakeServer; +} + +export interface FakeXHR { + useFakeXMLHttpRequest(): FakeXMLHttpRequestStatic; + FakeXMLHttpRequest: FakeXMLHttpRequestStatic; +} + +export const fakeServerWithClock: FakeServerStatic; +export const fakeServer: FakeServerStatic; +export const fakeXhr: FakeXHR; diff --git a/types/nise/nise-tests.ts b/types/nise/nise-tests.ts new file mode 100644 index 0000000000..827275fc55 --- /dev/null +++ b/types/nise/nise-tests.ts @@ -0,0 +1,56 @@ +import { fakeXhr, fakeServer, FakeServer, FakeXMLHttpRequest } from 'nise'; + +function testCreateFakeServer() { + fakeServer.create(); + fakeServer.create({ autoRespond: true, autoRespondAfter: 3, fakeHTTPMethods: true, respondImmediately: false }); + fakeServer.create({ autoRespond: true, autoRespondAfter: 3 }); +} + +function testFakeServer() { + const server: FakeServer = fakeServer.create(); + const respondWith = ['GET', 'http://test.com', [200, {}, '']]; + + server.requests; + server.autoRespond = true; + + server.respondWith((xhr: FakeXMLHttpRequest) => xhr.respond(200)); + server.respondWith('body'); + server.respondWith([]); + + server.respondWith('http://test.com', 'body'); + server.respondWith('http://test.com', []); + server.respondWith('http://test.com', (xhr: FakeXMLHttpRequest) => xhr.respond(200)); + + server.respondWith('GET', 'http://test.com', 'body'); + server.respondWith('GET', 'http://test.com', []); + server.respondWith('GET', 'http://test.com', (xhr: FakeXMLHttpRequest) => xhr.respond(200)); + + server.respondWith(/url/, ''); + server.respondWith(/url/, []); + server.respondWith(/url/, (xhr: FakeXMLHttpRequest) => xhr.respond(200)); + + server.respondWith('GET', /url/, ''); + server.respondWith('GET', /url/, []); + server.respondWith('GET', /url/, (xhr: FakeXMLHttpRequest) => xhr.respond(200)); + server.respondWith(...respondWith); + server.respond(); + server.restore(); +} + +function testFakeXMLHttpRequest() { + const xhr = new fakeXhr.FakeXMLHttpRequest(); + const headers = xhr.getAllResponseHeaders(); + const header = xhr.getResponseHeader('test'); + + xhr.setResponseHeaders({ Accept: 'application/json' }); + xhr.setResponseBody('body'); + xhr.respond(200, { Accept: 'application/json' }, 'body'); + xhr.error(); +} + +function testFakeXMLHttpRequestStatic() { + fakeXhr.FakeXMLHttpRequest.useFilters = true; + fakeXhr.FakeXMLHttpRequest.addFilter((method, url, async, user, pass) => true); + fakeXhr.FakeXMLHttpRequest.onCreate = (xhr: FakeXMLHttpRequest) => { }; + fakeXhr.FakeXMLHttpRequest.restore(); +} diff --git a/types/nise/tsconfig.json b/types/nise/tsconfig.json new file mode 100644 index 0000000000..1e535819c3 --- /dev/null +++ b/types/nise/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "noImplicitThis": true, + "noImplicitAny": true, + "module": "commonjs", + "noEmit": true, + "types": [], + "lib": ["es6", "dom"], + "baseUrl": "../", + "typeRoots": ["../"] + }, + + "files": [ + "nise-tests.ts", + "index.d.ts" + ] +} diff --git a/types/nise/tslint.json b/types/nise/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/nise/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/node-crate/index.d.ts b/types/node-crate/index.d.ts new file mode 100644 index 0000000000..971c71db24 --- /dev/null +++ b/types/node-crate/index.d.ts @@ -0,0 +1,69 @@ +// Type definitions for node-crate 2.0 +// Project: https://github.com/megastef/node-crate +// Definitions by: Greg Jednaszewski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare namespace crate { + interface DBResultObject { + json: object[]; + duration: number; + rowcount: number; + cols: string[]; + rows: object[][]; + } + + interface Crate { + /** + * Connect to a single crate instance with host and port + */ + connect: (host: string, port?: number) => void; + /** + * Executes a parameterized sql statement. + */ + execute: (sql: string, args?: Array) => Promise; + /** + * Inserts a row in table. + */ + insert: (tableName: string, data: object) => Promise; + /** + * Creates a table with the given schema. + */ + create: (schema: object) => Promise; + /** + * Creates a table if it doesn't already exist. + */ + createIfNotExists: (schema: object) => Promise; + /** + * Drops a table. + */ + drop: (tableName: string) => Promise; + /** + * Updates one or more rows in table. + */ + update: (tableName: string, data: object, where: string) => Promise; + /** + * Deletes one or more rows in a table. + */ + delete: (tableName: string, where: string) => Promise; + /** + * Creates a BLOB table + */ + createBlobTable: (tableName: string, replicas: number, shards: number) => Promise; + /** + * Inserts a BLOB + */ + insertBlob: (tableName: string, buffer: string) => Promise; + /** + * Inserts a BLOB from the filesystem + */ + insertBlobFile: (tableName: string, filename: string) => Promise; + /** + * Retrieves a BLOB with the given hash key + */ + getBlob: (tableName: string, hashKey: string) => Promise; + } +} + +declare var crate: crate.Crate; +export = crate; diff --git a/types/node-crate/node-crate-tests.ts b/types/node-crate/node-crate-tests.ts new file mode 100644 index 0000000000..117fdcbcdf --- /dev/null +++ b/types/node-crate/node-crate-tests.ts @@ -0,0 +1,27 @@ +import * as crate from "node-crate"; + +crate.connect("127.0.0.1"); +crate.connect("127.0.0.1", 1234); + +crate.execute('select * from users'); +crate.execute('select * from users where id = ?', ['test']); + +crate.insert('users', {id: 'test', password: 'password'}); + +crate.create({users: {id: 'string primary key', password: 'string'}}); + +crate.createIfNotExists({users: {id: 'string primary key', password: 'string'}}); + +crate.drop('users'); + +crate.update('users', {password: 'newPassword'}, "id = 'test'"); + +crate.delete('users', "id = 'test'"); + +crate.createBlobTable('photos', 1, 2); + +crate.insertBlob('photos', 'XXXXXXXX'); + +crate.insertBlobFile('photos', '/path/to/photo.png'); + +crate.getBlob('photos', 'WEWERTWERTWSHSDFG'); diff --git a/types/node-crate/tsconfig.json b/types/node-crate/tsconfig.json new file mode 100644 index 0000000000..a8fc4d93b5 --- /dev/null +++ b/types/node-crate/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-crate-tests.ts" + ] +} diff --git a/types/node-crate/tslint.json b/types/node-crate/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/node-crate/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/node-cron/index.d.ts b/types/node-cron/index.d.ts index 75ddaefdde..8c6b70ec1c 100644 --- a/types/node-cron/index.d.ts +++ b/types/node-cron/index.d.ts @@ -1,15 +1,28 @@ -// Type definitions for node-cron 1.2 -// Project: http://merencia.com/node-cron/ -// Definitions by: morsic +// Type definitions for node-cron 2.0 +// Project: https://github.com/node-cron/node-cron +// Definitions by: morsic , +// burtek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// immediateStart - default true -export function schedule(a: string, func: () => void, immediateStart?: boolean): ScheduledTask; +export function schedule(cronExpression: string, func: () => void, options?: ScheduleOptions): ScheduledTask; -export function validate(a: string): boolean; +export function validate(cronExpression: string): boolean; export interface ScheduledTask { start: () => this; stop: () => this; destroy: () => void; } + +export interface ScheduleOptions { + /** + * A boolean to set if the created task is scheduled. + * + * Defaults to `true` + */ + scheduled?: boolean; + /** + * The timezone that is used for job scheduling + */ + timezone?: string; +} diff --git a/types/node-cron/node-cron-tests.ts b/types/node-cron/node-cron-tests.ts index c670924d27..17350b6427 100644 --- a/types/node-cron/node-cron-tests.ts +++ b/types/node-cron/node-cron-tests.ts @@ -17,7 +17,7 @@ cron.schedule('1-5 * * * *', () => { const task = cron.schedule('* * * * *', () => { log('immediately started'); // because of manual call start method -}, false); +}, { scheduled: false }); task.start(); diff --git a/types/node-forge/README.md b/types/node-forge/README.md index fcac651de8..c70966e474 100644 --- a/types/node-forge/README.md +++ b/types/node-forge/README.md @@ -27,3 +27,4 @@ BSD-2-Clause [Aakash Goenka](https://github.com/a-k-g) [Rafal2228](https://github.com/rafal2228) [Beeno Tung](https://github.com/beenotung) +[Nikita Koryabkin](https://github.com/Apologiz) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index e30a217ddc..d362eb1c27 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -1,10 +1,12 @@ // Type definitions for node-forge 0.7.6 // Project: https://github.com/digitalbazaar/forge -// Definitions by: Seth Westphal -// Kay Schecker -// Aakash Goenka -// Rafal2228 -// Beeno Tung +// Definitions by: Seth Westphal +// Kay Schecker +// Aakash Goenka +// Rafal2228 +// Beeno Tung +// Joe Flateau +// Nikita Koryabkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -43,16 +45,26 @@ declare module "node-forge" { type Key = any; interface KeyPair { - publicKey: Key; - privateKey: Key; + publicKey: PublicKey; + privateKey: PrivateKey; + } + + interface PublicKey { + encrypt(data: string, scheme?: string, schemeOptions?: number): Bytes + verify(digest: string, signature: string, scheme?: string): boolean + } + + interface PrivateKey { + decrypt(data: string, scheme?: string, schemeOptions?: number): string + sign(md: string, scheme?: string): Bytes } function pemToDer(pem: PEM): util.ByteStringBuffer; - function privateKeyToPem(key: Key, maxline?: number): PEM; - function privateKeyInfoToPem(key: Key, maxline?: number): PEM; - function publicKeyToPem(key: Key, maxline?: number): PEM; - function publicKeyFromPem(pem: PEM): Key; - function privateKeyFromPem(pem: PEM): Key; + function privateKeyToPem(key: PrivateKey, maxline?: number): PEM; + function privateKeyInfoToPem(key: PrivateKey, maxline?: number): PEM; + function publicKeyToPem(key: PublicKey, maxline?: number): PEM; + function publicKeyFromPem(pem: PEM): PublicKey; + function privateKeyFromPem(pem: PEM): PrivateKey; function certificateToPem(cert: Certificate, maxline?: number): PEM; function certificateFromPem(pem: PEM, computeHash?: boolean, strict?: boolean): Certificate; @@ -72,7 +84,9 @@ declare module "node-forge" { prng?: any; algorithm?: string; } - + + function setPublicKey(n: any, e: any): any; + function generateKeyPair(bits?: number, e?: number, callback?: (err: Error, keypair: KeyPair) => void): KeyPair; function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair; } @@ -96,9 +110,15 @@ declare module "node-forge" { function publicKeyFromPrivateKey(options: { privateKey: NativeBuffer }): NativeBuffer; - function sign(options: { privateKey: NativeBuffer }): NativeBuffer; + function sign(options: { + message: string, + encoding: string, + privateKey: NativeBuffer + }): NativeBuffer; function verify(options: { + message: string, + encoding: string, signature: Buffer | Uint8Array | util.ByteBuffer | string, publicKey: NativeBuffer }): boolean; @@ -140,7 +160,8 @@ declare module "node-forge" { hash: any; }; extensions: any[]; - publicKey: any; + privateKey: Key; + publicKey: Key; md: any; /** * Sets the subject of this certificate. @@ -197,6 +218,16 @@ declare module "node-forge" { function decryptRsaPrivateKey(pem: PEM, passphrase?: string): Key; function createCertificate(): Certificate; + + function certificationRequestToPem(cert: Certificate, maxline?: number): PEM; + + function certificationRequestFromPem(pem: PEM, computeHash?: boolean, strict?: boolean): Certificate; + + function createCertificationRequest(): Certificate; + + function publicKeyToAsn1(publicKey: Key): any; + + function publicKeyToRSAPublicKey(publicKey: Key): any; } namespace ssh { @@ -410,6 +441,27 @@ declare module "node-forge" { function pkcs12FromAsn1(obj: any, strict?: boolean, password?: string): Pkcs12Pfx; function pkcs12FromAsn1(obj: any, password?: string): Pkcs12Pfx; } + + namespace pkcs7 { + interface PkcsSignedData { + content?: string | util.ByteBuffer; + contentInfo?: { value: any[] }; + + addCertificate(certificate: pki.Certificate): void; + addSigner(options: { + key: string; + certificate: pki.Certificate; + digestAlgorithm: string; + authenticatedAttributes: { type: string; value?: string }[]; + }): void; + sign(options?:{ + detached?: boolean + }): void; + toAsn1(): asn1.Asn1; + } + + function createSignedData(): PkcsSignedData; + } namespace md { @@ -425,6 +477,10 @@ declare module "node-forge" { namespace sha256 { function create(): MessageDigest; } + + namespace sha512 { + function create(): MessageDigest; + } namespace md5 { function create(): MessageDigest; @@ -435,11 +491,14 @@ declare module "node-forge" { type Algorithm = "AES-ECB" | "AES-CBC" | "AES-CFB" | "AES-OFB" | "AES-CTR" | "AES-GCM" | "3DES-ECB" | "3DES-CBC" | "DES-ECB" | "DES-CBC"; - function createCipher(algorithm: Algorithm, payload: util.ByteBuffer): BlockCipher; - function createDecipher(algorithm: Algorithm, payload: util.ByteBuffer): BlockCipher; + function createCipher(algorithm: Algorithm, payload: util.ByteBuffer | Bytes): BlockCipher; + function createDecipher(algorithm: Algorithm, payload: util.ByteBuffer | Bytes): BlockCipher; interface StartOptions { - iv?: string; + iv?: Bytes; + tag?: util.ByteStringBuffer; + tagLength?: number; + additionalData?: string; } interface BlockCipher { @@ -447,6 +506,25 @@ declare module "node-forge" { update: (payload: util.ByteBuffer) => void; finish: () => boolean; output: util.ByteStringBuffer; + mode: Mode; + } + + interface Mode { + tag: util.ByteStringBuffer; } } + + namespace pss { + function create(any: any): any; + } + + namespace mgf { + namespace mgf1 { + function create(any: any): any; + } + } + + namespace random { + function getBytesSync(length: number): Bytes; + } } diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 575661e9aa..abc863f7ff 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -8,8 +8,8 @@ let x: string = forge.ssh.privateKeyToOpenSSH(key); let pemKey: forge.pki.PEM = publicKeyPem; let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey); let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem); -let privateKeyRsa2 = forge.pki.privateKeyInfoToPem(privateKeyPem); -let byteBufferString = forge.pki.pemToDer(privateKeyRsa); +let privateKeyRsa2 = forge.pki.privateKeyInfoToPem(privateKeyRsa); +let byteBufferString = forge.pki.pemToDer(privateKeyPem); let certPem = forge.pki.certificateFromPem(pemKey); let cert = forge.pki.createCertificate(); diff --git a/types/node-ral/node-ral-tests.ts b/types/node-ral/node-ral-tests.ts index a625c37da4..3c6f6cd9b1 100644 --- a/types/node-ral/node-ral-tests.ts +++ b/types/node-ral/node-ral-tests.ts @@ -17,7 +17,7 @@ class HashringBalance extends nodeRal.Balance { return 'hashring'; } fetchServer(balanceContext: nodeRal.Balance.BalanceContextClass, conf: {}, prevBackend: nodeRal.Server) { - return {}; + return {} as nodeRal.Server; } } diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d7c358ae00..0f6698035d 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 10.11 +// Type definitions for Node.js 10.12 // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -30,6 +30,8 @@ // Wilco Bakker // wwwy3y3 // Zane Hannan AU +// Jeremie Rodriguez +// Samuel Ainsworth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -108,6 +110,10 @@ interface Console { * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`. */ timeEnd(label?: string): void; + /** + * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`. + */ + timeLog(label: string, ...data: any[]): void; /** * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code. */ @@ -154,7 +160,7 @@ interface ErrorConstructor { stackTraceLimit: number; } -// compat for TypeScript 1.8 +// compat for TypeScript 1.8 and default es5 target // if you use with --target es3 or --target es5 and use below definitions, // use the lib.es6.d.ts that is bundled with TypeScript 1.8. interface MapConstructor { } @@ -162,6 +168,9 @@ interface WeakMapConstructor { } interface SetConstructor { } interface WeakSetConstructor { } +interface Set {} +interface ReadonlySet {} + // Forward-declare needed types from lib.es2015.d.ts (in case users are using `--lib es5`) interface Iterable { } interface Iterator { @@ -174,7 +183,7 @@ interface SymbolConstructor { readonly iterator: symbol; readonly asyncIterator: symbol; } -// declare const Symbol: SymbolConstructor; +declare var Symbol: SymbolConstructor; interface SharedArrayBuffer { readonly byteLength: number; slice(begin?: number, end?: number): SharedArrayBuffer; @@ -193,27 +202,27 @@ interface String { * GLOBAL * * * ------------------------------------------------*/ -declare const process: NodeJS.Process; -declare const global: NodeJS.Global; +declare var process: NodeJS.Process; +declare var global: NodeJS.Global; declare var console: Console; -declare const __filename: string; -declare const __dirname: string; +declare var __filename: string; +declare var __dirname: string; -declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; declare namespace setTimeout { function __promisify__(ms: number): Promise; function __promisify__(ms: number, value: T): Promise; } -declare function clearTimeout(timeoutId: NodeJS.Timer): void; -declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; -declare function clearInterval(intervalId: NodeJS.Timer): void; -declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; +declare function clearTimeout(timeoutId: NodeJS.Timeout): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; +declare function clearInterval(intervalId: NodeJS.Timeout): void; +declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; declare namespace setImmediate { function __promisify__(): Promise; function __promisify__(value: T): Promise; } -declare function clearImmediate(immediateId: any): void; +declare function clearImmediate(immediateId: NodeJS.Immediate): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. interface NodeRequireFunction { @@ -240,7 +249,7 @@ interface NodeExtensions { [ext: string]: (m: NodeModule, filename: string) => any; } -declare const require: NodeRequire; +declare var require: NodeRequire; interface NodeModule { exports: any; @@ -253,10 +262,10 @@ interface NodeModule { paths: string[]; } -declare const module: NodeModule; +declare var module: NodeModule; // Same as module.exports -declare const exports: any; +declare var exports: any; declare const SlowBuffer: { new(str: string, encoding?: string): Buffer; new(size: number): Buffer; @@ -486,11 +495,20 @@ declare namespace NodeJS { maxArrayLength?: number | null; breakLength?: number; compact?: boolean; + sorted?: boolean | ((a: string, b: string) => number); + } + + interface ConsoleConstructorOptions { + stdout: WritableStream; + stderr?: WritableStream; + ignoreErrors?: boolean; + colorMode?: boolean | 'auto'; } interface ConsoleConstructor { prototype: Console; - new(stdout: WritableStream, stderr?: WritableStream): Console; + new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console; + new(options: ConsoleConstructorOptions): Console; } interface CallSite { @@ -684,6 +702,8 @@ declare namespace NodeJS { "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" | "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO"; + type MultipleResolveType = 'resolve' | 'reject'; + type BeforeExitListener = (code: number) => void; type DisconnectListener = () => void; type ExitListener = (code: number) => void; @@ -695,6 +715,7 @@ declare namespace NodeJS { type SignalsListener = (signal: Signals) => void; type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void; + type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: any) => void; interface Socket extends ReadWriteStream { isTTY?: true; @@ -811,8 +832,7 @@ declare namespace NodeJS { * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][] * environment variable. */ - // TODO: This Set is readonly - allowedNodeEnvironmentFlags: Set; + allowedNodeEnvironmentFlags: ReadonlySet; /** * EventEmitter @@ -839,6 +859,7 @@ declare namespace NodeJS { addListener(event: Signals, listener: SignalsListener): this; addListener(event: "newListener", listener: NewListenerListener): this; addListener(event: "removeListener", listener: RemoveListenerListener): this; + addListener(event: "multipleResolves", listener: MultipleResolveListener): this; emit(event: "beforeExit", code: number): boolean; emit(event: "disconnect"): boolean; @@ -851,6 +872,7 @@ declare namespace NodeJS { emit(event: Signals, signal: Signals): boolean; emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this; emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this; + emit(event: "multipleResolves", listener: MultipleResolveListener): this; on(event: "beforeExit", listener: BeforeExitListener): this; on(event: "disconnect", listener: DisconnectListener): this; @@ -863,6 +885,7 @@ declare namespace NodeJS { on(event: Signals, listener: SignalsListener): this; on(event: "newListener", listener: NewListenerListener): this; on(event: "removeListener", listener: RemoveListenerListener): this; + on(event: "multipleResolves", listener: MultipleResolveListener): this; once(event: "beforeExit", listener: BeforeExitListener): this; once(event: "disconnect", listener: DisconnectListener): this; @@ -875,6 +898,7 @@ declare namespace NodeJS { once(event: Signals, listener: SignalsListener): this; once(event: "newListener", listener: NewListenerListener): this; once(event: "removeListener", listener: RemoveListenerListener): this; + once(event: "multipleResolves", listener: MultipleResolveListener): this; prependListener(event: "beforeExit", listener: BeforeExitListener): this; prependListener(event: "disconnect", listener: DisconnectListener): this; @@ -887,6 +911,7 @@ declare namespace NodeJS { prependListener(event: Signals, listener: SignalsListener): this; prependListener(event: "newListener", listener: NewListenerListener): this; prependListener(event: "removeListener", listener: RemoveListenerListener): this; + prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; prependOnceListener(event: "disconnect", listener: DisconnectListener): this; @@ -899,6 +924,7 @@ declare namespace NodeJS { prependOnceListener(event: Signals, listener: SignalsListener): this; prependOnceListener(event: "newListener", listener: NewListenerListener): this; prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this; + prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; listeners(event: "beforeExit"): BeforeExitListener[]; listeners(event: "disconnect"): DisconnectListener[]; @@ -911,6 +937,7 @@ declare namespace NodeJS { listeners(event: Signals): SignalsListener[]; listeners(event: "newListener"): NewListenerListener[]; listeners(event: "removeListener"): RemoveListenerListener[]; + listeners(event: "multipleResolves"): MultipleResolveListener[]; } interface Global { @@ -953,9 +980,9 @@ declare namespace NodeJS { Uint8ClampedArray: Function; WeakMap: WeakMapConstructor; WeakSet: WeakSetConstructor; - clearImmediate: (immediateId: any) => void; - clearInterval: (intervalId: Timer) => void; - clearTimeout: (timeoutId: Timer) => void; + clearImmediate: (immediateId: Immediate) => void; + clearInterval: (intervalId: Timeout) => void; + clearTimeout: (timeoutId: Timeout) => void; console: typeof console; decodeURI: typeof decodeURI; decodeURIComponent: typeof decodeURIComponent; @@ -970,9 +997,9 @@ declare namespace NodeJS { parseInt: typeof parseInt; process: Process; root: Global; - setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; - setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timer; - setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timer; + setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate; + setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; + setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout; undefined: typeof undefined; unescape: (str: string) => string; gc: () => void; @@ -981,12 +1008,26 @@ declare namespace NodeJS { interface Timer { ref(): void; + refresh(): void; + unref(): void; + } + + class Immediate { + ref(): void; + unref(): void; + _onImmediate: Function; // to distinguish it from the Timeout class + } + + class Timeout implements Timer { + ref(): void; + refresh(): void; unref(): void; } class Module { static runMain(): void; static wrap(code: string): string; + static createRequireFromPath(path: string): (path: string) => any; static builtinModules: string[]; static Module: typeof Module; @@ -1951,65 +1992,371 @@ declare module "punycode" { } declare module "repl" { - import * as stream from "stream"; - import * as readline from "readline"; + import { Interface, Completer, AsyncCompleter } from "readline"; + import { Context } from "vm"; + import { InspectOptions } from "util"; interface ReplOptions { + /** + * The input prompt to display. + * Default: `"> "` + */ prompt?: string; + /** + * The `Readable` stream from which REPL input will be read. + * Default: `process.stdin` + */ input?: NodeJS.ReadableStream; + /** + * The `Writable` stream to which REPL output will be written. + * Default: `process.stdout` + */ output?: NodeJS.WritableStream; + /** + * If `true`, specifies that the output should be treated as a TTY terminal, and have + * ANSI/VT100 escape codes written to it. + * Default: checking the value of the `isTTY` property on the output stream upon + * instantiation. + */ terminal?: boolean; - eval?: Function; + /** + * The function to be used when evaluating each given line of input. + * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can + * error with `repl.Recoverable` to indicate the input was incomplete and prompt for + * additional lines. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions + */ + eval?: REPLEval; + /** + * If `true`, specifies that the default `writer` function should include ANSI color + * styling to REPL output. If a custom `writer` function is provided then this has no + * effect. + * Default: the REPL instance's `terminal` value. + */ useColors?: boolean; + /** + * If `true`, specifies that the default evaluation function will use the JavaScript + * `global` as the context as opposed to creating a new separate context for the REPL + * instance. The node CLI REPL sets this value to `true`. + * Default: `false`. + */ useGlobal?: boolean; + /** + * If `true`, specifies that the default writer will not output the return value of a + * command if it evaluates to `undefined`. + * Default: `false`. + */ ignoreUndefined?: boolean; - writer?: Function; - completer?: Function; - replMode?: any; - breakEvalOnSigint?: any; + /** + * The function to invoke to format the output of each command before writing to `output`. + * Default: a wrapper for `util.inspect`. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output + */ + writer?: REPLWriter; + /** + * An optional function used for custom Tab auto completion. + * + * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function + */ + completer?: Completer | AsyncCompleter; + /** + * A flag that specifies whether the default evaluator executes all JavaScript commands in + * strict mode or default (sloppy) mode. + * Accepted values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; + /** + * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is + * pressed. This cannot be used together with a custom `eval` function. + * Default: `false`. + */ + breakEvalOnSigint?: boolean; } - interface REPLServer extends readline.ReadLine { - context: any; - inputStream: NodeJS.ReadableStream; - outputStream: NodeJS.WritableStream; + type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; + type REPLWriter = (this: REPLServer, obj: any) => string; - defineCommand(keyword: string, cmd: Function | { help: string, action: Function }): void; + /** + * This is the default "writer" value, if none is passed in the REPL options, + * and it can be overridden by custom print functions. + */ + const writer: REPLWriter & { options: InspectOptions }; + + type REPLCommandAction = (this: REPLServer, text: string) => void; + + interface REPLCommand { + /** + * Help text to be displayed when `.help` is entered. + */ + help?: string; + /** + * The function to execute, optionally accepting a single string argument. + */ + action: REPLCommandAction; + } + + /** + * Provides a customizable Read-Eval-Print-Loop (REPL). + * + * Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those + * according to a user-defined evaluation function, then output the result. Input and output + * may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`. + * + * Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style + * line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session + * state, error recovery, and customizable evaluation functions. + * + * Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_ + * be created directly using the JavaScript `new` keyword. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl + */ + class REPLServer extends Interface { + /** + * The `vm.Context` provided to the `eval` function to be used for JavaScript + * evaluation. + */ + readonly context: Context; + /** + * The `Readable` stream from which REPL input will be read. + */ + readonly inputStream: NodeJS.ReadableStream; + /** + * The `Writable` stream to which REPL output will be written. + */ + readonly outputStream: NodeJS.WritableStream; + /** + * The commands registered via `replServer.defineCommand()`. + */ + readonly commands: { readonly [name: string]: REPLCommand | undefined }; + /** + * A value indicating whether the REPL is currently in "editor mode". + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys + */ + readonly editorMode: boolean; + /** + * A value indicating whether the `_` variable has been assigned. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreAssigned: boolean; + /** + * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly last: any; + /** + * A value indicating whether the `_error` variable has been assigned. + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreErrAssigned: boolean; + /** + * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly lastError: any; + /** + * Specified in the REPL options, this is the function to be used when evaluating each + * given line of input. If not specified in the REPL options, this is an async wrapper + * for the JavaScript `eval()` function. + */ + readonly eval: REPLEval; + /** + * Specified in the REPL options, this is a value indicating whether the default + * `writer` function should include ANSI color styling to REPL output. + */ + readonly useColors: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `eval` + * function will use the JavaScript `global` as the context as opposed to creating a new + * separate context for the REPL instance. + */ + readonly useGlobal: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `writer` + * function should output the result of a command if it evaluates to `undefined`. + */ + readonly ignoreUndefined: boolean; + /** + * Specified in the REPL options, this is the function to invoke to format the output of + * each command before writing to `outputStream`. If not specified in the REPL options, + * this will be a wrapper for `util.inspect`. + */ + readonly writer: REPLWriter; + /** + * Specified in the REPL options, this is the function to use for custom Tab auto-completion. + */ + readonly completer: Completer | AsyncCompleter; + /** + * Specified in the REPL options, this is a flag that specifies whether the default `eval` + * function should execute all JavaScript commands in strict mode or default (sloppy) mode. + * Possible values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; + + /** + * NOTE: According to the documentation: + * + * > Instances of `repl.REPLServer` are created using the `repl.start()` method and + * > _should not_ be created directly using the JavaScript `new` keyword. + * + * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver + */ + private constructor(); + + /** + * Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked + * by typing a `.` followed by the `keyword`. + * + * @param keyword The command keyword (_without_ a leading `.` character). + * @param cmd The function to invoke when the command is processed. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd + */ + defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; + /** + * Readies the REPL instance for input from the user, printing the configured `prompt` to a + * new line in the `output` and resuming the `input` to accept new input. + * + * When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'. + * + * This method is primarily intended to be called from within the action function for + * commands registered using the `replServer.defineCommand()` method. + * + * @param preserveCursor When `true`, the cursor placement will not be reset to `0`. + */ displayPrompt(preserveCursor?: boolean): void; + /** + * Clears any command that has been buffered but not yet executed. + * + * This method is primarily intended to be called from within the action function for + * commands registered using the `replServer.defineCommand()` method. + * + * @since v9.0.0 + */ + clearBufferedCommand(): void; /** * events.EventEmitter - * 1. exit - * 2. reset + * 1. close - inherited from `readline.Interface` + * 2. line - inherited from `readline.Interface` + * 3. pause - inherited from `readline.Interface` + * 4. resume - inherited from `readline.Interface` + * 5. SIGCONT - inherited from `readline.Interface` + * 6. SIGINT - inherited from `readline.Interface` + * 7. SIGTSTP - inherited from `readline.Interface` + * 8. exit + * 9. reset */ addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "line", listener: (input: string) => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: "SIGCONT", listener: () => void): this; + addListener(event: "SIGINT", listener: () => void): this; + addListener(event: "SIGTSTP", listener: () => void): this; addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (...args: any[]) => void): this; + addListener(event: "reset", listener: (context: Context) => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "line", input: string): boolean; + emit(event: "pause"): boolean; + emit(event: "resume"): boolean; + emit(event: "SIGCONT"): boolean; + emit(event: "SIGINT"): boolean; + emit(event: "SIGTSTP"): boolean; emit(event: "exit"): boolean; - emit(event: "reset", context: any): boolean; + emit(event: "reset", context: Context): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "line", listener: (input: string) => void): this; + on(event: "pause", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: "SIGCONT", listener: () => void): this; + on(event: "SIGINT", listener: () => void): this; + on(event: "SIGTSTP", listener: () => void): this; on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (...args: any[]) => void): this; + on(event: "reset", listener: (context: Context) => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "line", listener: (input: string) => void): this; + once(event: "pause", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: "SIGCONT", listener: () => void): this; + once(event: "SIGINT", listener: () => void): this; + once(event: "SIGTSTP", listener: () => void): this; once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (...args: any[]) => void): this; + once(event: "reset", listener: (context: Context) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "line", listener: (input: string) => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: "SIGCONT", listener: () => void): this; + prependListener(event: "SIGINT", listener: () => void): this; + prependListener(event: "SIGTSTP", listener: () => void): this; prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (...args: any[]) => void): this; + prependListener(event: "reset", listener: (context: Context) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "line", listener: (input: string) => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: "SIGCONT", listener: () => void): this; + prependOnceListener(event: "SIGINT", listener: () => void): this; + prependOnceListener(event: "SIGTSTP", listener: () => void): this; prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (...args: any[]) => void): this; + prependOnceListener(event: "reset", listener: (context: Context) => void): this; } + /** + * A flag passed in the REPL options. Evaluates expressions in sloppy mode. + */ + export const REPL_MODE_SLOPPY: symbol; // TODO: unique symbol + + /** + * A flag passed in the REPL options. Evaluates expressions in strict mode. + * This is equivalent to prefacing every repl statement with `'use strict'`. + */ + export const REPL_MODE_STRICT: symbol; // TODO: unique symbol + + /** + * Creates and starts a `repl.REPLServer` instance. + * + * @param options The options for the `REPLServer`. If `options` is a string, then it specifies + * the input prompt. + */ function start(options?: string | ReplOptions): REPLServer; + /** + * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors + */ class Recoverable extends SyntaxError { err: Error; @@ -2029,12 +2376,33 @@ declare module "readline" { shift?: boolean; } - interface ReadLine extends events.EventEmitter { + class Interface extends events.EventEmitter { + readonly terminal: boolean; + + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface + */ + protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface + */ + protected constructor(options: ReadLineOptions); + setPrompt(prompt: string): void; prompt(preserveCursor?: boolean): void; question(query: string, callback: (answer: string) => void): void; - pause(): ReadLine; - resume(): ReadLine; + pause(): this; + resume(): this; close(): void; write(data: string | Buffer, key?: Key): void; @@ -2051,7 +2419,7 @@ declare module "readline" { addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: any) => void): this; + addListener(event: "line", listener: (input: string) => void): this; addListener(event: "pause", listener: () => void): this; addListener(event: "resume", listener: () => void): this; addListener(event: "SIGCONT", listener: () => void): this; @@ -2060,7 +2428,7 @@ declare module "readline" { emit(event: string | symbol, ...args: any[]): boolean; emit(event: "close"): boolean; - emit(event: "line", input: any): boolean; + emit(event: "line", input: string): boolean; emit(event: "pause"): boolean; emit(event: "resume"): boolean; emit(event: "SIGCONT"): boolean; @@ -2069,7 +2437,7 @@ declare module "readline" { on(event: string, listener: (...args: any[]) => void): this; on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: any) => void): this; + on(event: "line", listener: (input: string) => void): this; on(event: "pause", listener: () => void): this; on(event: "resume", listener: () => void): this; on(event: "SIGCONT", listener: () => void): this; @@ -2078,7 +2446,7 @@ declare module "readline" { once(event: string, listener: (...args: any[]) => void): this; once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: any) => void): this; + once(event: "line", listener: (input: string) => void): this; once(event: "pause", listener: () => void): this; once(event: "resume", listener: () => void): this; once(event: "SIGCONT", listener: () => void): this; @@ -2087,7 +2455,7 @@ declare module "readline" { prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: any) => void): this; + prependListener(event: "line", listener: (input: string) => void): this; prependListener(event: "pause", listener: () => void): this; prependListener(event: "resume", listener: () => void): this; prependListener(event: "SIGCONT", listener: () => void): this; @@ -2096,7 +2464,7 @@ declare module "readline" { prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: any) => void): this; + prependOnceListener(event: "line", listener: (input: string) => void): this; prependOnceListener(event: "pause", listener: () => void): this; prependOnceListener(event: "resume", listener: () => void): this; prependOnceListener(event: "SIGCONT", listener: () => void): this; @@ -2104,6 +2472,8 @@ declare module "readline" { prependOnceListener(event: "SIGTSTP", listener: () => void): this; } + type ReadLine = Interface; // type forwarded for backwards compatiblity + type Completer = (line: string) => CompleterResult; type AsyncCompleter = (line: string, callback: (err: any, result: CompleterResult) => void) => any; @@ -2120,11 +2490,11 @@ declare module "readline" { removeHistoryDuplicates?: boolean; } - function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): ReadLine; - function createInterface(options: ReadLineOptions): ReadLine; + function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; + function createInterface(options: ReadLineOptions): Interface; function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number): void; - function emitKeypressEvents(stream: NodeJS.ReadableStream, interface?: ReadLine): void; + function emitKeypressEvents(stream: NodeJS.ReadableStream, interface?: Interface): void; function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void; function clearLine(stream: NodeJS.WritableStream, dir: number): void; function clearScreenDown(stream: NodeJS.WritableStream): void; @@ -2227,42 +2597,42 @@ declare module "child_process" { addListener(event: "close", listener: (code: number, signal: string) => void): this; addListener(event: "disconnect", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (code: number, signal: string) => void): this; + addListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this; addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: "close", code: number, signal: string): boolean; emit(event: "disconnect"): boolean; emit(event: "error", err: Error): boolean; - emit(event: "exit", code: number, signal: string): boolean; + emit(event: "exit", code: number | null, signal: string | null): boolean; emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "close", listener: (code: number, signal: string) => void): this; on(event: "disconnect", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (code: number, signal: string) => void): this; + on(event: "exit", listener: (code: number | null, signal: string | null) => void): this; on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "close", listener: (code: number, signal: string) => void): this; once(event: "disconnect", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (code: number, signal: string) => void): this; + once(event: "exit", listener: (code: number | null, signal: string | null) => void): this; once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "close", listener: (code: number, signal: string) => void): this; prependListener(event: "disconnect", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (code: number, signal: string) => void): this; + prependListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this; prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "close", listener: (code: number, signal: string) => void): this; prependOnceListener(event: "disconnect", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; + prependOnceListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this; prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; } @@ -2285,6 +2655,7 @@ declare module "child_process" { windowsHide?: boolean; } + function spawn(command: string, options?: SpawnOptions): ChildProcess; function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptions): ChildProcess; interface ExecOptions { @@ -2599,6 +2970,20 @@ declare module "url" { function domainToASCII(domain: string): string; function domainToUnicode(domain: string): string; + /** + * This function ensures the correct decodings of percent-encoded characters as + * well as ensuring a cross-platform valid absolute path string. + * @param url The file URL string or URL object to convert to a path. + */ + function fileURLToPath(url: string | URL): string; + + /** + * This function ensures that path is resolved absolutely, and that the URL + * control characters are correctly encoded when converting into a File URL. + * @param url The path to convert to a File URL. + */ + function pathToFileURL(url: string): URL; + interface URLFormatOptions { auth?: boolean; fragment?: boolean; @@ -2651,6 +3036,7 @@ declare module "dns" { family?: number; hints?: number; all?: boolean; + verbatim?: boolean; } interface LookupOneOptions extends LookupOptions { @@ -3974,12 +4360,26 @@ declare module "fs" { */ function rmdirSync(path: PathLike): void; + export interface MakeDirectoryOptions { + /** + * Indicates whether parent folders should be created. + * @default false + */ + recursive?: boolean; + /** + * A file mode. If a string is passed, it is parsed as an octal integer. If not specified + * @default 0o777. + */ + mode?: number; + } + /** * Asynchronous mkdir(2) - create a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. */ - function mkdir(path: PathLike, mode: number | string | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; + function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; /** * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. @@ -3992,17 +4392,19 @@ declare module "fs" { /** * Asynchronous mkdir(2) - create a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. */ - function __promisify__(path: PathLike, mode?: number | string | null): Promise; + function __promisify__(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise; } /** * Synchronous mkdir(2) - create a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. */ - function mkdirSync(path: PathLike, mode?: number | string | null): void; + function mkdirSync(path: PathLike, options?: number | string | MakeDirectoryOptions | null): void; /** * Asynchronously creates a unique temporary directory. @@ -5299,9 +5701,10 @@ declare module "fs" { /** * Asynchronous mkdir(2) - create a directory. * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. */ - function mkdir(path: PathLike, mode?: string | number): Promise; + function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise; /** * Asynchronous readdir(3) - read a directory. @@ -5606,7 +6009,7 @@ declare module "path" { /** * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. * * If {to} isn't already absolute, {from} arguments are prepended in right to left order, * until an absolute path is found. If after using all {from} paths still no absolute path is found, @@ -6209,8 +6612,8 @@ declare module "crypto" { interface Signer extends NodeJS.WritableStream { update(data: string | Buffer | NodeJS.TypedArray | DataView): Signer; update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: string | { key: string; passphrase: string, padding?: number, saltLength?: number }): Buffer; - sign(private_key: string | { key: string; passphrase: string, padding?: number, saltLength?: number }, output_format: HexBase64Latin1Encoding): string; + sign(private_key: string | { key: string; passphrase?: string, padding?: number, saltLength?: number }): Buffer; + sign(private_key: string | { key: string; passphrase?: string, padding?: number, saltLength?: number }, output_format: HexBase64Latin1Encoding): string; } function createVerify(algorith: string, options?: stream.WritableOptions): Verify; interface Verify extends NodeJS.WritableStream { @@ -6329,6 +6732,120 @@ declare module "crypto" { function timingSafeEqual(a: Buffer | NodeJS.TypedArray | DataView, b: Buffer | NodeJS.TypedArray | DataView): boolean; /** @deprecated since v10.0.0 */ const DEFAULT_ENCODING: string; + + export type KeyType = 'rsa' | 'dsa' | 'ec'; + export type KeyFormat = 'pem' | 'der'; + + interface BasePrivateKeyEncodingOptions { + format: T; + cipher: string; + passphrase: string; + } + + interface RSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * @default 0x10001 + */ + publicExponent?: number; + + publicKeyEncoding: { + type: 'pkcs1' | 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs1' | 'pkcs8'; + }; + } + + interface DSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Size of q in bits + */ + divisorLength: number; + + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + + interface ECKeyPairOptions { + /** + * Name of the curve to use. + */ + namedCurve: string; + + publicKeyEncoding: { + type: 'pkcs1' | 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'sec1' | 'pkcs8'; + }; + } + + interface KeyPairSyncResult { + publicKey: T1; + privateKey: T2; + } + + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + + namespace generateKeyPair { + function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; + function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; + function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; + function __promisify__(type: "rsa", options: RSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; + + function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; + function __promisify__(type: "dsa", options: DSAKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; + function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; + function __promisify__(type: "dsa", options: DSAKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; + + function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>; + function __promisify__(type: "ec", options: ECKeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>; + function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>; + function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; + } } declare module "stream" { @@ -7204,20 +7721,20 @@ declare module "v8" { } declare module "timers" { - function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; + function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; namespace setTimeout { function __promisify__(ms: number): Promise; function __promisify__(ms: number, value: T): Promise; } - function clearTimeout(timeoutId: NodeJS.Timer): void; - function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; - function clearInterval(intervalId: NodeJS.Timer): void; - function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; + function clearTimeout(timeoutId: NodeJS.Timeout): void; + function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout; + function clearInterval(intervalId: NodeJS.Timeout): void; + function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; namespace setImmediate { function __promisify__(): Promise; function __promisify__(value: T): Promise; } - function clearImmediate(immediateId: any): void; + function clearImmediate(immediateId: NodeJS.Immediate): void; } declare module "console" { @@ -7411,7 +7928,7 @@ declare module "http2" { export interface ServerStreamResponseOptions { endStream?: boolean; - getTrailers?: (trailers: OutgoingHttpHeaders) => void; + waitForTrailers?: boolean; } export interface StatOptions { @@ -7436,6 +7953,9 @@ declare module "http2" { readonly destroyed: boolean; readonly pending: boolean; readonly rstCode: number; + readonly sentHeaders: OutgoingHttpHeaders; + readonly sentInfoHeaders?: OutgoingHttpHeaders[]; + readonly sentTrailers?: OutgoingHttpHeaders; readonly session: Http2Session; readonly state: StreamState; /** @@ -7461,6 +7981,7 @@ declare module "http2" { addListener(event: "streamClosed", listener: (code: number) => void): this; addListener(event: "timeout", listener: () => void): this; addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: "wantTrailers", listener: () => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: "aborted"): boolean; @@ -7476,6 +7997,7 @@ declare module "http2" { emit(event: "streamClosed", code: number): boolean; emit(event: "timeout"): boolean; emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; + emit(event: "wantTrailers"): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "aborted", listener: () => void): this; @@ -7491,6 +8013,7 @@ declare module "http2" { on(event: "streamClosed", listener: (code: number) => void): this; on(event: "timeout", listener: () => void): this; on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + on(event: "wantTrailers", listener: () => void): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "aborted", listener: () => void): this; @@ -7506,6 +8029,7 @@ declare module "http2" { once(event: "streamClosed", listener: (code: number) => void): this; once(event: "timeout", listener: () => void): this; once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + once(event: "wantTrailers", listener: () => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "aborted", listener: () => void): this; @@ -7521,6 +8045,7 @@ declare module "http2" { prependListener(event: "streamClosed", listener: (code: number) => void): this; prependListener(event: "timeout", listener: () => void): this; prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: "wantTrailers", listener: () => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "aborted", listener: () => void): this; @@ -7536,6 +8061,9 @@ declare module "http2" { prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: "wantTrailers", listener: () => void): this; + + sendTrailers(headers: OutgoingHttpHeaders): this; } export interface ClientHttp2Stream extends Http2Stream { @@ -7645,6 +8173,7 @@ declare module "http2" { addListener(event: "localSettings", listener: (settings: Settings) => void): this; addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; addListener(event: "timeout", listener: () => void): this; + addListener(event: "ping", listener: () => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: "close"): boolean; @@ -7654,6 +8183,7 @@ declare module "http2" { emit(event: "localSettings", settings: Settings): boolean; emit(event: "remoteSettings", settings: Settings): boolean; emit(event: "timeout"): boolean; + emit(event: "ping"): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "close", listener: () => void): this; @@ -7663,6 +8193,7 @@ declare module "http2" { on(event: "localSettings", listener: (settings: Settings) => void): this; on(event: "remoteSettings", listener: (settings: Settings) => void): this; on(event: "timeout", listener: () => void): this; + on(event: "ping", listener: () => void): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "close", listener: () => void): this; @@ -7672,6 +8203,7 @@ declare module "http2" { once(event: "localSettings", listener: (settings: Settings) => void): this; once(event: "remoteSettings", listener: (settings: Settings) => void): this; once(event: "timeout", listener: () => void): this; + once(event: "ping", listener: () => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "close", listener: () => void): this; @@ -7681,6 +8213,7 @@ declare module "http2" { prependListener(event: "localSettings", listener: (settings: Settings) => void): this; prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; prependListener(event: "timeout", listener: () => void): this; + prependListener(event: "ping", listener: () => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "close", listener: () => void): this; @@ -7690,6 +8223,7 @@ declare module "http2" { prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; + prependOnceListener(event: "ping", listener: () => void): this; } export interface ClientHttp2Session extends Http2Session { @@ -7879,7 +8413,8 @@ declare module "http2" { prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; } - export interface Http2ServerRequest extends stream.Readable { + export class Http2ServerRequest extends stream.Readable { + private constructor(); headers: IncomingHttpHeaders; httpVersion: string; method: string; @@ -7910,7 +8445,8 @@ declare module "http2" { prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; } - export interface Http2ServerResponse extends events.EventEmitter { + export class Http2ServerResponse extends events.EventEmitter { + private constructor(); addTrailers(trailers: OutgoingHttpHeaders): void; connection: net.Socket | tls.TLSSocket; end(callback?: () => void): void; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 8c3a8f6f8b..c59ed08064 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -414,6 +414,19 @@ import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer } from "buff const cf = util.promisify(fs.copyFile); cf('/path/to/src', '/path/to/dest', fs.constants.COPYFILE_EXCL).then(console.log); } + + { + fs.mkdir('some/test/path', { + recursive: true, + mode: 0o777, + }, () => { + }); + + fs.mkdirSync('some/test/path', { + recursive: true, + mode: 0o777, + }); + } } /////////////////////////////////////////////////////// @@ -763,6 +776,15 @@ function bufferTests() { ]); assert.equal(params.toString(), 'user=abc&query=first&query=second'); } + + { + let path: string = url.fileURLToPath('file://test'); + path = url.fileURLToPath(new url.URL('file://test')); + } + + { + const path: url.URL = url.pathToFileURL('file://test'); + } } ///////////////////////////////////////////////////// @@ -781,7 +803,10 @@ function bufferTests() { showProxy: true, maxArrayLength: 10, breakLength: 20, - compact: true + compact: true, + sorted(a, b) { + return b.localeCompare(a); + }, }); util.inspect(["This is nice"], { colors: true, @@ -790,7 +815,8 @@ function bufferTests() { showProxy: true, maxArrayLength: null, breakLength: Infinity, - compact: false + compact: false, + sorted: true, }); assert(typeof util.inspect.custom === 'symbol'); @@ -1475,6 +1501,161 @@ async function asyncStreamPipelineFinished() { ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "compressed"); ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "hybrid"); } + + { + const rsaRes: { + publicKey: Buffer; + privateKey: string; + } = crypto.generateKeyPairSync('rsa', { + modulusLength: 123, + publicKeyEncoding: { + format: 'der', + type: 'pkcs1', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'pem', + passphrase: 'secret', + type: 'pkcs8', + }, + }); + + const dsaRes: { + publicKey: string; + privateKey: Buffer; + } = crypto.generateKeyPairSync('dsa', { + modulusLength: 123, + divisorLength: 123, + publicKeyEncoding: { + format: 'pem', + type: 'spki', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'der', + passphrase: 'secret', + type: 'pkcs8', + }, + }); + + const ecRes: { + publicKey: string; + privateKey: string; + } = crypto.generateKeyPairSync('ec', { + namedCurve: 'curve', + publicKeyEncoding: { + format: 'pem', + type: 'pkcs1', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'pem', + passphrase: 'secret', + type: 'pkcs8', + }, + }); + } + + { + crypto.generateKeyPair('rsa', { + modulusLength: 123, + publicKeyEncoding: { + format: 'der', + type: 'pkcs1', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'pem', + passphrase: 'secret', + type: 'pkcs8', + }, + }, (err: NodeJS.ErrnoException | null, publicKey: Buffer, privateKey: string) => {}); + + crypto.generateKeyPair('dsa', { + modulusLength: 123, + divisorLength: 123, + publicKeyEncoding: { + format: 'pem', + type: 'spki', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'der', + passphrase: 'secret', + type: 'pkcs8', + }, + }, (err: NodeJS.ErrnoException | null, publicKey: string, privateKey: Buffer) => {}); + + crypto.generateKeyPair('ec', { + namedCurve: 'curve', + publicKeyEncoding: { + format: 'pem', + type: 'pkcs1', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'pem', + passphrase: 'secret', + type: 'pkcs8', + }, + }, (err: NodeJS.ErrnoException | null, publicKey: string, privateKey: string) => {}); + } + + { + const generateKeyPairPromisified = util.promisify(crypto.generateKeyPair); + + const rsaRes: Promise<{ + publicKey: Buffer; + privateKey: string; + }> = generateKeyPairPromisified('rsa', { + modulusLength: 123, + publicKeyEncoding: { + format: 'der', + type: 'pkcs1', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'pem', + passphrase: 'secret', + type: 'pkcs8', + }, + }); + + const dsaRes: Promise<{ + publicKey: string; + privateKey: Buffer; + }> = generateKeyPairPromisified('dsa', { + modulusLength: 123, + divisorLength: 123, + publicKeyEncoding: { + format: 'pem', + type: 'spki', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'der', + passphrase: 'secret', + type: 'pkcs8', + }, + }); + + const ecRes: Promise<{ + publicKey: string; + privateKey: string; + }> = generateKeyPairPromisified('ec', { + namedCurve: 'curve', + publicKeyEncoding: { + format: 'pem', + type: 'pkcs1', + }, + privateKeyEncoding: { + cipher: 'some-cipher', + format: 'pem', + passphrase: 'secret', + type: 'pkcs8', + }, + }); + } } ////////////////////////////////////////////////// @@ -2455,6 +2636,8 @@ async function asyncStreamPipelineFinished() { { childProcess.exec("echo test"); childProcess.exec("echo test", { windowsHide: true }); + childProcess.spawn("echo"); + childProcess.spawn("echo", { windowsHide: true }); childProcess.spawn("echo", ["test"], { windowsHide: true }); childProcess.spawn("echo", ["test"], { windowsHide: true, argv0: "echo-test" }); childProcess.spawn("echo", ["test"], { stdio: [0xdeadbeef, "inherit", undefined, "pipe"] }); @@ -3087,6 +3270,7 @@ import * as p from "process"; process.prependOnceListener("SIGBREAK", () => { }); process.on("newListener", (event: string | symbol, listener: Function) => { }); process.once("removeListener", (event: string | symbol, listener: Function) => { }); + process.on("multipleResolves", (type: NodeJS.MultipleResolveType, prom: Promise, value: any) => {}); const listeners = process.listeners('uncaughtException'); const oldHandler = listeners[listeners.length - 1]; @@ -3100,7 +3284,7 @@ import * as p from "process"; const b: boolean = process.hasUncaughtExceptionCaptureCallback(); } { - process.allowedNodeEnvironmentFlags.has('asdf'); + // process.allowedNodeEnvironmentFlags.has('asdf'); } } @@ -3115,7 +3299,23 @@ import * as p from "process"; } { const writeStream = fs.createWriteStream('./index.d.ts'); - const consoleInstance = new console.Console(writeStream); + let consoleInstance: Console = new console.Console(writeStream); + + consoleInstance = new console.Console(writeStream, writeStream); + consoleInstance = new console.Console(writeStream, writeStream, true); + consoleInstance = new console.Console({ + stdout: writeStream, + stderr: writeStream, + colorMode: 'auto', + ignoreErrors: true + }); + consoleInstance = new console.Console({ + stdout: writeStream, + colorMode: false + }); + consoleInstance = new console.Console({ + stdout: writeStream + }); } } @@ -3420,7 +3620,7 @@ import * as p from "process"; { let _server: repl.REPLServer; let _boolean: boolean; - const _ctx: any = 1; + const _ctx: vm.Context = {}; _server = _server.addListener("exit", () => { }); _server = _server.addListener("reset", () => { }); @@ -3443,6 +3643,37 @@ import * as p from "process"; _server.outputStream.write("test"); const line = _server.inputStream.read(); + _server.clearBufferedCommand(); + _server.displayPrompt(); + _server.displayPrompt(true); + _server.defineCommand("cmd", function(text) { + // $ExpectType string + text; + // $ExpectType REPLServer + this; + }); + _server.defineCommand("cmd", { + help: "", + action(text) { + // $ExpectType string + text; + // $ExpectType REPLServer + this; + } + }); + + repl.start({ + eval() { + // $ExpectType REPLServer + this; + }, + writer() { + // $ExpectType REPLServer + this; + return ""; + } + }); + function test() { throw new repl.Recoverable(new Error("test")); } @@ -3491,6 +3722,10 @@ import * as p from "process"; const _err: NodeJS.ErrnoException = err; const _address: dns.LookupAddress[] = addresses; }); + dns.lookup("nodejs.org", { all: true, verbatim: true }, (err, addresses) => { + const _err: NodeJS.ErrnoException = err; + const _address: dns.LookupAddress[] = addresses; + }); function trueOrFalse(): boolean { return Math.random() > 0.5 ? true : false; @@ -3859,6 +4094,7 @@ import * as constants from 'constants'; http2Session.on('remoteSettings', (settings: http2.Settings) => {}); http2Session.on('stream', (stream: http2.Http2Stream, headers: http2.IncomingHttpHeaders, flags: number) => {}); http2Session.on('timeout', () => {}); + http2Session.on('ping', () => {}); http2Session.destroy(); @@ -3933,6 +4169,7 @@ import * as constants from 'constants'; http2Stream.on('streamClosed', (code: number) => {}); http2Stream.on('timeout', () => {}); http2Stream.on('trailers', (trailers: http2.IncomingHttpHeaders, flags: number) => {}); + http2Stream.on('wantTrailers', () => {}); const aborted: boolean = http2Stream.aborted; const closed: boolean = http2Stream.closed; @@ -3984,7 +4221,7 @@ import * as constants from 'constants'; const options: http2.ServerStreamResponseOptions = { endStream: true, - getTrailers: (trailers: http2.OutgoingHttpHeaders) => {} + waitForTrailers: true, }; serverHttp2Stream.respond(); serverHttp2Stream.respond(headers); @@ -4436,6 +4673,7 @@ import * as constants from 'constants'; //////////////////////////////////////////////////// /// module tests : http://nodejs.org/api/modules.html //////////////////////////////////////////////////// +import moduleModule = require('module'); { require.extensions[".ts"] = () => ""; @@ -4448,6 +4686,8 @@ import * as constants from 'constants'; const b: string[] = Module.builtinModules; let paths: string[] = module.paths; paths = m1.paths; + + moduleModule.createRequireFromPath('./test')('test'); } //////////////////////////////////////////////////// diff --git a/types/node/v0/index.d.ts b/types/node/v0/index.d.ts index 3bc1b3ed5d..1f29bbcc10 100644 --- a/types/node/v0/index.d.ts +++ b/types/node/v0/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Node.js 0.12 // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript , DefinitelyTyped +// Definitions by: Microsoft TypeScript +// DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************************ @@ -1482,7 +1483,7 @@ declare module "path" { /** * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. * * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. * diff --git a/types/node/v0/tslint.json b/types/node/v0/tslint.json index c752378347..88843a11f1 100644 --- a/types/node/v0/tslint.json +++ b/types/node/v0/tslint.json @@ -8,7 +8,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "import-spacing": false, "interface-over-type-literal": false, "jsdoc-format": false, diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 6ebd6b2839..26210a1857 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Node.js 4.x +// Type definitions for Node.js 4.9 // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped +// Definitions by: Microsoft TypeScript +// DefinitelyTyped // Sebastian Silbermann // Sander Koenders // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -1229,7 +1229,7 @@ declare module "child_process" { stdin: stream.Writable; stdout: stream.Readable; stderr: stream.Readable; - stdio: [stream.Writable, stream.Readable, stream.Readable]; + stdio: StdioStreams; killed: boolean; pid: number; kill(signal?: string): void; @@ -1239,6 +1239,12 @@ declare module "child_process" { unref(): void; } + export interface StdioStreams extends ReadonlyArray { + 0: stream.Writable; // stdin + 1: stream.Readable; // stdout + 2: stream.Readable; // stderr + } + export interface SpawnOptions { cwd?: string; env?: any; @@ -2049,7 +2055,7 @@ declare module "path" { /** * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. * * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. * diff --git a/types/node/v4/tslint.json b/types/node/v4/tslint.json index 518f58df03..fb3c172995 100644 --- a/types/node/v4/tslint.json +++ b/types/node/v4/tslint.json @@ -8,7 +8,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "import-spacing": false, "interface-over-type-literal": false, "jsdoc-format": false, diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 8a9ee77904..5ed74da702 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Node.js v6.x +// Type definitions for Node.js 6.14 // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped +// Definitions by: Microsoft TypeScript +// DefinitelyTyped // Wilco Bakker // Thomas Bouldin // Sebastian Silbermann @@ -1743,7 +1743,7 @@ declare module "child_process" { stdin: stream.Writable; stdout: stream.Readable; stderr: stream.Readable; - stdio: [stream.Writable, stream.Readable, stream.Readable]; + stdio: StdioStreams; killed: boolean; pid: number; kill(signal?: string): void; @@ -1805,6 +1805,12 @@ declare module "child_process" { prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; } + export interface StdioStreams extends ReadonlyArray { + 0: stream.Writable; // stdin + 1: stream.Readable; // stdout + 2: stream.Readable; // stderr + } + export interface SpawnOptions { cwd?: string; env?: any; @@ -3034,7 +3040,7 @@ declare module "path" { /** * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. * * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. * @@ -3611,8 +3617,8 @@ declare module "crypto" { export interface Signer extends NodeJS.WritableStream { update(data: string | Buffer): Signer; update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: string | { key: string; passphrase: string }): Buffer; - sign(private_key: string | { key: string; passphrase: string }, output_format: HexBase64Latin1Encoding): string; + sign(private_key: string | { key: string; passphrase?: string }): Buffer; + sign(private_key: string | { key: string; passphrase?: string }, output_format: HexBase64Latin1Encoding): string; } export function createVerify(algorith: string): Verify; export interface Verify extends NodeJS.WritableStream { diff --git a/types/node/v6/tslint.json b/types/node/v6/tslint.json index 82d575f726..a1956bd303 100644 --- a/types/node/v6/tslint.json +++ b/types/node/v6/tslint.json @@ -8,7 +8,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "import-spacing": false, "interface-over-type-literal": false, "jsdoc-format": false, diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 11dc0e4f5a..932d988912 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Node.js v7.x +// Type definitions for Node.js 7.10 // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped +// Definitions by: Microsoft TypeScript +// DefinitelyTyped // Parambir Singh // Christian Vaagland Tellnes // Wilco Bakker @@ -1785,7 +1785,7 @@ declare module "child_process" { stdin: stream.Writable; stdout: stream.Readable; stderr: stream.Readable; - stdio: [stream.Writable, stream.Readable, stream.Readable]; + stdio: StdioStreams; killed: boolean; pid: number; kill(signal?: string): void; @@ -1847,6 +1847,12 @@ declare module "child_process" { prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; } + export interface StdioStreams extends ReadonlyArray { + 0: stream.Writable; // stdin + 1: stream.Readable; // stdout + 2: stream.Readable; // stderr + } + export interface SpawnOptions { cwd?: string; env?: any; @@ -3059,7 +3065,7 @@ declare module "path" { /** * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. * * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. * @@ -3648,8 +3654,8 @@ declare module "crypto" { export interface Signer extends NodeJS.WritableStream { update(data: string | Buffer): Signer; update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: string | { key: string; passphrase: string }): Buffer; - sign(private_key: string | { key: string; passphrase: string }, output_format: HexBase64Latin1Encoding): string; + sign(private_key: string | { key: string; passphrase?: string }): Buffer; + sign(private_key: string | { key: string; passphrase?: string }, output_format: HexBase64Latin1Encoding): string; } export function createVerify(algorith: string): Verify; export interface Verify extends NodeJS.WritableStream { diff --git a/types/node/v7/tslint.json b/types/node/v7/tslint.json index 518f58df03..fb3c172995 100644 --- a/types/node/v7/tslint.json +++ b/types/node/v7/tslint.json @@ -8,7 +8,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "import-spacing": false, "interface-over-type-literal": false, "jsdoc-format": false, diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index c30c59c5c3..6a2ca10859 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Node.js 8.10.x +// Type definitions for Node.js 8.10 // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped +// Definitions by: Microsoft TypeScript +// DefinitelyTyped // Parambir Singh // Christian Vaagland Tellnes // Wilco Bakker @@ -2023,12 +2023,11 @@ declare module "child_process" { import * as events from "events"; import * as stream from "stream"; import * as net from "net"; - export interface ChildProcess extends events.EventEmitter { stdin: stream.Writable; stdout: stream.Readable; stderr: stream.Readable; - stdio: [stream.Writable, stream.Readable, stream.Readable]; + stdio: StdioStreams; killed: boolean; pid: number; kill(signal?: string): void; @@ -2092,6 +2091,12 @@ declare module "child_process" { prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; } + export interface StdioStreams extends ReadonlyArray { + 0: stream.Writable; // stdin + 1: stream.Readable; // stdout + 2: stream.Readable; // stderr + } + export interface MessageOptions { keepOpen?: boolean; } @@ -2429,6 +2434,7 @@ declare module "dns" { family?: number; hints?: number; all?: boolean; + verbatim?: boolean; } export interface LookupOneOptions extends LookupOptions { @@ -4764,7 +4770,7 @@ declare module "path" { /** * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. * * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. * @@ -5321,8 +5327,8 @@ declare module "crypto" { export interface Signer extends NodeJS.WritableStream { update(data: string | Buffer | DataView): Signer; update(data: string | Buffer | DataView, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: string | { key: string; passphrase: string }): Buffer; - sign(private_key: string | { key: string; passphrase: string }, output_format: HexBase64Latin1Encoding): string; + sign(private_key: string | { key: string; passphrase?: string }): Buffer; + sign(private_key: string | { key: string; passphrase?: string }, output_format: HexBase64Latin1Encoding): string; } export function createVerify(algorith: string): Verify; export interface Verify extends NodeJS.WritableStream { @@ -6783,7 +6789,8 @@ declare module "http2" { prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; } - export interface Http2ServerRequest extends stream.Readable { + export class Http2ServerRequest extends stream.Readable { + private constructor(); headers: IncomingHttpHeaders; httpVersion: string; method: string; @@ -6814,7 +6821,8 @@ declare module "http2" { prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; } - export interface Http2ServerResponse extends events.EventEmitter { + export class Http2ServerResponse extends events.EventEmitter { + private constructor(); addTrailers(trailers: OutgoingHttpHeaders): void; connection: net.Socket | tls.TLSSocket; end(callback?: () => void): void; diff --git a/types/node/v8/node-tests.ts b/types/node/v8/node-tests.ts index e1d14b9089..aa67464043 100644 --- a/types/node/v8/node-tests.ts +++ b/types/node/v8/node-tests.ts @@ -3075,6 +3075,10 @@ namespace dns_tests { const _err: NodeJS.ErrnoException = err; const _address: dns.LookupAddress[] = addresses; }); + dns.lookup("nodejs.org", { all: true, verbatim: true }, (err, addresses) => { + const _err: NodeJS.ErrnoException = err; + const _address: dns.LookupAddress[] = addresses; + }); function trueOrFalse(): boolean { return Math.random() > 0.5 ? true : false; diff --git a/types/node/v8/tslint.json b/types/node/v8/tslint.json index 45064d266f..4c1432c003 100644 --- a/types/node/v8/tslint.json +++ b/types/node/v8/tslint.json @@ -14,6 +14,7 @@ "no-namespace": false, "no-redundant-jsdoc": false, "no-redundant-jsdoc-2": false, + "no-single-declare-module": false, "no-unnecessary-class": false, "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index 0c77d826b9..4678c59c74 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Node.js 9.6.x +// Type definitions for Node.js 9.6 // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript -// DefinitelyTyped +// Definitions by: Microsoft TypeScript +// DefinitelyTyped // Parambir Singh // Christian Vaagland Tellnes // Wilco Bakker @@ -1881,66 +1881,372 @@ declare module "punycode" { } declare module "repl" { - import * as stream from "stream"; - import * as readline from "readline"; + import { Interface, Completer, AsyncCompleter } from "readline"; + import { Context } from "vm"; + import { InspectOptions } from "util"; - export interface ReplOptions { + interface ReplOptions { + /** + * The input prompt to display. + * Default: `"> "` + */ prompt?: string; + /** + * The `Readable` stream from which REPL input will be read. + * Default: `process.stdin` + */ input?: NodeJS.ReadableStream; + /** + * The `Writable` stream to which REPL output will be written. + * Default: `process.stdout` + */ output?: NodeJS.WritableStream; + /** + * If `true`, specifies that the output should be treated as a TTY terminal, and have + * ANSI/VT100 escape codes written to it. + * Default: checking the value of the `isTTY` property on the output stream upon + * instantiation. + */ terminal?: boolean; - eval?: Function; + /** + * The function to be used when evaluating each given line of input. + * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can + * error with `repl.Recoverable` to indicate the input was incomplete and prompt for + * additional lines. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions + */ + eval?: REPLEval; + /** + * If `true`, specifies that the default `writer` function should include ANSI color + * styling to REPL output. If a custom `writer` function is provided then this has no + * effect. + * Default: the REPL instance's `terminal` value. + */ useColors?: boolean; + /** + * If `true`, specifies that the default evaluation function will use the JavaScript + * `global` as the context as opposed to creating a new separate context for the REPL + * instance. The node CLI REPL sets this value to `true`. + * Default: `false`. + */ useGlobal?: boolean; + /** + * If `true`, specifies that the default writer will not output the return value of a + * command if it evaluates to `undefined`. + * Default: `false`. + */ ignoreUndefined?: boolean; - writer?: Function; - completer?: Function; - replMode?: any; - breakEvalOnSigint?: any; + /** + * The function to invoke to format the output of each command before writing to `output`. + * Default: a wrapper for `util.inspect`. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output + */ + writer?: REPLWriter; + /** + * An optional function used for custom Tab auto completion. + * + * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function + */ + completer?: Completer | AsyncCompleter; + /** + * A flag that specifies whether the default evaluator executes all JavaScript commands in + * strict mode or default (sloppy) mode. + * Accepted values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; + /** + * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is + * pressed. This cannot be used together with a custom `eval` function. + * Default: `false`. + */ + breakEvalOnSigint?: boolean; } - export interface REPLServer extends readline.ReadLine { - context: any; - inputStream: NodeJS.ReadableStream; - outputStream: NodeJS.WritableStream; + type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; + type REPLWriter = (this: REPLServer, obj: any) => string; - defineCommand(keyword: string, cmd: Function | { help: string, action: Function }): void; + /** + * This is the default "writer" value, if none is passed in the REPL options, + * and it can be overridden by custom print functions. + */ + const writer: REPLWriter & { options: InspectOptions }; + + type REPLCommandAction = (this: REPLServer, text: string) => void; + + interface REPLCommand { + /** + * Help text to be displayed when `.help` is entered. + */ + help?: string; + /** + * The function to execute, optionally accepting a single string argument. + */ + action: REPLCommandAction; + } + + /** + * Provides a customizable Read-Eval-Print-Loop (REPL). + * + * Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those + * according to a user-defined evaluation function, then output the result. Input and output + * may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`. + * + * Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style + * line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session + * state, error recovery, and customizable evaluation functions. + * + * Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_ + * be created directly using the JavaScript `new` keyword. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl + */ + class REPLServer extends Interface { + /** + * The `vm.Context` provided to the `eval` function to be used for JavaScript + * evaluation. + */ + readonly context: Context; + /** + * The `Readable` stream from which REPL input will be read. + */ + readonly inputStream: NodeJS.ReadableStream; + /** + * The `Writable` stream to which REPL output will be written. + */ + readonly outputStream: NodeJS.WritableStream; + /** + * The commands registered via `replServer.defineCommand()`. + */ + readonly commands: { readonly [name: string]: REPLCommand | undefined }; + /** + * A value indicating whether the REPL is currently in "editor mode". + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys + */ + readonly editorMode: boolean; + /** + * A value indicating whether the `_` variable has been assigned. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreAssigned: boolean; + /** + * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly last: any; + /** + * A value indicating whether the `_error` variable has been assigned. + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreErrAssigned: boolean; + /** + * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly lastError: any; + /** + * Specified in the REPL options, this is the function to be used when evaluating each + * given line of input. If not specified in the REPL options, this is an async wrapper + * for the JavaScript `eval()` function. + */ + readonly eval: REPLEval; + /** + * Specified in the REPL options, this is a value indicating whether the default + * `writer` function should include ANSI color styling to REPL output. + */ + readonly useColors: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `eval` + * function will use the JavaScript `global` as the context as opposed to creating a new + * separate context for the REPL instance. + */ + readonly useGlobal: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `writer` + * function should output the result of a command if it evaluates to `undefined`. + */ + readonly ignoreUndefined: boolean; + /** + * Specified in the REPL options, this is the function to invoke to format the output of + * each command before writing to `outputStream`. If not specified in the REPL options, + * this will be a wrapper for `util.inspect`. + */ + readonly writer: REPLWriter; + /** + * Specified in the REPL options, this is the function to use for custom Tab auto-completion. + */ + readonly completer: Completer | AsyncCompleter; + /** + * Specified in the REPL options, this is a flag that specifies whether the default `eval` + * function should execute all JavaScript commands in strict mode or default (sloppy) mode. + * Possible values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; + + /** + * NOTE: According to the documentation: + * + * > Instances of `repl.REPLServer` are created using the `repl.start()` method and + * > _should not_ be created directly using the JavaScript `new` keyword. + * + * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver + */ + private constructor(); + + /** + * Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked + * by typing a `.` followed by the `keyword`. + * + * @param keyword The command keyword (_without_ a leading `.` character). + * @param cmd The function to invoke when the command is processed. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd + */ + defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; + /** + * Readies the REPL instance for input from the user, printing the configured `prompt` to a + * new line in the `output` and resuming the `input` to accept new input. + * + * When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'. + * + * This method is primarily intended to be called from within the action function for + * commands registered using the `replServer.defineCommand()` method. + * + * @param preserveCursor When `true`, the cursor placement will not be reset to `0`. + */ displayPrompt(preserveCursor?: boolean): void; + /** + * Clears any command that has been buffered but not yet executed. + * + * This method is primarily intended to be called from within the action function for + * commands registered using the `replServer.defineCommand()` method. + * + * @since v9.0.0 + */ + clearBufferedCommand(): void; /** * events.EventEmitter - * 1. exit - * 2. reset + * 1. close - inherited from `readline.Interface` + * 2. line - inherited from `readline.Interface` + * 3. pause - inherited from `readline.Interface` + * 4. resume - inherited from `readline.Interface` + * 5. SIGCONT - inherited from `readline.Interface` + * 6. SIGINT - inherited from `readline.Interface` + * 7. SIGTSTP - inherited from `readline.Interface` + * 8. exit + * 9. reset */ addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "line", listener: (input: string) => void): this; + addListener(event: "pause", listener: () => void): this; + addListener(event: "resume", listener: () => void): this; + addListener(event: "SIGCONT", listener: () => void): this; + addListener(event: "SIGINT", listener: () => void): this; + addListener(event: "SIGTSTP", listener: () => void): this; addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (...args: any[]) => void): this; + addListener(event: "reset", listener: (context: Context) => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "line", input: string): boolean; + emit(event: "pause"): boolean; + emit(event: "resume"): boolean; + emit(event: "SIGCONT"): boolean; + emit(event: "SIGINT"): boolean; + emit(event: "SIGTSTP"): boolean; emit(event: "exit"): boolean; - emit(event: "reset", context: any): boolean; + emit(event: "reset", context: Context): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "close", listener: () => void): this; + on(event: "line", listener: (input: string) => void): this; + on(event: "pause", listener: () => void): this; + on(event: "resume", listener: () => void): this; + on(event: "SIGCONT", listener: () => void): this; + on(event: "SIGINT", listener: () => void): this; + on(event: "SIGTSTP", listener: () => void): this; on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (...args: any[]) => void): this; + on(event: "reset", listener: (context: Context) => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "close", listener: () => void): this; + once(event: "line", listener: (input: string) => void): this; + once(event: "pause", listener: () => void): this; + once(event: "resume", listener: () => void): this; + once(event: "SIGCONT", listener: () => void): this; + once(event: "SIGINT", listener: () => void): this; + once(event: "SIGTSTP", listener: () => void): this; once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (...args: any[]) => void): this; + once(event: "reset", listener: (context: Context) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "line", listener: (input: string) => void): this; + prependListener(event: "pause", listener: () => void): this; + prependListener(event: "resume", listener: () => void): this; + prependListener(event: "SIGCONT", listener: () => void): this; + prependListener(event: "SIGINT", listener: () => void): this; + prependListener(event: "SIGTSTP", listener: () => void): this; prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (...args: any[]) => void): this; + prependListener(event: "reset", listener: (context: Context) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "line", listener: (input: string) => void): this; + prependOnceListener(event: "pause", listener: () => void): this; + prependOnceListener(event: "resume", listener: () => void): this; + prependOnceListener(event: "SIGCONT", listener: () => void): this; + prependOnceListener(event: "SIGINT", listener: () => void): this; + prependOnceListener(event: "SIGTSTP", listener: () => void): this; prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (...args: any[]) => void): this; + prependOnceListener(event: "reset", listener: (context: Context) => void): this; } - export function start(options?: string | ReplOptions): REPLServer; + /** + * A flag passed in the REPL options. Evaluates expressions in sloppy mode. + */ + export const REPL_MODE_SLOPPY: symbol; // TODO: unique symbol - export class Recoverable extends SyntaxError { + /** + * A flag passed in the REPL options. Evaluates expressions in strict mode. + * This is equivalent to prefacing every repl statement with `'use strict'`. + */ + export const REPL_MODE_STRICT: symbol; // TODO: unique symbol + + /** + * Creates and starts a `repl.REPLServer` instance. + * + * @param options The options for the `REPLServer`. If `options` is a string, then it specifies + * the input prompt. + */ + function start(options?: string | ReplOptions): REPLServer; + + /** + * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors + */ + class Recoverable extends SyntaxError { err: Error; constructor(err: Error); @@ -1951,7 +2257,7 @@ declare module "readline" { import * as events from "events"; import * as stream from "stream"; - export interface Key { + interface Key { sequence?: string; name?: string; ctrl?: boolean; @@ -1959,12 +2265,33 @@ declare module "readline" { shift?: boolean; } - export interface ReadLine extends events.EventEmitter { + class Interface extends events.EventEmitter { + readonly terminal: boolean; + + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface + */ + protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface + */ + protected constructor(options: ReadLineOptions); + setPrompt(prompt: string): void; prompt(preserveCursor?: boolean): void; question(query: string, callback: (answer: string) => void): void; - pause(): ReadLine; - resume(): ReadLine; + pause(): this; + resume(): this; close(): void; write(data: string | Buffer, key?: Key): void; @@ -2034,12 +2361,14 @@ declare module "readline" { prependOnceListener(event: "SIGTSTP", listener: () => void): this; } + type ReadLine = Interface; // type forwarded for backwards compatiblity + type Completer = (line: string) => CompleterResult; type AsyncCompleter = (line: string, callback: (err: any, result: CompleterResult) => void) => any; - export type CompleterResult = [string[], string]; + type CompleterResult = [string[], string]; - export interface ReadLineOptions { + interface ReadLineOptions { input: NodeJS.ReadableStream; output?: NodeJS.WritableStream; completer?: Completer | AsyncCompleter; @@ -2050,14 +2379,14 @@ declare module "readline" { removeHistoryDuplicates?: boolean; } - export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): ReadLine; - export function createInterface(options: ReadLineOptions): ReadLine; + function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; + function createInterface(options: ReadLineOptions): Interface; - export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number): void; - export function emitKeypressEvents(stream: NodeJS.ReadableStream, interface?: ReadLine): void; - export function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void; - export function clearLine(stream: NodeJS.WritableStream, dir: number): void; - export function clearScreenDown(stream: NodeJS.WritableStream): void; + function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number): void; + function emitKeypressEvents(stream: NodeJS.ReadableStream, interface?: Interface): void; + function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void; + function clearLine(stream: NodeJS.WritableStream, dir: number): void; + function clearScreenDown(stream: NodeJS.WritableStream): void; } declare module "vm" { @@ -2102,7 +2431,7 @@ declare module "child_process" { stdin: stream.Writable; stdout: stream.Readable; stderr: stream.Readable; - stdio: [stream.Writable, stream.Readable, stream.Readable]; + stdio: StdioStreams; killed: boolean; pid: number; kill(signal?: string): void; @@ -2166,6 +2495,12 @@ declare module "child_process" { prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; } + export interface StdioStreams extends ReadonlyArray { + 0: stream.Writable; // stdin + 1: stream.Readable; // stdout + 2: stream.Readable; // stderr + } + export interface MessageOptions { keepOpen?: boolean; } @@ -4850,7 +5185,7 @@ declare module "path" { /** * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. * - * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. * * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. * @@ -5391,8 +5726,8 @@ declare module "crypto" { export interface Signer extends NodeJS.WritableStream { update(data: string | Buffer | DataView): Signer; update(data: string | Buffer | DataView, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: string | { key: string; passphrase: string }): Buffer; - sign(private_key: string | { key: string; passphrase: string }, output_format: HexBase64Latin1Encoding): string; + sign(private_key: string | { key: string; passphrase?: string }): Buffer; + sign(private_key: string | { key: string; passphrase?: string }, output_format: HexBase64Latin1Encoding): string; } export function createVerify(algorith: string): Verify; export interface Verify extends NodeJS.WritableStream { @@ -6873,7 +7208,8 @@ declare module "http2" { prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; } - export interface Http2ServerRequest extends stream.Readable { + export class Http2ServerRequest extends stream.Readable { + private constructor(); headers: IncomingHttpHeaders; httpVersion: string; method: string; @@ -6904,7 +7240,8 @@ declare module "http2" { prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; } - export interface Http2ServerResponse extends events.EventEmitter { + export class Http2ServerResponse extends events.EventEmitter { + private constructor(); addTrailers(trailers: OutgoingHttpHeaders): void; connection: net.Socket | tls.TLSSocket; end(callback?: () => void): void; diff --git a/types/node/v9/node-tests.ts b/types/node/v9/node-tests.ts index 03f641e216..c93079b39f 100644 --- a/types/node/v9/node-tests.ts +++ b/types/node/v9/node-tests.ts @@ -3038,7 +3038,7 @@ namespace repl_tests { { let _server: repl.REPLServer; let _boolean: boolean; - let _ctx: any; + const _ctx: vm.Context = {}; _server = _server.addListener("exit", () => { }); _server = _server.addListener("reset", () => { }); @@ -3059,9 +3059,42 @@ namespace repl_tests { _server = _server.prependOnceListener("reset", () => { }); _server.outputStream.write("test"); - let line = _server.inputStream.read(); + const line = _server.inputStream.read(); - throw new repl.Recoverable(new Error("test")); + _server.clearBufferedCommand(); + _server.displayPrompt(); + _server.displayPrompt(true); + _server.defineCommand("cmd", function(text) { + // $ExpectType string + text; + // $ExpectType REPLServer + this; + }); + _server.defineCommand("cmd", { + help: "", + action(text) { + // $ExpectType string + text; + // $ExpectType REPLServer + this; + } + }); + + repl.start({ + eval() { + // $ExpectType REPLServer + this; + }, + writer() { + // $ExpectType REPLServer + this; + return ""; + } + }); + + function test() { + throw new repl.Recoverable(new Error("test")); + } } } diff --git a/types/node/v9/tslint.json b/types/node/v9/tslint.json index 45064d266f..4c1432c003 100644 --- a/types/node/v9/tslint.json +++ b/types/node/v9/tslint.json @@ -14,6 +14,7 @@ "no-namespace": false, "no-redundant-jsdoc": false, "no-redundant-jsdoc-2": false, + "no-single-declare-module": false, "no-unnecessary-class": false, "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 11ab938130..57e8c55d87 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -9,6 +9,10 @@ import { Tree } from './tree'; import { TreeEntry } from './tree-entry'; import { Diff } from './diff'; +export interface HistoryEventEmitter extends EventEmitter { + start(): void; +} + export class Commit { static create(repo: Repository, updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree, parentCount: number, parents: any[]): Oid; static createV(id: Oid, repo: Repository, updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree, parentCount: number): number; @@ -75,11 +79,11 @@ export class Commit { /** * Walk the history from this commit backwards. * An EventEmitter is returned that will emit a "commit" event for each commit in the history, and one "end" - * event when the walk is completed. Don't forget to call start() on the returned event. + * event when the walk is completed. Don't forget to call start() on the returned EventEmitter. * * */ - history(): EventEmitter; + history(): HistoryEventEmitter; /** * Retrieve the commit's parents as commit objects. * diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index 20da9ce052..710c0531cd 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -78,7 +78,7 @@ export class Repository { /** * Creates a branch with the passed in name pointing to the commit */ - createBranch(name: string, commit: Commit | string | Oid, force: boolean): Promise; + createBranch(name: string, commit: Commit | string | Oid, force?: boolean): Promise; /** * Look up a refs's commit. */ @@ -175,7 +175,7 @@ export class Repository { * Fetches from all remotes. This is done in series due to deadlocking issues with fetching from many remotes that can happen. */ fetchAll(fetchOptions?: FetchOptions, callback?: Function): Promise; - mergeBranches(to: string | Reference, from: string | Reference, signature: Signature, mergePreference: Merge.PREFERENCE, mergeOptions?: MergeOptions): Promise; + mergeBranches(to: string | Reference, from: string | Reference, signature?: Signature, mergePreference?: Merge.PREFERENCE, mergeOptions?: MergeOptions): Promise; /** * Rebases a branch onto another branch */ diff --git a/types/nookies/index.d.ts b/types/nookies/index.d.ts new file mode 100644 index 0000000000..1eaab3ce64 --- /dev/null +++ b/types/nookies/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for nookies 1.1 +// Project: https://github.com/maticzav/nookies#readme +// Definitions by: Andreas Bergqvist +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { NextContext } from 'next'; +import { CookieParseOptions, CookieSerializeOptions } from 'cookie'; + +export function parseCookies(ctx: NextContext, options?: CookieParseOptions): { [key: string]: string }; +export function setCookie(ctx: NextContext, name: string, value: string, options?: CookieSerializeOptions): void; +export function destroyCookie(ctx: NextContext, name: string): void; + +declare const Nookies: { + set(ctx: NextContext, name: string, value: string, options?: CookieSerializeOptions): void; + get(ctx: NextContext, options?: CookieParseOptions): { [key: string]: string }; + destroy(ctx: NextContext, name: string): void; +}; + +export default Nookies; diff --git a/types/nookies/nookies-tests.ts b/types/nookies/nookies-tests.ts new file mode 100644 index 0000000000..2fe560affc --- /dev/null +++ b/types/nookies/nookies-tests.ts @@ -0,0 +1,9 @@ +import nookies, { parseCookies, setCookie, destroyCookie } from 'nookies'; + +nookies.set({ pathname: '', query: {}, asPath: ''}, 'test-cookie', 'test-value'); +nookies.get({ pathname: '', query: {}, asPath: ''}); +nookies.destroy({ pathname: '', query: {}, asPath: ''}, 'test-cookie'); + +parseCookies({ pathname: '', query: {}, asPath: ''}); +setCookie({ pathname: '', query: {}, asPath: ''}, 'test-cookie', 'test-value'); +destroyCookie({ pathname: '', query: {}, asPath: ''}, 'test-cookie'); diff --git a/types/nookies/tsconfig.json b/types/nookies/tsconfig.json new file mode 100644 index 0000000000..15118a6178 --- /dev/null +++ b/types/nookies/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "nookies-tests.ts" + ] +} diff --git a/types/nookies/tslint.json b/types/nookies/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/nookies/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/normalize-url/index.d.ts b/types/normalize-url/index.d.ts index ec70be130b..fd76c4f72a 100644 --- a/types/normalize-url/index.d.ts +++ b/types/normalize-url/index.d.ts @@ -1,14 +1,20 @@ -// Type definitions for normalize-url 1.9 +// Type definitions for normalize-url 3.3 // Project: https://github.com/sindresorhus/normalize-url // Definitions by: odin3 // BendingBender +// Mathieu M-Gosselin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace normalizeUrl { interface Options { + defaultProtocol?: string; + forceHttp?: boolean; + forceHttps?: boolean; normalizeProtocol?: boolean; normalizeHttps?: boolean; + sortQueryParameters?: boolean; stripFragment?: boolean; + stripHash?: boolean; stripWWW?: boolean; removeQueryParameters?: Array; removeTrailingSlash?: boolean; diff --git a/types/novnc-core/tslint.json b/types/novnc-core/tslint.json index 3224b40b8b..22e051f9bf 100644 --- a/types/novnc-core/tslint.json +++ b/types/novnc-core/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + "no-angle-bracket-type-assertion": false, "no-const-enum": false } } diff --git a/types/npm-package-arg/index.d.ts b/types/npm-package-arg/index.d.ts index bb1a0d8550..d83c95a6a7 100644 --- a/types/npm-package-arg/index.d.ts +++ b/types/npm-package-arg/index.d.ts @@ -1,7 +1,9 @@ -// Type definitions for npm-package-arg 5.1 +// Type definitions for npm-package-arg 6.1 // Project: https://github.com/npm/npm-package-arg // Definitions by: Melvin Groenhoff +// Jason // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /** * Throws if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported. @@ -20,7 +22,12 @@ declare namespace npa { * Something like: 1.2, ^1.7.17, http://x.com/foo.tgz, git+https://github.com/user/foo, bitbucket:user/foo, file:foo.tar.gz or file:../foo/bar/. If not included then the default is latest. * @param where Optionally the path to resolve file paths relative to. Defaults to process.cwd() */ - function resolve(name: string, spec: string, where?: string): Result; + function resolve(name: string, spec: string, where?: string): + FileResult | + HostedGitResult | + URLResult | + AliasResult | + RegistryResult; class Result { /** @@ -33,52 +40,95 @@ declare namespace npa { * * directory - A local directory. * * remote - An http url (presumably to a tgz) */ - type: "git" | "tag" | "version" | "range" | "file" | "directory" | "remote"; - /** - * If true this specifier refers to a resource hosted on a registry. This is true for tag, version and range types. - */ + type: + | "git" + | "tag" + | "version" + | "range" + | "file" + | "directory" + | "remote" + | "alias"; + + /** If true this specifier refers to a resource hosted on a registry. This is true for tag, version and range types. */ registry: boolean; - /** - * If known, the name field expected in the resulting pkg. - */ + + /** If known, the name field expected in the resulting pkg. */ name: string | null; - /** - * If a name is something like @org/module then the scope field will be set to @org. If it doesn't have a scoped name, then scope is null. - */ + + /** If a name is something like @org/module then the scope field will be set to @org. If it doesn't have a scoped name, then scope is null. */ scope: string | null; - /** - * A version of name escaped to match the npm scoped packages specification. Mostly used when making requests against a registry. When name is null, escapedName will also be null. - */ + + /** A version of name escaped to match the npm scoped packages specification. Mostly used when making requests against a registry. When name is null, escapedName will also be null. */ escapedName: string | null; - /** - * The specifier part that was parsed out in calls to npa(arg), or the value of spec in calls to `npa.resolve(name, spec). - */ + + /** The specifier part that was parsed out in calls to npa(arg), or the value of spec in calls to `npa.resolve(name, spec). */ rawSpec: string; - /** - * The normalized specifier, for saving to package.json files. null for registry dependencies. - */ + + /** The normalized specifier, for saving to package.json files. null for registry dependencies. */ saveSpec: string | null; - /** - * The version of the specifier to be used to fetch this resource. null for shortcuts to hosted git dependencies as there isn't just one URL to try with them. - */ + + /** The version of the specifier to be used to fetch this resource. null for shortcuts to hosted git dependencies as there isn't just one URL to try with them. */ fetchSpec: string | null; - /** - * If set, this is a semver specifier to match against git tags with - */ + + /** If set, this is a semver specifier to match against git tags with */ gitRange?: string; - /** - * If set, this is the specific committish to use with a git dependency. - */ + + /** If set, this is the specific committish to use with a git dependency. */ gitCommittish?: string; - /** - * If from === 'hosted' then this will be a hosted-git-info object. This property is not included when serializing the object as JSON. - */ - hosted?: any; - /** - * The original un-modified string that was provided. If called as npa.resolve(name, spec) then this will be name + '@' + spec. - */ + + /** If from === 'hosted' then this will be a hosted-git-info object. This property is not included when serializing the object as JSON. */ + hosted?: HostedGit; + + /** The original un-modified string that was provided. If called as npa.resolve(name, spec) then this will be name + '@' + spec. */ raw: string; } + + interface FileResult extends Result { + type: "file" | "directory"; + where: string; + saveSpec: string; + fetchSpec: null | string; + } + + interface HostedGitResult extends Result { + type: "git"; + hosted: HostedGit; + saveSpec: string; + fetchSpec: null | string; + gitRange: undefined | string; + gitCommittish: undefined | string; + } + + interface URLResult extends Result { + saveSpec: string; + type: "git" | "remote"; + fetchSpec: string; + gitCommittish: string | undefined; + gitRange: string | undefined; + } + + interface AliasResult extends Result { + subSpec: Result; + registry: true; + type: "alias"; + saveSpec: null; + fetchSpec: null; + } + + interface RegistryResult extends Result { + registry: true; + type: "version" | "range" | "tag"; + saveSpec: null; + fetchSpec: string; + } + + interface HostedGit { + type: string; + domain: string; + user: string; + project: string; + } } export = npa; diff --git a/types/nuka-carousel/index.d.ts b/types/nuka-carousel/index.d.ts index dcecb92a99..97edd08a6d 100644 --- a/types/nuka-carousel/index.d.ts +++ b/types/nuka-carousel/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for nuka-carousel 4.2 +// Type definitions for nuka-carousel 4.4 // Project: https://github.com/FormidableLabs/nuka-carousel // Definitions by: Roman Charugin +// Alex Smith +// matt-sungwook // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -17,38 +19,23 @@ export type CarouselSlidesToScrollProp = number | 'auto'; export type CarouselSlideWidthProp = string | number; export interface CarouselSlideRenderControlProps { + /** + * Space between slides, as an integer, but reflected as px + */ + cellSpacing: number; /** * Current slide index */ currentSlide: number; - /** - * Total amount of slides - */ - slideCount: number; /** * Current frame width (px) */ frameWidth: number; /** - * Current slide width (px) + * Go to X slide method + * @param index Slide's index to go */ - slideWidth: number; - /** - * Slides to scroll at once - */ - slidesToScroll: number; - /** - * Space between slides, as an integer, but reflected as px - */ - cellSpacing: number; - /** - * Slides to show at once - */ - slidesToShow: number; - /** - * Infinite mode enabled - */ - wrapAround: boolean; + goToSlide: (index: number) => void; /** * Go to the next slide method */ @@ -58,10 +45,25 @@ export interface CarouselSlideRenderControlProps { */ previousSlide: () => void; /** - * Go to X slide method - * @param index Slide's index to go + * Total amount of slides */ - goToSlide: (index: number) => void; + slideCount: number; + /** + * Slides to scroll at once + */ + slidesToScroll: number; + /** + * Slides to show at once + */ + slidesToShow: number; + /** + * Current slide width (px) + */ + slideWidth: number; + /** + * Infinite mode enabled + */ + wrapAround: boolean; } export type CarouselRenderControl = (props: CarouselSlideRenderControlProps) => JSX.Element; @@ -101,6 +103,11 @@ export interface CarouselProps { * Additional className */ className?: string; + /** + * When set to true, disable keyboard controls + * @default false + */ + disableKeyboardControls?: boolean; /** * Enable mouse swipe/dragging */ @@ -144,6 +151,11 @@ export interface CarouselProps { * Window onResize callback */ onResize?: () => void; + /** + * Pause autoPlay when mouse is over carousel + * @default true + */ + pauseOnHover?: boolean; /** * Function for rendering top left control */ @@ -222,6 +234,11 @@ export interface CarouselProps { * @default false */ wrapAround?: boolean; + /** + * Used to remove all controls at once. Overwrites the render[Top, Right, Bottom, Left]CenterControls() + * @default false + */ + withoutControls?: boolean; } export interface CarouselState { @@ -233,6 +250,10 @@ export interface CarouselState { * Is dragging enabled */ dragging: boolean; + /** + * Easing function name + */ + easing: string; /** * Current frame width */ @@ -240,7 +261,10 @@ export interface CarouselState { /** * Current left value */ + isWrappingAround: boolean; left: number; + pauseOnHover: boolean; + resetWrapAroundPosition: boolean; /** * Total amount of slides */ @@ -257,14 +281,8 @@ export interface CarouselState { * Current top value */ top: number; - /** - * Easing function name - */ - easing: string; /** * Is infinite mode enabled */ - isWrappingAround: boolean; wrapToIndex: boolean; - resetWrapAroundPosition: boolean; } diff --git a/types/nw.js/nw.js-tests.ts b/types/nw.js/nw.js-tests.ts index 853feed3b8..b0387f97a4 100644 --- a/types/nw.js/nw.js-tests.ts +++ b/types/nw.js/nw.js-tests.ts @@ -164,7 +164,7 @@ nw.Screen.chooseDesktopMedia( ["window", "screen"], maxWidth: 1920, maxHeight: 1080 }, - optional: [] + optional: [] as any[] }; //navigator.webkitGetUserMedia( { audio: false, video: constraint }, success_func, fallback_func ); } diff --git a/types/nwmatcher/index.d.ts b/types/nwmatcher/index.d.ts new file mode 100644 index 0000000000..cd0f97360e --- /dev/null +++ b/types/nwmatcher/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for nwmatcher 1.4 +// Project: https://github.com/dperini/nwmatcher +// Definitions by: Wouter van Heeswijk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function nwmatcher(global: { document: Document }): nwmatcher.Matcher; + +declare namespace nwmatcher { + interface Matcher { + // DOM Selection + + first: (selector: string, context?: Element) => Element | null; + match: (element: Element, selector: string, context?: Element) => boolean; + select: (selector: string, context?: Element, callback?: (element: Element) => void) => Element[]; + + // DOM Helpers + + byId: (id: string, from?: Element) => Element | null; + byTag: (tag: string, from?: Element) => Element[]; + byClass: (className: string, from?: Element) => Element[]; + byName: (name: string, from?: Element) => Element[]; + getAttribute: (element: Element, attribute: string) => string | undefined; + hasAttribute: (element: Element, attribute: string) => boolean; + } +} + +declare global { + namespace NW { + const Dom: nwmatcher.Matcher; + } +} + +export = nwmatcher; diff --git a/types/nwmatcher/test/nwmatcher-global.test.ts b/types/nwmatcher/test/nwmatcher-global.test.ts new file mode 100644 index 0000000000..b58e3f2367 --- /dev/null +++ b/types/nwmatcher/test/nwmatcher-global.test.ts @@ -0,0 +1,42 @@ +const matcher = NW.Dom; + +/** + * Test matcher (select/first/...) functions. + */ + +const element: Element = {} as any; + +let resultElementOrNull: Element | null; +let resultStringOrUndefined: string | undefined; +let resultElementArray: Element[]; +let resultBoolean: boolean; + +resultElementOrNull = matcher.first('foo'); +resultElementOrNull = matcher.first('foo', element); +resultElementOrNull = matcher.first('foo'); +resultElementOrNull = matcher.first('foo', element); + +resultBoolean = matcher.match(element, 'foo'); +resultBoolean = matcher.match(element, 'foo', element); + +resultElementArray = matcher.select('foo'); +resultElementArray = matcher.select('foo', element); +resultElementArray = matcher.select('foo', element, (element: Element) => undefined); + +resultElementOrNull = matcher.byId('foo'); +resultElementOrNull = matcher.byId('foo', element); +resultElementOrNull = matcher.byId('foo'); +resultElementOrNull = matcher.byId('foo', element); + +resultElementArray = matcher.byTag('foo'); +resultElementArray = matcher.byTag('foo', element); + +resultElementArray = matcher.byClass('foo'); +resultElementArray = matcher.byClass('foo', element); + +resultElementArray = matcher.byName('foo'); +resultElementArray = matcher.byName('foo', element); + +resultStringOrUndefined = matcher.getAttribute(element, 'foo'); + +resultBoolean = matcher.hasAttribute(element, 'foo'); diff --git a/types/nwmatcher/test/nwmatcher-module.test.ts b/types/nwmatcher/test/nwmatcher-module.test.ts new file mode 100644 index 0000000000..9275502bfd --- /dev/null +++ b/types/nwmatcher/test/nwmatcher-module.test.ts @@ -0,0 +1,45 @@ +import nwmatcher = require('nwmatcher'); + +const global: { document: Document } = { document: {} as any }; +const matcher = nwmatcher(global); + +/** + * Test matcher (select/first/...) functions. + */ + +const element: Element = {} as any; + +let resultElementOrNull: Element | null; +let resultStringOrUndefined: string | undefined; +let resultElementArray: Element[]; +let resultBoolean: boolean; + +resultElementOrNull = matcher.first('foo'); +resultElementOrNull = matcher.first('foo', element); +resultElementOrNull = matcher.first('foo'); +resultElementOrNull = matcher.first('foo', element); + +resultBoolean = matcher.match(element, 'foo'); +resultBoolean = matcher.match(element, 'foo', element); + +resultElementArray = matcher.select('foo'); +resultElementArray = matcher.select('foo', element); +resultElementArray = matcher.select('foo', element, (element: Element) => undefined); + +resultElementOrNull = matcher.byId('foo'); +resultElementOrNull = matcher.byId('foo', element); +resultElementOrNull = matcher.byId('foo'); +resultElementOrNull = matcher.byId('foo', element); + +resultElementArray = matcher.byTag('foo'); +resultElementArray = matcher.byTag('foo', element); + +resultElementArray = matcher.byClass('foo'); +resultElementArray = matcher.byClass('foo', element); + +resultElementArray = matcher.byName('foo'); +resultElementArray = matcher.byName('foo', element); + +resultStringOrUndefined = matcher.getAttribute(element, 'foo'); + +resultBoolean = matcher.hasAttribute(element, 'foo'); diff --git a/types/nwmatcher/tsconfig.json b/types/nwmatcher/tsconfig.json new file mode 100644 index 0000000000..b70d5c6fc3 --- /dev/null +++ b/types/nwmatcher/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/nwmatcher-global.test.ts", + "test/nwmatcher-module.test.ts" + ] +} \ No newline at end of file diff --git a/types/nwmatcher/tslint.json b/types/nwmatcher/tslint.json new file mode 100644 index 0000000000..b4b47a0378 --- /dev/null +++ b/types/nwmatcher/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/oauth-shim/index.d.ts b/types/oauth-shim/index.d.ts new file mode 100644 index 0000000000..a5016aed9f --- /dev/null +++ b/types/oauth-shim/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for oauth-shim 1.1 +// Project: https://github.com/MrSwitch/node-oauth-shim +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as express from "express"; + +export = oauthShim; + +declare const oauthShim: oauthShim.Handler; + +declare namespace oauthShim { + interface Handler extends express.RequestHandler { + interpret: express.RequestHandler; + proxy: express.RequestHandler; + redirect: express.RequestHandler; + unhandled: express.RequestHandler; + + credentials: { + get(query: any, cb: (success: false | object) => void): void; + }; + + init(configs: Config[]): void; + } + + interface Request extends express.Request { + oauthshim?: { + options?: { + [key: string]: any; + path?: string; + }; + redirect?: string; + data?: { + [key: string]: any; + access_token?: string; + }; + }; + } + + interface Config { + client_id: string; + client_secret: string; + grant_url: string; + domain: string; + } +} diff --git a/types/oauth-shim/oauth-shim-tests.ts b/types/oauth-shim/oauth-shim-tests.ts new file mode 100644 index 0000000000..2a287f8bda --- /dev/null +++ b/types/oauth-shim/oauth-shim-tests.ts @@ -0,0 +1,51 @@ +import oauthshim = require("oauth-shim"); +import express = require("express"); + +const app = express(); +app.listen(3000); +app.all("/oauthproxy", oauthshim); + +oauthshim.init([ + { + client_id: "12345", + client_secret: "secret678910", + grant_url: "https://linkedIn.com", + domain: "test.com, example.com/redirect", + }, +]); + +function customHandler(req: oauthshim.Request, res: express.Response, next: express.NextFunction) { + if ( + req.oauthshim && + req.oauthshim.redirect && + req.oauthshim.data && + req.oauthshim.data.access_token && + req.oauthshim.options && + !req.oauthshim.options.path + ) {} + + next(); +} + +app.all( + "/oauthproxy", + oauthshim.interpret, + customHandler, + oauthshim.proxy, + oauthshim.redirect, + oauthshim.unhandled +); + +oauthshim.credentials.get = (query, callback) => { + if (query.client_id === "12345") { + callback({ + client_secret: "secret678910", + }); + } else if (query.client_id === "abcde") { + callback({ + client_secret: "secret123456", + }); + } else { + callback(false); + } +}; diff --git a/types/oauth-shim/tsconfig.json b/types/oauth-shim/tsconfig.json new file mode 100644 index 0000000000..3c7fc0ad5a --- /dev/null +++ b/types/oauth-shim/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "oauth-shim-tests.ts" + ] +} diff --git a/types/oauth-shim/tslint.json b/types/oauth-shim/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/oauth-shim/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/oauth/index.d.ts b/types/oauth/index.d.ts index 21b74369e9..9f747e8b84 100644 --- a/types/oauth/index.d.ts +++ b/types/oauth/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for oauth 0.9 // Project: https://github.com/ciaranj/node-oauth#readme // Definitions by: nonAlgebraic +// Eduardo AC // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -25,8 +26,8 @@ export type oauth2tokenCallback = ( export type dataCallback = ( err: {statusCode: number, data?: any}, - result: string | Buffer, - response: IncomingMessage + result?: string | Buffer, + response?: IncomingMessage ) => any; export class OAuth { @@ -285,7 +286,7 @@ export class OAuth2 { get(url: string, access_token: string, - callback: string + callback: dataCallback ): void; protected _getAccessTokenUrl(): string; diff --git a/types/obelisk.js/tslint.json b/types/obelisk.js/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/obelisk.js/tslint.json +++ b/types/obelisk.js/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/oembed-parser/index.d.ts b/types/oembed-parser/index.d.ts new file mode 100644 index 0000000000..82e37b07f2 --- /dev/null +++ b/types/oembed-parser/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for oembed-parser 1.2 +// Project: https://www.npmjs.com/package/oembed-parser +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function extract(url: string): Promise; + +export function hasProvider(url: string): boolean; + +export interface OembedData { + type: string; + version: string; + html: string; + provider_url: string; + provider_name: string; +} diff --git a/types/oembed-parser/oembed-parser-tests.ts b/types/oembed-parser/oembed-parser-tests.ts new file mode 100644 index 0000000000..9d9ff34470 --- /dev/null +++ b/types/oembed-parser/oembed-parser-tests.ts @@ -0,0 +1,9 @@ +import { extract, hasProvider, OembedData } from "oembed-parser"; + +const url = "https://www.youtube.com/watch?v=8jPQjjsBbIc"; + +extract(url).then(data => { + const parsedData: OembedData = data; +}); + +const providerExists: boolean = hasProvider(url); diff --git a/types/oembed-parser/tsconfig.json b/types/oembed-parser/tsconfig.json new file mode 100644 index 0000000000..fc66a47c65 --- /dev/null +++ b/types/oembed-parser/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "oembed-parser-tests.ts" + ] +} diff --git a/types/oembed-parser/tslint.json b/types/oembed-parser/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/oembed-parser/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 0bb6cf22b4..ceb6f2263b 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Office.js -// Project: http://dev.office.com +// Project: https://github.com/OfficeDev/office-js // Definitions by: OfficeDev , Lance Austin , Michael Zlatkovsky , Kim Brandl , Ricky Kirkham , Alex Jerabek , Elizabeth Samuel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -252,7 +252,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -288,7 +288,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * + * * * * @@ -326,7 +326,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * + * * * * @@ -356,7 +356,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * + * * * * @@ -390,7 +390,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * + * * * * @@ -421,7 +421,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Project Y
      Word Y Y
      - * + * * * * @@ -476,7 +476,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      OneNote Y Y
      - * + * * * * @@ -540,7 +540,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      OneNote Y Y
      - * + * * * * @@ -551,7 +551,7 @@ declare namespace Office { */ asyncContext: any; /** - * Gets an {@link Office.Error} object that provides a description of the error, if any error occurred. + * Gets an object that may provide additional information if an error occurred. * * @remarks * @@ -566,6 +566,37 @@ declare namespace Office { * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      * + * + *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Outlook Y (Mailbox Preview)
      + * + * *Supported APIs* + * + * `Office.context.mailbox.item.getCallbackTokenAsync`, `Office.context.mailbox.item.getUserIdentityTokenAsync` + * + * *Supported errors* + * + * + * + * + *
      `AsyncResult.error.name` `AsyncResult.error.message` Description of diagnostics object returned
      HTTPRequestFailure The request has failed. Please look at the diagnostics object for the HTTP error code. The HTTP error code in a JSON object e.g., `{"HTTPCode":"401"}`
      InternalServerErrorThe Exchange server returned an error. Please look at the diagnostics object for more information.The error message from the Exchange server in a JSON object e.g., `{"ErrorText": "The mailbox database is temporarily unavailable"}`
      + */ + diagnostics: any; + /** + * Gets an {@link Office.Error} object that provides a description of the error, if any error occurred. + * + * @remarks + * + * **Support details** + * + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. + * An empty cell indicates that the Office host application doesn't support this enumeration. + * + * For more information about Office host application and server requirements, see + * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * + * *Supported hosts, by platform* + * + * * * * @@ -620,7 +651,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * + * * * * @@ -657,9 +688,9 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * - * - * + * + * + * *
      Office for iPad
      Excel Y
      Word Y
      Office for iPad
      Excel Y
      Word Y
      */ commerceAllowed: boolean; @@ -667,7 +698,7 @@ declare namespace Office { * Gets the locale (language) specified by the user for editing the document or item. * * @remarks - * The `contentLanguage` value reflects the **Editing Language** setting specified with **File > Options > Language** in the Office host + * The `contentLanguage` value reflects the **Editing Language** setting specified with **File \> Options \> Language** in the Office host * application. * * In content add-ins for Access web apps, the `contentLanguage` property gets the add-in culture (e.g., "en-GB"). @@ -682,7 +713,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -703,7 +734,7 @@ declare namespace Office { * * The returned value is a string in the RFC 1766 Language tag format, such as en-US. * - * The `displayLanguage` value reflects the current **Display Language** setting specified with **File > Options > Language** in the Office + * The `displayLanguage` value reflects the current **Display Language** setting specified with **File \> Options \> Language** in the Office * host application. * * In content add-ins for Access web apps, the `displayLanguage property` gets the add-in language (e.g., "en-US"). @@ -720,7 +751,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * + * * * * @@ -745,7 +776,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * + * * * * @@ -825,7 +856,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      - * + * * * * @@ -854,7 +885,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for iPad
      Office for iPad
      Excel Y
      PowerPoint Y
      Word Y
      - * + * * * * @@ -905,8 +936,8 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Outlook Y (Mailbox 1.3)
      Office for Windows desktop Office Online (in browser) Office for iPad
      Outlook Y (Mailbox 1.3)
      */ source:Source; @@ -938,7 +969,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -1035,6 +1066,10 @@ declare namespace Office { * * * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Outlook Y (Mailbox 1.3)
      PowerPoint Y Y Y
      12007A dialog box is already opened from the task pane. A task pane add-in can only have one dialog box open at a time.
      12009The user chose to ignore the dialog box. This error can occur in online versions of Office, where users may choose not to allow an add-in to present a dialog.
      * * In the callback function passed to the displayDialogAsync method, you can use the properties of the AsyncResult object to return the @@ -1070,9 +1105,9 @@ declare namespace Office { displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; /** * Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent. - * @param messageObject Accepts a message from the dialog to deliver to the add-in. + * @param message Accepts a message from the dialog to deliver to the add-in. In addition to a boolean, anything that can serialized to a string including JSON and XML can be sent. */ - messageParent(messageObject: any): void; + messageParent(message: boolean | string): void; /** * Closes the UI container where the JavaScript is executing. * @@ -1083,8 +1118,8 @@ declare namespace Office { * * - Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. * - * - Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. - * If the taskpane supports pinning and was pinned by the user, it will be un-pinned. + * - Called from a task pane: The task pane will close. Any dialog opened by displayDialogAsync will also close. + * If the task pane supports pinning and was pinned by the user, it will be un-pinned. * * - Called from a module extension: No effect. */ @@ -1212,7 +1247,7 @@ declare namespace Office { * * Example: `[{cells: Office.Table.Data, format: {fontColor: "yellow"}}, {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}]` */ - cellFormat?: Array + cellFormat?: RangeFormatConfiguration[] /** * Explicitly sets the shape of the data object. If not supplied is inferred from the data type. */ @@ -1220,7 +1255,7 @@ declare namespace Office { /** * Only for table bindings in content add-ins for Access. Array of strings. Specifies the column names. */ - columns?: Array + columns?: string[] /** * Only for table bindings in content add-ins for Access. Specifies the pre-defined string "thisRow" to get data in the currently selected row. */ @@ -1250,17 +1285,17 @@ declare namespace Office { */ interface RangeFormatConfiguration { /** - * Specifies the range. Example of using Office.Table enum: Office.Table.All. Example of using RangeCoordinates: {row: 3, column: 4} specifies + * Specifies the range. Example of using Office.Table enum: Office.Table.All. Example of using RangeCoordinates: `{row: 3, column: 4}` specifies * the cell in the 3rd (zero-based) row in the 4th (zero-based) column. */ cells: Office.Table | RangeCoordinates /** - * Specifies the formatting as key-value pairs. Example: {borderColor: "white", fontStyle: "bold"} + * Specifies the formatting as key-value pairs. Example: `{borderColor: "white", fontStyle: "bold"}` */ format: object } /** - * Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: {row: 3, column: 4} specifies the cell in the 3rd + * Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: `{row: 3, column: 4}` specifies the cell in the 3rd * (zero-based) row in the 4th (zero-based) column. */ interface RangeCoordinates { @@ -1334,7 +1369,7 @@ declare namespace Office { /** * The names of the columns involved in the binding. */ - columns?: Array + columns?: string[] /** * A user-defined item of any type that is returned, unchanged, in the asyncContext property of the AsyncResult object that is passed to a callback. */ @@ -1407,7 +1442,7 @@ declare namespace Office { * * Example: `[{cells: Office.Table.Data, format: {fontColor: "yellow"}}, {cells: {row: 3, column: 4}, format: {borderColor: "white", fontStyle: "bold"}}]` */ - cellFormat?: Array + cellFormat?: RangeFormatConfiguration[] /** * Explicitly sets the shape of the data object. If not supplied is inferred from the data type. */ @@ -1460,8 +1495,8 @@ declare namespace Office { /** * Provides access to the properties for Office theme colors. * - * Using Office theme colors lets you coordinate the color scheme of your add-in with the current Office theme selected by the user with File > - * Office Account > Office Theme UI, which is applied across all Office host applications. Using Office theme colors is appropriate for mail and + * Using Office theme colors lets you coordinate the color scheme of your add-in with the current Office theme selected by the user with File \> + * Office Account \> Office Theme UI, which is applied across all Office host applications. Using Office theme colors is appropriate for mail and * task pane add-ins. * * @remarks @@ -1476,7 +1511,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -1543,10 +1578,10 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop
      Office for Windows desktop
      Excel Y
      Outlook Y (in preview)
      PowerPoint Y
      - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y
      */ function select(expression: string, callback?: (result: AsyncResult) => void): Binding; @@ -1565,8 +1600,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      PowerPoint Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      PowerPoint Y Y Y Y
      */ enum ActiveView { @@ -1593,10 +1628,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      */ enum BindingType { @@ -1632,7 +1667,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -1681,7 +1716,7 @@ declare namespace Office { SlideRange, /** * Data is returned or set as an image stream. - * Note: Only applies to data in Excel, Word and PowerPoint. + * Note: Only applies to data in Excel, Word, and PowerPoint. */ Image } @@ -1702,11 +1737,11 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Office for Windows desktop Office Online (in browser) Office for iPad OWA for Devices Office for Mac
      Access Y
      Excel Y Y Y
      Outlook Y Y Y Y
      - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y Y Y
      Project Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Project Y
      Word Y Y Y
      */ enum DocumentMode { @@ -1735,8 +1770,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ enum CustomXMLNodeType { @@ -1789,7 +1824,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -1811,7 +1846,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Outlook Y Y Y
      PowerPoint Y Y
      - * + * * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      PowerPoint Y Y Y
      */ @@ -1822,6 +1857,14 @@ declare namespace Office { * [Api set: Mailbox 1.7] */ AppointmentTimeChanged, + /** + * Triggers when an attachment is added to or removed from an item. + * + * [Api set: Mailbox Preview] + * + * @beta + */ + AttachmentsChanged, /** * Occurs when data within the binding is changed. * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. @@ -1839,10 +1882,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      */ BindingDataChanged, @@ -1862,10 +1905,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      */ BindingSelectionChanged, @@ -1890,16 +1933,16 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y
      Word Y Y
      */ DocumentSelectionChanged, /** - * Triggers when the selected Outlook item is changed. + * Triggers when a different Outlook item is selected for viewing while the task pane is pinned. * - * [Api set: Mailbox 1.1] + * [Api set: Mailbox 1.5] */ ItemChanged, /** @@ -1918,6 +1961,8 @@ declare namespace Office { * Triggers when the OfficeTheme is changed in Outlook. * * [Api set: Mailbox Preview] + * + * @beta */ OfficeThemeChanged, /** @@ -1949,7 +1994,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -1982,10 +2027,10 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      */ enum FileType { @@ -2017,10 +2062,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Project Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Project Y
      Word Y Y
      */ enum FilterType { @@ -2048,7 +2093,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -2096,7 +2141,7 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y
      - * + * * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      PowerPoint Y Y Y
      */ @@ -2133,7 +2178,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -2168,10 +2213,10 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y
      Word Y Y
      - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Project Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Project Y
      Word Y Y
      */ enum ValueFormat { @@ -2189,7 +2234,7 @@ declare namespace Office { * Represents a binding to a section of the document. * * @remarks - *
      Requirement SetsMatrixBinding, TableBinding, TextBinding
      + *
      Requirement SetsMatrixBindings, TableBindings, TextBindings
      * * The Binding object exposes the functionality possessed by all bindings regardless of type. * @@ -2209,10 +2254,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      */ interface Binding { @@ -2496,10 +2541,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      */ document: Document; @@ -2537,10 +2582,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * @param itemName Name of the bindable object in the document. For Example 'MyExpenses' table in Excel." * @param bindingType The {@link Office.BindingType} for the data. The method returns null if the selected object cannot be coerced into the specified type. @@ -2568,9 +2613,9 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      * * @param bindingType Specifies the type of the binding object to create. Required. @@ -2603,10 +2648,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * * @param bindingType Specifies the type of the binding object to create. Required. @@ -2632,10 +2677,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -2661,10 +2706,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * * @param id Specifies the unique name of the binding object. Required. @@ -2691,10 +2736,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * * @param id Specifies the unique name to be used to identify the binding object. Required. @@ -2719,8 +2764,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ interface CustomXmlNode { @@ -2842,8 +2887,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ interface CustomXmlPart { @@ -2934,8 +2979,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ interface NodeDeletedEventArgs { @@ -2971,8 +3016,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ interface NodeInsertedEventArgs { @@ -3002,8 +3047,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ interface NodeReplacedEventArgs { @@ -3042,8 +3087,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y
      */ interface CustomXmlParts { @@ -3093,8 +3138,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ interface CustomXmlPrefixMappings { @@ -3163,10 +3208,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      */ bindings: Bindings; @@ -3185,8 +3230,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Word Y Y Y Y
      */ customXmlParts: CustomXmlParts; @@ -3205,11 +3250,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      */ mode: DocumentMode; @@ -3228,11 +3273,12 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * < + * < + * < + * < *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      OneNote Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      */ settings: Settings; @@ -3251,7 +3297,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * * @@ -3277,11 +3323,12 @@ declare namespace Office { * * *Supported hosts, by platform* *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y
      - * - * - * - * - * + * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y Y Y
      Project Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      OneNote Y
      PowerPoint Y Y Y Y
      Project Y
      Word Y Y Y Y
      * * @param eventType For a Document object event, the eventType parameter can be specified as `Office.EventType.Document.SelectionChanged` or @@ -3309,10 +3356,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y
      PowerPoint Y Y Y
      Word Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      PowerPoint Y Y Y Y
      * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -3336,13 +3381,13 @@ declare namespace Office { * The fileType parameter can be specified by using the {@link Office.FileType} enumeration or text values. But the possible values vary with * the host: * - * Excel Online, Win32, Mac, and iOS: `Office.FileType.Compressed` + * Excel for Windows desktop, iPad, and Excel Online: `Office.FileType.Compressed` + * + * Excel for Mac: `Office.FileType.Compressed`, `Office.FileType.Pdf` * - * PowerPoint on Windows desktop, Mac, and iPad, and PowerPoint Online: `Office.FileType.Compressed`, `Office.FileType.Pdf` + * PowerPoint for Windows desktop, Mac, iPad, and PowerPoint Online: `Office.FileType.Compressed`, `Office.FileType.Pdf` * - * Word on Windows desktop, Word on Mac, and Word Online: `Office.FileType.Compressed`, `Office.FileType.Pdf`, `Office.FileType.Text` - * - * Word on iPad: `Office.FileType.Compressed`, `Office.FileType.Text` + * Word for Windows desktop, Mac, iPad, and Word Online: `Office.FileType.Compressed`, `Office.FileType.Pdf`, `Office.FileType.Text` * * **Support details** * @@ -3354,10 +3399,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y
      PowerPoint Y Y Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      * * @param fileType The format in which the file will be returned @@ -3384,10 +3429,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -3435,15 +3480,15 @@ declare namespace Office { * Supported coercionType * * - * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online + * Excel, PowerPoint, Project, and Word * `Office.CoercionType.Text` (string) * * - * Excel, Word, and Word Online + * Excel and Word * `Office.CoercionType.Matrix` (array of arrays) * * - * Access, Excel, Word, and Word Online + * Access, Excel, and Word * `Office.CoercionType.Table` (TableData object) * * @@ -3451,7 +3496,7 @@ declare namespace Office { * `Office.CoercionType.Html` * * - * Word and Word Online + * Word * `Office.CoercionType.Ooxml` (Office Open XML) * * @@ -3470,12 +3515,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Project Y Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Project Y
      Word Y Y Y Y
      * * @param coercionType The type of data structure to return. See the remarks section for each host's supported coercion types. @@ -3517,10 +3561,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y
      * * @param id The identifier of the object or location to go to. @@ -3546,10 +3590,12 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      OneNote Y
      PowerPoint Y Y Y Y
      Project Y
      Word Y Y Y Y
      * * @param eventType The event type. For document can be 'Document.SelectionChanged' or 'Document.ActiveViewChanged'. @@ -3598,15 +3644,15 @@ declare namespace Office { * Supported coercionType * * - * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online + * Excel, PowerPoint, Project, and Word * `Office.CoercionType.Text` (string) * * - * Excel, Word, and Word Online + * Excel and Word * `Office.CoercionType.Matrix` (array of arrays) * * - * Access, Excel, Word, and Word Online + * Access, Excel, and Word * `Office.CoercionType.Table` (TableData object) * * @@ -3614,7 +3660,7 @@ declare namespace Office { * `Office.CoercionType.Html` * * - * Word and Word Online + * Word * `Office.CoercionType.Ooxml` (Office Open XML) * * @@ -3633,11 +3679,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Project Y
      Word Y Y Y Y
      * * @param data The data to be set. Either a string or {@link Office.CoercionType} value, 2d array or TableData object. @@ -3689,8 +3735,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getProjectFieldAsync(fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3714,8 +3760,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getResourceFieldAsync(resourceId: string, fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3737,8 +3783,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getSelectedResourceAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3760,8 +3806,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getSelectedTaskAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3785,8 +3831,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getSelectedViewAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3812,8 +3858,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getTaskAsync(taskId: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3837,8 +3883,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getTaskFieldAsync(taskId: string, fieldId: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3862,8 +3908,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getWSSUrlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3914,8 +3960,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getMaxTaskIndexAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3941,8 +3987,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getResourceByIndexAsync(resourceIndex: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3968,8 +4014,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ getTaskByIndexAsync(taskIndex: number, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -3996,8 +4042,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ setResourceFieldAsync(resourceId: string, fieldId: number, fieldValue: string | number | boolean | object, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -4024,8 +4070,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ setTaskFieldAsync(taskId: string, fieldId: number, fieldValue: string | number | boolean | object, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -4059,9 +4105,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      */ interface File { @@ -4177,9 +4224,9 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      Word Y Y Y Y
      */ interface MatrixBinding extends Binding { @@ -4272,8 +4319,9 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y
      */ addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; @@ -4293,11 +4341,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      * * @param settingName The case-sensitive name of the setting to retrieve. @@ -4353,11 +4401,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * - * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Excel Y Y
      PowerPoint Y Y
      Word Y Y
      * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. @@ -4386,11 +4434,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      * * @param settingName The case-sensitive name of the setting to remove. @@ -4422,10 +4470,9 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y
      * * @param eventType Specifies the type of event to remove. Required. @@ -4479,11 +4526,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      * * @param options Provides options for saving settings. @@ -4515,11 +4562,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      PowerPoint Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      PowerPoint Y Y Y Y
      Word Y Y Y Y
      * * @param settingName The case-sensitive name of the setting to set or create. @@ -4558,9 +4605,9 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y
      Word Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y
      Word Y Y
      */ interface SettingsChangedEventArgs { @@ -4591,7 +4638,7 @@ declare namespace Office { * * *Supported hosts, by platform* * - * + * * * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Office for Windows desktop Office Online (in browser) Office for iPad
      PowerPoint Y Y Y
      Word Y Y Y
      @@ -4643,10 +4690,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * < + * < *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      */ columnCount: number; @@ -4665,10 +4712,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * < + * < *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      */ hasHeaders: boolean; @@ -4700,10 +4747,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * < + * < *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      */ rowCount: number; @@ -4733,15 +4780,16 @@ declare namespace Office { * * A capital Y in the following matrix indicates that this method is supported in the corresponding Office host application. * An empty cell indicates that the Office host application doesn't support this method. - * + * * For more information about Office host application and server requirements, see * {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. * * *Supported hosts, by platform* * - * - * - * + * + * + * < + * < *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * * @param tableData An array of arrays ("matrix") or a TableData object that contains one or more columns of data to add to the table. Required. @@ -4778,10 +4826,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * < + * < *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * * @param rows An array of arrays ("matrix") or a TableData object that contains one or more rows of data to add to the table. Required. @@ -4806,10 +4854,10 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * + * + * + * < + * < *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Access Y
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Access Y
      Excel Y Y Y Y
      Word Y Y Y Y
      * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -4832,8 +4880,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      * * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -4859,32 +4907,33 @@ declare namespace Office { * Description * * - * {row: n} + * `{row: n}` * Specifies the range that is the zero-based nth row of data in the table. * * - * {column: n} + * `{column: n}` * Specifies the range that is the zero-based nth column of data in the table. * * - * {row: i, column: j} + * `{row: i, column: j}` * Specifies the single cell that is the ith row and jth column of the table. * * - * Office.Table.All + * `Office.Table.All` * Specifies the entire table, including column headers, data, and totals (if any). * * - * Office.Table.Data + * `Office.Table.Data` * Specifies only the data in the table (no headers and totals). * * - * Office.Table.Headers + * `Office.Table.Headers` * Specifies only the header row. * * * - * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel (Right-click > Format Cells or Home > Format > Format Cells). + * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel + * (Right-click \> Format Cells or Home \> Format \> Format Cells). * * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. * @param formats An array specifying the format properties to get. @@ -4916,33 +4965,33 @@ declare namespace Office { * Description * * - * {row: n} + * `{row: n}` * Specifies the range that is the zero-based nth row of data in the table. * * - * {column: n} + * `{column: n}` * Specifies the range that is the zero-based nth column of data in the table. * * - * {row: i, column: j} + * `{row: i, column: j}` * Specifies the single cell that is the ith row and jth column of the table. * * - * Office.Table.All + * `Office.Table.All` * Specifies the entire table, including column headers, data, and totals (if any). * * - * Office.Table.Data + * `Office.Table.Data` * Specifies only the data in the table (no headers and totals). * * - * Office.Table.Headers + * `Office.Table.Headers` * Specifies only the header row. * * * * The `format:` property specifies values that correspond to a subset of the settings available in the Format Cells dialog box in Excel - * (Right-click > Format Cells or Home > Format > Format Cells). + * (Right-click \> Format Cells or Home \> Format \> Format Cells). * * You specify the value of the `format:` property as a list of one or more property name - value pairs in a JavaScript object literal. The * property name specifies the name of the formatting property to set, and value specifies the property value. @@ -4997,8 +5046,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      * * @param cellFormat An array that contains one or more JavaScript objects that specify which cells to target and the formatting to apply to them. @@ -5049,8 +5098,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      * * @param tableOptions An object literal containing a list of property name-value pairs that define the table options to apply. @@ -5091,8 +5140,8 @@ declare namespace Office { */ headers: any[]; /** - * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are - * no rows. + * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. + * Returns an empty array if there are no rows. * * @remarks * @@ -5127,8 +5176,8 @@ declare namespace Office { * * *Supported hosts, by platform* *
      HostsExcel, Word
      - * - * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      */ enum Table { @@ -5164,9 +5213,9 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * + * + * + * *
      Office for Windows desktop Office Online (in browser) Office for iPad
      Excel Y Y Y
      Word Y Y Y
      Office for Windows desktop Office Online (in browser) Office for iPad Office for Mac
      Excel Y Y Y Y
      Word Y Y Y Y
      */ interface TextBinding extends Binding { } @@ -5187,8 +5236,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ enum ProjectProjectFields { @@ -5263,8 +5312,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ enum ProjectResourceFields { @@ -6090,8 +6139,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ enum ProjectTaskFields { @@ -7252,8 +7301,8 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * + * + * *
      Office for Windows desktop Office Online (in browser)
      Project Y
      Office for Windows desktop Office Online (in browser)
      Project Y
      */ enum ProjectViewTypes { @@ -7339,6 +7388,62 @@ declare namespace Office { declare namespace Office { namespace MailboxEnums { + /** + * Specifies the formatting that applies to an attachment's content. + * + * [Api set: Mailbox Preview] + * + * @remarks + *
      + * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode} + * Compose or read
      + * + * @beta + */ + enum AttachmentContentFormat { + /** + * The content of the attachment is returned as a base64-encoded string. + */ + Base64 = "base64", + + /** + * The content of the attachment is returned as a string representing a URL. + */ + Url = "url", + + /** + * The content of the attachment is returned as a string representing an .eml formatted file. + */ + Eml = "eml", + + /** + * The content of the attachment is returned as a string representing an .icalendar formatted file. + */ + ICalendar = "iCalendar" + } + /** + * Specifies whether an attachment was added to or removed from an item. + * + * [Api set: Mailbox Preview] + * + * @remarks + *
      + * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode} + * Compose or read
      + * + * @beta + */ + enum AttachmentStatus { + /** + * An attachment was added to the item. + */ + Added = "added", + + /** + * An attachment was removed from the item. + */ + Removed = "removed" + } /** * Specifies an attachment's type. * @@ -8493,6 +8598,36 @@ declare namespace Office { */ subject: string; } + /** + * Represents the content of an attachment on a message or appointment item. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
      + * + * @beta + */ + interface AttachmentContent { + /** + * The content of an attachment as a string. + */ + content: string; + /** + * The string format to use for an attachment's content. + * + * For file attachments, the formatting is a base64-encoded string. + * + * For item attachments that represent messages, the formatting is a string representing an .eml formatted file. + * + * For item attachments that represent calendar items, the formatting is a string representing an .icalendar file. + * + * For cloud attachments, the formatting is a URL string. + */ + format: Office.MailboxEnums.AttachmentContentFormat; + } /** * Represents an attachment on an item from the server. Read mode only. * @@ -8561,7 +8696,7 @@ declare namespace Office { * * In addition to this signature, this method also has the following signature: * - * `getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void;` + * `getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void;` * * @param coercionType The format for the returned body. * @param options Optional. An object literal that contains one or more of the following properties: @@ -8569,7 +8704,7 @@ declare namespace Office { * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coerciontype: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + getAsync(coerciontype: Office.CoercionType, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Returns the current body in a specified format. * @@ -8590,7 +8725,7 @@ declare namespace Office { * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. * The body is provided in the requested format in the asyncResult.value property. */ - getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; + getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult) => void): void; /** * Gets a value that indicates whether the content is in HTML or text format. @@ -8614,7 +8749,7 @@ declare namespace Office { * The prependAsync method inserts the specified string at the beginning of the item body. * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8648,7 +8783,7 @@ declare namespace Office { * The prependAsync method inserts the specified string at the beginning of the item body. * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8672,7 +8807,7 @@ declare namespace Office { * The prependAsync method inserts the specified string at the beginning of the item body. * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8693,7 +8828,7 @@ declare namespace Office { * The prependAsync method inserts the specified string at the beginning of the item body. * After insertion, the cursor is returned to its original place, relative to the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8713,7 +8848,7 @@ declare namespace Office { * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] @@ -8748,7 +8883,7 @@ declare namespace Office { * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] @@ -8773,7 +8908,7 @@ declare namespace Office { * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] @@ -8797,7 +8932,7 @@ declare namespace Office { * The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method * previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.3] @@ -8820,7 +8955,7 @@ declare namespace Office { * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8855,7 +8990,7 @@ declare namespace Office { * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8880,7 +9015,7 @@ declare namespace Office { * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8904,7 +9039,7 @@ declare namespace Office { * the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the * UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content. * - * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor () to "LPNoLP" + * When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (\) to "LPNoLP" * (please see the Examples section for a sample). * * [Api set: Mailbox 1.1] @@ -8937,7 +9072,7 @@ declare namespace Office { /** * An array of strings containing the mailing and street addresses associated with the contact. Nullable. */ - addresses: Array; + addresses: string[]; /** * A string containing the name of the business associated with the contact. Nullable. */ @@ -8945,7 +9080,7 @@ declare namespace Office { /** * An array of strings containing the SMTP email addresses associated with the contact. Nullable, */ - emailAddresses: Array; + emailAddresses: string[]; /** * A string containing the name of the person associated with the contact. Nullable. */ @@ -8953,11 +9088,11 @@ declare namespace Office { /** * An array containing a PhoneNumber object for each phone number associated with the contact. Nullable. */ - phoneNumbers: Array; + phoneNumbers: PhoneNumber[]; /** * An array of strings containing the Internet URLs associated with the contact. Nullable. */ - urls: Array; + urls: string[]; } /** * The CustomProperties object represents custom properties that are specific to a particular item and specific to a mail add-in for Outlook. @@ -9278,6 +9413,154 @@ declare namespace Office { getAsync(callback?: (result: AsyncResult) => void): void; } + /** + * The InternetHeaders object represents properties that are preserved after the item leaves Exchange and converted to a MIME message. + * These properties are stored as x-headers in the MIME message. + * + * InternetHeaders are stored as key/value pairs on a per-item basis. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
      + * + * @beta + */ + export interface InternetHeaders { + /** + * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. + * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
      + * + * In addition to this signature, this method also has the following signature: + * + * `getAsync(names: string[], callback: (result: AsyncResult) => void): void;` + * + * @param names The names of the internet headers to be returned. + * @param options Optional. An object literal that contains one or more of the following properties: + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * + * @beta + */ + getAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Given an array of internet header names, this method returns a dictionary containing those internet headers and their values. + * If the add-in requests an x-header that is not available, that x-header will not be returned in the results. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
      + * + * @param names The names of the internet headers to be returned. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * + * @beta + */ + getAsync(names: string[], callback?: (result: AsyncResult) => void): void; + /** + * Given an array of internet header names, this method removes the specified headers from the internet header collection. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
      + * + * In addition to this signature, this method also has the following signature: + * + * `removeAsync(names: string[], callback: (result: AsyncResult) => void): void;` + * + * @param names The names of the internet headers to be removed. + * @param options Optional. An object literal that contains one or more of the following properties: + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * + * @beta + */ + removeAsync(names: string[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Given an array of internet header names, this method removes the specified headers from the internet header collection. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
      + * + * @param names The names of the internet headers to be removed. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. + * + * @beta + */ + removeAsync(names: string[], callback?: (result: AsyncResult) => void): void; + /** + * Sets the specified internet headers to the specified values. + * + * The setAsync method creates a new header if the specified header does not already exist; otherwise, the existing value is replaced with + * the new value. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * In addition to this signature, this method also has the following signatures: + * + * `setAsync(headers: string, callback: (result: AsyncResult) => void): void;` + * + * @param headers The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the + * internet headers and values being the values of the internet headers. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * Any errors encountered will be provided in the asyncResult.error property. + * + * @beta + */ + setAsync(headers: Object, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + /** + * Sets the specified internet headers to the specified values. + * + * The setAsync method creates a new header if the specified header does not already exist; otherwise, the existing value is replaced with + * the new value. + * + * [Api set: Mailbox Preview] + * + * @remarks + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
      + * + * + * + * @param headers The names and corresponding values of the headers to be set. Should be a dictionary object with keys being the names of the + * internet headers and values being the values of the internet headers. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. + * Any errors encountered will be provided in the asyncResult.error property. + * + * @beta + */ + setAsync(headers: Object, callback?: (result: AsyncResult) => void): void; + } + /** * Represents the appointment organizer, even if an alias or a delegate was used to create the appointment. * This object provides a method to get the organizer value of an appointment in an Outlook add-in. @@ -9668,7 +9951,8 @@ declare namespace Office { /** * Adds an event handler for a supported event. * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrenceChanged`. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -9695,7 +9979,7 @@ declare namespace Office { * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -9854,6 +10138,26 @@ declare namespace Office { *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadWriteItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer
      */ close(): void; + /** + * Gets the item's attachments as an array. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
      + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. If the call fails, the asyncResult.error property will contain and error code with the reason for + * the failure. + * + * @beta + */ + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -9962,8 +10266,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -9996,8 +10300,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -10018,8 +10322,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -10043,8 +10347,8 @@ declare namespace Office { * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. * In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -10066,7 +10370,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -10080,7 +10384,7 @@ declare namespace Office { * * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param options Optional. An object literal that contains one or more of the following properties. @@ -10092,7 +10396,8 @@ declare namespace Office { /** * Removes an event handler for a supported event. * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrenceChanged`. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -10102,7 +10407,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Organizer * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, @@ -10146,13 +10451,13 @@ declare namespace Office { * * `saveAsync(options: Office.AsyncContextOptions): void;` * - * `saveAsync(callback: (result: AsyncResult) => void): void;` + * `saveAsync(callback: (result: AsyncResult) => void): void;` * * @param options Optional. An object literal that contains one or more of the following properties. * asyncContext: Developers can provide any object they wish to access in the callback method. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Asynchronously saves an item. * @@ -10253,7 +10558,7 @@ declare namespace Office { * * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult. */ - saveAsync(callback: (result: AsyncResult) => void): void; + saveAsync(callback: (result: AsyncResult) => void): void; /** * Asynchronously inserts data into the body or subject of a message. * @@ -10377,7 +10682,7 @@ declare namespace Office { */ interface AppointmentRead extends Appointment, ItemRead { /** - * Gets an array of attachments for the item. + * Gets the item's attachments as an array. * * [Api set: Mailbox 1.0] * @@ -10681,7 +10986,7 @@ declare namespace Office { * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -10709,7 +11014,7 @@ declare namespace Office { * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -11062,7 +11367,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -11076,7 +11381,7 @@ declare namespace Office { * * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param options Optional. An object literal that contains one or more of the following properties. @@ -11089,7 +11394,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -11099,7 +11404,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Appointment Attendee * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, @@ -11236,7 +11541,8 @@ declare namespace Office { /** * Adds an event handler for a supported event. * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrenceChanged`. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -11263,7 +11569,8 @@ declare namespace Office { /** * Adds an event handler for a supported event. * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrenceChanged`. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -11280,6 +11587,36 @@ declare namespace Office { * asyncResult, which is an Office.AsyncResult object. */ addHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void; + + /** + * Gets an attachment from a message or appointment and returns it as an `Office.AttachmentContent` object. + * + * The `getAttachmentContentAsync` method gets the attachment with the specified identifier from the item. As a best practice, you should use + * the identifier to retrieve an attachment in the same session that the attachmentIds were retrieved with the `getAttachmentsAsync` or + * `item.attachments` call. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
      ErrorsInvalidAttachmentId - The attachment identifier does not exist.
      + * + * @param attachmentId The identifier of the attachment you want to get. The maximum length of the string is 100 characters. + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, + * asyncResult, which is an Office.AsyncResult object. If the call fails, the asyncResult.error property will contain and error code + * with the reason for the failure. + * + * @beta + */ + getAttachmentContentAsync(attachmentId: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is {@link https://docs.microsoft.com/outlook/actionable-messages/invoke-add-in-from-actionable-message | activated by an actionable message}. @@ -11383,7 +11720,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -11397,7 +11734,7 @@ declare namespace Office { * * `removeHandlerAsync(eventType: Office.EventType, handler: any, callback?: (result: AsyncResult) => void): void;` * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param options Optional. An object literal that contains one or more of the following properties. @@ -11411,7 +11748,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -11421,7 +11758,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, @@ -11731,6 +12068,26 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose */ close(): void; + /** + * Gets the item's attachments as an array. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
      + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. If the call fails, the asyncResult.error property will contain and error code with the reason for + * the failure. + * + * @beta + */ + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -11817,8 +12174,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -11852,8 +12209,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -11874,8 +12231,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -11898,8 +12255,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -12191,7 +12548,7 @@ declare namespace Office { */ interface ItemRead extends Item { /** - * Gets an array of attachments for the item. + * Gets the item's attachments as an array. * * [Api set: Mailbox 1.0] * @@ -12739,6 +13096,22 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose */ from: Office.From; + /** + * Sets the internet headers of a message. + * + * The internetHeaders property returns an InternetHeaders object that provides methods to manage the internet headers on the message. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose
      + * + * @beta + */ + internetHeaders: Office.InternetHeaders; /** * Gets the type of item that an instance represents. * @@ -12977,7 +13350,8 @@ declare namespace Office { /** * Adds an event handler for a supported event. * - * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and `Office.EventType.RecurrenceChanged`. + * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -13004,7 +13378,7 @@ declare namespace Office { * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -13165,6 +13539,26 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose */ close(): void; + /** + * Gets the item's attachments as an array. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose
      + * + * @param options Optional. An object literal that contains one or more of the following properties. + * asyncContext: Developers can provide any object they wish to access in the callback method. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. If the call fails, the asyncResult.error property will contain and error code with the reason for + * the failure. + * + * @beta + */ + getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; /** * Gets initialization data passed when the add-in is activated by an actionable message. * @@ -13277,8 +13671,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -13312,8 +13706,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -13334,8 +13728,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -13358,8 +13752,8 @@ declare namespace Office { * The removeAttachmentAsync method removes the attachment with the specified identifier from the item. * As a best practice, you should use the attachment identifier to remove an attachment only if the same mail app has added that attachment * in the same session. In Outlook Web App and OWA for Devices, the attachment identifier is valid only within the same session. - * A session is over when the user closes the app, or if the user starts composing in an inline form and subsequently pops out the inline form - * to continue in a separate window. + * A session is over when the user closes the app, or if the user starts composing an inline form then subsequently pops out the form to + * continue in a separate window. * * [Api set: Mailbox 1.1] * @@ -13381,7 +13775,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -13395,7 +13789,7 @@ declare namespace Office { * * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param options Optional. An object literal that contains one or more of the following properties. @@ -13408,7 +13802,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -13418,7 +13812,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Compose * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, @@ -13693,7 +14087,7 @@ declare namespace Office { */ interface MessageRead extends Message, ItemRead { /** - * Gets an array of attachments for the item. + * Gets the item's attachments as an array. * * [Api set: Mailbox 1.0] * @@ -13801,6 +14195,22 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read */ from: EmailAddressDetails; + /** + * Gets the internet headers of a message. + * + * The internetHeaders property returns an InternetHeaders object that provides methods to manage the internet headers on the message. + * + * [Api set: Mailbox Preview] + * + * @remarks + * + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read
      + * + * @beta + */ + internetHeaders: Office.InternetHeaders; /** * Gets the Internet message identifier for an email message. * @@ -14013,7 +14423,7 @@ declare namespace Office { * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -14041,7 +14451,7 @@ declare namespace Office { * Adds an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -14398,7 +14808,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -14412,7 +14822,7 @@ declare namespace Office { * * `removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;` * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param options Optional. An object literal that contains one or more of the following properties. @@ -14425,7 +14835,7 @@ declare namespace Office { * Removes an event handler for a supported event. * * Currently the supported event types are `Office.EventType.AppointmentTimeChanged`, `Office.EventType.RecipientsChanged`, and - * `Office.EventType.RecurrenceChanged`. + * `Office.EventType.RecurrenceChanged`. In Preview, `Office.EventType.AttachmentsChanged` is also supported. * * [Api set: Mailbox 1.7] * @@ -14435,7 +14845,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Message Read * - * @param eventType The event that should invoke the handler. + * @param eventType The event that should revoke the handler. * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. * The type property on the parameter will match the eventType parameter passed to removeHandlerAsync. * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, @@ -14724,7 +15134,7 @@ declare namespace Office { */ restUrl: string; /** - * Information about the user associated with the mailbox. This includes their account type, display name, email adddress, and time zone. + * Information about the user associated with the mailbox. This includes their account type, display name, email address, and time zone. * * More information is under {@link Office.UserProfile} */ @@ -14732,7 +15142,7 @@ declare namespace Office { /** * Adds an event handler for a supported event. * - * Currently, the supported event types are `Office.EventType.ItemChanged` and `Office.EventType.OfficeThemeChanged`. + * Currently, the only supported event type is `Office.EventType.ItemChanged`. In Preview, `Office.EventType.OfficeThemeChanged` is also supported. * * [Api set: Mailbox 1.5] * @@ -15005,7 +15415,8 @@ declare namespace Office { * isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false. * asyncContext: Any state data that is passed to the asynchronous method. * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. The token is provided as a string in the asyncResult.value property. + * type Office.AsyncResult. The token is provided as a string in the `asyncResult.value` property. + * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. */ getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: AsyncResult) => void): void; /** @@ -15032,7 +15443,8 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose and read * * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. - * The token is provided as a string in the asyncResult.value property. + * The token is provided as a string in the `asyncResult.value` property. + * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. */ getCallbackTokenAsync(callback: (result: AsyncResult) => void): void; /** @@ -15059,7 +15471,8 @@ declare namespace Office { * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose and read * * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of - * type Office.AsyncResult. The token is provided as a string in the asyncResult.value property. + * type Office.AsyncResult. The token is provided as a string in the `asyncResult.value` property. + * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext Optional. Any state data that is passed to the asynchronous method. */ getCallbackTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void; @@ -15081,7 +15494,8 @@ declare namespace Office { * * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of * type Office.AsyncResult. - * The token is provided as a string in the asyncResult.value property. + * The token is provided as a string in the `asyncResult.value` property. + * If there was an error, then the `asyncResult.error` and `asyncResult.diagnostics` properties may provide additional information. * @param userContext Optional. Any state data that is passed to the asynchronous method.| */ getUserIdentityTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void; @@ -15094,7 +15508,7 @@ declare namespace Office { * * You cannot request Folder Associated Items with the makeEwsRequestAsync method. * - * The XML request must specify UTF-8 encoding. + * The XML request must specify UTF-8 encoding. \ * * Your add-in must have the ReadWriteMailbox permission to use the makeEwsRequestAsync method. * For information about using the ReadWriteMailbox permission and the EWS operations that you can call with the makeEwsRequestAsync method, @@ -15138,6 +15552,27 @@ declare namespace Office { * @param userContext Optional. Any state data that is passed to the asynchronous method. */ makeEwsRequestAsync(data: any, callback: (result: AsyncResult) => void, userContext?: any): void; + /** + * Removes an event handler for a supported event. + * + * Currently, the only supported event type is `Office.EventType.ItemChanged`. In Preview, `Office.EventType.OfficeThemeChanged` is also supported. + * + * [Api set: Mailbox 1.5] + * + * @remarks + * + * + * + *
      {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}ReadItem
      {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read
      + * + * @param eventType The event that should revoke the handler. + * @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. + * The type property on the parameter will match the eventType parameter passed to addHandlerAsync. + * @param options Optional. Provides an option for preserving context data of any type, unchanged, for use in a callback. + * @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of + * type Office.AsyncResult. + */ + removeHandlerAsync(eventType: Office.EventType, handler: (type: EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; } /** @@ -16204,7 +16639,7 @@ declare namespace Office { * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name. * The value is stored in the document as the serialized JSON representation of its data type. * - * A maximum of 2MB is available for the settings of each add-in, and each individual setting is limited to 32KB. + * A maximum of 32KB is available for the settings of each add-in. * * Any changes made to settings using the set function will not be saved to the server until the saveAsync function is called. * @@ -16443,7 +16878,7 @@ declare namespace Office { */ owner: String; /** - * The remote REST url related to the owner’s mailbox. + * The remote REST URL related to the owner’s mailbox. */ restUrl: String; /** @@ -16767,7 +17202,7 @@ declare namespace Office { } /** - * Information about the user associated with the mailbox. This includes their account type, display name, email adddress, and time zone. + * Information about the user associated with the mailbox. This includes their account type, display name, email address, and time zone. * * [Api set: Mailbox 1.0] * @@ -17103,7 +17538,7 @@ declare namespace OfficeExtension { * If there was an error, this contains all trace messages that were executed before the error occurred. * These messages can help you monitor the program execution sequence and detect the case of the error. */ - traceMessages: Array; + traceMessages: string[]; /** Debug info (useful for detailed logging of the error, i.e., via `JSON.stringify(...)`). */ debugInfo: DebugInfo; /** Inner error, if applicable. */ @@ -19890,7 +20325,7 @@ declare namespace Excel { * @param key The Key of the new setting. * @param value The Value for the new setting. */ - add(key: string, value: string | number | boolean | Date | Array | any): Excel.Setting; + add(key: string, value: string | number | boolean | Date | any[] | any): Excel.Setting; /** * * Gets the number of Settings in the collection. @@ -21396,12 +21831,11 @@ declare namespace Excel { inCellDropDown: boolean; /** * - * Source of the list for data validation - When setting the value, it can be passed in as a Excel Range object, or a string that contains comma separated number, boolean or date. + * The source of the list for data validation. The value is a string, which can either be a range reference (e.g. `"=Names!$A$1:$A$3"`) or a comma-separated list of the values themselves. * * [Api set: ExcelApi 1.8] */ - source: string | Range; + source: string; } /** * @@ -22167,8 +22601,7 @@ declare namespace Excel { readonly worksheet: Excel.Worksheet; /** * - * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to - the level of where the category labels are being sourced from. Read/Write. + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to the level of where the category labels are being sourced from. Read/Write. * * [Api set: ExcelApi 1.8] */ @@ -22231,8 +22664,7 @@ declare namespace Excel { plotVisibleOnly: boolean; /** * - * Returns or sets a ChartSeriesNameLevel enumeration constant referring to - the level of where the series names are being sourced from. Read/Write. + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to the level of where the series names are being sourced from. Read/Write. * * [Api set: ExcelApi 1.8] */ @@ -23316,7 +23748,7 @@ declare namespace Excel { position: Excel.ChartAxisPosition | "Automatic" | "Maximum" | "Minimum" | "Custom"; /** * - * Represents the specified axis position where the other axis crosses at. Read Only. Set to this property should use SetPositionAt(double) method. + * Represents the specified axis position where the other axis crosses at. You should use the SetPositionAt(double) method to set this property. * * [Api set: ExcelApi 1.8] */ @@ -23682,15 +24114,14 @@ declare namespace Excel { readonly format: Excel.ChartDataLabelFormat; /** * - * Represents whether data labels automatically generates appropriate text based on context. + * Represents whether data labels automatically generate appropriate text based on context. * * [Api set: ExcelApi 1.8] */ autoText: boolean; /** * - * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. - This property is valid only when TextOrientation of data label is 0. + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. This property is valid only when TextOrientation of data label is 0. * * [Api set: ExcelApi 1.8] */ @@ -23767,8 +24198,7 @@ declare namespace Excel { textOrientation: number; /** * - * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. - This property is valid only when TextOrientation of data label is 90, -90 or 180. + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. This property is valid only when TextOrientation of data label is -90, 90, or 180. * * [Api set: ExcelApi 1.8] */ diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index ae86c01bcb..31c3dded97 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for office-runtime 1.0 -// Project: http://dev.office.com/ +// Project: https://github.com/OfficeDev/office-js // Definitions by: Michael Zlatskovsky , Michelle Scharlock // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Typescript Version: 2.4 @@ -49,11 +49,6 @@ declare namespace OfficeRuntime { * Removes an item for specified key and invokes a callback when finished. Returns a Promise. */ removeItem(key: string, callback?: (error?: Error) => void): Promise; - /** - * @beta - * Erases all AsyncStorage. Returns a Promise. - */ - clear(callback?: (error?: Error) => void): Promise; /** * @beta * Returns a Promise with all keys. @@ -75,7 +70,7 @@ declare namespace OfficeRuntime { */ multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } - /* + /** * @beta * Object representing the dialog box. */ @@ -111,15 +106,20 @@ declare namespace OfficeRuntime { * True if title is hidden from the dialog box. */ hideTitle?: boolean; - /* + /** * @beta * Callback that is run when the dialog box is closed. */ onClose?: () => void; + /** + * @beta + * Callback that is run when the dialog sends a message to its parent. + */ + onMessage?(message: string, dialog?: Dialog): void; /* * @beta * Callback that is run when the dialog box sends an error. */ - onMessage?(message: string, dialog?: Dialog): void; + onRuntimeError?(error: Error, dialog?: Dialog): void; } } diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts index e8d15137b8..b0e0457bae 100644 --- a/types/office-runtime/office-runtime-tests.ts +++ b/types/office-runtime/office-runtime-tests.ts @@ -4,59 +4,72 @@ Copyright (c) Microsoft Corporation */ OfficeRuntime.AsyncStorage.getItem("foo", () => { - // perform an action - }); - OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); +}); +OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); - OfficeRuntime.AsyncStorage.setItem("foo", "bar"); - OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => console.log(error)); +OfficeRuntime.AsyncStorage.setItem("foo", "bar"); +OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => + console.log(error) +); - OfficeRuntime.AsyncStorage.removeItem("foo"); - OfficeRuntime.AsyncStorage.removeItem("foo", () => { +OfficeRuntime.AsyncStorage.removeItem("foo"); +OfficeRuntime.AsyncStorage.removeItem("foo", () => { // perform an action - }); +}); - OfficeRuntime.AsyncStorage.clear(); - OfficeRuntime.AsyncStorage.clear(() => { - // perform an action - }); +OfficeRuntime.AsyncStorage.getAllKeys().then(keys => { + keys.forEach(item => console.log(item)); +}); - OfficeRuntime.AsyncStorage.getAllKeys().then(keys => { - keys.forEach(item => console.log(item)); - }); +OfficeRuntime.AsyncStorage.getAllKeys((error, keys) => { + if (error) { + console.error(error); + } else { + keys.forEach(item => console.log(item)); + } +}); - OfficeRuntime.AsyncStorage.getAllKeys((error, keys) => { - if (error) { - console.error(error); - } else { - keys.forEach(item => console.log(item)); - } - }); +OfficeRuntime.AsyncStorage.multiSet( + [["username", "foo"], ["yearOfBirth", "2001"]], + errors => { + errors + .filter(error => error != null) + .forEach(error => console.log(error)); + } +); - OfficeRuntime.AsyncStorage.multiSet( - [["username", "foo"], ["yearOfBirth", "2001"]], - errors => { - errors.filter(error => error != null).forEach(error => console.log(error)); - } - ); +OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); +OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => + console.log(value) +); - OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); - OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => console.log(value)); +OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( + values => { + console.log(values[0][1]); + console.log(values[1][1]); + } +); - OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( - values => { - console.log(values[0][1]); - console.log(values[1][1]); - } - ); +OfficeRuntime.displayWebDialog("https://localhost:3000", { + displayInIFrame: false, + onMessage: (message: string, dialog: OfficeRuntime.Dialog) => { + console.log(message); + if (message === "close") { + dialog.close(); + } + }, + onRuntimeError: (error: Error) => { + console.error(error); + } +}); - OfficeRuntime.displayWebDialog("https://localhost:3000", { - displayInIFrame: false - }); - - OfficeRuntime.displayWebDialog("https://localhost:3000", { +OfficeRuntime.displayWebDialog("https://localhost:3000", { onClose: () => { console.log("closed"); } - }); +}); + +OfficeRuntime.displayWebDialog("https://localhost:3000", { + displayInIFrame: false +}); diff --git a/types/okta__okta-vue/tsconfig.json b/types/okta__okta-vue/tsconfig.json index f114dc0fe8..ffd7c33703 100644 --- a/types/okta__okta-vue/tsconfig.json +++ b/types/okta__okta-vue/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/ol/ol-tests.ts b/types/ol/ol-tests.ts index fbfed7e90f..ca099420cd 100644 --- a/types/ol/ol-tests.ts +++ b/types/ol/ol-tests.ts @@ -304,10 +304,10 @@ import View from 'ol/view'; // Map const map: ol.Map = new Map( {}); -const mapView: View = {}; -const layerBase: LayerBase = {}; -const control: ControlControl = {}; -const interaction: InteractionInteraction = {}; +declare const mapView: View; +declare const layerBase: LayerBase; +declare const control: ControlControl; +declare const interaction: InteractionInteraction; map.setView(mapView); map.addLayer(layerBase); map.addControl(control); @@ -315,9 +315,9 @@ map.addInteraction(interaction); // View let view: View; -const coordinate: ol.Coordinate = {}; -const size: ol.Size = {}; -const position: ol.Pixel = {}; +declare const coordinate: ol.Coordinate; +declare const size: ol.Size; +declare const position: ol.Pixel; view = map.getView(); view.getProjection(); view.animate( {}); diff --git a/types/on-wake-up/index.d.ts b/types/on-wake-up/index.d.ts new file mode 100644 index 0000000000..c9568404b8 --- /dev/null +++ b/types/on-wake-up/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for on-wake-up 1.0 +// Project: https://github.com/mafintosh/on-wake-up +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Register a callback when the device presumably wakes up from sleep. + * @param cb The callback to execute + * @returns Function to unregister the callback + */ +declare function onWakeUp(cb: () => void): () => void; + +export = onWakeUp; diff --git a/types/on-wake-up/on-wake-up-tests.ts b/types/on-wake-up/on-wake-up-tests.ts new file mode 100644 index 0000000000..985d415063 --- /dev/null +++ b/types/on-wake-up/on-wake-up-tests.ts @@ -0,0 +1,4 @@ +import onWakeUp = require('on-wake-up'); + +const unregister = onWakeUp(() => void 0); +unregister(); diff --git a/types/on-wake-up/tsconfig.json b/types/on-wake-up/tsconfig.json new file mode 100644 index 0000000000..691fba15c1 --- /dev/null +++ b/types/on-wake-up/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "on-wake-up-tests.ts" + ] +} diff --git a/types/on-wake-up/tslint.json b/types/on-wake-up/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/on-wake-up/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/onoff/index.d.ts b/types/onoff/index.d.ts index 72c25d11f5..f4eba3ffb6 100644 --- a/types/onoff/index.d.ts +++ b/types/onoff/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for onoff +// Type definitions for onoff v3.2 // Project: https://github.com/fivdi/onoff // Definitions by: Marcel Ernst +// Kallu609 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -8,47 +9,56 @@ export = __ONOFF; declare namespace __ONOFF { - - var version:string; - + var version: string; + interface GpioOptions { - debounceTimeout?:number; - activeLow?:boolean; + debounceTimeout?: number; + activeLow?: boolean; } - + + type Direction = 'in' | 'out' | 'high' | 'low'; + type Edge = 'none' | 'falling' | 'rising' | 'both'; + class Gpio { - constructor(gpio:number, direction:string); - constructor(gpio:number, direction:string, edge:string); - constructor(gpio:number, direction:string, edge:string, options:GpioOptions); - constructor(gpio:number, direction:string, options:GpioOptions); + constructor(gpio: number, direction: Direction, options?: GpioOptions); + constructor( + gpio: number, + direction: Direction, + edge?: Edge, + options?: GpioOptions + ); + + static accessible: boolean; - gpio:number - gpioPath:string; - opts:GpioOptions; - readBuffer:Buffer; - listeners:Array<(error:Error, value:number) => void>; - valueFd:number; - - read(cb:(err:Error, value:number) => void):void; - readSync():number; - - write(value:number, cb:(err:Error, value:number) => void):void; - writeSync(value:number):void; - - watch(cb:(error:Error, value:number) => void):void; - unwatch():void; - unwatch(cb:(error:Error, value:number) => void):void; - unwatchAll():void; - - direction():string; - setDirection(value:string):void; - - edge():string; - setEdge(value:string):void; - - options():GpioOptions; - - unexport():void; + gpio: number; + gpioPath: string; + opts: GpioOptions; + readBuffer: Buffer; + listeners: Array<(err: Error, value: number) => void>; + _valueFd: number; + + read(cb: (err: Error, value: number) => void): void; + readSync(): number; + + write(value: number, cb: (err: Error, value: number) => void): void; + writeSync(value: number): void; + + watch(cb: (err: Error, value: number) => void): void; + unwatch(): void; + unwatch(cb: (err: Error, value: number) => void): void; + unwatchAll(): void; + + direction(): Direction; + setDirection(value: Direction): void; + + edge(): Edge; + setEdge(value: Edge): void; + + activeLow(): boolean; + setActiveLow(invert?: boolean): void; + + options(): GpioOptions; + + unexport(): void; } - } diff --git a/types/onoff/onoff-tests.ts b/types/onoff/onoff-tests.ts index 21b47e7f99..776b577348 100644 --- a/types/onoff/onoff-tests.ts +++ b/types/onoff/onoff-tests.ts @@ -14,3 +14,5 @@ setTimeout(function() { led.writeSync(0); led.unexport(); }, 2000); + +var accessible:boolean = onoff.Gpio.accessible; diff --git a/types/openfin/_v2/api/application/application.d.ts b/types/openfin/_v2/api/application/application.d.ts index 616501834d..37263a9a63 100644 --- a/types/openfin/_v2/api/application/application.d.ts +++ b/types/openfin/_v2/api/application/application.d.ts @@ -1,10 +1,12 @@ -import { EmitterBase, Base, Reply, RuntimeEvent } from '../base'; +import { EmitterBase, Base, Reply } from '../base'; import { Identity } from '../../identity'; import { _Window } from '../window/window'; import { Point } from '../system/point'; import { MonitorInfo } from '../system/monitor'; import Transport from '../../transport/transport'; import Bounds from '../window/bounds'; +import { ApplicationEvents } from '../events/application'; +import { ApplicationOption } from './applicationOption'; export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> { button: number; monitorInfo: MonitorInfo; @@ -21,7 +23,7 @@ export declare class NavigationRejectedReply extends Reply<'window-navigation-re sourceName: string; url: string; } -export interface ConfigInterface { +export interface ShortCutConfig { desktop?: boolean; startMenu?: boolean; systemStartup?: boolean; @@ -32,32 +34,54 @@ export interface TrayInfo { x: number; y: number; } +/** + * @lends Application + */ export default class ApplicationModule extends Base { /** - * Returns an Application object that represents an existing application. - * @param { Identity } indentity + * Asynchronously returns an Application object that represents an existing application. + * @param { Identity } identity * @return {Promise.} * @tutorial Application.wrap + * @static */ wrap(identity: Identity): Promise; + /** + * Synchronously returns an Application object that represents an existing application. + * @param { Identity } identity + * @return {Application} + * @tutorial Application.wrapSync + * @static + */ + wrapSync(identity: Identity): Application; /** * Creates a new Application. - * @param {*} appOptions + * @param { ApplicationOption } appOptions * @return {Promise.} * @tutorial Application.create + * @static */ - create(appOptions: any): Promise; + create(appOptions: ApplicationOption): Promise; /** - * Returns an Application object that represents the current application + * Asynchronously returns an Application object that represents the current application * @return {Promise.} * @tutorial Application.getCurrent + * @static */ getCurrent(): Promise; + /** + * Synchronously returns an Application object that represents the current application + * @return {Application} + * @tutorial Application.getCurrentSync + * @static + */ + getCurrentSync(): Application; /** * Retrieves application's manifest and returns a wrapped application. * @param {string} manifestUrl - The URL of app's manifest. * @return {Promise.} * @tutorial Application.createFromManifest + * @static */ createFromManifest(manifestUrl: string): Promise; } @@ -66,12 +90,11 @@ export default class ApplicationModule extends Base { * execute, show/close an application as well as listen to application events. * @class */ -export declare class Application extends EmitterBase { +export declare class Application extends EmitterBase { identity: Identity; _manifestUrl?: string; private window; constructor(wire: Transport, identity: Identity); - protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; private windowListFromIdentityList; /** * Determines if the application is currently running. @@ -116,10 +139,16 @@ export declare class Application extends EmitterBase { getParentUuid(): Promise; /** * Retrieves current application's shortcut configuration. - * @return {Promise.} + * @return {Promise.} * @tutorial Application.getShortcuts */ - getShortcuts(): Promise; + getShortcuts(): Promise; + /** + * Returns the current zoom level of the application. + * @return {Promise.} + * @tutorial Application.getZoomLevel + */ + getZoomLevel(): Promise; /** * Returns an instance of the main Window of the application * @return {Promise.<_Window>} @@ -174,7 +203,15 @@ export declare class Application extends EmitterBase { * @return {Promise.} * @tutorial Application.setShortcuts */ - setShortcuts(config: ConfigInterface): Promise; + setShortcuts(config: ShortCutConfig): Promise; + /** + * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20% + * larger or smaller to default limits of 300% and 50% of original size, respectively. + * @param { number } level The zoom level + * @return {Promise.} + * @tutorial Application.setZoomLevel + */ + setZoomLevel(level: number): Promise; /** * @summary Retrieves information about the system tray. * @desc The only information currently returned is the position and dimensions. @@ -203,21 +240,3 @@ export declare class Application extends EmitterBase { */ getInfo(): Promise; } -export interface Application { - on(type: 'closed', listener: (data: Reply<'application', 'closed'>) => void): Promise; - on(type: 'initialized', listener: (data: Reply<'application', 'initialized'>) => void): Promise; - on(type: 'connected', listener: (data: Reply<'application', 'connected'>) => void): Promise; - on(type: 'crashed', listener: (data: Reply<'application', 'crashed'>) => void): Promise; - on(type: 'error', listener: (data: Reply<'application', 'error'>) => void): Promise; - on(type: 'not-responding', listener: (data: Reply<'application', 'not-responding'>) => void): Promise; - on(type: 'out-of-memory', listener: (data: Reply<'application', 'out-of-memory'>) => void): Promise; - on(type: 'responding', listener: (data: Reply<'application', 'responding'>) => void): Promise; - on(type: 'started', listener: (data: Reply<'application', 'started'>) => void): Promise; - on(type: 'run-requested', listener: (data: Reply<'application', 'run-requested'>) => void): Promise; - on(type: 'window-navigation-rejected', listener: (data: NavigationRejectedReply) => void): Promise; - on(type: 'window-created', listener: (data: Reply<'application', 'window-created'>) => void): Promise; - on(type: 'window-closed', listener: (data: Reply<'application', 'window-closed'>) => void): Promise; - on(type: 'tray-icon-clicked', listener: (data: TrayIconClickReply) => void): Promise; - on(type: 'removeListener', listener: (eventType: string) => void): Promise; - on(type: 'newListener', listener: (eventType: string) => void): Promise; -} diff --git a/types/openfin/_v2/api/application/applicationOption.d.ts b/types/openfin/_v2/api/application/applicationOption.d.ts new file mode 100644 index 0000000000..134e4482d6 --- /dev/null +++ b/types/openfin/_v2/api/application/applicationOption.d.ts @@ -0,0 +1,50 @@ +import { WindowOption, CustomRequestHeaders } from '../window/windowOption'; +import { DownloadPreloadOption } from '../system/download-preload'; +export interface ApplicationOption { + disableIabSecureLogging?: boolean; + loadErrorMessage?: string; + mainWindowOptions?: WindowOption; + name?: string; + nonPersistent?: boolean; + plugins?: boolean; + spellCheck?: boolean; + url?: string; + uuid: string; + webSecurity?: boolean; + accelerator?: object; + alwaysOnTop?: boolean; + api?: object; + aspectRatio?: number; + autoShow?: boolean; + backgroundColor?: string; + contentNavigation?: object; + contextMenu?: boolean; + cornerRounding?: object; + customData?: string; + customRequestHeaders?: Array; + defaultCentered?: boolean; + defaultHeight?: number; + defaultLeft?: number; + defaultTop?: number; + defaultWidth?: number; + frame?: boolean; + hideOnClose?: boolean; + icon?: string; + maxHeight?: number; + maximizable?: boolean; + maxWidth?: number; + minHeight?: number; + minimizable?: boolean; + minWidth?: number; + opacity?: number; + preloadScripts?: Array; + resizable?: boolean; + resizeRegion?: object; + saveWindowState?: boolean; + shadow?: boolean; + showTaskbarIcon?: boolean; + smallWindow?: boolean; + state?: string; + taskbarIconGroup?: string; + waitForPageLoad?: boolean; +} diff --git a/types/openfin/_v2/api/base.d.ts b/types/openfin/_v2/api/base.d.ts index 1f17e1f24f..5cbb8658a7 100644 --- a/types/openfin/_v2/api/base.d.ts +++ b/types/openfin/_v2/api/base.d.ts @@ -1,10 +1,11 @@ /// -import Transport, { Message } from '../transport/transport'; +import Transport from '../transport/transport'; import { Identity } from '../identity'; import { EventEmitter } from 'events'; -export interface RuntimeEvent extends Identity { - topic: string; - type: string | symbol; +import { EmitterAccessor } from './events/emitterMap'; +import { BaseEventMap } from './events/base'; +interface SubOptions { + timestamp?: number; } export declare class Base { wire: Transport; @@ -14,26 +15,27 @@ export declare class Base { readonly me: Identity; protected isNodeEnvironment: () => boolean; protected isOpenFinEnvironment: () => boolean; - protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; } -export declare class EmitterBase extends Base { +export declare class EmitterBase extends Base { + private emitterAccessor; protected identity: Identity; - protected emitter: EventEmitter; - listeners: (event: string | symbol) => Function[]; + constructor(wire: Transport, emitterAccessor: EmitterAccessor); + eventNames: () => (string | symbol)[]; + emit: >(eventName: E, payload: E extends Extract ? EventTypes[E] : any, ...args: any[]) => boolean; + private hasEmitter; + private getEmitter; + listeners: (type: string | symbol) => Function[]; listenerCount: (type: string | symbol) => number; - constructor(wire: Transport); - emit: (eventName: string | symbol, ...args: any[]) => void; - protected onmessage: (message: Message) => boolean; - protected registerEventListener: (listener: RuntimeEvent) => Promise>; - protected deregisterEventListener: (listener: RuntimeEvent) => Promise>; - on(eventType: string, listener: (...args: any[]) => void): Promise; - addListener: (eventType: string, listener: (...args: any[]) => void) => Promise; - once(eventType: string, listener: (...args: any[]) => void): Promise; - prependListener(eventType: string, listener: (...args: any[]) => void): Promise; - prependOnceListener(eventType: string, listener: (...args: any[]) => void): Promise; - removeListener(eventType: string, listener: (...args: any[]) => void): Promise; - protected deregisterAllListeners: (eventType: string | symbol) => Promise>; - removeAllListeners(eventType?: string): Promise; + protected registerEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise; + protected deregisterEventListener: (eventType: string | symbol | Extract, options?: SubOptions) => Promise; + on | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + addListener: >(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions) => Promise; + once | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + prependListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + prependOnceListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + removeListener | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: SubOptions): Promise; + protected deregisterAllListeners: (eventType: string | symbol | Extract) => Promise; + removeAllListeners(eventType?: Extract | string | symbol): Promise; } export declare class Reply implements Identity { topic: TOPIC; @@ -41,3 +43,4 @@ export declare class Reply imp uuid: string; name?: string; } +export {}; diff --git a/types/openfin/_v2/api/events/application.d.ts b/types/openfin/_v2/api/events/application.d.ts new file mode 100644 index 0000000000..444d358cbd --- /dev/null +++ b/types/openfin/_v2/api/events/application.d.ts @@ -0,0 +1,56 @@ +import { WindowEvent, BaseEventMap, ApplicationEvent } from './base'; +import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents } from './window'; +export interface CrashedEvent { + reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory'; +} +export interface RunRequestedEvent extends ApplicationEvent { + userAppConfigArgs: any; +} +export interface TrayIconClicked extends ApplicationEvent { + button: 0 | 1 | 2; + x: number; + y: number; + monitorInfo: any; +} +export interface ApplicationEventMapping extends BaseEventMap { + 'closed': ApplicationEvent; + 'connected': ApplicationEvent; + 'crashed': CrashedEvent & ApplicationEvent; + 'initialized': ApplicationEvent; + 'manifest-changed': ApplicationEvent; + 'not-responding': ApplicationEvent; + 'responding': ApplicationEvent; + 'run-requested': RunRequestedEvent; + 'started': ApplicationEvent; + 'tray-icon-clicked': TrayIconClicked; + 'window-alert-requested': WindowAlertRequestedEvent; + 'window-auth-requested': WindowAuthRequestedEvent; + 'window-created': WindowEvent; + 'window-end-load': WindowEndLoadEvent; + 'window-not-responding': WindowEvent; + 'window-responding': WindowEvent; + 'window-show-requested': WindowEvent; + 'window-start-load': WindowEvent; +} +export interface PropagatedApplicationEventMapping { + 'application-closed': ApplicationEvent; + 'application-connected': ApplicationEvent; + 'application-crashed': CrashedEvent & ApplicationEvent; + 'application-initialized': ApplicationEvent; + 'application-manifest-changed': ApplicationEvent; + 'application-not-responding': ApplicationEvent; + 'application-responding': ApplicationEvent; + 'application-started': ApplicationEvent; + 'application-tray-icon-clicked': TrayIconClicked; + 'window-created': WindowEvent; + 'window-end-load': WindowEndLoadEvent; + 'window-not-responding': WindowEvent; + 'window-responding': WindowEvent; + 'window-start-load': WindowEvent; +} +export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & { + [Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type]; +}; +export declare type PropagatedApplicationEvents = { + [Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping[Type]; +}; diff --git a/types/openfin/_v2/api/events/base.d.ts b/types/openfin/_v2/api/events/base.d.ts new file mode 100644 index 0000000000..700f82679b --- /dev/null +++ b/types/openfin/_v2/api/events/base.d.ts @@ -0,0 +1,18 @@ +import { FrameEvent } from './frame'; +export declare type RuntimeEvent = Topic extends 'window' ? WindowEvent : Topic extends 'frame' ? FrameEvent : Topic extends 'application' ? ApplicationEvent : BaseEvent; +export interface BaseEvent { + topic: Topic; + type: Type; +} +export interface ApplicationEvent extends BaseEvent { + uuid: string; +} +export interface WindowEvent extends ApplicationEvent { + name: string; +} +export declare function getTopic(e: RuntimeEvent): string; +export interface BaseEventMap { + [name: string]: any; + 'newListener': string; + 'listenerRemoved': string; +} diff --git a/types/openfin/_v2/api/events/channel.d.ts b/types/openfin/_v2/api/events/channel.d.ts new file mode 100644 index 0000000000..3c448071cb --- /dev/null +++ b/types/openfin/_v2/api/events/channel.d.ts @@ -0,0 +1,10 @@ +import { BaseEventMap, ApplicationEvent } from './base'; +export interface ChannelEvent extends ApplicationEvent<'channel', Type> { + channelName: string; + channelId: string; + name?: string; +} +export interface ChannelEvents extends BaseEventMap { + 'connected': ChannelEvent<'connected'>; + 'disconnected': ChannelEvent<'disconnected'>; +} diff --git a/types/openfin/_v2/api/events/emitterMap.d.ts b/types/openfin/_v2/api/events/emitterMap.d.ts new file mode 100644 index 0000000000..aa3fb498e8 --- /dev/null +++ b/types/openfin/_v2/api/events/emitterMap.d.ts @@ -0,0 +1,15 @@ +/// +import { EventEmitter } from 'events'; +export declare class EmitterMap { + private storage; + constructor(); + private hashKeys; + get(keys: EmitterAccessor): EventEmitter; + has(keys: EmitterAccessor): boolean; + delete(keys: EmitterAccessor): boolean; +} +export declare type SystemEmitterAccessor = ['system']; +export declare type ApplicationEmitterAccessor = ['application', string]; +export declare type WindowEmitterAccessor = ['window', string, string]; +export declare type HotkeyEmitterAccessor = ['global-hotkey']; +export declare type EmitterAccessor = SystemEmitterAccessor | ApplicationEmitterAccessor | WindowEmitterAccessor | HotkeyEmitterAccessor | string[]; diff --git a/types/openfin/_v2/api/events/eventAggregator.d.ts b/types/openfin/_v2/api/events/eventAggregator.d.ts new file mode 100644 index 0000000000..ac7b7ca1b2 --- /dev/null +++ b/types/openfin/_v2/api/events/eventAggregator.d.ts @@ -0,0 +1,5 @@ +import { Message } from '../../transport/transport'; +import { EmitterMap } from './emitterMap'; +export declare class EventAggregator extends EmitterMap { + dispatchEvent: (message: Message) => boolean; +} diff --git a/types/openfin/_v2/api/events/externalApplication.d.ts b/types/openfin/_v2/api/events/externalApplication.d.ts new file mode 100644 index 0000000000..f7cd85f45d --- /dev/null +++ b/types/openfin/_v2/api/events/externalApplication.d.ts @@ -0,0 +1,5 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +export interface ExternalApplicationEvents extends BaseEventMap { + connected: RuntimeEvent<'externalapplication', 'connected'>; + disconnected: RuntimeEvent<'externalapplication', 'disconnected'>; +} diff --git a/types/openfin/_v2/api/events/frame.d.ts b/types/openfin/_v2/api/events/frame.d.ts new file mode 100644 index 0000000000..c31933e557 --- /dev/null +++ b/types/openfin/_v2/api/events/frame.d.ts @@ -0,0 +1,9 @@ +import { BaseEventMap, WindowEvent } from './base'; +export interface FrameEvent extends WindowEvent<'frame', Type> { + entityType: 'iframe'; + frameName: string; +} +export interface FrameEvents extends BaseEventMap { + connected: FrameEvent<'connected'>; + disconnected: FrameEvent<'disconnected'>; +} diff --git a/types/openfin/_v2/api/events/globalHotkey.d.ts b/types/openfin/_v2/api/events/globalHotkey.d.ts new file mode 100644 index 0000000000..561baba446 --- /dev/null +++ b/types/openfin/_v2/api/events/globalHotkey.d.ts @@ -0,0 +1,11 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +import { Identity } from '../../identity'; +import { nonHotkeyEvents } from '../global-hotkey'; +export interface GlobalHotkeyEvent extends RuntimeEvent<'global-hotkey', Type> { + identity: Identity; + hotkey: string; +} +export interface GlobalHotkeyEvents extends BaseEventMap { + [nonHotkeyEvents.REGISTERED]: GlobalHotkeyEvent; + [nonHotkeyEvents.UNREGISTERED]: GlobalHotkeyEvent; +} diff --git a/types/openfin/_v2/api/events/notifications.d.ts b/types/openfin/_v2/api/events/notifications.d.ts new file mode 100644 index 0000000000..a269817222 --- /dev/null +++ b/types/openfin/_v2/api/events/notifications.d.ts @@ -0,0 +1,8 @@ +import { RuntimeEvent, BaseEventMap } from './base'; +export interface NotificationEvents extends BaseEventMap { + show: RuntimeEvent<'notification', 'show'>; + close: RuntimeEvent<'notification', 'close'>; + error: RuntimeEvent<'notification', 'error'>; + click: RuntimeEvent<'notification', 'click'>; + message: RuntimeEvent<'notification', 'message'>; +} diff --git a/types/openfin/_v2/api/events/system.d.ts b/types/openfin/_v2/api/events/system.d.ts new file mode 100644 index 0000000000..20285a8862 --- /dev/null +++ b/types/openfin/_v2/api/events/system.d.ts @@ -0,0 +1,22 @@ +import { BaseEvent, ApplicationEvent, BaseEventMap } from './base'; +import { MonitorInfo } from '../system/monitor'; +import { PropagatedWindowEvents } from './window'; +import { PropagatedApplicationEvents } from './application'; +export interface IdleEvent extends BaseEvent { + elapsedTime: number; + isIdle: boolean; +} +export declare type MonitorEvent = MonitorInfo & BaseEvent; +export interface SessionChangedEvent extends BaseEvent { + reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown'; +} +export interface SystemEventMapping extends BaseEventMap { + 'application-created': ApplicationEvent; + 'desktop-icon-clicked': ApplicationEvent; + 'idle-state-changed': IdleEvent; + 'monitor-info-changed': MonitorEvent; + 'session-changed': SessionChangedEvent; +} +export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & { + [Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type]; +}; diff --git a/types/openfin/_v2/api/events/window.d.ts b/types/openfin/_v2/api/events/window.d.ts new file mode 100644 index 0000000000..85d4d553f0 --- /dev/null +++ b/types/openfin/_v2/api/events/window.d.ts @@ -0,0 +1,176 @@ +import { CrashedEvent } from './application'; +import { WindowEvent, BaseEventMap } from './base'; +export declare type SpecificWindowEvent = WindowEvent<'window', Type>; +export interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; +} +export interface WindowAuthRequestedEvent extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; +} +export interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; +} +export interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; +} +export interface WindowReloadedEvent extends WindowEvent { + url: string; +} +export interface WindowExternalProcessExitedEvent extends WindowEvent { + processUuid: string; + exitCode: number; +} +export interface WindowExternalProcessStartedEvent extends WindowEvent { + processUuid: string; +} +export interface WindowHiddenEvent extends WindowEvent { + reason: 'closing' | 'hide' | 'hide-on-close'; +} +export interface PreloadScriptInfoRunning { + state: 'load-started' | // started loading preload script + 'load-failed' | // preload script failed to load + 'load-succeeded' | // preload script is loaded and ready to be eval'ed + 'failed' | // preload script failed to eval + 'succeeded'; +} +export interface PreloadScriptInfo { + state: 'load-failed' | // preload script failed to load + 'failed' | // preload script failed to eval + 'succeeded'; +} +export interface WindowPreloadScriptsStateChangeEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfoRunning & any)[]; +} +export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfoRunning & any)[]; +} +export interface WindowPreloadScriptsStateChangedEvent extends WindowEvent { + preloadScripts: (PreloadScriptInfo & any)[]; +} +export interface WindowResourceLoadFailedEvent extends WindowEvent { + errorCode: number; + errorDescription: string; + validatedURL: string; + isMainFrame: boolean; +} +export interface WindowResourceResponseReceivedEvent extends WindowEvent { + status: boolean; + newUrl: string; + originalUrl: string; + httpResponseCode: number; + requestMethod: string; + referrer: string; + headers: any; + resourceType: 'mainFrame' | 'subFrame' | 'styleSheet' | 'script' | 'image' | 'object' | 'xhr' | 'other'; +} +export interface WindowBeginBoundsChangingEvent extends WindowEvent { + height: number; + left: number; + top: number; + width: number; + windowState: 'minimized' | 'normal' | 'maximized'; +} +export interface WindowBoundsChange extends WindowEvent { + changeType: 0 | 1 | 2; + deferred: boolean; + height: number; + left: number; + top: number; + width: number; +} +export interface WindowGroupChanged extends WindowEvent { + memberOf: 'source' | 'target' | 'nothing'; + reason: 'leave' | 'join' | 'merge' | 'disband'; + sourceGroup: { + appUuid: string; + windowName: string; + }[]; + sourceWindowAppUuid: string; + sourceWindowName: string; + targetGroup: { + appUuid: string; + windowName: string; + }[]; + targetWindowAppUuid: string; + targetWindowName: string; +} +export interface WindowEventMapping extends BaseEventMap { + 'auth-requested': WindowAuthRequestedEvent; + 'begin-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'blurred': WindowEvent; + 'bounds-changed': WindowBoundsChange; + 'bounds-changing': WindowBoundsChange; + 'close-requested': WindowEvent; + 'closed': WindowEvent; + 'closing': WindowEvent; + 'crashed': CrashedEvent & WindowEvent; + 'disabled-frame-bounds-changed': WindowBoundsChange; + 'disabled-frame-bounds-changing': WindowBoundsChange; + 'embedded': WindowEvent; + 'end-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'external-process-exited': WindowExternalProcessExitedEvent; + 'external-process-started': WindowExternalProcessStartedEvent; + 'focused': WindowEvent; + 'frame-disabled': WindowEvent; + 'frame-enabled': WindowEvent; + 'group-changed': WindowGroupChanged; + 'hidden': WindowHiddenEvent; + 'initialized': WindowEvent; + 'maximized': WindowEvent; + 'minimized': WindowEvent; + 'navigation-rejected': WindowNavigationRejectedEvent; + 'preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; + 'preload-scripts-state-changing': WindowPreloadScriptsStateChangeEvent; + 'resource-load-failed': WindowResourceLoadFailedEvent; + 'resource-response-received': WindowResourceResponseReceivedEvent; + 'reloaded': WindowReloadedEvent; + 'restored': WindowEvent; + 'show-requested': WindowEvent; + 'shown': WindowEvent; +} +export interface PropagatedWindowEventMapping extends BaseEventMap { + 'window-begin-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'window-blurred': WindowEvent; + 'window-bounds-changed': WindowBoundsChange; + 'window-bounds-changing': WindowBoundsChange; + 'window-closed': WindowEvent; + 'window-closing': WindowEvent; + 'window-crashed': CrashedEvent & WindowEvent; + 'window-disabled-frame-bounds-changed': WindowBoundsChange; + 'window-disabled-frame-bounds-changing': WindowBoundsChange; + 'window-embedded': WindowEvent; + 'window-end-user-bounds-changing': WindowBeginBoundsChangingEvent; + 'window-external-process-exited': WindowExternalProcessExitedEvent; + 'window-external-process-started': WindowExternalProcessStartedEvent; + 'window-focused': WindowEvent; + 'window-frame-disabled': WindowEvent; + 'window-frame-enabled': WindowEvent; + 'window-group-changed': WindowGroupChanged; + 'window-hidden': WindowHiddenEvent; + 'window-initialized': WindowEvent; + 'window-maximized': WindowEvent; + 'window-minimized': WindowEvent; + 'window-navigation-rejected': WindowNavigationRejectedEvent; + 'window-preload-scripts-state-changed': WindowPreloadScriptsStateChangeEvent; + 'window-preload-scripts-state-changing': WindowPreloadScriptsStateChangedEvent; + 'window-resource-load-failed': WindowResourceLoadFailedEvent; + 'window-resource-response-received': WindowResourceResponseReceivedEvent; + 'window-reloaded': WindowReloadedEvent; + 'window-restored': WindowEvent; + 'window-shown': WindowEvent; +} +export declare type WindowEvents = { + [Type in keyof WindowEventMapping]: WindowEventMapping<'window', Type>[Type]; +}; +export declare type PropagatedWindowEvents = { + [Type in keyof PropagatedWindowEventMapping]: PropagatedWindowEventMapping[Type]; +}; diff --git a/types/openfin/_v2/api/external-application/external-application.d.ts b/types/openfin/_v2/api/external-application/external-application.d.ts index 2d1f46e0f3..a4f44851e9 100644 --- a/types/openfin/_v2/api/external-application/external-application.d.ts +++ b/types/openfin/_v2/api/external-application/external-application.d.ts @@ -1,16 +1,30 @@ -import { Base, EmitterBase, Reply } from '../base'; +import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Transport from '../../transport/transport'; +import { ExternalApplicationEvents } from '../events/externalApplication'; export interface ExternalApplicationInfo { parent: Identity; } +/** + * @lends ExternalApplication + */ export default class ExternalApplicationModule extends Base { /** - * Returns an External Application object that represents an existing external application. + * Asynchronously returns an External Application object that represents an existing external application. * @param {string} uuid The UUID of the external application to be wrapped * @return {Promise.} + * @tutorial ExternalApplication.wrap + * @static */ wrap(uuid: string): Promise; + /** + * Synchronously returns an External Application object that represents an existing external application. + * @param {string} uuid The UUID of the external application to be wrapped + * @return {ExternalApplication} + * @tutorial ExternalApplication.wrapSync + * @static + */ + wrapSync(uuid: string): ExternalApplication; } /** * @classdesc An ExternalApplication object representing an application. Allows @@ -18,7 +32,7 @@ export default class ExternalApplicationModule extends Base { * well as listen to application events. * @class */ -export declare class ExternalApplication extends EmitterBase { +export declare class ExternalApplication extends EmitterBase { identity: Identity; constructor(wire: Transport, identity: Identity); /** @@ -28,9 +42,3 @@ export declare class ExternalApplication extends EmitterBase { */ getInfo(): Promise; } -export interface ExternalApplication { - on(type: 'connected', listener: (data: Reply<'externalapplication', 'connected'>) => void): Promise; - on(type: 'disconnected', listener: (data: Reply<'externalapplication', 'disconnected'>) => void): Promise; - on(type: 'removeListener', listener: (eventType: string) => void): Promise; - on(type: 'newListener', listener: (eventType: string) => void): Promise; -} diff --git a/types/openfin/_v2/api/frame/frame.d.ts b/types/openfin/_v2/api/frame/frame.d.ts index 4a5ab971de..8795ae190b 100644 --- a/types/openfin/_v2/api/frame/frame.d.ts +++ b/types/openfin/_v2/api/frame/frame.d.ts @@ -1,6 +1,7 @@ import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Transport from '../../transport/transport'; +import { FrameEvents } from '../events/frame'; export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown'; export interface FrameInfo { uuid: string; @@ -8,19 +9,40 @@ export interface FrameInfo { entityType: EntityType; parent: Identity; } +/** + * @lends Frame + */ export default class _FrameModule extends Base { /** - * Gets a reference to the specified frame. The frame does not have to exist - * @param {string} uuid - uuid of the frame you want to wrap - * @param {string} name - name of the frame you want to wrap + * Asynchronously returns a reference to the specified frame. The frame does not have to exist + * @param {Identity} identity - the identity of the frame you want to wrap * @return {Promise.<_Frame>} + * @tutorial Frame.wrap + * @static */ - wrap(uuid: string, name: string): Promise<_Frame>; + wrap(identity: Identity): Promise<_Frame>; /** - * Get a reference to the current frame + * Synchronously returns a reference to the specified frame. The frame does not have to exist + * @param {Identity} identity - the identity of the frame you want to wrap + * @return {_Frame} + * @tutorial Frame.wrapSync + * @static + */ + wrapSync(identity: Identity): _Frame; + /** + * Asynchronously returns a reference to the current frame * @return {Promise.<_Frame>} + * @tutorial Frame.getCurrent + * @static */ getCurrent(): Promise<_Frame>; + /** + * Synchronously returns a reference to the current frame + * @return {_Frame} + * @tutorial Frame.getCurrentSync + * @static + */ + getCurrentSync(): _Frame; } /** * @classdesc Represents a way to interact with `iframes`. Facilitates discovery of current context @@ -28,7 +50,7 @@ export default class _FrameModule extends Base { * @class * @alias Frame */ -export declare class _Frame extends EmitterBase { +export declare class _Frame extends EmitterBase { identity: Identity; constructor(wire: Transport, identity: Identity); /** @@ -45,7 +67,3 @@ export declare class _Frame extends EmitterBase { */ getParentWindow(): Promise; } -export interface _Frame { - on(type: 'connected', listener: (eventType: string) => void): Promise; - on(type: 'disconnected', listener: (eventType: string) => void): Promise; -} diff --git a/types/openfin/_v2/api/global-hotkey/index.d.ts b/types/openfin/_v2/api/global-hotkey/index.d.ts index 148ddff7e9..7aa08d6f20 100644 --- a/types/openfin/_v2/api/global-hotkey/index.d.ts +++ b/types/openfin/_v2/api/global-hotkey/index.d.ts @@ -1,10 +1,15 @@ import { EmitterBase } from '../base'; import Transport from '../../transport/transport'; +import { GlobalHotkeyEvents } from '../events/globalHotkey'; +export declare const enum nonHotkeyEvents { + REGISTERED = "registered", + UNREGISTERED = "unregistered" +} /** * The GlobalHotkey module can register/unregister a global hotkeys. * @namespace */ -export default class GlobalHotkey extends EmitterBase { +export default class GlobalHotkey extends EmitterBase { constructor(wire: Transport); /** * Registers a global hotkey with the operating system. diff --git a/types/openfin/_v2/api/interappbus/channel/index.d.ts b/types/openfin/_v2/api/interappbus/channel/index.d.ts index 1297d2c5ea..2b2d963932 100644 --- a/types/openfin/_v2/api/interappbus/channel/index.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/index.d.ts @@ -4,30 +4,29 @@ import { ChannelProvider } from './provider'; import { EmitterBase } from '../../base'; import Transport, { Message, Payload } from '../../../transport/transport'; import { ProviderIdentity } from './channel'; -export interface Options { +import { ChannelEvents } from '../../events/channel'; +export interface ConnectOptions { wait?: boolean; - uuid: string; - name?: string; payload?: any; } export interface ChannelPayload { payload: Payload; } -export interface ChannelMessage { +export interface ChannelMessage extends Message { senderIdentity: Identity; ackToSender: any; - providerIdentity: Identity; + providerIdentity: ProviderIdentity; connectAction: boolean; } -export declare class Channel extends EmitterBase { +export declare class Channel extends EmitterBase { private channelMap; constructor(wire: Transport); getAllChannels(): Promise; - onChannelConnect(listener: Function): Promise; - onChannelDisconnect(listener: Function): Promise; - connect(options: Options): Promise; - create(channelName?: string): Promise; - onmessage: (msg: Message) => boolean; + onChannelConnect(listener: (...args: any[]) => void): Promise; + onChannelDisconnect(listener: (...args: any[]) => void): Promise; + connect(channelName: string, options?: ConnectOptions): Promise; + create(channelName: string): Promise; + onmessage: (msg: ChannelMessage) => boolean; private processChannelMessage; private processChannelConnection; } diff --git a/types/openfin/_v2/api/interappbus/channel/provider.d.ts b/types/openfin/_v2/api/interappbus/channel/provider.d.ts index a869928ac2..4b978c2781 100644 --- a/types/openfin/_v2/api/interappbus/channel/provider.d.ts +++ b/types/openfin/_v2/api/interappbus/channel/provider.d.ts @@ -1,13 +1,15 @@ import { ChannelBase, ProviderIdentity } from './channel'; import Transport from '../../../transport/transport'; -export declare type ConnectionListener = (adapterIdentity: ProviderIdentity, connectionMessage?: any) => any; +import { Identity } from '../../../main'; +export declare type ConnectionListener = (identity: Identity, connectionMessage?: any) => any; export declare class ChannelProvider extends ChannelBase { private connectListener; private disconnectListener; - connections: ProviderIdentity[]; + connections: Identity[]; constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); - dispatch(to: ProviderIdentity, action: string, payload: any): Promise; - processConnection(senderId: ProviderIdentity, payload: any): Promise; + dispatch(to: Identity, action: string, payload: any): Promise; + processConnection(senderId: Identity, payload: any): Promise; publish(action: string, payload: any): Promise[]; onConnection(listener: ConnectionListener): void; + onDisconnection(listener: ConnectionListener): void; } diff --git a/types/openfin/_v2/api/notification/notification.d.ts b/types/openfin/_v2/api/notification/notification.d.ts index 8deec180ba..9a6bee7076 100644 --- a/types/openfin/_v2/api/notification/notification.d.ts +++ b/types/openfin/_v2/api/notification/notification.d.ts @@ -1,6 +1,7 @@ import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Transport from '../../transport/transport'; +import { NotificationEvents } from '../events/notifications'; export declare class NotificationOptions { url: string; message: string; @@ -22,14 +23,12 @@ export interface NotificationCallback { * @class * @alias Notification */ -export declare class _Notification extends EmitterBase { +export declare class _Notification extends EmitterBase { private listenerList; private unhookAllListeners; - private buildLocalPayload; protected options: NotificationOptions; protected generalListener: (msg: any) => void; protected notificationId: number; - protected onmessage: (message: any) => boolean; constructor(wire: Transport, options: NotificationOptions); url: string; timeout: number | string; diff --git a/types/openfin/_v2/api/system/application.d.ts b/types/openfin/_v2/api/system/application.d.ts index 9d7ea09b67..0e14602942 100644 --- a/types/openfin/_v2/api/system/application.d.ts +++ b/types/openfin/_v2/api/system/application.d.ts @@ -1,4 +1,5 @@ export interface ApplicationInfo { isRunning: boolean; uuid: string; + parentUuid?: string; } diff --git a/types/openfin/_v2/api/system/external-process.d.ts b/types/openfin/_v2/api/system/external-process.d.ts index 8a68f1eae3..624c93ea18 100644 --- a/types/openfin/_v2/api/system/external-process.d.ts +++ b/types/openfin/_v2/api/system/external-process.d.ts @@ -1,7 +1,17 @@ export interface ExternalProcessRequestType { - path: string; - arguments: string; - listener: LaunchExternalProcessListener; + path?: string; + alias?: string; + arguments?: string; + listener?: LaunchExternalProcessListener; + lifetime?: string; + certificate?: CertificationInfo; +} +export interface CertificationInfo { + serial?: string; + subject?: string; + publickey?: string; + thumbprint?: string; + trusted?: boolean; } export interface ExitCode { topic: string; @@ -20,3 +30,7 @@ export interface ExternalConnection { token: string; uuid: string; } +export interface ExternalProcessInfo { + pid: number; + listener?: LaunchExternalProcessListener; +} diff --git a/types/openfin/_v2/api/system/host-specs.d.ts b/types/openfin/_v2/api/system/host-specs.d.ts index 2c5a134aea..dfd3e665fd 100644 --- a/types/openfin/_v2/api/system/host-specs.d.ts +++ b/types/openfin/_v2/api/system/host-specs.d.ts @@ -14,9 +14,11 @@ export interface GpuInfo { name: string; } export interface HostSpecs { - cpu: CpuInfo[]; - memory: number; + aeroGlassEnabled?: boolean; arch: string; - name: string; + cpus: CpuInfo[]; gpu: GpuInfo; + memory: number; + name: string; + screenSaver?: boolean; } diff --git a/types/openfin/_v2/api/system/process.d.ts b/types/openfin/_v2/api/system/process.d.ts index 8a513ceecd..98901db137 100644 --- a/types/openfin/_v2/api/system/process.d.ts +++ b/types/openfin/_v2/api/system/process.d.ts @@ -1,15 +1,15 @@ export interface ProcessInfo { - cpuUsage: number; - name: string; - nonPagedPoolUsage: number; - pageFaultCount: number; - pagedPoolUsage: number; - pagefileUsage: number; - peakNonPagedPoolUsage: number; - peakPagedPoolUsage: number; - peakPagefileUsage: number; - peakWorkingSetSize: number; - processId: number; - uuid: string; - workingSetSize: number; + cpuUsage?: number; + name?: string; + nonPagedPoolUsage?: number; + pageFaultCount?: number; + pagedPoolUsage?: number; + pagefileUsage?: number; + peakNonPagedPoolUsage?: number; + peakPagedPoolUsage?: number; + peakPagefileUsage?: number; + peakWorkingSetSize?: number; + processId?: number; + uuid?: string; + workingSetSize?: number; } diff --git a/types/openfin/_v2/api/system/proxy.d.ts b/types/openfin/_v2/api/system/proxy.d.ts index 597afa6548..2f8a945903 100644 --- a/types/openfin/_v2/api/system/proxy.d.ts +++ b/types/openfin/_v2/api/system/proxy.d.ts @@ -1,14 +1,15 @@ export interface ProxyInfo { config: ProxyConfig; - system: { - autoConfigUrl: string; - bypass: ''; - enabled: boolean; - proxy: string; - }; + system: ProxySystemInfo; } export interface ProxyConfig { proxyAddress: string; proxyPort: number; type: string; } +export interface ProxySystemInfo { + autoConfigUrl: string; + bypass: string; + enabled: boolean; + proxy: string; +} diff --git a/types/openfin/_v2/api/system/rvm.d.ts b/types/openfin/_v2/api/system/rvm.d.ts index 42fc0b94db..fb8737a081 100644 --- a/types/openfin/_v2/api/system/rvm.d.ts +++ b/types/openfin/_v2/api/system/rvm.d.ts @@ -1,5 +1,8 @@ export interface RVMInfo { action: string; + appLogDirectory: string; + path: string; 'start-time': string; version: string; + 'working-dir': string; } diff --git a/types/openfin/_v2/api/system/system.d.ts b/types/openfin/_v2/api/system/system.d.ts index 8c0bc7d3b6..76f244cabf 100644 --- a/types/openfin/_v2/api/system/system.d.ts +++ b/types/openfin/_v2/api/system/system.d.ts @@ -12,13 +12,14 @@ import { RVMInfo } from './rvm'; import { RuntimeInfo } from './runtime-info'; import { Entity, EntityInfo } from './entity'; import { HostSpecs } from './host-specs'; -import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection } from './external-process'; +import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection, ExternalProcessInfo } from './external-process'; import Transport from '../../transport/transport'; import { CookieInfo, CookieOption } from './cookie'; import { RegistryInfo } from './registry-info'; import { DownloadPreloadOption, DownloadPreloadInfo } from './download-preload'; import { ClearCacheOption } from './clearCacheOption'; import { CrashReporterOption } from './crashReporterOption'; +import { SystemEvents } from '../events/system'; /** * AppAssetInfo interface * @typedef { Object } AppAssetInfo @@ -35,6 +36,23 @@ import { CrashReporterOption } from './crashReporterOption'; * @typedef { Object } AppAssetRequest * @property { string } alias The name of the asset */ +/** + * ApplicationInfo interface + * @typedef { Object } ApplicationInfo + * @property { boolean } isRunning true when the application is running + * @property { string } uuid uuid of the application + * @property { string } parentUuid uuid of the application that launches this application + */ +/** + * @typedef { Object } ClearCacheOption + * @summary Clear cache options. + * @desc These are the options required by the clearCache function. + * + * @property {boolean} appcache html5 application cache + * @property {boolean} cache browser data cache for html files and images + * @property {boolean} cookies browser cookies + * @property {boolean} localStorage browser data that can be used across sessions + */ /** * CookieInfo interface * @typedef { Object } CookieInfo @@ -48,18 +66,33 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { string } name The name of the cookie */ /** - * ExternalConnection interface - * @typedef { Object } ExternalConnection - * @property { string } token The token to broker an external connection - * @property { string } uuid The uuid of the external connection + * CpuInfo interface + * @typedef { Object } CpuInfo + * @property { string } model The model of the cpu + * @property { number } speed The number in MHz + * @property { Time } times The numbers of milliseconds the CPU has spent in different modes. */ /** -* ExternalProcessRequestType interface -* @typedef { Object } ExternalProcessRequestType -* @property { string } path The file path to where the running application resides -* @property { string } arguments The argument passed to the running application -* @property { Object } listener This is described in the {LaunchExternalProcessListner} type definition +* CrashReporterOption interface +* @typedef { Object } CrashReporterOption +* @property { boolean } diagnosticMode In diagnostic mode the crash reporter will send diagnostic logs to +* the OpenFin reporting service on runtime shutdown +* @property { boolean } isRunning check if it's running */ +/** + * DownloadPreloadInfo interface + * @typedef { Object } DownloadPreloadInfo + * @desc downloadPreloadScripts function return value + * @property { string } url url to the preload script + * @property { string } error error during preload script acquisition + * @property { boolean } succeess download operation success + */ +/** + * DownloadPreloadOption interface + * @typedef { Object } DownloadPreloadOption + * @desc These are the options object required by the downloadPreloadScripts function + * @property { string } url url to the preload script + */ /** * Entity interface * @typedef { Object } Entity @@ -75,18 +108,54 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { string } entityType The type of the entity */ /** -* GetLogRequestType interface -* @typedef { Object } GetLogRequestType -* @property { string } name The name of the running application -* @property { number } endFile The file length of the log file -* @property { number } sizeLimit The set size limit of the log file -*/ + * ExternalConnection interface + * @typedef { Object } ExternalConnection + * @property { string } token The token to broker an external connection + * @property { string } uuid The uuid of the external connection + */ +/** + * ExternalProcessRequestType interface + * @typedef { Object } ExternalProcessRequestType + * @property { string } path The file path to where the running application resides + * @property { string } arguments The argument passed to the running application + * @property { Object } listener This is described in the {LaunchExternalProcessListner} type definition + */ +/** + * GetLogRequestType interface + * @typedef { Object } GetLogRequestType + * @property { string } name The name of the running application + * @property { number } endFile The file length of the log file + * @property { number } sizeLimit The set size limit of the log file + */ +/** + * GpuInfo interface + * @typedef { Object } GpuInfo + * @property { string } name The graphics card name + */ +/** + * HostSpecs interface + * @typedef { Object } HostSpecs + * @property { boolean } aeroGlassEnabled Value to check if Aero Glass theme is supported on Windows platforms + * @property { string } arch "x86" for 32-bit or "x86_64" for 64-bit + * @property { Array } cpus The same payload as Node's os.cpus() + * @property { GpuInfo } gpu The graphics card name + * @property { number } memory The same payload as Node's os.totalmem() + * @property { string } name The OS name and version/edition + * @property { boolean } screenSaver Value to check if screensaver is running. Supported on Windows only + */ /** * Identity interface * @typedef { Object } Identity * @property { string } name The name of the application * @property { string } uuid The uuid of the application */ +/** + * LogInfo interface + * @typedef { Object } LogInfo + * @property { string } name The filename of the log + * @property { number } size The size of the log in bytes + * @property { string } date The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)"" + */ /** * @typedef { verbose | info | warning | error | fatal } LogLevel * @summary Log verbosity levels. @@ -98,12 +167,49 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { string } error error and above * @property { string } fatal fatal only, indicates a crash is imminent */ +/** + * PointTopLeft interface + * @typedef { Object } PointTopLeft + * @property { number } top The mouse top position in virtual screen coordinates + * @property { number } left The mouse left position in virtual screen coordinates + */ +/** + * ProcessInfo interface + * @typedef { Object } ProcessInfo + * @property { numder } cpuUsage The percentage of total CPU usage + * @property { string } name The application name + * @property { number } nonPagedPoolUsage The current nonpaged pool usage in bytes + * @property { number } pageFaultCount The number of page faults + * @property { number } pagedPoolUsage The current paged pool usage in bytes + * @property { number } pagefileUsage The total amount of memory in bytes that the memory manager has committed + * @property { number } peakNonPagedPoolUsage The peak nonpaged pool usage in bytes + * @property { number } peakPagedPoolUsage The peak paged pool usage in bytes + * @property { number } peakPagefileUsage The peak value in bytes of pagefileUsage during the lifetime of this process + * @property { number } peakWorkingSetSize The peak working set size in bytes + * @property { number } processId The native process identifier + * @property { string } uuid The application UUID + * @property { nubmer } workingSetSize The current working set size (both shared and private data) in bytes + */ /** * ProxyConfig interface * @typedef { Object } ProxyConfig - * @property { numder } proxyPort The port number of the running application - * @property { string } proxyAddress The address of the running application - * @property { string } type + * @property { string } proxyAddress The configured proxy address + * @property { numder } proxyPort The configured proxy port + * @property { string } type The proxy Type + */ +/** + * ProxyInfo interface + * @typedef { Object } ProxyInfo + * @property { ProxyConfig } config The proxy config + * @property { ProxySystemInfo } system The proxy system info + */ +/** + * ProxySystemInfo interface + * @typedef { Object } ProxySystemInfo + * @property { string } autoConfigUrl The auto configuration url + * @property { string } bypass The proxy bypass info + * @property { boolean } enabled Value to check if a proxy is enabled + * @property { string } proxy The proxy info */ /** * RegistryInfo interface @@ -120,6 +226,16 @@ import { CrashReporterOption } from './crashReporterOption'; * @desc These are the options object required by the downloadRuntime function. * @property { string } version The given version to download */ +/** + * RVMInfo interface + * @typedef { Object } RVMInfo + * @property { string } action The name of action: "get-rvm-info" + * @property { string } appLogDirectory The app log directory + * @property { string } path The path of OpenfinRVM.exe + * @property { string } 'start-time' The start time of RVM + * @property { string } version The version of RVM + * @property { string } 'working-dir' The working directory + */ /** * TerminateExternalRequestType interface * @typedef { Object } TerminateExternalRequestType @@ -128,43 +244,41 @@ import { CrashReporterOption } from './crashReporterOption'; * @property { boolean } killtree Value to terminate the running application */ /** - * DownloadPreloadOption interface - * @typedef { Object } DownloadPreloadOption - * @desc These are the options object required by the downloadPreloadScripts function - * @property { string } url url to the preload script + * Time interface + * @typedef { Object } Time + * @property { number } user The number of milliseconds the CPU has spent in user mode + * @property { number } nice The number of milliseconds the CPU has spent in nice mode + * @property { number } sys The number of milliseconds the CPU has spent in sys mode + * @property { number } idle The number of milliseconds the CPU has spent in idle mode + * @property { number } irq The number of milliseconds the CPU has spent in irq mode */ /** - * DownloadPreloadInfo interface - * @typedef { Object } DownloadPreloadInfo - * @desc downloadPreloadScripts function return value - * @property { string } url url to the preload script - * @property { string } error error during preload script acquisition - * @property { boolean } succeess download operation success + * WindowDetail interface + * @typedef { Object } WindowDetail + * @property { number } bottom The bottom-most coordinate of the window + * @property { number } height The height of the window + * @property { boolean } isShowing Value to check if the window is showing + * @property { number } left The left-most coordinate of the window + * @property { string } name The name of the window + * @property { number } right The right-most coordinate of the window + * @property { string } state The window state + * @property { number } top The top-most coordinate of the window + * @property { number } width The width of the window */ /** - * @typedef { Object } ClearCacheOption - * @summary Clear cache options. - * @desc These are the options required by the clearCache function. - * - * @property {boolean} appcache html5 application cache - * @property {boolean} cache browser data cache for html files and images - * @property {boolean} cookies browser cookies - * @property {boolean} localStorage browser data that can be used across sessions + * WindowInfo interface + * @typedef { Object } WindowInfo + * @property { Array } childWindows The array of child windows details + * @property { WindowDetail } mainWindow The main window detail + * @property { string } uuid The uuid of the application */ -/** -* CrashReporterOption interface -* @typedef { Object } CrashReporterOption -* @property { boolean } diagnosticMode In diagnostic mode the crash reporter will send diagnostic logs to -* the OpenFin reporting service on runtime shutdown -* @property { boolean } isRunning check if it's running -*/ /** * An object representing the core of OpenFin Runtime. Allows the developer * to perform system-level actions, such as accessing logs, viewing processes, * clearing the cache and exiting the runtime. * @namespace */ -export default class System extends EmitterBase { +export default class System extends EmitterBase { constructor(wire: Transport); /** * Returns the version of the runtime. The version contains the major, minor, @@ -224,13 +338,6 @@ export default class System extends EmitterBase { * @tutorial System.getCrashReporterState */ getCrashReporterState(): Promise; - /** - * Returns a unique identifier (UUID) for the machine (SHA256 hash of the system's MAC address). - * This call will return the same value on subsequent calls on the same machine(host). - * The values will be different on different machines, and should be considered globally unique. - * @return {Promise.} - * @tutorial System.getDeviceId - */ getDeviceId(): Promise; /** * Start the crash reporter for the browser process if not already running. @@ -275,6 +382,12 @@ export default class System extends EmitterBase { * @tutorial System.getLog */ getLog(options: GetLogRequestType): Promise; + /** + * Returns a unique identifier (UUID) provided by the machine. + * @return {Promise.} + * @tutorial System.getMachineId + */ + getMachineId(): Promise; /** * Returns the minimum (inclusive) logging level that is currently being written to the log. * @return {Promise.} @@ -328,7 +441,7 @@ export default class System extends EmitterBase { getRvmInfo(): Promise; /** * Retrieves system information. - * @return {Promise.} + * @return {Promise.} * @tutorial System.getHostSpecs */ getHostSpecs(): Promise; @@ -341,11 +454,11 @@ export default class System extends EmitterBase { launchExternalProcess(options: ExternalProcessRequestType): Promise; /** * Monitors a running process. - * @param { number } pid See tutorial for more details + * @param { ExternalProcessInfo } options See tutorial for more details * @return {Promise.} * @tutorial System.monitorExternalProcess */ - monitorExternalProcess(pid: number): Promise; + monitorExternalProcess(options: ExternalProcessInfo): Promise; /** * Writes the passed message into both the log file and the console. * @param { string } level The log level for the entry. Can be either "info", "warning" or "error" diff --git a/types/openfin/_v2/api/system/window.d.ts b/types/openfin/_v2/api/system/window.d.ts index 886084fad6..7b2a3b858b 100644 --- a/types/openfin/_v2/api/system/window.d.ts +++ b/types/openfin/_v2/api/system/window.d.ts @@ -1,14 +1,16 @@ export interface WindowInfo { - uuid: string; - mainWindow: WindowDetail; childWindows: Array; + mainWindow: WindowDetail; + uuid: string; } export interface WindowDetail { - name: string; - top: number; - right: number; bottom: number; height: number; - width: number; + isShowing: boolean; left: number; + name: string; + right: number; + state: string; + top: number; + width: number; } diff --git a/types/openfin/_v2/api/window/anchor-type.d.ts b/types/openfin/_v2/api/window/anchor-type.d.ts new file mode 100644 index 0000000000..4e09af40ab --- /dev/null +++ b/types/openfin/_v2/api/window/anchor-type.d.ts @@ -0,0 +1 @@ +export declare type AnchorType = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; diff --git a/types/openfin/_v2/api/window/window.d.ts b/types/openfin/_v2/api/window/window.d.ts index 8d597a6446..fcefc4fa5d 100644 --- a/types/openfin/_v2/api/window/window.d.ts +++ b/types/openfin/_v2/api/window/window.d.ts @@ -1,32 +1,54 @@ -import { Base, EmitterBase, RuntimeEvent } from '../base'; +import { Base, EmitterBase } from '../base'; import { Identity } from '../../identity'; import Bounds from './bounds'; -import BoundsChangedReply from './bounds-changed'; import { Transition, TransitionOptions } from './transition'; import { Application } from '../application/application'; import Transport from '../../transport/transport'; +import { WindowEvents } from '../events/window'; +import { AnchorType } from './anchor-type'; +import { WindowOption } from './windowOption'; +/** + * @lends Window + */ export default class _WindowModule extends Base { - private instance; /** - * Returns a Window object that represents an existing window. - * @param { Identity } indentity + * Asynchronously returns a Window object that represents an existing window. + * @param { Identity } identity * @return {Promise.<_Window>} * @tutorial Window.wrap + * @static */ wrap(identity: Identity): Promise<_Window>; + /** + * Synchronously returns a Window object that represents an existing window. + * @param { Identity } identity + * @return {_Window} + * @tutorial Window.wrapSync + * @static + */ + wrapSync(identity: Identity): _Window; /** * Creates a new Window. - * @param { * } options - Window creation options + * @param { WindowOption } options - Window creation options * @return {Promise.<_Window>} * @tutorial Window.create + * @static */ - create(options: any): Promise<_Window>; + create(options: WindowOption): Promise<_Window>; /** - * Returns a Window object that represents the current window - * @return {Promise.} - * @tutorial window.getCurrent + * Asynchronously returns a Window object that represents the current window + * @return {Promise.<_Window>} + * @tutorial Window.getCurrent + * @static */ getCurrent(): Promise<_Window>; + /** + * Synchronously returns a Window object that represents the current window + * @return {_Window} + * @tutorial Window.getCurrentSync + * @static + */ + getCurrentSync(): _Window; } export interface CloseEventShape { name: string; @@ -47,6 +69,19 @@ export interface FrameInfo { entityType: string; parent?: Identity; } +export interface Area { + height: number; + width: number; + x: number; + y: number; +} +/** + * @typedef { Object } Area + * @property { number } height Area's height + * @property { number } width Area's width + * @property { number } x X coordinate of area's starting point + * @property { number } y Y coordinate of area's starting point + */ /** * @typedef {object} Transition * @property {Opacity} opacity - The Opacity transition @@ -98,7 +133,7 @@ this animation onto the end of the animation queue. * @class * @alias Window */ -export declare class _Window extends EmitterBase { +export declare class _Window extends EmitterBase { identity: Identity; /** * Raised when a window within this application requires credentials from the user. @@ -425,10 +460,8 @@ export declare class _Window extends EmitterBase { * @property {string} state - The preload script state: "load-failed", "failed", "succeeded" */ - private nativeWindow; constructor(wire: Transport, identity: Identity); - createWindow(options: any): Promise<_Window>; - protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; + createWindow(options: WindowOption): Promise<_Window>; private windowListFromNameList; /** * Retrieves an array of frame info objects representing the main frame and any @@ -443,12 +476,6 @@ export declare class _Window extends EmitterBase { * @tutorial Window.getBounds */ getBounds(): Promise; - /** - * Returns the native JavaScript "window" object for the window. - * @return {Promise.} - * @tutorial Window.getNativeWindow - */ - getNativeWindow(): Promise; /** * Gives focus to the window. * @return {Promise.} @@ -561,11 +588,13 @@ export declare class _Window extends EmitterBase { */ getParentWindow(): Promise<_Window>; /** - * Gets a base64 encoded PNG snapshot of the window. + * Gets a base64 encoded PNG snapshot of the window or just part a of it. + * @param { Area } [area] The area of the window to be captured. + * Omitting it will capture the whole visible window. * @return {Promise.} * @tutorial Window.getSnapshot */ - getSnapshot(): Promise; + getSnapshot(area?: Area): Promise; /** * Gets the current state ("minimized", "maximized", or "restored") of the window. * @return {Promise.} @@ -636,24 +665,24 @@ export declare class _Window extends EmitterBase { * Resizes the window by a specified amount. * @param { number } deltaWidth The change in the width of the window * @param { number } deltaHeight The change in the height of the window - * @param { string } anchor Specifies a corner to remain fixed during the resize. - * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". * If undefined, the default is "top-left" * @return {Promise.} * @tutorial Window.resizeBy */ - resizeBy(deltaWidth: number, deltaHeight: number, anchor: string): Promise; + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType): Promise; /** * Resizes the window to the specified dimensions. * @param { number } width The change in the width of the window * @param { number } height The change in the height of the window - * @param { string } anchor Specifies a corner to remain fixed during the resize. - * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * @param { AnchorType } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". * If undefined, the default is "top-left" * @return {Promise.} * @tutorial Window.resizeTo */ - resizeTo(width: number, height: number, anchor: string): Promise; + resizeTo(width: number, height: number, anchor: AnchorType): Promise; /** * Restores the window to its normal state (i.e., unminimized, unmaximized). * @return {Promise.} @@ -747,13 +776,3 @@ export declare class _Window extends EmitterBase { */ stopNavigation(): Promise; } -export interface _Window { - on(type: 'focused', listener: Function): Promise; - on(type: 'initialized', listener: Function): Promise; - on(type: 'bounds-changed', listener: (data: BoundsChangedReply) => void): Promise; - on(type: 'hidden', listener: Function): Promise; - on(type: 'removeListener', listener: (eventType: string | symbol) => void): Promise; - on(type: 'newListener', listener: (eventType: string | symbol) => void): Promise; - on(type: 'closed', listener: (eventType: CloseEventShape) => void): Promise; - on(type: 'fire-constructor-callback', listener: Function): Promise; -} diff --git a/types/openfin/_v2/api/window/windowOption.d.ts b/types/openfin/_v2/api/window/windowOption.d.ts new file mode 100644 index 0000000000..faab275187 --- /dev/null +++ b/types/openfin/_v2/api/window/windowOption.d.ts @@ -0,0 +1,46 @@ +import { DownloadPreloadOption } from '../system/download-preload'; +export interface WindowOption { + accelerator?: object; + alwaysOnTop?: boolean; + api?: object; + aspectRatio?: number; + autoShow?: boolean; + backgroundColor?: string; + contentNavigation?: object; + contextMenu?: boolean; + cornerRounding?: object; + customData?: string; + customRequestHeaders?: Array; + defaultCentered?: boolean; + defaultHeight?: number; + defaultLeft?: number; + defaultTop?: number; + defaultWidth?: number; + frame?: boolean; + hideOnClose?: boolean; + icon?: string; + maxHeight?: number; + maximizable?: boolean; + maxWidth?: number; + minHeight?: number; + minimizable?: boolean; + minWidth?: number; + name?: string; + opacity?: number; + preloadScripts?: Array; + resizable?: boolean; + resizeRegion?: object; + saveWindowState?: boolean; + shadow?: boolean; + showTaskbarIcon?: boolean; + smallWindow?: boolean; + state?: string; + taskbarIconGroup?: string; + url?: string; + uuid?: string; + waitForPageLoad?: boolean; +} +export interface CustomRequestHeaders { + urlPatterns: Array; + headers: Array; +} diff --git a/types/openfin/_v2/transport/transport.d.ts b/types/openfin/_v2/transport/transport.d.ts index fb7b967240..519562de95 100644 --- a/types/openfin/_v2/transport/transport.d.ts +++ b/types/openfin/_v2/transport/transport.d.ts @@ -3,6 +3,8 @@ import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, ConnectConfi import { Identity } from '../identity'; import { EventEmitter } from 'events'; import { Environment } from '../environment/environment'; +import { RuntimeEvent } from '../api/events/base'; +import { EventAggregator } from '../api/events/eventAggregator'; export declare type MessageHandler = (data: any) => boolean; declare class Transport extends EventEmitter { protected wireListeners: Map; protected uncorrelatedListener: Function; - protected messageHandlers: MessageHandler[]; me: Identity; protected wire: Wire; environment: Environment; topicRefMap: Map; sendRaw: Wire['send']; + eventAggregator: EventAggregator; + protected messageHandlers: MessageHandler[]; constructor(wireType: WireConstructor, environment: Environment); connectSync: (config: ConnectConfig) => any; connect(config: InternalConnectConfig): Promise; @@ -38,6 +41,20 @@ export declare class Message { payload: T; correlationId?: number; } +export declare class EventMessage implements Message { + action: 'process-desktop-event'; + payload: RuntimeEvent; +} +export declare class NotificationEventMessage implements Message { + action: 'process-notification-event'; + payload: NotificationEvent; +} +export interface NotificationEvent { + payload: { + notificationId: string; + }; + type: string | symbol; +} export declare class Payload { success: boolean; data: any; diff --git a/types/openfin/index.d.ts b/types/openfin/index.d.ts index fe34f0b630..55ee5b6741 100644 --- a/types/openfin/index.d.ts +++ b/types/openfin/index.d.ts @@ -1,12 +1,13 @@ -// Type definitions for OpenFin API 34.0 +// Type definitions for OpenFin API 37.0 // Project: https://openfin.co/ // Definitions by: Chris Barker // Ricardo de Pena // Roma +// Li Cui // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 -// based on v9.61.34.22 +// based on v9.61.37.14 // see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean /** @@ -24,15 +25,51 @@ * without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "documennt" objects. */ declare namespace fin { - var Application: import('./_v2/api/application/application').default - var Clipboard: import('./_v2/api/clipboard/clipboard').default + var Application: import('./_v2/api/application/application').default; + var Clipboard: import('./_v2/api/clipboard/clipboard').default; var ExternalApplication: import('./_v2/api/external-application/external-application').default - var Frame: import('./_v2/api/frame/frame').default - var GlobalHotkey: import('./_v2/api/global-hotkey/index').default - var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default - var Notification: import('./_v2/api/notification/notification').default - var System: import('./_v2/api/system/system').default - var Window: import('./_v2/api/window/window').default + var Frame: import('./_v2/api/frame/frame').default; + var GlobalHotkey: import('./_v2/api/global-hotkey/index').default; + var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default; + var Notification: import('./_v2/api/notification/notification').default; + var System: import('./_v2/api/system/system').default; + var Window: import('./_v2/api/window/window').default; + + // v2 shapes + type Identity = import('./_v2/identity').Identity; + type LaunchInfo = import('./_v2/api/application/application').ApplicationInfo; + type ShortCutConfig = import('./_v2/api/application/application').ShortCutConfig; + type TrayInfo = import('./_v2/api/application/application').TrayInfo; + type ApplicationOption = import('./_v2/api/application/applicationOption').ApplicationOption; + type ExternalApplicationInfo = import('./_v2/api/external-application/external-application').ExternalApplicationInfo; + type ApplicationInfo = import('./_v2/api/system/application').ApplicationInfo; + type ClearCacheOption = import('./_v2/api/system/clearCacheOption').ClearCacheOption; + type CookieInfo = import('./_v2/api/system/cookie').CookieInfo; + type CookieOption = import('./_v2/api/system/cookie').CookieOption; + type AppAssetInfo = import('./_v2/api/system/download-asset').AppAssetInfo; + type AppAssetRequest = import('./_v2/api/system/download-asset').AppAssetRequest; + type RuntimeDownloadOptions = import('./_v2/api/system/download-asset').RuntimeDownloadOptions; + type RuntimeDownloadProgress = import('./_v2/api/system/download-asset').RuntimeDownloadProgress; + type DownloadPreloadInfo = import('./_v2/api/system/download-preload').DownloadPreloadInfo; + type DownloadPreloadOption = import('./_v2/api/system/download-preload').DownloadPreloadOption; + type EntityInfo = import('./_v2/api/system/entity').EntityInfo; + type ExternalProcessRequestType = import('./_v2/api/system/external-process').ExternalProcessRequestType; + type ExternalProcessInfo = import('./_v2/api/system/external-process').ExternalProcessInfo; + type HostSpecs = import('./_v2/api/system/host-specs').HostSpecs; + type LogInfo = import('./_v2/api/system/log').LogInfo; + type MonitorInfo = import('./_v2/api/system/monitor').MonitorInfo; + type PointTopLeft = import('./_v2/api/system/point').PointTopLeft; + type ProcessInfo = import('./_v2/api/system/process').ProcessInfo; + type ProxyInfo = import('./_v2/api/system/proxy').ProxyInfo; + type RegistryInfo = import('./_v2/api/system/registry-info').RegistryInfo; + type RVMInfo = import('./_v2/api/system/rvm').RVMInfo; + type WindowDetail = import('./_v2/api/system/window').WindowDetail; + type WindowInfo = import('./_v2/api/system/window').WindowInfo; + type AnchorType = import('./_v2/api/window/anchor-type').AnchorType; + type Bounds = import('./_v2/api/window/bounds').default; + type Transition = import('./_v2/api/window/transition').Transition; + type TransitionOptions = import('./_v2/api/window/transition').TransitionOptions; + type WindowOption = import('./_v2/api/window/windowOption').WindowOption; const desktop: OpenFinDesktop; @@ -53,7 +90,7 @@ declare namespace fin { * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. */ new ( - options: ApplicationOptions, + options: ApplicationOption, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication; /** @@ -124,7 +161,7 @@ declare namespace fin { /** * Retrieves information about the system tray. */ - getTrayIconInfo(callback?: (trayInfo: TrayIconInfo) => void, errorCallback?: (reason: string) => void): void; + getTrayIconInfo(callback?: (trayInfo: TrayInfo) => void, errorCallback?: (reason: string) => void): void; /** * Determines if the application is currently running. */ @@ -188,21 +225,6 @@ declare namespace fin { uuid: string; } - interface ShortCutConfig { - /** - * application has a shortcut on the desktop - */ - desktop?: boolean; - /** - * application has no shortcut in the start menu - */ - startMenu?: boolean; - /** - * application will be launched on system startup - */ - systemStartup?: boolean; - } - interface SuccessObj { httpResponseCode: number; } @@ -216,192 +238,6 @@ declare namespace fin { message: string; } - interface ApplicationOptions { - /** - * The name of the application. - */ - name?: string; - /** - * The url to the application. - */ - url?: string; - /** - * The UUID of the application, unique within the set of all other applications running in the OpenFin Runtime. name and uuid must match. - */ - uuid?: string; - /** - * Enable Flash at the application level. Default: false. - */ - plugins?: boolean; - /** - * The options of the main window of the application. - */ - mainWindowOptions?: WindowOptions; - } - - interface WindowOptions { - /** - * Enable keyboard shortcuts for devtools and zoom. Default: false for both. - */ - accelerator?: { - devtools?: boolean, - zoom?: boolean, - reload?: boolean, - reloadIgnoreCache?: boolean, - }; - /** - * A flag to always position the window at the top of the window stack. Default: false. - * Updatable - */ - alwaysOnTop?: boolean; - /** - * A flag to automatically show the Window when it is created. Default: false. - */ - autoShow?: boolean; - /** - * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true - * Updatable - */ - contextMenu?: boolean; - /** - * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. - * Updatable - */ - cornerRounding?: { - width?: number; - height?: number; - }; - /** - * A field that the user can attach serializable data to to be ferried around with the window options. Default: ''. - */ - customData?: any; - /** - * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the position from before the window was closed is used. - * This option overrides defaultLeft and defaultTop. Default: false. - */ - defaultCentered?: boolean; - /** - * The default height of the window. Specifies the height of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500. - */ - defaultHeight?: number; - /** - * The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100. - */ - defaultWidth?: number; - /** - * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. - */ - defaultTop?: number; - /** - * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. - */ - defaultLeft?: number; - /** - * A flag to show the frame. Default: true. - * Updatable - */ - frame?: boolean; - /** - * A flag to allow a window to be hidden when the close button is clicked.Default: false. - * Updatable - */ - hideOnClose?: boolean; - /** - * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. - * Updatable - */ - icon?: string; - /** - * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. - * Updatable - */ - maxHeight?: number; - /** - * A flag that lets the window be maximized.Default: true. - * Updatable - */ - maximizable?: boolean; - /** - * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. - * Updatable - */ - maxWidth?: number; - /** - * The minimum height of a window.Default: 0. - * Updatable - */ - minHeight?: number; - /** - * A flag that lets the window be minimized.Default: true. - */ - minimizable?: boolean; - /** - * The minimum width of a window.Default: 0. - */ - minWidth?: number; - /** - * The name for the window which must be unique within the context of the invoking Application. - */ - name?: string; - /** - * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. - * Updatable - */ - opacity?: number; - /** - * A flag to drop to allow the user to resize the window.Default: true. - * Updatable - */ - resizable?: boolean; - /** - * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. - * Updatable - */ - resizeRegion?: { - /** - * The size in pixels (Default: 2), - */ - size?: number; - /** - * The size in pixels of an additional - * square resizable region located at the - * bottom right corner of a - * frameless window. (Default: 4) - */ - bottomRightCorner?: number; - }; - /** - * A flag to show the Window's icon in the taskbar. Default: true. - */ - showTaskbarIcon?: boolean; - /** - * A flag to cache the location of the window or not. Default: true. - */ - saveWindowState?: boolean; - /** - * Specify a taskbar group for the window. Default: app's uuid. - */ - taskbarIconGroup?: string; - /** - * A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal". - */ - state?: string; - /** - * The URL of the window. Default: "about:blank". - */ - url?: string; - /** - * When set to false, the window will render before the "load" event is fired on the content's window. - * Caution, when false you will see an initial empty white window. Default: true. - */ - waitForPageLoad?: boolean; - } - /** * Clipboard * Clipboard API allows reading and writting to the clipboard in multiple formats. @@ -637,7 +473,7 @@ declare namespace fin { * Clears cached data containing window state/positions, * application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. */ - clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + clearCache(options: ClearCacheOption, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Clears all cached data when OpenFin Runtime exits. */ @@ -679,11 +515,11 @@ declare namespace fin { /** * Retrieves an array of data (name, ids, bounds) for all application windows. */ - getAllWindows(callback?: (windowInfoList: WindowDetails[]) => void, errorCallback?: (reason: string) => void): void; + getAllWindows(callback?: (windowInfoList: WindowInfo[]) => void, errorCallback?: (reason: string) => void): void; /** * Returns information about the app asset. */ - getAppAssetInfo(options: AppAssetOptions, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void; + getAppAssetInfo(options: AppAssetRequest, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void; /** * Get additional info of cookies. */ @@ -715,7 +551,7 @@ declare namespace fin { /** * Retrieves system information. */ - getHostSpecs(callback?: (info: HostSpecInfo) => void, errorCallback?: (reason: string) => void): void; + getHostSpecs(callback?: (info: HostSpecs) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves the contents of the log with the specified filename. */ @@ -735,7 +571,7 @@ declare namespace fin { /** * Returns the mouse in virtual screen coordinates (left, top). */ - getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; + getMousePosition(callback?: (mousePosition: PointTopLeft) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves an array of all of the runtime processes that are currently running. * Each element in the array is an object containing the uuid and the name of the application to which the process belongs. @@ -748,7 +584,7 @@ declare namespace fin { /** * Returns information about the running RVM in an object. */ - getRvmInfo(callback?: (rvmInfo: RvmInfo) => void, errorCallback?: (reason: string) => void): void; + getRvmInfo(callback?: (rvmInfo: RVMInfo) => void, errorCallback?: (reason: string) => void): void; /** * Returns the version of the runtime. The version contains the major, minor, build and revision numbers. */ @@ -756,7 +592,7 @@ declare namespace fin { /** * Runs an executable or batch file. */ - launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + launchExternalProcess(options: ExternalProcessRequestType, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; /** * Writes the passed message into both the log file and the console. */ @@ -829,340 +665,6 @@ declare namespace fin { updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; } - interface CacheOptions { - cache?: boolean; - cookies?: boolean; - localStorage?: boolean; - appcache?: boolean; - userData?: boolean; - } - - interface AppAssetInfo { - src?: string; - alias?: string; - version?: string; - target?: string; - args?: string; - mandatory?: boolean; - } - - interface AppAssetOptions { - alias: string; - } - - interface ApplicationInfo { - /** - * true when the application is running. - */ - isRunning?: boolean; - /** - * uuid of the application. - */ - uuid?: string; - /** - * uuid of the application that launches this application. - */ - parentUuid?: string; - } - - interface Identity { - uuid: string; - name: string; - } - - interface EntityInfo { - name: string; - uuid: string; - parent: Identity; - entityType: string; - } - - interface DownloadPreloadOption { - url: string; - } - - interface DownloadPreloadInfo { - success: boolean; - url?: string; - error: string; - } - - interface CookieInfo { - name: string; - // expirationDate: Date; - domain: string; - path: string; - } - - interface CookieOption { - name: string; - } - - interface RegistryInfo { - data: any; - rootKey: string; - subkey: string; - type: string; - value: string; - } - - interface RuntimeDownloadOptions { - version: string; - } - - interface RuntimeDownloadProgress { - downloadedBytes: number; - totalBytes: number; - } - - interface WindowDetails { - uuid?: string; - mainWindow?: WindowInfo; - childWindows?: WindowInfo[]; - } - - interface WindowInfo { - /** - * name of the child window - */ - name?: string; - /** - * top-most coordinate of the child window - */ - top?: number; - /** - * right-most coordinate of the child window - */ - right?: number; - /** - * bottom-most coordinate of the child window - */ - bottom?: number; - /** - * left-most coordinate of the child window - */ - left?: number; - } - - interface HostSpecInfo { - /** - * "x86" for 32-bit or "x86_64" for 64-bit - */ - arch: string; - /** - * Same payload as Node's os.cpus() - */ - cpus: NodeCpuInfo[]; - gpu: { - /** - * Graphics card name - */ - name: string; - }; - /** - * Same payload as Node's os.totalmem() - */ - memory: number; - /** - * OS name and version/edition - */ - name: string; - } - - interface NodeCpuInfo { - model: string; - /** - * in MHz - */ - speed: number; - times: { - /** - * The number of milliseconds the CPU has spent in user mode. - */ - user: number; - /** - * The number of milliseconds the CPU has spent in nice mode. - */ - nice: number; - /** - * The number of milliseconds the CPU has spent in sys mode. - */ - sys: number; - /** - * The number of milliseconds the CPU has spent in idle mode. - */ - idle: number; - /** - * The number of milliseconds the CPU has spent in irq mode. - */ - irq: number; - }; - } - - interface LogInfo { - /** - * the filename of the log - */ - name?: string; - /** - * the size of the log in bytes - */ - size?: number; - /** - * the unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" - */ - date?: string; - } - - interface ProcessInfo { - /** - * the percentage of total CPU usage - */ - cpuUsage?: number; - /** - * the application name - */ - name?: string; - /** - * the current nonpaged pool usage in bytes - */ - nonPagedPoolUsage?: number; - /** - * the number of page faults - */ - pageFaultCount?: number; - /** - * the current paged pool usage in bytes - */ - pagedPoolUsage?: number; - /** - * the total amount of memory in bytes that the memory manager has committed - */ - pagefileUsage?: number; - /** - * the peak nonpaged pool usage in bytes - */ - peakNonPagedPoolUsage?: number; - /** - * the peak paged pool usage in bytes - */ - peakPagedPoolUsage?: number; - /** - * the peak value in bytes of pagefileUsage during the lifetime of this process - */ - peakPagefileUsage?: number; - /** - * the peak working set size in bytes - */ - peakWorkingSetSize?: number; - /** - * the native process identifier - */ - processId?: number; - /** - * the application UUID - */ - uuid?: string; - /** - * the current working set size (both shared and private data) in bytes - */ - workingSetSize?: number; - } - - interface ProxyInfo { - /** - * the configured Proxy Address - */ - proxyAddress?: string; - /** - * the configured Proxy port - */ - proxyPort?: number; - /** - * Proxy Type - */ - type?: string; - } - - interface RvmInfo { - version?: string; - "start-time"?: string; - } - - interface ExternalProcessLaunchInfo { - path?: string; - /** - * Additionally note that the executable found in the zip file specified in appAssets - * will default to the one mentioned by appAssets.target - * If the the path below refers to a specific path it will override this default - */ - alias?: string; - /** - * When using alias; if no arguments are passed then the arguments (if any) - * are taken from the 'app.json' file, from the 'args' parameter - * of the 'appAssets' Object with the relevant 'alias'. - * If 'arguments' is passed as a parameter it takes precedence - * over any 'args' set in the 'app.json'. - */ - arguments?: string; - listener?(result: { - /** - * "Exited" Or "released" on a call to releaseExternalProcess - */ - topic?: string; - /** - * The mapped UUID which identifies the launched process - */ - uuid?: string; - /* - * Process exit code - */ - exitCode?: number; - }): void; - certificate?: CertificationInfo; - } - - interface CertificationInfo { - /** - * A hex string with or without spaces - */ - serial?: string; - /** - * An internally tokenized and comma delimited string allowing partial or full checks of the subject fields - */ - subject?: string; - /** - * A hex string with or without spaces - */ - publickey?: string; - /** - * A hex string with or without spaces - */ - thumbprint?: string; - /** - * A boolean indicating that the certificate is trusted and not revoked - */ - trusted?: boolean; - } - - interface ExternalProcessInfo { - pid?: number; - listener?(result: { - /** - * "Exited" Or "released" on a call to releaseExternalProcess - */ - topic?: string; - /** - * The mapped UUID which identifies the launched process - */ - uuid?: string; - /* - * Process exit code - */ - exitCode?: number; - }): void; - } - interface OpenFinWindowStatic { /** * Class: Window @@ -1179,7 +681,7 @@ declare namespace fin { * @param [callback.successObj] - httpResponseCode */ new ( - options: WindowOptions, + options: WindowOption, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; /** @@ -1242,7 +744,7 @@ declare namespace fin { /** * Performs the specified window transitions */ - animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; + animate(transitions: Transition, options: TransitionOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; /** * Provides credentials to authentication requests */ @@ -1287,7 +789,7 @@ declare namespace fin { /** * Gets the current bounds (top, left, width, height) of the window. */ - getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; + getBounds(callback?: (bounds: Bounds) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. * Please note that calling window is included in the result array. @@ -1296,7 +798,7 @@ declare namespace fin { /** * Gets the current settings of the window. */ - getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void; + getOptions(callback?: (options: WindowOption) => void, errorCallback?: (reason: string) => void): void; /** * Gets a base64 encoded PNG snapshot of the window. */ @@ -1363,11 +865,11 @@ declare namespace fin { /** * Resizes the window by a specified amount. */ - resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + resizeBy(deltaWidth: number, deltaHeight: number, anchor: AnchorType, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Resizes the window by a specified amount. */ - resizeTo(width: number, height: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + resizeTo(width: number, height: number, anchor: AnchorType, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Restores the window to its normal state (i.e., unminimized, unmaximized). */ @@ -1400,7 +902,7 @@ declare namespace fin { /** * Updates the window using the passed options */ - updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + updateOptions(options: WindowOption, callback?: () => void, errorCallback?: (reason: string) => void): void; } interface OpenFinFrameStatic { @@ -1469,51 +971,6 @@ declare namespace fin { type: "monitor-info-changed"; } - interface MonitorInfo { - nonPrimaryMonitors: MonitorInfoDetail[]; - primaryMonitor: MonitorInfoDetail; - reason: string; - taskbar: { - edge: "left" | "right" | "top" | "bottom", - rect: MontiorCoordinates - }; - topic: "system"; - type: "monitor-info-changed"; - virtualScreen: MontiorCoordinates; - } - - interface TrayIconInfo { - x: number; - y: number; - bounds: { - x: number; - y: number; - width: number; - height: number; - }; - monitorInfo: MonitorInfo; - } - - interface MonitorInfoDetail { - availableRect: MontiorCoordinates; - deviceId: string; - displayDeviceActive: boolean; - monitorRect: MontiorCoordinates; - name: string; - } - - interface MontiorCoordinates { - bottom: number; - left: number; - right: number; - top: number; - } - - interface VirtualScreenCoordinates { - left: number; - top: number; - } - interface SystemBaseEvent { topic: string; type: OpenFinSystemEventType; @@ -1713,96 +1170,6 @@ declare namespace fin { uuid: string; } - interface AnimationTransition { - opacity?: { - /** - * This value is clamped from 0.0 to 1.0 - */ - opacity?: number; - /** - * The total time in milliseconds this transition should take. - */ - duration?: number; - /** - * Treat 'opacity' as absolute or as a delta. Defaults to false. - */ - relative?: boolean; - }; - position?: { - /** - * Defaults to the window's current left position in virtual screen coordinates. - */ - left?: number; - /** - * Defaults to the window's current top position in virtual screen coordinates. - */ - top?: number; - /** - * The total time in milliseconds this transition should take. - */ - duration?: number; - /** - * Treat 'left' and 'top' as absolute or as deltas. Defaults to false. - */ - relative?: boolean; - }; - size?: { - /** - * Optional if height is present. Defaults to the window's current width. - */ - width?: number; - /** - * Optional if width is present. Defaults to the window's current height. - */ - height?: number; - /** - * The total time in milliseconds this transition should take. - */ - duration?: number; - /** - * Treat 'width' and 'height' as absolute or as deltas. Defaults to false. - */ - relative?: boolean; - }; - } - - interface AnimationOptions { - /** - * This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue. - */ - interrupt?: boolean; - /** - * Transition effect. Defaults to 'ease-in-out'. - */ - tween?: OpenFinTweenType; - } - - interface WindowBounds { - /** - * the height of the window. - */ - height?: number; - /** - * left-most coordinate of the window. - */ - left?: number; - /** - * top-most coordinate of the window. - */ - top?: number; - /** - * the width of the window. - */ - width?: number; - } - - interface ExternalApplicationInfo { - parent: { - uuid: string; - name: string; - }; - } - interface SessionChangedEvent { /** * the action that triggered this event: @@ -1816,34 +1183,6 @@ declare namespace fin { type: "session-changed"; } - interface LaunchInfo { - launchMode: "fin-protocol" - | "fins-protocol" - | "shortcut" - | "command-line" - | "adapter" - | "other" - | string; - } - - type OpenFinTweenType = "linear" - | "ease-in" - | "ease-out" - | "ease-in-out" - | "ease-in-quad" - | "ease-out-quad" - | "ease-in-out-quad" - | "ease-in-cubic" - | "ease-out-cubic" - | "ease-in-out-cubic" - | "ease-out-bounce" - | "ease-in-back" - | "ease-out-back" - | "ease-in-out-back" - | "ease-in-elastic" - | "ease-out-elastic" - | "ease-in-out-elastic"; - type OpenFinApplicationEventType = "closed" | "connected" | "crashed" @@ -1899,9 +1238,4 @@ declare namespace fin { | "restored" | "show-requested" | "shown"; - - type OpenFinAnchor = "top-left" - | "top-right" - | "bottom-left" - | "bottom-right"; } diff --git a/types/openfin/openfin-tests.ts b/types/openfin/openfin-tests.ts index 6059f54de7..167a6c86be 100644 --- a/types/openfin/openfin-tests.ts +++ b/types/openfin/openfin-tests.ts @@ -78,8 +78,8 @@ function test_application() { }); // getTrayIconInfo application.getTrayIconInfo(info => { - console.log(info.x, info.y, info.bounds.x, info.bounds.y, info.bounds.height, info.bounds.width, - info.monitorInfo.type, info.monitorInfo.reason); + console.log(info.x, info.y, info.bounds.left, info.bounds.top, info.bounds.height, info.bounds.width, + info.monitorInfo.reason); }); // isRunning application.isRunning(running => { @@ -235,8 +235,7 @@ function test_system() { cache: true, cookies: true, localStorage: true, - appcache: true, - userData: true + appcache: true }); // deleteCacheOnExit fin.desktop.System.deleteCacheOnExit(() => { diff --git a/types/openfin/tsconfig.json b/types/openfin/tsconfig.json index 2a2c9d108b..a7f3e48849 100644 --- a/types/openfin/tsconfig.json +++ b/types/openfin/tsconfig.json @@ -21,6 +21,7 @@ "index.d.ts", "openfin-tests.ts", "_v2/api/application/application.d.ts", + "_v2/api/application/applicationOption.d.ts", "_v2/api/base.d.ts", "_v2/api/clipboard/clipboard.d.ts", "_v2/api/clipboard/write-request.d.ts", @@ -53,10 +54,12 @@ "_v2/api/system/rvm.d.ts", "_v2/api/system/system.d.ts", "_v2/api/system/window.d.ts", + "_v2/api/window/anchor-type.d.ts", "_v2/api/window/bounds-changed.d.ts", "_v2/api/window/bounds.d.ts", "_v2/api/window/transition.d.ts", "_v2/api/window/window.d.ts", + "_v2/api/window/windowOption.d.ts", "_v2/environment/environment.d.ts", "_v2/environment/node-env.d.ts", "_v2/environment/openfin-env.d.ts", diff --git a/types/openfin/v34/_v2/api/application/application.d.ts b/types/openfin/v34/_v2/api/application/application.d.ts new file mode 100644 index 0000000000..616501834d --- /dev/null +++ b/types/openfin/v34/_v2/api/application/application.d.ts @@ -0,0 +1,223 @@ +import { EmitterBase, Base, Reply, RuntimeEvent } from '../base'; +import { Identity } from '../../identity'; +import { _Window } from '../window/window'; +import { Point } from '../system/point'; +import { MonitorInfo } from '../system/monitor'; +import Transport from '../../transport/transport'; +import Bounds from '../window/bounds'; +export interface TrayIconClickReply extends Point, Reply<'application', 'tray-icon-clicked'> { + button: number; + monitorInfo: MonitorInfo; +} +export interface ApplicationInfo { + initialOptions: object; + launchMode: string; + manifest: object; + manifestUrl: string; + parentUuid?: string; + runtime: object; +} +export declare class NavigationRejectedReply extends Reply<'window-navigation-rejected', void> { + sourceName: string; + url: string; +} +export interface ConfigInterface { + desktop?: boolean; + startMenu?: boolean; + systemStartup?: boolean; +} +export interface TrayInfo { + bounds: Bounds; + monitorInfo: MonitorInfo; + x: number; + y: number; +} +export default class ApplicationModule extends Base { + /** + * Returns an Application object that represents an existing application. + * @param { Identity } indentity + * @return {Promise.} + * @tutorial Application.wrap + */ + wrap(identity: Identity): Promise; + /** + * Creates a new Application. + * @param {*} appOptions + * @return {Promise.} + * @tutorial Application.create + */ + create(appOptions: any): Promise; + /** + * Returns an Application object that represents the current application + * @return {Promise.} + * @tutorial Application.getCurrent + */ + getCurrent(): Promise; + /** + * Retrieves application's manifest and returns a wrapped application. + * @param {string} manifestUrl - The URL of app's manifest. + * @return {Promise.} + * @tutorial Application.createFromManifest + */ + createFromManifest(manifestUrl: string): Promise; +} +/** + * @classdesc An object representing an application. Allows the developer to create, + * execute, show/close an application as well as listen to application events. + * @class + */ +export declare class Application extends EmitterBase { + identity: Identity; + _manifestUrl?: string; + private window; + constructor(wire: Transport, identity: Identity); + protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; + private windowListFromIdentityList; + /** + * Determines if the application is currently running. + * @return {Promise.} + * @tutorial Application.isRunning + */ + isRunning(): Promise; + /** + * Closes the application and any child windows created by the application. + * @param { boolean } [force = false] Close will be prevented from closing when force is false and + * ‘close-requested’ has been subscribed to for application’s main window. + * @return {Promise.} + * @tutorial Application.close + */ + close(force?: boolean): Promise; + /** + * Retrieves an array of wrapped fin.Windows for each of the application’s child windows. + * @return {Promise.Array.<_Window>} + * @tutorial Application.getChildWindows + */ + getChildWindows(): Promise>; + /** + * Retrieves an array of active window groups for all of the application's windows. Each group is + * represented as an array of wrapped fin.Windows. + * @return {Promise.Array.Array.<_Window>} + * @tutorial Application.getGroups + */ + getGroups(): Promise>>; + /** + * Retrieves the JSON manifest that was used to create the application. Invokes the error callback + * if the application was not created from a manifest. + * @return {Promise.} + * @tutorial Application.getManifest + */ + getManifest(): Promise; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback + * if the application was created from a manifest. + * @return {Promise.} + * @tutorial Application.getParentUuid + */ + getParentUuid(): Promise; + /** + * Retrieves current application's shortcut configuration. + * @return {Promise.} + * @tutorial Application.getShortcuts + */ + getShortcuts(): Promise; + /** + * Returns an instance of the main Window of the application + * @return {Promise.<_Window>} + * @tutorial Application.getWindow + */ + getWindow(): Promise<_Window>; + /** + * Manually registers a user with the licensing service. The only data sent by this call is userName and appName. + * @param { string } userName - username to be passed to the RVM. + * @param { string } appName - app name to be passed to the RVM. + * @return {Promise.} + * @tutorial Application.registerUser + */ + registerUser(userName: string, appName: string): Promise; + /** + * Removes the application’s icon from the tray. + * @return {Promise.} + * @tutorial Application.removeTrayIcon + */ + removeTrayIcon(): Promise; + /** + * Restarts the application. + * @return {Promise.} + * @tutorial Application.restart + */ + restart(): Promise; + /** + * Runs the application. When the application is created, run must be called. + * @return {Promise.} + * @tutorial Application.run + */ + run(): Promise; + /** + * Instructs the RVM to schedule one restart of the application. + * @return {Promise.} + * @tutorial Application.scheduleRestart + */ + scheduleRestart(): Promise; + /** + * Adds a customizable icon in the system tray and notifies the application when clicked. + * @param { string } iconUrl Image URL to be used as the icon + * @return {Promise.} + * @tutorial Application.setTrayIcon + */ + setTrayIcon(iconUrl: string): Promise; + /** + * Sets new application's shortcut configuration. + * @param { Object } config New application's shortcut configuration. + * @param {Boolean} [config.desktop] - Enable/disable desktop shortcut. + * @param {Boolean} [config.startMenu] - Enable/disable start menu shortcut. + * @param {Boolean} [config.systemStartup] - Enable/disable system startup shortcut. + * @return {Promise.} + * @tutorial Application.setShortcuts + */ + setShortcuts(config: ConfigInterface): Promise; + /** + * @summary Retrieves information about the system tray. + * @desc The only information currently returned is the position and dimensions. + * @return {Promise.} + * @tutorial Application.getTrayIconInfo + */ + getTrayIconInfo(): Promise; + /** + * Closes the application by terminating its process. + * @return {Promise.} + * @tutorial Application.terminate + */ + terminate(): Promise; + /** + * Waits for a hanging application. This method can be called in response to an application + * "not-responding" to allow the application to continue and to generate another "not-responding" + * message after a certain period of time. + * @return {Promise.} + * @ignore + */ + wait(): Promise; + /** + * Retrieves information about the application. + * @return {Promise.} + * @tutorial Application.getInfo + */ + getInfo(): Promise; +} +export interface Application { + on(type: 'closed', listener: (data: Reply<'application', 'closed'>) => void): Promise; + on(type: 'initialized', listener: (data: Reply<'application', 'initialized'>) => void): Promise; + on(type: 'connected', listener: (data: Reply<'application', 'connected'>) => void): Promise; + on(type: 'crashed', listener: (data: Reply<'application', 'crashed'>) => void): Promise; + on(type: 'error', listener: (data: Reply<'application', 'error'>) => void): Promise; + on(type: 'not-responding', listener: (data: Reply<'application', 'not-responding'>) => void): Promise; + on(type: 'out-of-memory', listener: (data: Reply<'application', 'out-of-memory'>) => void): Promise; + on(type: 'responding', listener: (data: Reply<'application', 'responding'>) => void): Promise; + on(type: 'started', listener: (data: Reply<'application', 'started'>) => void): Promise; + on(type: 'run-requested', listener: (data: Reply<'application', 'run-requested'>) => void): Promise; + on(type: 'window-navigation-rejected', listener: (data: NavigationRejectedReply) => void): Promise; + on(type: 'window-created', listener: (data: Reply<'application', 'window-created'>) => void): Promise; + on(type: 'window-closed', listener: (data: Reply<'application', 'window-closed'>) => void): Promise; + on(type: 'tray-icon-clicked', listener: (data: TrayIconClickReply) => void): Promise; + on(type: 'removeListener', listener: (eventType: string) => void): Promise; + on(type: 'newListener', listener: (eventType: string) => void): Promise; +} diff --git a/types/openfin/v34/_v2/api/base.d.ts b/types/openfin/v34/_v2/api/base.d.ts new file mode 100644 index 0000000000..1f17e1f24f --- /dev/null +++ b/types/openfin/v34/_v2/api/base.d.ts @@ -0,0 +1,43 @@ +/// +import Transport, { Message } from '../transport/transport'; +import { Identity } from '../identity'; +import { EventEmitter } from 'events'; +export interface RuntimeEvent extends Identity { + topic: string; + type: string | symbol; +} +export declare class Base { + wire: Transport; + constructor(wire: Transport); + private _topic; + protected topic: string; + readonly me: Identity; + protected isNodeEnvironment: () => boolean; + protected isOpenFinEnvironment: () => boolean; + protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; +} +export declare class EmitterBase extends Base { + protected identity: Identity; + protected emitter: EventEmitter; + listeners: (event: string | symbol) => Function[]; + listenerCount: (type: string | symbol) => number; + constructor(wire: Transport); + emit: (eventName: string | symbol, ...args: any[]) => void; + protected onmessage: (message: Message) => boolean; + protected registerEventListener: (listener: RuntimeEvent) => Promise>; + protected deregisterEventListener: (listener: RuntimeEvent) => Promise>; + on(eventType: string, listener: (...args: any[]) => void): Promise; + addListener: (eventType: string, listener: (...args: any[]) => void) => Promise; + once(eventType: string, listener: (...args: any[]) => void): Promise; + prependListener(eventType: string, listener: (...args: any[]) => void): Promise; + prependOnceListener(eventType: string, listener: (...args: any[]) => void): Promise; + removeListener(eventType: string, listener: (...args: any[]) => void): Promise; + protected deregisterAllListeners: (eventType: string | symbol) => Promise>; + removeAllListeners(eventType?: string): Promise; +} +export declare class Reply implements Identity { + topic: TOPIC; + type: TYPE; + uuid: string; + name?: string; +} diff --git a/types/openfin/v34/_v2/api/clipboard/clipboard.d.ts b/types/openfin/v34/_v2/api/clipboard/clipboard.d.ts new file mode 100644 index 0000000000..11b466dea0 --- /dev/null +++ b/types/openfin/v34/_v2/api/clipboard/clipboard.d.ts @@ -0,0 +1,70 @@ +import { Base } from '../base'; +import { WriteRequestType, WriteAnyRequestType } from './write-request'; +/** + * WriteRequestType interface + * @typedef { Object } WriteRequestType + * @property { string } name The name of the running application + * @property { string } uuid The uuid of the running application + */ +/** + * The Clipboard API allows reading and writing to the clipboard in multiple formats. + * @namespace +*/ +export default class Clipboard extends Base { + /** + * Writes data into the clipboard as plain text + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typeof + * @return {Promise.} + * @tutorial Clipboard.writeText + */ + writeText(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as plain text + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readText + */ + readText(type?: string): Promise; + /** + * Writes data into the clipboard as Html + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.writeHtml + */ + writeHtml(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as Html + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readHtml + */ + readHtml(type?: string): Promise; + /** + * Writes data into the clipboard as Rtf + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.writeRtf + */ + writeRtf(writeObj: WriteRequestType): Promise; + /** + * Read the content of the clipboard as Rtf + * @param { string } type Clipboard Type + * @return {Promise.} + * @tutorial Clipboard.readRtf + */ + readRtf(type?: string): Promise; + /** + * Writes data into the clipboard + * @param { WriteRequestType } writeObj This object is described in the WriteRequestType typedef + * @return {Promise.} + * @tutorial Clipboard.write + */ + write(writeObj: WriteAnyRequestType): Promise; + /** + * Reads available formats for the clipboard type + * @param { string } type Clipboard Type + * @return {Promise.Array.} + * @tutorial Clipboard.getAvailableFormats + */ + getAvailableFormats(type?: string): Promise>; +} diff --git a/types/openfin/v34/_v2/api/clipboard/write-request.d.ts b/types/openfin/v34/_v2/api/clipboard/write-request.d.ts new file mode 100644 index 0000000000..a2fc5c333e --- /dev/null +++ b/types/openfin/v34/_v2/api/clipboard/write-request.d.ts @@ -0,0 +1,12 @@ +export interface WriteRequestType { + data: string; + type?: string; +} +export interface WriteAnyRequestType { + data: { + text?: string; + html?: string; + rtf?: string; + }; + type?: string; +} diff --git a/types/openfin/v34/_v2/api/external-application/external-application.d.ts b/types/openfin/v34/_v2/api/external-application/external-application.d.ts new file mode 100644 index 0000000000..2d1f46e0f3 --- /dev/null +++ b/types/openfin/v34/_v2/api/external-application/external-application.d.ts @@ -0,0 +1,36 @@ +import { Base, EmitterBase, Reply } from '../base'; +import { Identity } from '../../identity'; +import Transport from '../../transport/transport'; +export interface ExternalApplicationInfo { + parent: Identity; +} +export default class ExternalApplicationModule extends Base { + /** + * Returns an External Application object that represents an existing external application. + * @param {string} uuid The UUID of the external application to be wrapped + * @return {Promise.} + */ + wrap(uuid: string): Promise; +} +/** + * @classdesc An ExternalApplication object representing an application. Allows + * the developer to create, execute, show and close an external application as + * well as listen to application events. + * @class + */ +export declare class ExternalApplication extends EmitterBase { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Retrieves information about the external application. + * @return {Promise.} + * @tutorial ExternalApplication.getInfo + */ + getInfo(): Promise; +} +export interface ExternalApplication { + on(type: 'connected', listener: (data: Reply<'externalapplication', 'connected'>) => void): Promise; + on(type: 'disconnected', listener: (data: Reply<'externalapplication', 'disconnected'>) => void): Promise; + on(type: 'removeListener', listener: (eventType: string) => void): Promise; + on(type: 'newListener', listener: (eventType: string) => void): Promise; +} diff --git a/types/openfin/v34/_v2/api/fin.d.ts b/types/openfin/v34/_v2/api/fin.d.ts new file mode 100644 index 0000000000..1bec2ffb4f --- /dev/null +++ b/types/openfin/v34/_v2/api/fin.d.ts @@ -0,0 +1,27 @@ +/// +import Transport from '../transport/transport'; +import { EventEmitter } from 'events'; +import System from './system/system'; +import _WindowModule from './window/window'; +import Application from './application/application'; +import InterApplicationBus from './interappbus/interappbus'; +import _NotificationModule from './notification/notification'; +import Clipbpard from './clipboard/clipboard'; +import ExternalApplication from './external-application/external-application'; +import _FrameModule from './frame/frame'; +import GlobalHotkey from './global-hotkey'; +import { Identity } from '../identity'; +export default class Fin extends EventEmitter { + private wire; + System: System; + Window: _WindowModule; + Application: Application; + InterApplicationBus: InterApplicationBus; + Notification: _NotificationModule; + Clipboard: Clipbpard; + ExternalApplication: ExternalApplication; + Frame: _FrameModule; + GlobalHotkey: GlobalHotkey; + readonly me: Identity; + constructor(wire: Transport); +} diff --git a/types/openfin/v34/_v2/api/frame/frame.d.ts b/types/openfin/v34/_v2/api/frame/frame.d.ts new file mode 100644 index 0000000000..4a5ab971de --- /dev/null +++ b/types/openfin/v34/_v2/api/frame/frame.d.ts @@ -0,0 +1,51 @@ +import { Base, EmitterBase } from '../base'; +import { Identity } from '../../identity'; +import Transport from '../../transport/transport'; +export declare type EntityType = 'window' | 'iframe' | 'external connection' | 'unknown'; +export interface FrameInfo { + uuid: string; + name: string; + entityType: EntityType; + parent: Identity; +} +export default class _FrameModule extends Base { + /** + * Gets a reference to the specified frame. The frame does not have to exist + * @param {string} uuid - uuid of the frame you want to wrap + * @param {string} name - name of the frame you want to wrap + * @return {Promise.<_Frame>} + */ + wrap(uuid: string, name: string): Promise<_Frame>; + /** + * Get a reference to the current frame + * @return {Promise.<_Frame>} + */ + getCurrent(): Promise<_Frame>; +} +/** + * @classdesc Represents a way to interact with `iframes`. Facilitates discovery of current context + * (iframe or main window) as well as the ability to listen for frame-specific events. + * @class + * @alias Frame + */ +export declare class _Frame extends EmitterBase { + identity: Identity; + constructor(wire: Transport, identity: Identity); + /** + * Returns a frame info object for the represented frame + * @return {Promise.} + * @tutorial Frame.getInfo + */ + getInfo(): Promise; + /** + * Returns a frame info object representing the window that the referenced iframe is + * currently embedded in + * @return {Promise.} + * @tutorial Frame.getParentWindow + */ + getParentWindow(): Promise; +} +export interface _Frame { + on(type: 'connected', listener: (eventType: string) => void): Promise; + on(type: 'disconnected', listener: (eventType: string) => void): Promise; +} diff --git a/types/openfin/v34/_v2/api/global-hotkey/index.d.ts b/types/openfin/v34/_v2/api/global-hotkey/index.d.ts new file mode 100644 index 0000000000..148ddff7e9 --- /dev/null +++ b/types/openfin/v34/_v2/api/global-hotkey/index.d.ts @@ -0,0 +1,33 @@ +import { EmitterBase } from '../base'; +import Transport from '../../transport/transport'; +/** + * The GlobalHotkey module can register/unregister a global hotkeys. + * @namespace + */ +export default class GlobalHotkey extends EmitterBase { + constructor(wire: Transport); + /** + * Registers a global hotkey with the operating system. + * @return {Promise.} + * @tutorial GlobalHotkey.register + */ + register(hotkey: string, listener: (...args: any[]) => void): Promise; + /** + * Unregisters a global hotkey with the operating system. + * @return {Promise.} + * @tutorial GlobalHotkey.unregister + */ + unregister(hotkey: string): Promise; + /** + * Unregisters all global hotkeys for the current application. + * @return {Promise.} + * @tutorial GlobalHotkey.unregisterAll + */ + unregisterAll(): Promise; + /** + * Checks if a given hotkey has been registered + * @return {Promise.} + * @tutorial GlobalHotkey.isRegistered + */ + isRegistered(hotkey: string): Promise; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/channel.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/channel.d.ts new file mode 100644 index 0000000000..1c9a502e12 --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/channel.d.ts @@ -0,0 +1,31 @@ +import { Identity } from '../../../identity'; +import Transport, { Message } from '../../../transport/transport'; +export interface ProviderIdentity extends Identity { + channelId: string; + isExternal?: boolean; + channelName: string; +} +export declare type Action = (() => any) | ((payload: any) => any) | ((payload: any, id: ProviderIdentity) => any); +export declare type Middleware = (() => any) | ((action: string) => any) | ((action: string, payload: any) => any) | ((action: string, payload: any, id: ProviderIdentity) => any); +export interface ChannelMessagePayload extends Identity { + action: string; + payload: any; +} +export declare class ChannelBase { + protected subscriptions: any; + defaultAction: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any; + private preAction; + private postAction; + private errorMiddleware; + private defaultSet; + protected send: (to: Identity, action: string, payload: any) => Promise>; + protected providerIdentity: ProviderIdentity; + constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); + processAction(action: string, payload: any, senderIdentity: ProviderIdentity): Promise; + beforeAction(func: Action): void; + onError(func: (e: any, action: string, id: Identity) => any): void; + afterAction(func: Action): void; + remove(action: string): void; + setDefaultAction(func: (action?: string, payload?: any, senderIdentity?: ProviderIdentity) => any): void; + register(topic: string, listener: Action): boolean; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/client.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/client.d.ts new file mode 100644 index 0000000000..d1c128a349 --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/client.d.ts @@ -0,0 +1,6 @@ +import { ChannelBase, ProviderIdentity } from './channel'; +import Transport from '../../../transport/transport'; +export declare class ChannelClient extends ChannelBase { + constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); + dispatch(action: string, payload?: any): Promise; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/index.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/index.d.ts new file mode 100644 index 0000000000..1297d2c5ea --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/index.d.ts @@ -0,0 +1,33 @@ +import { ChannelClient } from './client'; +import { Identity } from '../../../identity'; +import { ChannelProvider } from './provider'; +import { EmitterBase } from '../../base'; +import Transport, { Message, Payload } from '../../../transport/transport'; +import { ProviderIdentity } from './channel'; +export interface Options { + wait?: boolean; + uuid: string; + name?: string; + payload?: any; +} +export interface ChannelPayload { + payload: Payload; +} +export interface ChannelMessage { + senderIdentity: Identity; + ackToSender: any; + providerIdentity: Identity; + connectAction: boolean; +} +export declare class Channel extends EmitterBase { + private channelMap; + constructor(wire: Transport); + getAllChannels(): Promise; + onChannelConnect(listener: Function): Promise; + onChannelDisconnect(listener: Function): Promise; + connect(options: Options): Promise; + create(channelName?: string): Promise; + onmessage: (msg: Message) => boolean; + private processChannelMessage; + private processChannelConnection; +} diff --git a/types/openfin/v34/_v2/api/interappbus/channel/provider.d.ts b/types/openfin/v34/_v2/api/interappbus/channel/provider.d.ts new file mode 100644 index 0000000000..a869928ac2 --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/channel/provider.d.ts @@ -0,0 +1,13 @@ +import { ChannelBase, ProviderIdentity } from './channel'; +import Transport from '../../../transport/transport'; +export declare type ConnectionListener = (adapterIdentity: ProviderIdentity, connectionMessage?: any) => any; +export declare class ChannelProvider extends ChannelBase { + private connectListener; + private disconnectListener; + connections: ProviderIdentity[]; + constructor(providerIdentity: ProviderIdentity, send: Transport['sendAction']); + dispatch(to: ProviderIdentity, action: string, payload: any): Promise; + processConnection(senderId: ProviderIdentity, payload: any): Promise; + publish(action: string, payload: any): Promise[]; + onConnection(listener: ConnectionListener): void; +} diff --git a/types/openfin/v34/_v2/api/interappbus/interappbus.d.ts b/types/openfin/v34/_v2/api/interappbus/interappbus.d.ts new file mode 100644 index 0000000000..48aaf7430c --- /dev/null +++ b/types/openfin/v34/_v2/api/interappbus/interappbus.d.ts @@ -0,0 +1,80 @@ +/// +import { Base } from '../base'; +import { Identity } from '../../identity'; +import Transport, { Message } from '../../transport/transport'; +import { EventEmitter } from 'events'; +import { Channel } from './channel/index'; +/** + * A messaging bus that allows for pub/sub messaging between different applications. + * @namespace +*/ +export default class InterApplicationBus extends Base { + Channel: Channel; + events: { + subscriberAdded: string; + subscriberRemoved: string; + }; + private refCounter; + protected emitter: EventEmitter; + on: any; + removeAllListeners: any; + constructor(wire: Transport); + /** + * Publishes a message to all applications running on OpenFin Runtime that + * are subscribed to the specified topic. + * @param { string } topic The topic on which the message is sent + * @param { any } message The message to be published. Can be either a primitive + * data type (string, number, or boolean) or composite data type (object, array) + * that is composed of other primitive or composite data types + * @return {Promise.} + * @tutorial InterApplicationBus.publish + */ + publish(topic: string, message: any): Promise; + /** + * Sends a message to a specific application on a specific topic. + * @param { object } destination The uuid of the application to which the message is sent + * @param { string } topic The topic on which the message is sent + * @param { any } message The message to be sent. Can be either a primitive data + * type (string, number, or boolean) or composite data type (object, array) that + * is composed of other primitive or composite data types + * @return {Promise.} + * @tutorial InterApplicationBus.send + */ + send(destination: Identity, topic: string, message: any): Promise; + /** + * Subscribes to messages from the specified application on the specified topic. + * If the subscription is for a uuid, [name], topic combination that has already + * been published to upon subscription you will receive the last 20 missed messages + * in the order they were published. + * @param { Identity } source This object is described in the Identity in the typedef + * @param { string } topic The topic on which the message is sent + * @param { function } listener A function that is called when a message has + * been received. It is passed the message, uuid and name of the sending application. + * The message can be either a primitive data type (string, number, or boolean) or + * composite data type (object, array) that is composed of other primitive or composite + * data types + * @return {Promise.} + * @tutorial InterApplicationBus.subcribe + */ + subscribe(source: Identity, topic: string, listener: any): Promise; + /** + * Unsubscribes to messages from the specified application on the specified topic. + * @param { Identity } source This object is described in the Identity in the typedef + * @param { string } topic The topic on which the message is sent + * @param { function } listener A callback previously registered with subscribe() + * @return {Promise.} + * @tutorial InterApplicationBus.unsubscribe + */ + unsubscribe(source: Identity, topic: string, listener: any): Promise; + private processMessage; + private emitSubscriverEvent; + protected createSubscriptionKey(uuid: string, name: string, topic: string): string; + protected onmessage(message: Message): boolean; +} +export declare class InterAppPayload { + sourceUuid: string; + sourceWindowName: string; + topic: string; + destinationUuid?: string; + message?: any; +} diff --git a/types/openfin/v34/_v2/api/notification/notification.d.ts b/types/openfin/v34/_v2/api/notification/notification.d.ts new file mode 100644 index 0000000000..8deec180ba --- /dev/null +++ b/types/openfin/v34/_v2/api/notification/notification.d.ts @@ -0,0 +1,71 @@ +import { Base, EmitterBase } from '../base'; +import { Identity } from '../../identity'; +import Transport from '../../transport/transport'; +export declare class NotificationOptions { + url: string; + message: string; + timeout: string | number; + notificationId: number; + uuidOfProxiedApp: string; + ignoreMouseOver: boolean; + constructor(options: any, identity: Identity, notificationId: number); +} +export interface NotificationCallback { + message?: any; +} +/** + * @classdesc A Notification object represents a window on OpenFin Runtime which + * is shown briefly to the user on the bottom-right corner of the primary monitor. + * A notification is typically used to alert the user of some important event which + * requires his or her attention. Notifications are a child or your application that + * are controlled by the runtime. + * @class + * @alias Notification + */ +export declare class _Notification extends EmitterBase { + private listenerList; + private unhookAllListeners; + private buildLocalPayload; + protected options: NotificationOptions; + protected generalListener: (msg: any) => void; + protected notificationId: number; + protected onmessage: (message: any) => boolean; + constructor(wire: Transport, options: NotificationOptions); + url: string; + timeout: number | string; + message: any; + /** + * Invoked when the notification is shown + * @return {Promise.} + * @tutorial Notification.show + */ + show(): Promise; + /** + * Sends a message to the notification. + * @param { any } message The message to be sent to the notification. + * Can be either a primitive data type (string, number, or boolean) + * or composite data type (object, array) that is composed of other + * primitive or composite data types + * @return {Promise.} + * @tutorial Notification.sendMessage + */ + sendMessage(message: any): Promise; + /** + * Closes the notification + * @return {Promise.} + * @tutorial Notification.close + */ + close(): Promise; +} +export default class _NotificationModule extends Base { + private nextNoteId; + private genNoteId; + events: { + show: string; + close: string; + error: string; + click: string; + message: string; + }; + create(options: any): _Notification; +} diff --git a/types/openfin/v34/_v2/api/system/application.d.ts b/types/openfin/v34/_v2/api/system/application.d.ts new file mode 100644 index 0000000000..9d7ea09b67 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/application.d.ts @@ -0,0 +1,4 @@ +export interface ApplicationInfo { + isRunning: boolean; + uuid: string; +} diff --git a/types/openfin/v34/_v2/api/system/clearCacheOption.d.ts b/types/openfin/v34/_v2/api/system/clearCacheOption.d.ts new file mode 100644 index 0000000000..6bae8116b7 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/clearCacheOption.d.ts @@ -0,0 +1,6 @@ +export interface ClearCacheOption { + appcache?: boolean; + cache?: boolean; + cookies?: boolean; + localStorage?: boolean; +} diff --git a/types/openfin/v34/_v2/api/system/cookie.d.ts b/types/openfin/v34/_v2/api/system/cookie.d.ts new file mode 100644 index 0000000000..1d229232c6 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/cookie.d.ts @@ -0,0 +1,8 @@ +export interface CookieInfo { + name: string; + domain: string; + path: string; +} +export interface CookieOption { + name: string; +} diff --git a/types/openfin/v34/_v2/api/system/crashReporterOption.d.ts b/types/openfin/v34/_v2/api/system/crashReporterOption.d.ts new file mode 100644 index 0000000000..7d512fdd7b --- /dev/null +++ b/types/openfin/v34/_v2/api/system/crashReporterOption.d.ts @@ -0,0 +1,4 @@ +export interface CrashReporterOption { + diagnosticMode: boolean; + isRunning?: boolean; +} diff --git a/types/openfin/v34/_v2/api/system/download-asset.d.ts b/types/openfin/v34/_v2/api/system/download-asset.d.ts new file mode 100644 index 0000000000..be513f5f0e --- /dev/null +++ b/types/openfin/v34/_v2/api/system/download-asset.d.ts @@ -0,0 +1,18 @@ +export interface AppAssetInfo { + src: string; + alias: string; + version: string; + target?: string; + args?: string; + mandatory?: boolean; +} +export interface RuntimeDownloadOptions { + version: string; +} +export interface AppAssetRequest { + alias: string; +} +export interface RuntimeDownloadProgress { + downloadedBytes: number; + totalBytes: number; +} diff --git a/types/openfin/v34/_v2/api/system/download-preload.d.ts b/types/openfin/v34/_v2/api/system/download-preload.d.ts new file mode 100644 index 0000000000..a7e635bcb8 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/download-preload.d.ts @@ -0,0 +1,8 @@ +export interface DownloadPreloadOption { + url: string; +} +export interface DownloadPreloadInfo { + success: boolean; + url?: string; + error: string; +} diff --git a/types/openfin/v34/_v2/api/system/entity.d.ts b/types/openfin/v34/_v2/api/system/entity.d.ts new file mode 100644 index 0000000000..50011a64f3 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/entity.d.ts @@ -0,0 +1,11 @@ +import { Identity } from '../../identity'; +export interface Entity { + type: string; + uuid: string; +} +export interface EntityInfo { + name: string; + uuid: string; + parent: Identity; + entityType: string; +} diff --git a/types/openfin/v34/_v2/api/system/external-process.d.ts b/types/openfin/v34/_v2/api/system/external-process.d.ts new file mode 100644 index 0000000000..8a68f1eae3 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/external-process.d.ts @@ -0,0 +1,22 @@ +export interface ExternalProcessRequestType { + path: string; + arguments: string; + listener: LaunchExternalProcessListener; +} +export interface ExitCode { + topic: string; + uuid: string; + exitCode: number; +} +export interface LaunchExternalProcessListener { + (code: ExitCode): void; +} +export interface TerminateExternalRequestType { + uuid: string; + timeout: number; + killTree: boolean; +} +export interface ExternalConnection { + token: string; + uuid: string; +} diff --git a/types/openfin/v34/_v2/api/system/host-specs.d.ts b/types/openfin/v34/_v2/api/system/host-specs.d.ts new file mode 100644 index 0000000000..2c5a134aea --- /dev/null +++ b/types/openfin/v34/_v2/api/system/host-specs.d.ts @@ -0,0 +1,22 @@ +export interface Time { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; +} +export interface CpuInfo { + model: string; + speed: number; + times: Time; +} +export interface GpuInfo { + name: string; +} +export interface HostSpecs { + cpu: CpuInfo[]; + memory: number; + arch: string; + name: string; + gpu: GpuInfo; +} diff --git a/types/openfin/v34/_v2/api/system/log.d.ts b/types/openfin/v34/_v2/api/system/log.d.ts new file mode 100644 index 0000000000..9b03b28c57 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/log.d.ts @@ -0,0 +1,11 @@ +export interface GetLogRequestType { + name: string; + endFile?: string; + sizeLimit?: number; +} +export interface LogInfo { + name: string; + size: number; + date: string; +} +export declare type LogLevel = 'verbose' | 'info' | 'warning' | 'error' | 'fatal'; diff --git a/types/openfin/v34/_v2/api/system/monitor.d.ts b/types/openfin/v34/_v2/api/system/monitor.d.ts new file mode 100644 index 0000000000..ea4aed799c --- /dev/null +++ b/types/openfin/v34/_v2/api/system/monitor.d.ts @@ -0,0 +1,39 @@ +import { Point } from './point'; +export interface MonitorInfo { + deviceScaleFactor: number; + dpi: Point; + nonPrimaryMonitors: Array; + primaryMonitor: MonitorDetails; + reason: string; + taskBar: TaskBar; + virtualScreen: DipRect; +} +export interface MonitorDetails { + available: DipScaleRects; + availableRect: Rect; + deviceId: string; + displayDeviceActive: boolean; + deviceScaleFactor: number; + monitorRect: Rect; + name: number; + dpi: Point; + monitor: DipScaleRects; +} +export interface Rect { + bottom: number; + left: number; + right: number; + top: number; +} +export interface DipRect extends Rect { + dipRect: Rect; + scaledRect: Rect; +} +export interface DipScaleRects { + dipRect: Rect; + scaledRect: Rect; +} +export interface TaskBar extends DipScaleRects { + edge: string; + rect: Rect; +} diff --git a/types/openfin/v34/_v2/api/system/point.d.ts b/types/openfin/v34/_v2/api/system/point.d.ts new file mode 100644 index 0000000000..b9830ce514 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/point.d.ts @@ -0,0 +1,8 @@ +export interface Point { + x: number; + y: number; +} +export interface PointTopLeft { + top: number; + left: number; +} diff --git a/types/openfin/v34/_v2/api/system/process.d.ts b/types/openfin/v34/_v2/api/system/process.d.ts new file mode 100644 index 0000000000..8a513ceecd --- /dev/null +++ b/types/openfin/v34/_v2/api/system/process.d.ts @@ -0,0 +1,15 @@ +export interface ProcessInfo { + cpuUsage: number; + name: string; + nonPagedPoolUsage: number; + pageFaultCount: number; + pagedPoolUsage: number; + pagefileUsage: number; + peakNonPagedPoolUsage: number; + peakPagedPoolUsage: number; + peakPagefileUsage: number; + peakWorkingSetSize: number; + processId: number; + uuid: string; + workingSetSize: number; +} diff --git a/types/openfin/v34/_v2/api/system/proxy.d.ts b/types/openfin/v34/_v2/api/system/proxy.d.ts new file mode 100644 index 0000000000..597afa6548 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/proxy.d.ts @@ -0,0 +1,14 @@ +export interface ProxyInfo { + config: ProxyConfig; + system: { + autoConfigUrl: string; + bypass: ''; + enabled: boolean; + proxy: string; + }; +} +export interface ProxyConfig { + proxyAddress: string; + proxyPort: number; + type: string; +} diff --git a/types/openfin/v34/_v2/api/system/registry-info.d.ts b/types/openfin/v34/_v2/api/system/registry-info.d.ts new file mode 100644 index 0000000000..a48ed34959 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/registry-info.d.ts @@ -0,0 +1,7 @@ +export interface RegistryInfo { + data: any; + rootKey: string; + subkey: string; + type: string; + value: string; +} diff --git a/types/openfin/v34/_v2/api/system/runtime-info.d.ts b/types/openfin/v34/_v2/api/system/runtime-info.d.ts new file mode 100644 index 0000000000..1508f87ef3 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/runtime-info.d.ts @@ -0,0 +1,7 @@ +export interface RuntimeInfo { + architecture: string; + manifestUrl: string; + port: number; + securityRealm?: string; + version: string; +} diff --git a/types/openfin/v34/_v2/api/system/rvm.d.ts b/types/openfin/v34/_v2/api/system/rvm.d.ts new file mode 100644 index 0000000000..42fc0b94db --- /dev/null +++ b/types/openfin/v34/_v2/api/system/rvm.d.ts @@ -0,0 +1,5 @@ +export interface RVMInfo { + action: string; + 'start-time': string; + version: string; +} diff --git a/types/openfin/v34/_v2/api/system/system.d.ts b/types/openfin/v34/_v2/api/system/system.d.ts new file mode 100644 index 0000000000..8c0bc7d3b6 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/system.d.ts @@ -0,0 +1,475 @@ +import { EmitterBase } from '../base'; +import { ApplicationInfo } from './application'; +import { WindowInfo } from './window'; +import { Identity } from '../../identity'; +import { MonitorInfo } from './monitor'; +import { PointTopLeft } from './point'; +import { GetLogRequestType, LogInfo, LogLevel } from './log'; +import { ProxyInfo, ProxyConfig } from './proxy'; +import { ProcessInfo } from './process'; +import { AppAssetInfo, AppAssetRequest, RuntimeDownloadOptions, RuntimeDownloadProgress } from './download-asset'; +import { RVMInfo } from './rvm'; +import { RuntimeInfo } from './runtime-info'; +import { Entity, EntityInfo } from './entity'; +import { HostSpecs } from './host-specs'; +import { ExternalProcessRequestType, TerminateExternalRequestType, ExternalConnection } from './external-process'; +import Transport from '../../transport/transport'; +import { CookieInfo, CookieOption } from './cookie'; +import { RegistryInfo } from './registry-info'; +import { DownloadPreloadOption, DownloadPreloadInfo } from './download-preload'; +import { ClearCacheOption } from './clearCacheOption'; +import { CrashReporterOption } from './crashReporterOption'; +/** + * AppAssetInfo interface + * @typedef { Object } AppAssetInfo + * @property { string } src The URL to a zip file containing the package files (executables, dlls, etc…) + * @property { string } alias The name of the asset + * @property { string } version The version of the package + * @property { string } target Specify default executable to launch. This option can be overridden in launchExternalProcess + * @property { args } args The default command line arguments for the aforementioned target. + * @property { boolean } mandatory When set to true, the app will fail to load if the asset cannot be downloaded. + * When set to false, the app will continue to load if the asset cannot be downloaded. (Default: true) + */ +/** + * AppAssetRequest interface + * @typedef { Object } AppAssetRequest + * @property { string } alias The name of the asset + */ +/** + * CookieInfo interface + * @typedef { Object } CookieInfo + * @property { string } name The name of the cookie + * @property { string } domain The domain of the cookie + * @property { string } path The path of the cookie + */ +/** + * CookieOption interface + * @typedef { Object } CookieOption + * @property { string } name The name of the cookie + */ +/** + * ExternalConnection interface + * @typedef { Object } ExternalConnection + * @property { string } token The token to broker an external connection + * @property { string } uuid The uuid of the external connection + */ +/** +* ExternalProcessRequestType interface +* @typedef { Object } ExternalProcessRequestType +* @property { string } path The file path to where the running application resides +* @property { string } arguments The argument passed to the running application +* @property { Object } listener This is described in the {LaunchExternalProcessListner} type definition +*/ +/** + * Entity interface + * @typedef { Object } Entity + * @property { string } type The type of the entity + * @property { string } uuid The uuid of the entity + */ +/** + * EntityInfo interface + * @typedef { Object } EntityInfo + * @property { string } name The name of the entity + * @property { string } uuid The uuid of the entity + * @property { Identity } parent The parent of the entity + * @property { string } entityType The type of the entity + */ +/** +* GetLogRequestType interface +* @typedef { Object } GetLogRequestType +* @property { string } name The name of the running application +* @property { number } endFile The file length of the log file +* @property { number } sizeLimit The set size limit of the log file +*/ +/** + * Identity interface + * @typedef { Object } Identity + * @property { string } name The name of the application + * @property { string } uuid The uuid of the application + */ +/** + * @typedef { verbose | info | warning | error | fatal } LogLevel + * @summary Log verbosity levels. + * @desc Describes the minimum level (inclusive) above which logs will be written + * + * @property { string } verbose all logs written + * @property { string } info info and above + * @property { string } warning warning and above + * @property { string } error error and above + * @property { string } fatal fatal only, indicates a crash is imminent + */ +/** + * ProxyConfig interface + * @typedef { Object } ProxyConfig + * @property { numder } proxyPort The port number of the running application + * @property { string } proxyAddress The address of the running application + * @property { string } type + */ +/** + * RegistryInfo interface + * @typedef { Object } RegistryInfo + * @property { any } data The registry data + * @property { string } rootKey The registry root key + * @property { string } subkey The registry key + * @property { string } type The registry type + * @property { string } value The registry value name + */ +/** + * RuntimeDownloadOptions interface + * @typedef { Object } RuntimeDownloadOptions + * @desc These are the options object required by the downloadRuntime function. + * @property { string } version The given version to download + */ +/** + * TerminateExternalRequestType interface + * @typedef { Object } TerminateExternalRequestType + * @property { string } uuid The uuid of the running application + * @property { number } timeout Time out period before the running application terminates + * @property { boolean } killtree Value to terminate the running application + */ +/** + * DownloadPreloadOption interface + * @typedef { Object } DownloadPreloadOption + * @desc These are the options object required by the downloadPreloadScripts function + * @property { string } url url to the preload script + */ +/** + * DownloadPreloadInfo interface + * @typedef { Object } DownloadPreloadInfo + * @desc downloadPreloadScripts function return value + * @property { string } url url to the preload script + * @property { string } error error during preload script acquisition + * @property { boolean } succeess download operation success + */ +/** + * @typedef { Object } ClearCacheOption + * @summary Clear cache options. + * @desc These are the options required by the clearCache function. + * + * @property {boolean} appcache html5 application cache + * @property {boolean} cache browser data cache for html files and images + * @property {boolean} cookies browser cookies + * @property {boolean} localStorage browser data that can be used across sessions + */ +/** +* CrashReporterOption interface +* @typedef { Object } CrashReporterOption +* @property { boolean } diagnosticMode In diagnostic mode the crash reporter will send diagnostic logs to +* the OpenFin reporting service on runtime shutdown +* @property { boolean } isRunning check if it's running +*/ +/** + * An object representing the core of OpenFin Runtime. Allows the developer + * to perform system-level actions, such as accessing logs, viewing processes, + * clearing the cache and exiting the runtime. + * @namespace + */ +export default class System extends EmitterBase { + constructor(wire: Transport); + /** + * Returns the version of the runtime. The version contains the major, minor, + * build and revision numbers. + * @return {Promise.} + * @tutorial System.getVersion + */ + getVersion(): Promise; + /** + * Clears cached data containing application resource + * files (images, HTML, JavaScript files), cookies, and items stored in the + * Local Storage. + * @param { ClearCacheOption } options - See tutorial for more details. + * @return {Promise.} + * @tutorial System.clearCache + */ + clearCache(options: ClearCacheOption): Promise; + /** + * Clears all cached data when OpenFin Runtime exits. + * @return {Promise.} + * @tutorial System.deleteCacheOnExit + */ + deleteCacheOnExit(): Promise; + /** + * Exits the Runtime. + * @return {Promise.} + * @tutorial System.exit + */ + exit(): Promise; + /** + * Writes any unwritten cookies data to disk. + * @return {Promise.} + * @tutorial System.flushCookieStore + */ + flushCookieStore(): Promise; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + * @return {Promise.Array.} + * @tutorial System.getAllWindows + */ + getAllWindows(): Promise>; + /** + * Retrieves an array of data for all applications. + * @return {Promise.Array.} + * @tutorial System.getAllApplications + */ + getAllApplications(): Promise>; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + * @return {Promise.} + * @tutorial System.getCommandLineArguments + */ + getCommandLineArguments(): Promise; + /** + * Get the current state of the crash reporter. + * @return {Promise.} + * @tutorial System.getCrashReporterState + */ + getCrashReporterState(): Promise; + /** + * Returns a unique identifier (UUID) for the machine (SHA256 hash of the system's MAC address). + * This call will return the same value on subsequent calls on the same machine(host). + * The values will be different on different machines, and should be considered globally unique. + * @return {Promise.} + * @tutorial System.getDeviceId + */ + getDeviceId(): Promise; + /** + * Start the crash reporter for the browser process if not already running. + * You can optionally specify `diagnosticMode` to have the logs sent to + * OpenFin on runtime close + * + * @param { CrashReporterOption } options - configure crash reporter + * @return {Promise.} + * @tutorial System.startCrashReporter + */ + startCrashReporter(options: CrashReporterOption): Promise; + /** + * Returns a hex encoded hash of the mac address and the currently logged in user name + * @return {Promise.} + * @tutorial System.getDeviceUserId + */ + getDeviceUserId(): Promise; + /** + * Retrieves a frame info object for the uuid and name passed in + * @param { string } uuid - The UUID of the target. + * @param { string } name - The name of the target. + * @return {Promise.} + * @tutorial System.getEntityInfo + */ + getEntityInfo(uuid: string, name: string): Promise; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed + * @return {Promise.} + * @tutorial System.getEnvironmentVariable + */ + getEnvironmentVariable(envName: string): Promise; + /** + * Get current focused window. + * @return {Promise.} + * @tutorial System.getFocusedWindow + */ + getFocusedWindow(): Promise; + /** + * Retrieves the contents of the log with the specified filename. + * @param { GetLogRequestType } options A object that id defined by the GetLogRequestType interface + * @return {Promise.} + * @tutorial System.getLog + */ + getLog(options: GetLogRequestType): Promise; + /** + * Returns the minimum (inclusive) logging level that is currently being written to the log. + * @return {Promise.} + * @tutorial System.getMinLogLevel + */ + getMinLogLevel(): Promise; + /** + * Retrieves an array containing information for each log file. + * @return {Promise.Array} + * @tutorial System.getLogList + */ + getLogList(): Promise>; + /** + * Retrieves an object that contains data about the monitor setup of the + * computer that the runtime is running on. + * @return {Promise.} + * @tutorial System.getMonitorInfo + */ + getMonitorInfo(): Promise; + /** + * Returns the mouse in virtual screen coordinates (left, top). + * @return {Promise.} + * @tutorial System.getMousePosition + */ + getMousePosition(): Promise; + /** + * Retrieves an array of all of the runtime processes that are currently + * running. Each element in the array is an object containing the uuid + * and the name of the application to which the process belongs. + * @return {Promise.Array.} + * @tutorial System.getProcessList + */ + getProcessList(): Promise>; + /** + * Retrieves the Proxy settings. + * @return {Promise.} + * @tutorial System.getProxySettings + */ + getProxySettings(): Promise; + /** + * Returns information about the running Runtime in an object. + * @return {Promise.} + * @tutorial System.getRuntimeInfo + */ + getRuntimeInfo(): Promise; + /** + * Returns information about the running RVM in an object. + * @return {Promise.} + * @tutorial System.getRvmInfo + */ + getRvmInfo(): Promise; + /** + * Retrieves system information. + * @return {Promise.} + * @tutorial System.getHostSpecs + */ + getHostSpecs(): Promise; + /** + * Runs an executable or batch file. + * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface + * @return {Promise.} + * @tutorial System.launchExternalProcess + */ + launchExternalProcess(options: ExternalProcessRequestType): Promise; + /** + * Monitors a running process. + * @param { number } pid See tutorial for more details + * @return {Promise.} + * @tutorial System.monitorExternalProcess + */ + monitorExternalProcess(pid: number): Promise; + /** + * Writes the passed message into both the log file and the console. + * @param { string } level The log level for the entry. Can be either "info", "warning" or "error" + * @param { string } message The log message text + * @return {Promise.} + * @tutorial System.log + */ + log(level: string, message: string): Promise; + /** + * Opens the passed URL in the default web browser. + * @param { string } url The URL to open + * @return {Promise.} + * @tutorial System.openUrlWithBrowser + */ + openUrlWithBrowser(url: string): Promise; + /** + * Removes the process entry for the passed UUID obtained from a prior call + * of fin.System.launchExternalProcess(). + * @param { string } uuid The UUID for a process obtained from a prior call to fin.desktop.System.launchExternalProcess() + * @return {Promise.} + * @tutorial System.releaseExternalProcess + */ + releaseExternalProcess(uuid: string): Promise; + /** + * Shows the Chromium Developer Tools for the specified window + * @param { Identity } identity This is a object that is defined by the Identity interface + * @return {Promise.} + * @tutorial System.showDeveloperTools + */ + showDeveloperTools(identity: Identity): Promise; + /** + * Attempt to close an external process. The process will be terminated if it + * has not closed after the elapsed timeout in milliseconds. + * @param { TerminateExternalRequestType } options A object defined in the TerminateExternalRequestType interface + * @return {Promise.} + * @tutorial System.terminateExternalProcess + */ + terminateExternalProcess(options: TerminateExternalRequestType): Promise; + /** + * Update the OpenFin Runtime Proxy settings. + * @param { ProxyConfig } options A config object defined in the ProxyConfig interface + * @return {Promise.} + * @tutorial System.updateProxySettings + */ + updateProxySettings(options: ProxyConfig): Promise; + /** + * Downloads the given application asset + * @param { AppAssetInfo } appAsset App asset object + * @return {Promise.} + * @tutorial System.downloadAsset + */ + downloadAsset(appAsset: AppAssetInfo, progressListener: (progress: RuntimeDownloadProgress) => void): Promise; + /** + * Downloads a version of the runtime. + * @param { RuntimeDownloadOptions } options - Download options. + * @param {Function} [progressListener] - called as the runtime is downloaded with progress information. + * @return {Promise.} + * @tutorial System.downloadRuntime + */ + downloadRuntime(options: RuntimeDownloadOptions, progressListener: (progress: RuntimeDownloadProgress) => void): Promise; + /** + * Download preload scripts from given URLs + * @param {DownloadPreloadOption[]} scripts - URLs of preload scripts. See tutorial for more details. + * @return {Promise.Array} + * @tutorial System.downloadPreloadScripts + */ + downloadPreloadScripts(scripts: Array): Promise>; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + * @return {Promise.Array.} + * @tutorial System.getAllExternalApplications + */ + getAllExternalApplications(): Promise>; + /** + * Retrieves app asset information. + * @param { AppAssetRequest } options + * @return {Promise.} + * @tutorial System.getAppAssetInfo + */ + getAppAssetInfo(options: AppAssetRequest): Promise; + /** + * Get additional info of cookies. + * @param { CookieOption } options - See tutorial for more details. + * @return {Promise.Array.} + * @tutorial System.getCookies + */ + getCookies(options: CookieOption): Promise>; + /** + * Set the minimum log level above which logs will be written to the OpenFin log + * @param { LogLevel } The minimum level (inclusive) above which all calls to log will be written + * @return {Promise.} + * @tutorial System.setMinLogLevel + */ + setMinLogLevel(level: LogLevel): Promise; + /** + * Retrieves the UUID of the computer on which the runtime is installed + * @param { string } uuid The uuid of the running application + * @return {Promise.} + * @tutorial System.resolveUuid + */ + resolveUuid(uuid: string): Promise; + /** + * Retrieves an array of data for all external applications + * @param { Identity } requestingIdentity This object is described in the Identity typedef + * @param { any } data Any data type to pass to the method + * @return {Promise.} + * @ignore + */ + executeOnRemote(requestingIdentity: Identity, data: any): Promise; + /** + * Reads the specifed value from the registry. + * @param { string } rootKey - The registry root key. + * @param { string } subkey - The registry key. + * @param { string } value - The registry value name. + * @return {Promise.} + * @tutorial System.readRegistryValue + */ + readRegistryValue(rootKey: string, subkey: string, value: string): Promise; + /** + * This function call will register a unique id and produce a token. + * The token can be used to broker an external connection. + * @param { string } uuid - A UUID for the remote connection. + * @return {Promise.} + * @tutorial System.registerExternalConnection + */ + registerExternalConnection(uuid: string): Promise; +} diff --git a/types/openfin/v34/_v2/api/system/window.d.ts b/types/openfin/v34/_v2/api/system/window.d.ts new file mode 100644 index 0000000000..886084fad6 --- /dev/null +++ b/types/openfin/v34/_v2/api/system/window.d.ts @@ -0,0 +1,14 @@ +export interface WindowInfo { + uuid: string; + mainWindow: WindowDetail; + childWindows: Array; +} +export interface WindowDetail { + name: string; + top: number; + right: number; + bottom: number; + height: number; + width: number; + left: number; +} diff --git a/types/openfin/v34/_v2/api/window/bounds-changed.d.ts b/types/openfin/v34/_v2/api/window/bounds-changed.d.ts new file mode 100644 index 0000000000..f7801da3fc --- /dev/null +++ b/types/openfin/v34/_v2/api/window/bounds-changed.d.ts @@ -0,0 +1,14 @@ +import { Reply } from '../base'; +export default class BoundsChangedReply extends Reply<'window', 'bounds-changed'> { + changeType: BoundsChangeType; + deferred: boolean; + height: number; + width: number; + top: number; + left: number; +} +export declare const enum BoundsChangeType { + POSITION = 0, + SIZE = 1, + POSITION_AND_SIZE = 2 +} diff --git a/types/openfin/v34/_v2/api/window/bounds.d.ts b/types/openfin/v34/_v2/api/window/bounds.d.ts new file mode 100644 index 0000000000..40822c4aa3 --- /dev/null +++ b/types/openfin/v34/_v2/api/window/bounds.d.ts @@ -0,0 +1,9 @@ +interface Bounds { + height: number; + width: number; + top: number; + left: number; + right?: number; + bottom?: number; +} +export default Bounds; diff --git a/types/openfin/v34/_v2/api/window/transition.d.ts b/types/openfin/v34/_v2/api/window/transition.d.ts new file mode 100644 index 0000000000..c16440c80d --- /dev/null +++ b/types/openfin/v34/_v2/api/window/transition.d.ts @@ -0,0 +1,24 @@ +export interface TransitionBase { + duration: number; + relative?: boolean; +} +export interface Opacity extends TransitionBase { + opacity: number; +} +export interface Position extends TransitionBase { + left: number; + top: number; +} +export interface Size extends TransitionBase { + width: number; + height: number; +} +export interface TransitionOptions { + interrupt: boolean; + tween?: string; +} +export interface Transition { + opacity?: Opacity; + position?: Position; + size?: Size; +} diff --git a/types/openfin/v34/_v2/api/window/window.d.ts b/types/openfin/v34/_v2/api/window/window.d.ts new file mode 100644 index 0000000000..8d597a6446 --- /dev/null +++ b/types/openfin/v34/_v2/api/window/window.d.ts @@ -0,0 +1,759 @@ +import { Base, EmitterBase, RuntimeEvent } from '../base'; +import { Identity } from '../../identity'; +import Bounds from './bounds'; +import BoundsChangedReply from './bounds-changed'; +import { Transition, TransitionOptions } from './transition'; +import { Application } from '../application/application'; +import Transport from '../../transport/transport'; +export default class _WindowModule extends Base { + private instance; + /** + * Returns a Window object that represents an existing window. + * @param { Identity } indentity + * @return {Promise.<_Window>} + * @tutorial Window.wrap + */ + wrap(identity: Identity): Promise<_Window>; + /** + * Creates a new Window. + * @param { * } options - Window creation options + * @return {Promise.<_Window>} + * @tutorial Window.create + */ + create(options: any): Promise<_Window>; + /** + * Returns a Window object that represents the current window + * @return {Promise.} + * @tutorial window.getCurrent + */ + getCurrent(): Promise<_Window>; +} +export interface CloseEventShape { + name: string; + uuid: string; + type: string; + topic: string; +} +export interface WindowInfo { + canNavigateBack: boolean; + canNavigateForward: boolean; + preloadScripts: Array; + title: string; + url: string; +} +export interface FrameInfo { + name: string; + uuid: string; + entityType: string; + parent?: Identity; +} +/** + * @typedef {object} Transition + * @property {Opacity} opacity - The Opacity transition + * @property {Position} position - The Position transition + * @property {Size} size - The Size transition +*/ +/** + * @typedef {object} TransitionOptions + * @property {boolean} interrupt - This option interrupts the current animation. When false it pushes +this animation onto the end of the animation queue. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + */ +/** + * @typedef {object} Size + * @property {number} duration - The total time in milliseconds this transition should take. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + * @property {number} width - Optional if height is present. Defaults to the window's current width. + * @property {number} height - Optional if width is present. Defaults to the window's current height. + */ +/** + * @typedef {object} Position + * @property {number} duration - The total time in milliseconds this transition should take. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + * @property {number} left - Defaults to the window's current left position in virtual screen coordinates. + * @property {number} top - Defaults to the window's current top position in virtual screen coordinates. + */ +/** + * @typedef {object} Opacity + * @property {number} duration - The total time in milliseconds this transition should take. + * @property {boolean} relative - Treat 'opacity' as absolute or as a delta. Defaults to false. + * @property {number} opacity - This value is clamped from 0.0 to 1.0. +*/ +/** + * Bounds is a interface that has the properties of height, + * width, left, top which are all numbers + * @typedef { Object } Bounds + * @property { number } height Get the application height bound + * @property { number } width Get the application width bound + * @property { number } top Get the application top bound + * @property { number } left Get the application left bound + * @property { number } right Get the application right bound + * @property { number } bottom Get the application bottom bound + */ +/** + * @classdesc A basic window that wraps a native HTML window. Provides more fine-grained + * control over the window state such as the ability to minimize, maximize, restore, etc. + * By default a window does not show upon instantiation; instead the window's show() method + * must be invoked manually. The new window appears in the same process as the parent window. + * @class + * @alias Window +*/ +export declare class _Window extends EmitterBase { + identity: Identity; + /** + * Raised when a window within this application requires credentials from the user. + * + * @event Window#auth-requested + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {object} authInfo + * @property {string} authInfo.host - Host server. + * @property {boolean} authInfo.isProxy - Indicates if the request involves a proxy. + * @property {number} authInfo.port - Port number. + * @property {string} authInfo.realm - Authentication request realm. + * @property {string} authInfo.scheme - Authentication scheme. + */ + /** + * Raised when a window loses focus. + * + * @event Window#blurred + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised after changes in a window's size and/or position. + * + * @event Window#bounds-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} changeType - Describes what kind of change occurred. + 0 means a change in position. + 1 means a change in size. + 2 means a change in position and size. + * @property {string} deferred - Indicated whether pending changes have been applied. + * @property {number} height - New height of the window. + * @property {number} left - New left most coordinate of the window. + * @property {number} top - New top most coordinate of the window. + * @property {number} width - New width of the window. + */ + /** + * Raised when a window has been prevented from closing. A window will be prevented from closing by default, + either through the API or by a user when ‘close-requested’ has been subscribed to and the Window.close(force) flag is false. + * + * @event Window#close-requested + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window has closed. + * + * @event Window#closed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window has crashed. + * + * @event Window#crashed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when the frame is disabled after all prevent user changes in window's size and/or position have completed. + * + * @event Window#disabled-frame-bounds-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} changeType - Describes what kind of change occurred. + 0 means a change in position. + 1 means a change in size. + 2 means a change in position and size. + * @property {string} deferred - Indicated whether pending changes have been applied. + * @property {number} height - New height of the window. + * @property {number} left - New left most coordinate of the window. + * @property {number} top - New top most coordinate of the window. + * @property {number} width - New width of the window. + */ + /** + * Raised when the frame is disabled during prevented user changes to a window's size and/or position. + * + * @event Window#disabled-frame-bounds-changing + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} changeType - Describes what kind of change occurred. + 0 means a change in position. + 1 means a change in size. + 2 means a change in position and size. + * @property {string} deferred - Indicated whether pending changes have been applied. + * @property {number} height - New height of the window. + * @property {number} left - New left most coordinate of the window. + * @property {number} top - New top most coordinate of the window. + * @property {number} width - New width of the window. + */ + /** + * Raised when the window has been embedded. + * + * @event Window#embedded + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when an external process has exited. + * + * @event Window#external-process-exited + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} processUuid - The process handle UUID. + * @property {number} exitCode - The process exit code + */ + /** + * Raised when an external process has started. + * + * @event Window#external-process-started + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} processUuid - The process handle UUID. + */ + /** + * Raised when a window's frame becomes disabled. + * + * @event Window#frame-disabled + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window's frame becomes enabled. + * + * @event Window#frame-enabled + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window joins/leaves a group and/or when the group a window is a member of changes. + * + * @event Window#group-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} source - Which group array the window that the event listener was registered on is included in: + 'source' The window is included in sourceGroup. + 'target' The window is included in targetGroup. + 'nothing' The window is not included in sourceGroup nor targetGroup. + * @property {string} reason - The reason this event was triggered. + 'leave' A window has left the group due to a leave or merge with group. + 'join' A window has joined the group. + 'merge' Two groups have been merged together. + 'disband' There are no other windows in the group. + * @property {string} name - Name of the window. + * @property {legacyWindowIdentity[]} sourceGroup - All the windows in the group the sourceWindow originated from. + * @property {string} sourceWindowAppUuid - UUID of the application the sourceWindow belongs to the + source window is the window in which (merge/join/leave)group(s) was called. + * @property {string} sourceWindowName - Name of the sourcewindow. + The source window is the window in which (merge/join/leave)group(s) was called. + * @property {legacyWindowIdentity[]} targetGroup - All the windows in the group the targetWindow orginated from. + * @property {string} targetWindowAppUuid - UUID of the application the targetWindow belongs to. + The target window is the window that was passed into (merge/join)group(s). + * @property {string} targetWindowName - Name of the targetWindow. + The target window is the window that was passed into (merge/join)group(s). + */ + /** + * Raised when a window has been hidden. + * + * @event Window#hidden + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} reason - Action prompted the close The reasons are: + "hide" + "hide-on-close" + */ + /** + * Raised when a window is initialized. + * + * @event Window#initialized + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window is maximized. + * + * @event Window#maximized + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window is minimized. + * + * @event Window#minimized + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when window navigation is rejected as per ContentNavigation whitelist/blacklist rules. + * + * @event Window#navigation-rejected + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} sourceName - source of navigation window name. + * @property {string} url - Blocked content url. + */ + /** + * Raised when a window is out of memory. + * + * @event Window#out-of-memory + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised after the execution of all of a window's preload scripts. Contains + information about all window's preload scripts' final states. + * + * @event Window#preload-scripts-state-changed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states + */ + /** + * Raised during the execution of a window's preload script. Contains information + about a single window's preload script's state, for which the event has been raised. + * + * @event Window#preload-scripts-state-changing + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {preloadScriptState[]} preloadState - An array of all final preload scripts' states + */ + /** + * Raised when an HTTP load was cancelled or failed. + * + * @event Window#resource-load-failed + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {number} errorCode - The Chromium error code. + * @property {string} errorDescription - The Chromium error description. + * @property {string} validatedURL - The url attempted. + * @property {boolean} isMainFrame - Was the attempt made from the main frame. + */ + /** + * Raised when an HTTP resource request has received response details. + * + * @event Window#resource-response-received + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {boolean} status - Status of the request. + * @property {string} newUrl - The URL of the responded resource. + * @property {string} originalUrl - The requested URL. + * @property {number} httpResponseCode - The HTTP Response code. + * @property {string} requestMethod - The HTTP request method. + * @property {string} referrer - The HTTP referrer. + * @property {object} headers - The HTTP headers. + * @property {string} resourceType - Resource type: + "mainFrame", "subFrame", + "styleSheet", "script", "image", + "object", "xhr", or "other" + */ + /** + * Raised when a window has reloaded. + * + * @event Window#reloaded + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + * @property {string} url - Url has has been reloaded. + */ + /** + * Raised when a window is displayed after having been minimized or + when a window leaves the maximize state without minimizing. + * + * @event Window#restored + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window has been prevented from showing. + A window will be prevented from showing by default, either through the API or by a user when + ‘show-requested’ has been subscribed to on the window or 'window-show-requested' + on the parent application and the Window.show(force) flag is false. + * + * @event Window#show-requested + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * Raised when a window been shown. + * + * @event Window#shown + * @type {object} + * @property {string} name - Name of the window. + * @property {string} uuid - UUID of the application that the window belongs to. + */ + /** + * @typedef {object} legacyWindowIdentity + * @summary Object summary + * @desc Object description + * @property {string} appUuid - The UUID of the application this window entry belongs to. + * @property {string} windowName - The name of this window entry. + */ + /** + * @typedef {object} preloadScriptState + * @summary Object summary + * @desc Object description + * @property {string} url - The url of the preload script. + * @property {string} state - The preload script state: + "load-failed", "failed", "succeeded" + */ + private nativeWindow; + constructor(wire: Transport, identity: Identity); + createWindow(options: any): Promise<_Window>; + protected runtimeEventComparator: (listener: RuntimeEvent) => boolean; + private windowListFromNameList; + /** + * Retrieves an array of frame info objects representing the main frame and any + * iframes that are currently on the page. + * @return {Promise.>} + * @tutorial Window.getAllFrames + */ + getAllFrames(): Promise>; + /** + * Gets the current bounds (top, left, width, height) of the window. + * @return {Promise.} + * @tutorial Window.getBounds + */ + getBounds(): Promise; + /** + * Returns the native JavaScript "window" object for the window. + * @return {Promise.} + * @tutorial Window.getNativeWindow + */ + getNativeWindow(): Promise; + /** + * Gives focus to the window. + * @return {Promise.} + * @emits _Window#focused + * @tutorial Window.focus + */ + focus(): Promise; + /** + * Removes focus from the window. + * @return {Promise.} + * @tutorial Window.blur + */ + blur(): Promise; + /** + * Brings the window to the front of the window stack. + * @return {Promise.} + * @tutorial Window.bringToFront + */ + bringToFront(): Promise; + /** + * Performs the specified window transitions. + * @param {Transition} transitions - Describes the animations to perform. See the tutorial. + * @param {TransitionOptions} options - Options for the animation. See the tutorial. + * @return {Promise.} + * @tutorial Window.animate + */ + animate(transitions: Transition, options: TransitionOptions): Promise; + /** + * Hides the window. + * @return {Promise.} + * @tutorial Window.hide + */ + hide(): Promise; + /** + * closes the window application + * @param { boolean } [force = false] Close will be prevented from closing when force is false and + * ‘close-requested’ has been subscribed to for application’s main window. + * @return {Promise.} + * @tutorial Window.close + */ + close(force?: boolean): Promise; + /** + * Returns then running applications uuid + * @return {Promise.} + * @tutorial Window.getNativeId + */ + getNativeId(): Promise; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * @return {Promise.} + * @tutorial Window.disableFrame + */ + disableFrame(): Promise; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * @return {Promise.} + * @tutorial Window.enableFrame + */ + enableFrame(): Promise; + /** + * Executes Javascript on the window, restricted to windows you own or windows owned by + * applications you have created. + * @param { string } code JavaScript code to be executed on the window. + * @return {Promise.} + * @tutorial Window.executeJavaScript + */ + executeJavaScript(code: string): Promise; + /** + * Flashes the window’s frame and taskbar icon until stopFlashing is called. + * @return {Promise.} + * @tutorial Window.flash + */ + flash(): Promise; + /** + * Stops the taskbar icon from flashing. + * @return {Promise.} + * @tutorial Window.stopFlashing + */ + stopFlashing(): Promise; + /** + * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this + * window. If a window is not in a group an empty array is returned. Please note that + * calling window is included in the result array. + * @return {Promise.>} + * @tutorial Window.getGroup + */ + getGroup(): Promise>; + /** + * Gets an information object for the window. + * @return {Promise.} + * @tutorial Window.getInfo + */ + getInfo(): Promise; + /** + * Gets the current settings of the window. + * @return {Promise.} + * @tutorial Window.getOptions + */ + getOptions(): Promise; + /** + * Gets the parent application. + * @return {Promise.} + * @tutorial Window.getParentApplication + */ + getParentApplication(): Promise; + /** + * Gets the parent window. + * @return {Promise.<_Window>} + * @tutorial Window.getParentWindow + */ + getParentWindow(): Promise<_Window>; + /** + * Gets a base64 encoded PNG snapshot of the window. + * @return {Promise.} + * @tutorial Window.getSnapshot + */ + getSnapshot(): Promise; + /** + * Gets the current state ("minimized", "maximized", or "restored") of the window. + * @return {Promise.} + * @tutorial Window.getState + */ + getState(): Promise; + /** + * Determines if the window is currently showing. + * @return {Promise.} + * @tutorial Window.isShowing + */ + isShowing(): Promise; + /** + * Joins the same window group as the specified window. + * @param { class } target The window whose group is to be joined + * @return {Promise.} + * @tutorial Window.joinGroup + */ + joinGroup(target: _Window): Promise; + /** + * Reloads the window current page + * @return {Promise.} + * @tutorial Window.reload + */ + reload(ignoreCache?: boolean): Promise; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + * @return {Promise.} + * @tutorial Window.leaveGroup + */ + leaveGroup(): Promise; + /** + * Maximizes the window + * @return {Promise.} + * @tutorial Window.maximize + */ + maximize(): Promise; + /** + * Merges the instance's window group with the same window group as the specified window + * @param { class } target The window whose group is to be merged with + * @return {Promise.} + * @tutorial Window.mergeGroups + */ + mergeGroups(target: _Window): Promise; + /** + * Minimizes the window. + * @return {Promise.} + * @tutorial Window.minimize + */ + minimize(): Promise; + /** + * Moves the window by a specified amount. + * @param { number } deltaLeft The change in the left position of the window + * @param { number } deltaTop The change in the top position of the window + * @return {Promise.} + * @tutorial Window.moveBy + */ + moveBy(deltaLeft: number, deltaTop: number): Promise; + /** + * Moves the window to a specified location. + * @param { number } left The left position of the window + * @param { number } top The top position of the window + * @return {Promise.} + * @tutorial Window.moveTo + */ + moveTo(left: number, top: number): Promise; + /** + * Resizes the window by a specified amount. + * @param { number } deltaWidth The change in the width of the window + * @param { number } deltaHeight The change in the height of the window + * @param { string } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * If undefined, the default is "top-left" + * @return {Promise.} + * @tutorial Window.resizeBy + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: string): Promise; + /** + * Resizes the window to the specified dimensions. + * @param { number } width The change in the width of the window + * @param { number } height The change in the height of the window + * @param { string } anchor Specifies a corner to remain fixed during the resize. + * Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right." + * If undefined, the default is "top-left" + * @return {Promise.} + * @tutorial Window.resizeTo + */ + resizeTo(width: number, height: number, anchor: string): Promise; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + * @return {Promise.} + * @tutorial Window.restore + */ + restore(): Promise; + /** + * Will bring the window to the front of the entire stack and give it focus. + * @return {Promise.} + * @tutorial Window.setAsForeground + */ + setAsForeground(): Promise; + /** + * Sets the window's size and position. + * @property { Bounds } bounds This is a * @type {string} name - name of the window.object that holds the propertys of + * @return {Promise.} + * @tutorial Window.setBounds + */ + setBounds(bounds: Bounds): Promise; + /** + * Shows the window if it is hidden. + * @param { boolean } [force = false] Show will be prevented from showing when force is false and + * ‘show-requested’ has been subscribed to for application’s main window. + * @return {Promise.} + * @tutorial Window.show + */ + show(force?: boolean): Promise; + /** + * Shows the window if it is hidden at the specified location. + * If the toggle parameter is set to true, the window will + * alternate between showing and hiding. + * @param { number } left The left position of the window + * @param { number } top The right position of the window + * @param { boolean } force Show will be prevented from closing when force is false and + * ‘show-requested’ has been subscribed to for application’s main window + * @return {Promise.} + * @tutorial Window.showAt + */ + showAt(left: number, top: number, force?: boolean): Promise; + /** + * Shows the Chromium Developer Tools + * @return {Promise.} + * @tutorial Window.showDeveloperTools + */ + showDeveloperTools(): Promise; + /** + * Updates the window using the passed options + * @param {*} options Changes a window's options that were defined upon creation. See tutorial + * @return {Promise.} + * @tutorial Window.updateOptions + */ + updateOptions(options: any): Promise; + /** + * Provides credentials to authentication requests + * @param { string } userName userName to provide to the authentication challange + * @param { string } password password to provide to the authentication challange + * @return {Promise.} + * @tutorial Window.authenticate + */ + authenticate(userName: string, password: string): Promise; + /** + * Returns the zoom level of the window. + * @return {Promise.} + * @tutorial Window.getZoomLevel + */ + getZoomLevel(): Promise; + /** + * Sets the zoom level of the window. + * @param { number } level The zoom level + * @return {Promise.} + * @tutorial Window.setZoomLevel + */ + setZoomLevel(level: number): Promise; + /** + * Navigates the window to a specified URL. + * @param {string} url - The URL to navigate the window to. + * @return {Promise.} + * @tutorial Window.navigate + */ + navigate(url: string): Promise; + /** + * Navigates the window back one page. + * @return {Promise.} + * @tutorial Window.navigateBack + */ + navigateBack(): Promise; + /** + * Stops any current navigation the window is performing. + * @return {Promise.} + * @tutorial Window.stopNavigation + */ + stopNavigation(): Promise; +} +export interface _Window { + on(type: 'focused', listener: Function): Promise; + on(type: 'initialized', listener: Function): Promise; + on(type: 'bounds-changed', listener: (data: BoundsChangedReply) => void): Promise; + on(type: 'hidden', listener: Function): Promise; + on(type: 'removeListener', listener: (eventType: string | symbol) => void): Promise; + on(type: 'newListener', listener: (eventType: string | symbol) => void): Promise; + on(type: 'closed', listener: (eventType: CloseEventShape) => void): Promise; + on(type: 'fire-constructor-callback', listener: Function): Promise; +} diff --git a/types/openfin/v34/_v2/environment/environment.d.ts b/types/openfin/v34/_v2/environment/environment.d.ts new file mode 100644 index 0000000000..0b0f1571f2 --- /dev/null +++ b/types/openfin/v34/_v2/environment/environment.d.ts @@ -0,0 +1,10 @@ +import { NewConnectConfig } from '../transport/wire'; +export interface Environment { + writeToken(path: string, token: string): Promise; + retrievePort(config: NewConnectConfig): Promise; + getNextMessageId(): any; + getRandomId(): string; + createChildWindow(options: any): Promise; + isWindowExists(uuid: string, name: string): boolean; +} +export declare const notImplementedEnvErrorMsg = "Not implemented in this environment"; diff --git a/types/openfin/v34/_v2/environment/node-env.d.ts b/types/openfin/v34/_v2/environment/node-env.d.ts new file mode 100644 index 0000000000..03e0faeede --- /dev/null +++ b/types/openfin/v34/_v2/environment/node-env.d.ts @@ -0,0 +1,11 @@ +import { Environment } from './environment'; +import { NewConnectConfig } from '../transport/wire'; +export default class NodeEnvironment implements Environment { + private messageCounter; + writeToken: (path: string, token: string) => Promise; + retrievePort: (config: NewConnectConfig) => Promise; + getNextMessageId: () => any; + createChildWindow: (options: any) => Promise; + getRandomId: () => string; + isWindowExists: (uuid: string, name: string) => boolean; +} diff --git a/types/openfin/v34/_v2/environment/openfin-env.d.ts b/types/openfin/v34/_v2/environment/openfin-env.d.ts new file mode 100644 index 0000000000..456e2f8caf --- /dev/null +++ b/types/openfin/v34/_v2/environment/openfin-env.d.ts @@ -0,0 +1,11 @@ +import { Environment } from './environment'; +import { NewConnectConfig } from '../transport/wire'; +export default class OpenFinEnvironment implements Environment { + writeToken: (path: string, token: string) => Promise; + retrievePort: (config: NewConnectConfig) => Promise; + getNextMessageId: () => any; + createChildWindow: (options: any) => Promise; + getRandomId: () => string; + private resolveUrl; + isWindowExists: (uuid: string, name: string) => boolean; +} diff --git a/types/openfin/v34/_v2/environment/openfin-renderer-api.d.ts b/types/openfin/v34/_v2/environment/openfin-renderer-api.d.ts new file mode 100644 index 0000000000..82822c3111 --- /dev/null +++ b/types/openfin/v34/_v2/environment/openfin-renderer-api.d.ts @@ -0,0 +1,6 @@ +export declare const ipc: any; +export declare const routingId: any; +export declare const CORE_MESSAGE_CHANNEL: any; +export declare const outboundTopic = "of-window-message"; +export declare const inboundTopic: string; +export declare const currentWindowIdentity: any; diff --git a/types/openfin/v34/_v2/identity.d.ts b/types/openfin/v34/_v2/identity.d.ts new file mode 100644 index 0000000000..f10f030248 --- /dev/null +++ b/types/openfin/v34/_v2/identity.d.ts @@ -0,0 +1,4 @@ +export interface Identity { + uuid: string; + name?: string; +} diff --git a/types/openfin/v34/_v2/launcher/launcher.d.ts b/types/openfin/v34/_v2/launcher/launcher.d.ts new file mode 100644 index 0000000000..d0ffc16989 --- /dev/null +++ b/types/openfin/v34/_v2/launcher/launcher.d.ts @@ -0,0 +1,15 @@ +/// +import { ChildProcess } from 'child_process'; +import { ConfigWithRuntime } from '../transport/wire'; +export default class Launcher { + private os; + OpenFin_Installer: string; + Installer_Work_Dir: string; + Security_Realm_Config_Key: string; + nixConfig?: any; + constructor(); + launch(config: ConfigWithRuntime, manifestLocation: string, namedPipeName: string): Promise; + static IS_SUPPORTED(): boolean; + private macLaunch; + private winLaunch; +} diff --git a/types/openfin/v34/_v2/launcher/nix-launch.d.ts b/types/openfin/v34/_v2/launcher/nix-launch.d.ts new file mode 100644 index 0000000000..02b0da4fbb --- /dev/null +++ b/types/openfin/v34/_v2/launcher/nix-launch.d.ts @@ -0,0 +1,14 @@ +/// +import { ChildProcess } from 'child_process'; +import { ConfigWithRuntime } from '../transport/wire'; +export declare function getUrl(version: string, urlPath: string): string; +export declare function download(version: string, folder: string, osConfig: OsConfig): Promise; +export declare function getRuntimePath(version: string): Promise; +export declare function install(versionOrChannel: string, osConfig: OsConfig): Promise; +export interface OsConfig { + manifestLocation: string; + namedPipeName: string; + urlPath: string; + executablePath: string; +} +export default function launch(config: ConfigWithRuntime, osConfig: OsConfig): Promise; diff --git a/types/openfin/v34/_v2/launcher/util.d.ts b/types/openfin/v34/_v2/launcher/util.d.ts new file mode 100644 index 0000000000..808ad015ea --- /dev/null +++ b/types/openfin/v34/_v2/launcher/util.d.ts @@ -0,0 +1,8 @@ +export declare function exists(path: string): Promise; +export declare function get(url: string): Promise; +export declare function unzip(file: string, dest: string): Promise; +export declare function rmDir(dirPath: string, removeSelf?: boolean): Promise; +export declare function downloadFile(url: string, writeLocation: string): Promise<{}>; +export declare function resolveRuntimeVersion(versionOrChannel: string): Promise; +export declare function first(arr: T[], func: (x: T, i: number, r: T[]) => boolean): T | null; +export declare function resolveDir(base: string, paths: string[]): Promise; diff --git a/types/openfin/v34/_v2/launcher/win-launch.d.ts b/types/openfin/v34/_v2/launcher/win-launch.d.ts new file mode 100644 index 0000000000..b08fac3f8a --- /dev/null +++ b/types/openfin/v34/_v2/launcher/win-launch.d.ts @@ -0,0 +1,4 @@ +/// +import { ChildProcess } from 'child_process'; +import { ConfigWithRuntime } from '../transport/wire'; +export default function launch(config: ConfigWithRuntime, manifestLocation: string, namedPipeName: string, Installer_Work_Dir: string): Promise; diff --git a/types/openfin/v34/_v2/main.d.ts b/types/openfin/v34/_v2/main.d.ts new file mode 100644 index 0000000000..2f4a3d8730 --- /dev/null +++ b/types/openfin/v34/_v2/main.d.ts @@ -0,0 +1,11 @@ +import Fin from './api/fin'; +import { Application } from './api/application/application'; +import { _Window as Window } from './api/window/window'; +import { _Frame as Frame } from './api/frame/frame'; +import { _Notification as Notification } from './api/notification/notification'; +import System from './api/system/system'; +import { ConnectConfig } from './transport/wire'; +export declare function connect(config: ConnectConfig): Promise; +export declare function launch(config: ConnectConfig): Promise; +export { Identity } from './identity'; +export { Fin, Application, Window, System, Frame, Notification }; diff --git a/types/openfin/v34/_v2/of-main.d.ts b/types/openfin/v34/_v2/of-main.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/types/openfin/v34/_v2/of-main.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/types/openfin/v34/_v2/transport/elipc.d.ts b/types/openfin/v34/_v2/transport/elipc.d.ts new file mode 100644 index 0000000000..94c398cba5 --- /dev/null +++ b/types/openfin/v34/_v2/transport/elipc.d.ts @@ -0,0 +1,13 @@ +/// +import { EventEmitter } from 'events'; +import { Wire, READY_STATE } from './wire'; +export default class ElIPCTransport extends EventEmitter implements Wire { + protected wire: any; + onmessage: (data: any) => void; + constructor(onmessage: (data: any) => void); + connectSync: () => any; + connect: (address: string) => Promise; + send(data: any, flags?: any): Promise; + shutdown(): Promise; + static READY_STATE: typeof READY_STATE; +} diff --git a/types/openfin/v34/_v2/transport/port-discovery.d.ts b/types/openfin/v34/_v2/transport/port-discovery.d.ts new file mode 100644 index 0000000000..d8ea25934d --- /dev/null +++ b/types/openfin/v34/_v2/transport/port-discovery.d.ts @@ -0,0 +1,17 @@ +import { PortDiscoveryConfig } from './wire'; +import { Environment } from '../environment/environment'; +export declare class PortDiscovery { + private savedConfig; + private namedPipeName; + private manifestLocation; + private namedPipeServer; + private pipeConnection; + private timeoutTimer; + private environment; + constructor(config: PortDiscoveryConfig, environment: Environment); + retrievePort(): Promise; + private createDiscoveryNamedPipe; + private listenDiscoveryMessage; + private createManifest; + private cleanup; +} diff --git a/types/openfin/v34/_v2/transport/transport-errors.d.ts b/types/openfin/v34/_v2/transport/transport-errors.d.ts new file mode 100644 index 0000000000..90f9d10f55 --- /dev/null +++ b/types/openfin/v34/_v2/transport/transport-errors.d.ts @@ -0,0 +1,17 @@ +export declare class DisconnectedError extends Error { + constructor(readyState: number); + readyState: number; +} +export declare class UnexpectedActionError extends Error { +} +export declare class DuplicateCorrelationError extends Error { +} +export declare class NoAckError extends Error { +} +export declare class NotImplementedError extends Error { +} +export declare class NotSupportedError extends Error { +} +export declare class RuntimeError extends Error { + constructor(data: any); +} diff --git a/types/openfin/v34/_v2/transport/transport.d.ts b/types/openfin/v34/_v2/transport/transport.d.ts new file mode 100644 index 0000000000..fb7b967240 --- /dev/null +++ b/types/openfin/v34/_v2/transport/transport.d.ts @@ -0,0 +1,48 @@ +/// +import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, ConnectConfig, InternalConnectConfig } from './wire'; +import { Identity } from '../identity'; +import { EventEmitter } from 'events'; +import { Environment } from '../environment/environment'; +export declare type MessageHandler = (data: any) => boolean; +declare class Transport extends EventEmitter { + protected wireListeners: Map; + protected uncorrelatedListener: Function; + protected messageHandlers: MessageHandler[]; + me: Identity; + protected wire: Wire; + environment: Environment; + topicRefMap: Map; + sendRaw: Wire['send']; + constructor(wireType: WireConstructor, environment: Environment); + connectSync: (config: ConnectConfig) => any; + connect(config: InternalConnectConfig): Promise; + connectByPort(config: ExistingConnectConfig): Promise; + READY_STATE: typeof READY_STATE; + ferryAction(data: any): Promise>; + registerMessageHandler(handler: MessageHandler): void; + protected addWireListener(id: number, resolve: Function, reject: Function, uncorrelated: boolean): void; + protected onmessage(data: Message): void; + protected handleMessage(data: Message): boolean; +} +export default Transport; +interface Transport { + sendAction(action: 'request-external-authorization', payload: {}, uncorrelated: true): Promise>; + sendAction(action: string, payload: {}, uncorrelated: boolean): Promise>; + topicRefMap: Map; +} +export declare class Message { + action: string; + payload: T; + correlationId?: number; +} +export declare class Payload { + success: boolean; + data: any; +} +export declare class AuthorizationPayload { + token: string; + file: string; +} diff --git a/types/openfin/v34/_v2/transport/websocket.d.ts b/types/openfin/v34/_v2/transport/websocket.d.ts new file mode 100644 index 0000000000..5617afa8e3 --- /dev/null +++ b/types/openfin/v34/_v2/transport/websocket.d.ts @@ -0,0 +1,14 @@ +/// +import { EventEmitter } from 'events'; +import * as WebSocket from 'ws'; +import { Wire, READY_STATE } from './wire'; +export default class WebSocketTransport extends EventEmitter implements Wire { + protected wire: WebSocket; + onmessage: (data: any) => void; + constructor(onmessage: (data: any) => void); + connect: (address: string) => Promise; + connectSync: () => any; + send(data: any, flags?: any): Promise; + shutdown(): Promise; + static READY_STATE: typeof READY_STATE; +} diff --git a/types/openfin/v34/_v2/transport/wire.d.ts b/types/openfin/v34/_v2/transport/wire.d.ts new file mode 100644 index 0000000000..227c6d4d72 --- /dev/null +++ b/types/openfin/v34/_v2/transport/wire.d.ts @@ -0,0 +1,71 @@ +/// +import { EventEmitter } from 'events'; +export interface Wire extends EventEmitter { + connect(address: string): Promise; + connectSync(): any; + send(data: any): Promise; + shutdown(): Promise; +} +export interface WireConstructor { + new (onmessage: (data: any) => void): Wire; +} +export interface RuntimeConfig { + version: string; + fallbackVersion?: string; + securityRealm?: string; + verboseLogging?: boolean; + arguments?: string; + rvmDir?: string; +} +export interface BaseConfig { + uuid?: string; + address?: string; + name?: string; + nonPersistent?: boolean; + runtimeClient?: boolean; + licenseKey?: string; + client?: any; + manifestUrl?: string; + startupApp?: any; + lrsUrl?: string; + assetsUrl?: string; + devToolsPort?: number; + installerUI?: boolean; + runtime?: RuntimeConfig; + appAssets?: [{ + src: string; + alias: string; + target: string; + version: string; + args: string; + }]; + customItems?: [any]; + timeout?: number; +} +export interface ConfigWithUuid extends BaseConfig { + uuid: string; +} +export interface ExistingConnectConfig extends ConfigWithUuid { + address: string; +} +export interface ConfigWithRuntime extends BaseConfig { + runtime: RuntimeConfig; +} +export interface ExternalConfig extends BaseConfig { + manifestUrl: string; +} +export declare type NewConnectConfig = ConfigWithUuid & ConfigWithRuntime; +export declare type PortDiscoveryConfig = (ExternalConfig & ConfigWithRuntime) | NewConnectConfig; +export declare type ConnectConfig = ExistingConnectConfig | NewConnectConfig | ExternalConfig; +export declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig; +export declare function isExternalConfig(config: ConnectConfig): config is ExternalConfig; +export declare function isExistingConnectConfig(config: any): config is ExistingConnectConfig; +export declare function isNewConnectConfig(config: any): config is NewConnectConfig; +export declare function isPortDiscoveryConfig(config: any): config is PortDiscoveryConfig; +export declare function isInternalConnectConfig(config: any): config is InternalConnectConfig; +export declare enum READY_STATE { + CONNECTING = 0, + OPEN = 1, + CLOSING = 2, + CLOSED = 3 +} diff --git a/types/openfin/v34/_v2/util/normalize-config.d.ts b/types/openfin/v34/_v2/util/normalize-config.d.ts new file mode 100644 index 0000000000..ed322d30ec --- /dev/null +++ b/types/openfin/v34/_v2/util/normalize-config.d.ts @@ -0,0 +1,3 @@ +import { ConnectConfig, InternalConnectConfig, ExternalConfig } from '../transport/wire'; +export declare function normalizeConfig(config: ConnectConfig): Promise; +export declare function validateConfig(config: ConnectConfig): Promise; diff --git a/types/openfin/v34/_v2/util/promises.d.ts b/types/openfin/v34/_v2/util/promises.d.ts new file mode 100644 index 0000000000..8e7bf9efe9 --- /dev/null +++ b/types/openfin/v34/_v2/util/promises.d.ts @@ -0,0 +1,5 @@ +export declare function promisify(func: Function): (...args: any[]) => Promise; +export declare function promiseMap(arr: T[], asyncF: (x: T, i: number, r: T[]) => Promise): Promise; +export declare type asyncF = (...args: any[]) => Promise; +export declare function serial(arr: asyncF[]): Promise; +export declare function promiseMapSerial(arr: any[], func: asyncF): Promise; diff --git a/types/openfin/v34/_v2/util/ref-counter.d.ts b/types/openfin/v34/_v2/util/ref-counter.d.ts new file mode 100644 index 0000000000..8184e09079 --- /dev/null +++ b/types/openfin/v34/_v2/util/ref-counter.d.ts @@ -0,0 +1,7 @@ +export default class RefCoutner { + topicRefMap: Map; + incRefCount(key: string): number; + decRefCount(key: string): number; + actOnFirst(key: string, firstAction: () => any, nonFirstAction?: () => void): any; + actOnLast(key: string, lastAction: () => any, nonLastAction?: () => void): any; +} diff --git a/types/openfin/v34/index.d.ts b/types/openfin/v34/index.d.ts new file mode 100644 index 0000000000..fe34f0b630 --- /dev/null +++ b/types/openfin/v34/index.d.ts @@ -0,0 +1,1907 @@ +// Type definitions for OpenFin API 34.0 +// Project: https://openfin.co/ +// Definitions by: Chris Barker +// Ricardo de Pena +// Roma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +// based on v9.61.34.22 +// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean + +/** + * JavaScript API + * The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, + * can communicate with other applications and has access to sandboxed system-level features. + * + * API Ready + * When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify + * that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly + * after it has returned. This avoids the situation of trying to access methods that are not yet fully injected. + * + * Overview + * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API + * without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "documennt" objects. + */ +declare namespace fin { + var Application: import('./_v2/api/application/application').default + var Clipboard: import('./_v2/api/clipboard/clipboard').default + var ExternalApplication: import('./_v2/api/external-application/external-application').default + var Frame: import('./_v2/api/frame/frame').default + var GlobalHotkey: import('./_v2/api/global-hotkey/index').default + var InterApplicationBus: import('./_v2/api/interappbus/interappbus').default + var Notification: import('./_v2/api/notification/notification').default + var System: import('./_v2/api/system/system').default + var Window: import('./_v2/api/window/window').default + + const desktop: OpenFinDesktop; + + interface OpenFinDesktop { + main(f: () => any): void; + Application: OpenFinApplicationStatic; + ExternalApp: OpenFinExternalApplicationStatic; + InterApplicationBus: OpenFinInterApplicationBus; + Notification: OpenFinNotificationStatic; + System: OpenFinSystem; + Window: OpenFinWindowStatic; + Frame: OpenFinFrameStatic; + } + + interface OpenFinApplicationStatic { + /** + * Creates a new Application. + * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. + */ + new ( + options: ApplicationOptions, + callback?: (successObj: { httpResponseCode: number }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication; + /** + * Launches the given Application manifest. + */ + createFromManifest(manifestUrl: string, callback?: (app: OpenFinApplication) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Returns an Application object that represents an existing application. + */ + getCurrent(): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + wrap(uuid: string): OpenFinApplication; + } + + /** + * Application + * An object representing an application.Allows the developer to create, execute, show / close an application as well as listen to application events. + */ + interface OpenFinApplication { + /** + * Returns an instance of the main Window of the application + */ + getWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinApplicationEventType, + listener: (event: ApplicationBaseEvent + | TrayIconClickedEvent + | WindowEvent + | WindowAlertRequestedEvent + | WindowAuthRequested + | WindowNavigationRejectedEvent + | WindowEndLoadEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Closes the application and any child windows created by the application. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of wrapped fin.desktop.Windows for each of the application's child windows. + */ + getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of active window groups for all of the application's windows. Each group is represented as an array of wrapped fin.desktop.Windows. + */ + getGroups(callback?: (groups: OpenFinWindow[][]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest. + */ + getManifest(callback?: (manifest: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback if the application was created from a manifest. + */ + getParentUuid(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves current configuration of application's shortcuts. + */ + getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves information about the application. + */ + getInfo(callback?: (info: LaunchInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves information about the system tray. + */ + getTrayIconInfo(callback?: (trayInfo: TrayIconInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the application is currently running. + */ + isRunning(callback?: (running: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Registers a username and an app name for licensing purposes. + */ + registerUser(userName: string, appName: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinApplicationEventType, + previouslyRegisteredListener: (event: ApplicationBaseEvent + | TrayIconClickedEvent + | WindowEvent + | WindowAlertRequestedEvent + | WindowAuthRequested + | WindowNavigationRejectedEvent + | WindowEndLoadEvent) => any, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Removes the application's icon from the tray. + */ + removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restarts the application. + */ + restart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Runs the application. When the application is created, run must be called. + */ + run(callback?: (successObj: SuccessObj) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * Tells the rvm to relaunch the main application once upon a complete shutdown + */ + scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets new shortcut configuration for current application. + * Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to + * be able to change shortcut states. + */ + setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Adds a customizable icon in the system tray and notifies the application when clicked. + */ + setTrayIcon(iconUrl: string, listener: (clickInfo: TrayIconClickedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the application by terminating its process. + */ + terminate(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application + * to continue and to generate another "not-responding" message after a certain period of time. + */ + wait(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * The Application's uuid + */ + uuid: string; + } + + interface ShortCutConfig { + /** + * application has a shortcut on the desktop + */ + desktop?: boolean; + /** + * application has no shortcut in the start menu + */ + startMenu?: boolean; + /** + * application will be launched on system startup + */ + systemStartup?: boolean; + } + + interface SuccessObj { + httpResponseCode: number; + } + + interface NetworkErrorInfo extends ErrorInfo { + networkErrorCode: number; + } + + interface ErrorInfo { + stack: string; + message: string; + } + + interface ApplicationOptions { + /** + * The name of the application. + */ + name?: string; + /** + * The url to the application. + */ + url?: string; + /** + * The UUID of the application, unique within the set of all other applications running in the OpenFin Runtime. name and uuid must match. + */ + uuid?: string; + /** + * Enable Flash at the application level. Default: false. + */ + plugins?: boolean; + /** + * The options of the main window of the application. + */ + mainWindowOptions?: WindowOptions; + } + + interface WindowOptions { + /** + * Enable keyboard shortcuts for devtools and zoom. Default: false for both. + */ + accelerator?: { + devtools?: boolean, + zoom?: boolean, + reload?: boolean, + reloadIgnoreCache?: boolean, + }; + /** + * A flag to always position the window at the top of the window stack. Default: false. + * Updatable + */ + alwaysOnTop?: boolean; + /** + * A flag to automatically show the Window when it is created. Default: false. + */ + autoShow?: boolean; + /** + * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true + * Updatable + */ + contextMenu?: boolean; + /** + * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. + * Updatable + */ + cornerRounding?: { + width?: number; + height?: number; + }; + /** + * A field that the user can attach serializable data to to be ferried around with the window options. Default: ''. + */ + customData?: any; + /** + * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the position from before the window was closed is used. + * This option overrides defaultLeft and defaultTop. Default: false. + */ + defaultCentered?: boolean; + /** + * The default height of the window. Specifies the height of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500. + */ + defaultHeight?: number; + /** + * The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100. + */ + defaultWidth?: number; + /** + * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. + */ + defaultTop?: number; + /** + * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. + */ + defaultLeft?: number; + /** + * A flag to show the frame. Default: true. + * Updatable + */ + frame?: boolean; + /** + * A flag to allow a window to be hidden when the close button is clicked.Default: false. + * Updatable + */ + hideOnClose?: boolean; + /** + * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. + * Updatable + */ + icon?: string; + /** + * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. + * Updatable + */ + maxHeight?: number; + /** + * A flag that lets the window be maximized.Default: true. + * Updatable + */ + maximizable?: boolean; + /** + * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. + * Updatable + */ + maxWidth?: number; + /** + * The minimum height of a window.Default: 0. + * Updatable + */ + minHeight?: number; + /** + * A flag that lets the window be minimized.Default: true. + */ + minimizable?: boolean; + /** + * The minimum width of a window.Default: 0. + */ + minWidth?: number; + /** + * The name for the window which must be unique within the context of the invoking Application. + */ + name?: string; + /** + * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. + * Updatable + */ + opacity?: number; + /** + * A flag to drop to allow the user to resize the window.Default: true. + * Updatable + */ + resizable?: boolean; + /** + * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + * Updatable + */ + resizeRegion?: { + /** + * The size in pixels (Default: 2), + */ + size?: number; + /** + * The size in pixels of an additional + * square resizable region located at the + * bottom right corner of a + * frameless window. (Default: 4) + */ + bottomRightCorner?: number; + }; + /** + * A flag to show the Window's icon in the taskbar. Default: true. + */ + showTaskbarIcon?: boolean; + /** + * A flag to cache the location of the window or not. Default: true. + */ + saveWindowState?: boolean; + /** + * Specify a taskbar group for the window. Default: app's uuid. + */ + taskbarIconGroup?: string; + /** + * A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal". + */ + state?: string; + /** + * The URL of the window. Default: "about:blank". + */ + url?: string; + /** + * When set to false, the window will render before the "load" event is fired on the content's window. + * Caution, when false you will see an initial empty white window. Default: true. + */ + waitForPageLoad?: boolean; + } + + /** + * Clipboard + * Clipboard API allows reading and writting to the clipboard in multiple formats. + */ + interface OpenFinClipboard { + /** + * Reads available formats for the clipboard type + */ + availableFormats(type: string | null, callback?: (formats: string[]) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Reads available formats for the clipboard type + */ + readHtml(type: string | null, callback?: (html: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as Rtf + */ + readRtf(type: string | null, callback?: (rtf: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as plain text + */ + readText(type: string | null, callback?: (text: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard + */ + write(data: any, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Html + */ + writeHtml(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Rtf + */ + writeRtf(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as plain text + */ + writeText(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + interface OpenFinExternalApplicationStatic { + /** + * Returns an External Application object that represents an existing external application. + */ + wrap(uuid: string): OpenFinExternalApplication; + } + /** + * ExternalApplication + * An object representing an application. Allows the developer to create, execute, show and close an application, as well as listen to application events. + */ + interface OpenFinExternalApplication { + /** + * Retrieves information about the application. + */ + getInfo(callback?: (info: ExternalApplicationInfo) => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinExternalApplicationEventType, + listener: () => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinExternalApplicationEventType, + listener: () => void, + callback?: () => void, + errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + /** + * InterApplicationBus + * A messaging bus that allows for pub/sub messaging between different applications. + */ + interface OpenFinInterApplicationBus { + /** + * Adds a listener that gets called when applications subscribe to the current application's messages. + */ + addSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Adds a listener that gets called when applications unsubscribe to the current application's messages. + */ + addUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered subscribe listener. + */ + removeSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered unsubscribe listener. + */ + removeUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic. + */ + publish(topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sends a message to a specific application on a specific topic. + */ + send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], + * topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published. + */ + subscribe( + senderUuid: string, + name: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + subscribe( + senderUuid: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Unsubscribes to messages from the specified application on the specified topic. + */ + unsubscribe( + senderUuid: string, + name: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + unsubscribe( + senderUuid: string, + topic: string, + listener: (message: any, uuid: string, name: string) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + } + + interface OpenFinNotificationStatic { + /** + * ctor + */ + new (options: NotificationOptions, callback?: () => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinNotification; + /** + * Gets an instance of the current notification. For use within a notification window to close the window or send a message back to its parent application. + */ + getCurrent(): OpenFinNotification; + } + + /** + * Notification + * Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. + * A notification is typically used to alert the user of some important event which requires his or her attention. + * Notifications are a child or your application that are controlled by the runtime. + */ + interface OpenFinNotification { + /** + * Closes the notification. + */ + close(callback?: () => void): void; + /** + * Sends a message to the notification. + */ + sendMessage(message: any, callback?: () => void): void; + /** + * Sends a message from the notification to the application that created the notification. The message is handled by the notification's onMessage callback. + */ + sendMessageToApplication(message: any, callback?: () => void): void; + } + + interface NotificationOptions { + /** + * A boolean that will force dismissal even if the mouse is hovering over the notification + */ + ignoreMouseOver?: boolean; + /** + * A message of any primitive or composite-primitive type to be passed to the notification upon creation. + */ + message?: any; + /** + * The timeout for displaying a notification.Can be in milliseconds or "never". + */ + duration?: number | "never"; + /** + * The url of the notification + */ + url?: string; + /** + * A function that is called when a notification is clicked. + */ + onClick?(callback: () => void): void; + /** + * Invoked when the notification is closed via .close() method on the created notification instance + * or the by the notification itself via fin.desktop.Notification.getCurrent().close(). + * NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss + */ + onClose?(callback: () => void): void; + /** + * Invoked when a the notification is dismissed by swiping it off the screen to the right. NOTE: this is no fired on a programmatic close. + */ + onDismiss?(callback: () => void): void; + /** + * A function that is called when an error occurs.The reason for the error is passed as an argument. + */ + onError?(errorCallback: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * The onMessage function will respond to messages sent from notification.sendMessageToApplication. + * The function is passed the message, which can be of any primitive or composite-primitive type. + */ + onMessage?(callback: (message: any) => void): void; + /** + * A function that is called when a notification is shown. + */ + onShow?(callback: (successObj: SuccessObj) => void): void; + } + + /** + * System + * An object representing the core of OpenFin Runtime. + * Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime. + */ + interface OpenFinSystem { + Clipboard: OpenFinClipboard; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinSystemEventType, + listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Clears cached data containing window state/positions, + * application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. + */ + clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Clears all cached data when OpenFin Runtime exits. + */ + deleteCacheOnExit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Downloads the given application asset + */ + downloadAsset( + assetObj: AppAssetInfo, + progressListener?: (progress: { downloadedBytes: number, totalBytes: number }) => void, + callback?: (successObj: { path: string }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + + /** + * Download preload scripts from given URLs + */ + downloadPreloadScripts(scripts: DownloadPreloadOption[], callback?: (downloadInfo: DownloadPreloadInfo[]) => void, + errorCallback?: (reason: string) => void): void; + /** + * Downloads the given OpenFin Runtime. + */ + downloadRuntime(options: RuntimeDownloadOptions, onProgress?: (progress: RuntimeDownloadProgress) => void, onComplete?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Exits the Runtime. + */ + exit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Writes any unwritten cookies data to disk. + */ + flushCookieStore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all applications. + */ + getAllApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all external applications. + */ + getAllExternalApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + */ + getAllWindows(callback?: (windowInfoList: WindowDetails[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the app asset. + */ + getAppAssetInfo(options: AppAssetOptions, callback?: (appAssetInfo: AppAssetInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Get additional info of cookies. + */ + getCookies(option: CookieOption, callback?: (info: CookieInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + */ + getCommandLineArguments(callback?: (args: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the configuration object that started the OpenFin Runtime. + */ + getDeviceId(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns a hex encoded hash of the mac address and the currently logged in user name + */ + getDeviceUserId(callback?: (id: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns an Entity info object relating to the entity specified by the uuid and name passed in. The possible types are 'window', 'iframe', 'external connection' or 'unknown'. + */ + getEntityInfo(uuid: string, name: string, callback?: (info: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed. + */ + getEnvironmentVariable(envVar: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves currently focused window identity. + */ + getFocusedWindow(callback?: (focusedWindowIdentity: Identity) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves system information. + */ + getHostSpecs(callback?: (info: HostSpecInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the contents of the log with the specified filename. + */ + getLog(logFileName: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing information for each log file. + */ + getLogList(callback?: (logInfoList: LogInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the minimum (inclusive) logging level that is currently being written to the logs. + */ + getMinLogLevel(callback?: (logLevel: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an object that contains data about the about the monitor setup of the computer that the runtime is running on. + */ + getMonitorInfo(callback?: (monitorInfo: MonitorInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the mouse in virtual screen coordinates (left, top). + */ + getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of all of the runtime processes that are currently running. + * Each element in the array is an object containing the uuid and the name of the application to which the process belongs. + */ + getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the Proxy settings. + */ + getProxySettings(callback?: (proxy: ProxyInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the running RVM in an object. + */ + getRvmInfo(callback?: (rvmInfo: RvmInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the version of the runtime. The version contains the major, minor, build and revision numbers. + */ + getVersion(callback?: (version: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Runs an executable or batch file. + */ + launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Writes the passed message into both the log file and the console. + */ + log(level: "debug" | "info" | "warn" | "error", message: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Monitors a running process. + */ + monitorExternalProcess(options: ExternalProcessInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + openUrlWithBrowser(url: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + readRegistryValue(rootKey: string, subkey: string, value: string, callback?: (info: RegistryInfo) => void, + errorCallback?: (reason: string) => void): void; + /** + * This function call will register a unique id and produce a token. The token can be used to broker an external connection. + */ + registerExternalConnection( + uuid: string, + callback?: (detail: { + /** + * this will be unique each time + */ + token: string; + /** + * "remote-connection-uuid" + */ + uuid: string; + }) => void, + errorCallback?: (reason: string) => void): void; + /** + * Removes the process entry for the passed UUID obtained from a prior call of fin.desktop.System.launchExternalProcess(). + */ + releaseExternalProcess(processUuid: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinSystemEventType, + listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, + callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Set the minimum log level above which logs will be written to the OpenFin log + */ + setMinLogLevel(logLevel: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the Chrome Developer Tools for the specified window. + */ + showDeveloperTools(uuid: string, name: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds. + */ + terminateExternalProcess( + processUuid: string, + timeout: number, + killTree: boolean, + callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, + errorCallback?: (reason: string) => void): void; + terminateExternalProcess( + processUuid: string, + timeout: number, + callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, + errorCallback?: (reason: string) => void): void; + /** + * Update the OpenFin Runtime Proxy settings. + */ + updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface CacheOptions { + cache?: boolean; + cookies?: boolean; + localStorage?: boolean; + appcache?: boolean; + userData?: boolean; + } + + interface AppAssetInfo { + src?: string; + alias?: string; + version?: string; + target?: string; + args?: string; + mandatory?: boolean; + } + + interface AppAssetOptions { + alias: string; + } + + interface ApplicationInfo { + /** + * true when the application is running. + */ + isRunning?: boolean; + /** + * uuid of the application. + */ + uuid?: string; + /** + * uuid of the application that launches this application. + */ + parentUuid?: string; + } + + interface Identity { + uuid: string; + name: string; + } + + interface EntityInfo { + name: string; + uuid: string; + parent: Identity; + entityType: string; + } + + interface DownloadPreloadOption { + url: string; + } + + interface DownloadPreloadInfo { + success: boolean; + url?: string; + error: string; + } + + interface CookieInfo { + name: string; + // expirationDate: Date; + domain: string; + path: string; + } + + interface CookieOption { + name: string; + } + + interface RegistryInfo { + data: any; + rootKey: string; + subkey: string; + type: string; + value: string; + } + + interface RuntimeDownloadOptions { + version: string; + } + + interface RuntimeDownloadProgress { + downloadedBytes: number; + totalBytes: number; + } + + interface WindowDetails { + uuid?: string; + mainWindow?: WindowInfo; + childWindows?: WindowInfo[]; + } + + interface WindowInfo { + /** + * name of the child window + */ + name?: string; + /** + * top-most coordinate of the child window + */ + top?: number; + /** + * right-most coordinate of the child window + */ + right?: number; + /** + * bottom-most coordinate of the child window + */ + bottom?: number; + /** + * left-most coordinate of the child window + */ + left?: number; + } + + interface HostSpecInfo { + /** + * "x86" for 32-bit or "x86_64" for 64-bit + */ + arch: string; + /** + * Same payload as Node's os.cpus() + */ + cpus: NodeCpuInfo[]; + gpu: { + /** + * Graphics card name + */ + name: string; + }; + /** + * Same payload as Node's os.totalmem() + */ + memory: number; + /** + * OS name and version/edition + */ + name: string; + } + + interface NodeCpuInfo { + model: string; + /** + * in MHz + */ + speed: number; + times: { + /** + * The number of milliseconds the CPU has spent in user mode. + */ + user: number; + /** + * The number of milliseconds the CPU has spent in nice mode. + */ + nice: number; + /** + * The number of milliseconds the CPU has spent in sys mode. + */ + sys: number; + /** + * The number of milliseconds the CPU has spent in idle mode. + */ + idle: number; + /** + * The number of milliseconds the CPU has spent in irq mode. + */ + irq: number; + }; + } + + interface LogInfo { + /** + * the filename of the log + */ + name?: string; + /** + * the size of the log in bytes + */ + size?: number; + /** + * the unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" + */ + date?: string; + } + + interface ProcessInfo { + /** + * the percentage of total CPU usage + */ + cpuUsage?: number; + /** + * the application name + */ + name?: string; + /** + * the current nonpaged pool usage in bytes + */ + nonPagedPoolUsage?: number; + /** + * the number of page faults + */ + pageFaultCount?: number; + /** + * the current paged pool usage in bytes + */ + pagedPoolUsage?: number; + /** + * the total amount of memory in bytes that the memory manager has committed + */ + pagefileUsage?: number; + /** + * the peak nonpaged pool usage in bytes + */ + peakNonPagedPoolUsage?: number; + /** + * the peak paged pool usage in bytes + */ + peakPagedPoolUsage?: number; + /** + * the peak value in bytes of pagefileUsage during the lifetime of this process + */ + peakPagefileUsage?: number; + /** + * the peak working set size in bytes + */ + peakWorkingSetSize?: number; + /** + * the native process identifier + */ + processId?: number; + /** + * the application UUID + */ + uuid?: string; + /** + * the current working set size (both shared and private data) in bytes + */ + workingSetSize?: number; + } + + interface ProxyInfo { + /** + * the configured Proxy Address + */ + proxyAddress?: string; + /** + * the configured Proxy port + */ + proxyPort?: number; + /** + * Proxy Type + */ + type?: string; + } + + interface RvmInfo { + version?: string; + "start-time"?: string; + } + + interface ExternalProcessLaunchInfo { + path?: string; + /** + * Additionally note that the executable found in the zip file specified in appAssets + * will default to the one mentioned by appAssets.target + * If the the path below refers to a specific path it will override this default + */ + alias?: string; + /** + * When using alias; if no arguments are passed then the arguments (if any) + * are taken from the 'app.json' file, from the 'args' parameter + * of the 'appAssets' Object with the relevant 'alias'. + * If 'arguments' is passed as a parameter it takes precedence + * over any 'args' set in the 'app.json'. + */ + arguments?: string; + listener?(result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic?: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid?: string; + /* + * Process exit code + */ + exitCode?: number; + }): void; + certificate?: CertificationInfo; + } + + interface CertificationInfo { + /** + * A hex string with or without spaces + */ + serial?: string; + /** + * An internally tokenized and comma delimited string allowing partial or full checks of the subject fields + */ + subject?: string; + /** + * A hex string with or without spaces + */ + publickey?: string; + /** + * A hex string with or without spaces + */ + thumbprint?: string; + /** + * A boolean indicating that the certificate is trusted and not revoked + */ + trusted?: boolean; + } + + interface ExternalProcessInfo { + pid?: number; + listener?(result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic?: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid?: string; + /* + * Process exit code + */ + exitCode?: number; + }): void; + } + + interface OpenFinWindowStatic { + /** + * Class: Window + * + * new Window(options, callbackopt, errorCallbackopt) + * + * Creates a new OpenFin Window + * + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, + * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. + * The new window appears in the same process as the parent window. + * @param options - The options of the window + * @param [callback] - Called if the window creation was successful + * @param [callback.successObj] - httpResponseCode + */ + new ( + options: WindowOptions, + callback?: (successObj: { httpResponseCode: number }) => void, + errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; + /** + * Returns an instance of the current window. + * @returns Current window + */ + getCurrent(): OpenFinWindow; + /** + * Returns a Window object that wraps an existing window. + */ + wrap(appUuid: string, windowName: string): OpenFinWindow; + } + + /** + * Window + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, + * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. + * The new window appears in the same process as the parent window. + */ + interface OpenFinWindow { + /** + * uuid of the application that the window belongs to. + */ + uuid: string; + /** + * Name of window + */ + name: string; + /** + * Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, + * otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the + * contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. + * Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap(). + * @returns Native window + */ + getNativeWindow(): Window; + /** + * Gets the parent application. + * @returns Parent application + */ + getParentApplication(): OpenFinApplication; + /** + * Gets the parent window. + */ + getParentWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener( + type: OpenFinWindowEventType, + listener: (event: WindowBaseEvent + | WindowAuthRequestedEvent + | WindowBoundsEvent + | WindowExternalProcessStartedEvent + | WindowExternalProcessExited + | WindowGroupChangedEvent + | WindowHiddenEvent + | Window_NavigationRejectedEvent) => void, + callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Performs the specified window transitions + */ + animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Provides credentials to authentication requests + */ + authenticate(userName: string, password: string, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes focus from the window. + */ + blur(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Brings the window to the front of the OpenFin window stack. + */ + bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the window. + * @param Close will be prevented from closing when force is false and 'close-requested' has been subscribed to for application's main window. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-disabled' is generated when an enabled frame becomes disabled. + */ + disableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-enabled' is generated when a disabled frame has becomes enabled. + */ + enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Flashes the window's frame and taskbar icon until the window is activated. + */ + flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gives focus to the window. + */ + focus(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current bounds (top, left, width, height) of the window. + */ + getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. + * Please note that calling window is included in the result array. + */ + getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current settings of the window. + */ + getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets a base64 encoded PNG snapshot of the window. + */ + getSnapshot(callback?: (base64Snapshot: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current state ("minimized", "maximized", or "restored") of the window. + */ + getState(callback?: (state: "minimized" | "maximized" | "restored") => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the zoom level of the window. + */ + getZoomLevel(callback?: (level: number) => void, errorCallback?: (reason: string) => void): void; + /** + * Hides the window. + */ + hide(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the window is currently showing. + */ + isShowing(callback?: (showing: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Joins the same window group as the specified window. + */ + joinGroup(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + */ + leaveGroup(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Maximizes the window. + */ + maximize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Merges the instance's window group with the same window group as the specified window + */ + mergeGroups(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Minimizes the window. + */ + minimize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window by a specified amount. + */ + moveBy(deltaLeft: number, deltaTop: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window to a specified location. + */ + moveTo(left: number, top: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener( + type: OpenFinWindowEventType, + listener: (event: WindowBaseEvent + | WindowAuthRequestedEvent + | WindowBoundsEvent + | WindowExternalProcessStartedEvent + | WindowExternalProcessExited + | WindowGroupChangedEvent + | WindowHiddenEvent + | Window_NavigationRejectedEvent) => void, + callback?: () => void, + errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeTo(width: number, height: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + */ + restore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Will bring the window to the front of the entire stack and give it focus. + */ + setAsForeground(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the window's size and position + */ + setBounds(left: number, top: number, width: number, height: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the zoom level of the window. + */ + setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden. + * @param Show will be prevented from closing when force is false and 'show-requested' has been subscribed to for application's main window. + */ + show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden at the specified location. If the toggle parameter is set to true, the window will alternate between showing and hiding. + */ + showAt(left: number, top: number, force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Stops the taskbar icon from flashing. + */ + stopFlashing(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Updates the window using the passed options + */ + updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface OpenFinFrameStatic { + wrap(uuid: string, name: string): OpenFinFrame; + + getCurrent(): OpenFinFrame; + } + + interface OpenFinFrame { + name: string; + uuid: string; + + addEventListener(type: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + + getParentWindow(callback?: (entityInfo: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + + getInfo(callback?: (entityInfo: EntityInfo) => void, errorCallback?: (reason: string) => void): void; + + removeEventListener(type: string, listener: () => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface ApplicationBaseEvent { + topic: string; + type: OpenFinApplicationEventType; + uuid: string; + } + + interface TrayIconClickedEvent extends ApplicationBaseEvent { + button: number; // 0 for left, 1 for middle, 2 for right + monitorInfo: MonitorInfo; + x: number; // the cursor x coordinate + y: number; // the cursor y coordinate + } + + interface WindowEvent extends ApplicationBaseEvent { + name: string; + } + + interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; + } + + interface WindowAuthRequested extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; + } + + interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; + } + + interface MonitorInfoChangedEvent extends MonitorInfo { + topic: "system"; + type: "monitor-info-changed"; + } + + interface MonitorInfo { + nonPrimaryMonitors: MonitorInfoDetail[]; + primaryMonitor: MonitorInfoDetail; + reason: string; + taskbar: { + edge: "left" | "right" | "top" | "bottom", + rect: MontiorCoordinates + }; + topic: "system"; + type: "monitor-info-changed"; + virtualScreen: MontiorCoordinates; + } + + interface TrayIconInfo { + x: number; + y: number; + bounds: { + x: number; + y: number; + width: number; + height: number; + }; + monitorInfo: MonitorInfo; + } + + interface MonitorInfoDetail { + availableRect: MontiorCoordinates; + deviceId: string; + displayDeviceActive: boolean; + monitorRect: MontiorCoordinates; + name: string; + } + + interface MontiorCoordinates { + bottom: number; + left: number; + right: number; + top: number; + } + + interface VirtualScreenCoordinates { + left: number; + top: number; + } + + interface SystemBaseEvent { + topic: string; + type: OpenFinSystemEventType; + uuid: string; + } + + interface DesktopIconClickedEvent { + mouse: { + /** + * the left virtual screen coordinate of the mouse + */ + left: number, + /** + * the top virtual screen coordinate of the mouse + */ + top: number + }; + /** + * the number of milliseconds that have elapsed since the system was started, + */ + tickCount: number; + topic: "system"; + type: "desktop-icon-clicked"; + } + + interface IdleStateChangedEvent { + /** + * How long in milliseconds since the user has been idle. + */ + elapsedTime: number; + /** + * true when the user is idle,false when the user has returned; + */ + isIdle: boolean; + topic: "system"; + type: "idle-state-changed"; + } + + interface WindowBaseEvent { + /** + * the name of the window + */ + name: string; + /** + * always window + */ + topic: "window"; + /** + * window event type + */ + type: OpenFinWindowEventType; + /** + * the UUID of the application the window belongs to + */ + uuid: string; + } + + interface WindowAuthRequestedEvent extends WindowBaseEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowBoundsEvent extends WindowBaseEvent { + /** + * describes what kind of change occurred. + * 0 means a change in position. + * 1 means a change in size. + * 2 means a change in position and size. + */ + changeType: number; + /** + * true when pending changes have been applied to the window. + */ + deferred: boolean; + /** + * the new height of the window. + */ + height: number; + /** + * the left-most coordinate of the window. + */ + left: number; + /** + * the top-most coordinate of the window. + */ + top: number; + + type: "bounds-changed" | "bounds-changing" | "disabled-frame-bounds-changed" | "disabled-frame-bounds-changing"; + /** + * the new width of the window. + */ + width: number; + } + + interface WindowExternalProcessStartedEvent extends WindowBaseEvent { + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-started"; + } + + interface WindowExternalProcessExited extends WindowBaseEvent { + /** + * the process exit code + */ + exitCode: number; + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-exited"; + } + + interface WindowGroupChangedEvent extends WindowBaseEvent { + /** + * Which group array the window that the event listener was registered on is included in: + * 'source' The window is included in sourceGroup. + * 'target' The window is included in targetGroup. + * 'nothing' The window is not included in sourceGroup nor targetGroup. + */ + memberOf: "source" | "target" | "nothing"; + /** + * The reason this event was triggered. + * 'leave' A window has left the group due to a leave or merge with group. + * 'join' A window has joined the group. + * 'merge' Two groups have been merged together. + * 'disband' There are no other windows in the group. + */ + reason: "leave" | "join" | "merge" | "disband"; + /** + * All the windows in the group the sourceWindow originated from. + */ + sourceGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the sourceWindow belongs to The source window is the window in which (merge/join/leave)group(s) was called. + */ + sourceWindowAppUuid: string; + /** + * the name of the sourcewindow.The source window is the window in which(merge / join / leave) group(s) was called. + */ + sourceWindowName: string; + /** + * All the windows in the group the targetWindow orginated from + */ + targetGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowAppUuid: string; + /** + * The name of the targetWindow. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowName: string; + type: "group-changed"; + } + + interface WindowOfGroupInfo { + /** + * The UUID of the application this window entry belongs to. + */ + appUuid: string; + /** + * The name of this window entry. + */ + windowName: string; + } + + interface WindowHiddenEvent extends WindowBaseEvent { + /** + * What action prompted the close. + * The reasons are: "hide", "hide-on-close" + */ + reason: "hide" | "hide-on-close"; + type: "hidden"; + } + + interface Window_NavigationRejectedEvent { + name: string; + /** + * source of navigation window name + */ + sourceName: string; + topic: "navigation-rejected"; + /** + * Url that was not reached "http://blocked-content.url" + */ + url: string; + /** + * the UUID of the application the window belongs to. + */ + uuid: string; + } + + interface AnimationTransition { + opacity?: { + /** + * This value is clamped from 0.0 to 1.0 + */ + opacity?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'opacity' as absolute or as a delta. Defaults to false. + */ + relative?: boolean; + }; + position?: { + /** + * Defaults to the window's current left position in virtual screen coordinates. + */ + left?: number; + /** + * Defaults to the window's current top position in virtual screen coordinates. + */ + top?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'left' and 'top' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + size?: { + /** + * Optional if height is present. Defaults to the window's current width. + */ + width?: number; + /** + * Optional if width is present. Defaults to the window's current height. + */ + height?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'width' and 'height' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + } + + interface AnimationOptions { + /** + * This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue. + */ + interrupt?: boolean; + /** + * Transition effect. Defaults to 'ease-in-out'. + */ + tween?: OpenFinTweenType; + } + + interface WindowBounds { + /** + * the height of the window. + */ + height?: number; + /** + * left-most coordinate of the window. + */ + left?: number; + /** + * top-most coordinate of the window. + */ + top?: number; + /** + * the width of the window. + */ + width?: number; + } + + interface ExternalApplicationInfo { + parent: { + uuid: string; + name: string; + }; + } + + interface SessionChangedEvent { + /** + * the action that triggered this event: + */ + reason: "lock" + | "unlock" + | "remote-connect" + | "remote-disconnect" + | "unknown"; + topic: "system"; + type: "session-changed"; + } + + interface LaunchInfo { + launchMode: "fin-protocol" + | "fins-protocol" + | "shortcut" + | "command-line" + | "adapter" + | "other" + | string; + } + + type OpenFinTweenType = "linear" + | "ease-in" + | "ease-out" + | "ease-in-out" + | "ease-in-quad" + | "ease-out-quad" + | "ease-in-out-quad" + | "ease-in-cubic" + | "ease-out-cubic" + | "ease-in-out-cubic" + | "ease-out-bounce" + | "ease-in-back" + | "ease-out-back" + | "ease-in-out-back" + | "ease-in-elastic" + | "ease-out-elastic" + | "ease-in-out-elastic"; + + type OpenFinApplicationEventType = "closed" + | "connected" + | "crashed" + | "initialized" + | "manifest-changed" + | "not-responding" + | "out-of-memory" + | "responding" + | "run-requested" + | "started" + | "tray-icon-clicked" + | "window-alert-requested" + | "window-auth-requested" + | "window-closed" + | "window-created" + | "window-end-load" + | "window-navigation-rejected" + | "window-show-requested" + | "window-start-load"; + + type OpenFinExternalApplicationEventType = "connected" + | "disconnected"; + + type OpenFinSystemEventType = "application-closed" + | "application-crashed" + | "application-created" + | "application-started" + | "desktop-icon-clicked" + | "idle-state-changed" + | "monitor-info-changed" + | "session-changed"; + + type OpenFinWindowEventType = "auth-requested" + | "blurred" + | "bounds-changed" + | "bounds-changing" + | "close-requested" + | "closed" + | "disabled-frame-bounds-changed" + | "disabled-frame-bounds-changing" + | "embedded" + | "external-process-exited" + | "external-process-started" + | "focused" + | "frame-disabled" + | "frame-enabled" + | "group-changed" + | "hidden" + | "initialized" + | "maximized" + | "minimized" + | "navigation-rejected" + | "restored" + | "show-requested" + | "shown"; + + type OpenFinAnchor = "top-left" + | "top-right" + | "bottom-left" + | "bottom-right"; +} diff --git a/types/openfin/v34/openfin-tests.ts b/types/openfin/v34/openfin-tests.ts new file mode 100644 index 0000000000..6059f54de7 --- /dev/null +++ b/types/openfin/v34/openfin-tests.ts @@ -0,0 +1,800 @@ +function test_application() { + let application: fin.OpenFinApplication; + // constructor + application = new fin.desktop.Application({ + url: "application.html", + uuid: "74BED629-2D8E-4141-8582-73E364BDFA74", + name: "Application Name", + plugins: false, + mainWindowOptions: { + defaultHeight: 600, + defaultWidth: 800, + defaultTop: 300, + defaultLeft: 300, + autoShow: true + } + }, (successObj) => { + console.log("Application successfully created, HTTP response code:", successObj); + application.run(); + }, (error) => { + console.log("Error creating application:", error); + }); + // createFromManifest + fin.desktop.Application.createFromManifest("http://stuf.com/app.json", (app) => { + console.log(app.uuid); + }, err => console.log(err)); + // getCurrent + application = fin.desktop.Application.getCurrent(); + // wrap + application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52"); + // getWindow + application.getWindow(); + // addEventListener + application.addEventListener("closed", (event) => { + console.log("The application has closed"); + }, () => { + console.log("The registration was successful"); + }, reason => { + console.log("failure: " + reason); + }); + // close + application.close(); + // getChildWindows + application.getChildWindows(children => { + children.forEach(childWindow => { + console.log("Showing child: " + childWindow.name); + childWindow.show(); + }); + }); + // getGroups + application.getGroups(allGroups => { + console.log(`There are a total of ${allGroups.length} groups.`); + + let groupCounter = 1; + allGroups.forEach(windowGroup => { + console.log(`Group ${groupCounter} contains ${windowGroup.length} windows.`); + ++groupCounter; + }); + }); + // getManifest + application.getManifest(manifest => { + console.log("Application manifest:"); + console.log(manifest); + }); + // getParentUuid + application.getParentUuid(parentUuid => { + console.log("UUID of parent application:"); + console.log(parentUuid); + }); + // getShortcuts + application.getShortcuts(config => { + console.log("Desktop shortcut is enabled: ", config.desktop); + console.log("Start Menu shortcut is enabled: ", config.startMenu); + console.log("System Startup shortcut is enabled: ", config.systemStartup); + }); + // getInfo + application.getInfo(info => { + console.log(`Launch mode: ${info.launchMode}`); + }); + // getTrayIconInfo + application.getTrayIconInfo(info => { + console.log(info.x, info.y, info.bounds.x, info.bounds.y, info.bounds.height, info.bounds.width, + info.monitorInfo.type, info.monitorInfo.reason); + }); + // isRunning + application.isRunning(running => { + console.log("the application is", running ? "running" : "not running"); + }); + // registerCustomData + application.registerUser("a", "b", () => console.log("done"), err => console.log(err)); + // removeEventListener + application.removeEventListener("closed", (event: any) => { + console.log(event); + }, () => { + console.log("The unregistration was successful"); + }, err => { + console.log("failure:", err); + }); + // removeTrayIcon + application.removeTrayIcon(() => { + console.log("Removed the tray icon."); + }, err => { + console.log("failure:", err); + }); + // restart + application.restart(() => { + console.log("You will not read this."); + }, err => { + console.log("failure:", err); + }); + // schedule restart + application.scheduleRestart(() => { + console.log("You will not read this."); + }, err => { + console.log("failure:", err); + }); + // setShortcuts + application.setShortcuts({ + desktop: true, + startMenu: false, + systemStartup: true + }, () => { + console.log("Successfully set new shortcut states"); + }, error => { + console.log("Failed to set new shortcut states. Error: ", error); + }); + // setTrayIcon + application.setTrayIcon("https://developer.openf.in/download/openfin.png", clickInfo => { + console.log(`The mouse has clicked at (${clickInfo.x}, ${clickInfo.y})`); + }); + // terminate + application.terminate(); + // wait + application.addEventListener("not-responding", () => { + console.log("waiting for hung application"); + application.wait(); + }); + // uuid + const hasUuid = application.uuid; +} + +function test_external_application() { + let externalApp: fin.OpenFinExternalApplication; + // wrap + externalApp = fin.desktop.ExternalApp.wrap('my-uuid'); + // addEventListener + externalApp.addEventListener('connected', () => { + console.log('external app connected'); + }, () => { + console.log('The registration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); + // removeEventListener + const previousCallback = () => { }; + externalApp.removeEventListener('connected', previousCallback, () => { + console.log('The unregistration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); + + // getInfo + externalApp.getInfo(info => { + console.log(info.parent.uuid, info.parent.name); + }, err => console.log(err)); +} + +function test_inter_application_bus() { + // addSubscribeListener + fin.desktop.InterApplicationBus.addSubscribeListener((uuid, topic, name) => { + console.log(`The application ${uuid} has subscribed to ${topic}`); + }); + // addUnsubscribeListener + fin.desktop.InterApplicationBus.addUnsubscribeListener((uuid, topic, name) => { + console.log(`The application ${uuid} has unsubscribed to ${topic}`); + }); + // removeSubscribeListener + const aRegisteredListener = (uuid: string, topic: string, name: string) => { }; + fin.desktop.InterApplicationBus.removeSubscribeListener(aRegisteredListener); + // removeUnsubscribeListener + fin.desktop.InterApplicationBus.removeUnsubscribeListener(aRegisteredListener); + // publish + fin.desktop.InterApplicationBus.publish("a topic", { + field1: "value1", + field2: "value2" + }); + // send + fin.desktop.InterApplicationBus.send("an application's uuid", "a topic", { + field1: "value1", + field2: "value2" + }); + // subscribe + fin.desktop.InterApplicationBus.subscribe("*", "a topic", (message, uuid, name) => { + console.log(`The application ${uuid} sent this message: ${message}`); + }); + // unsubscribe + const aRegisteredMessageListener = (message: any, senderUuid: string) => { + console.log(message, senderUuid); + }; + fin.desktop.InterApplicationBus.unsubscribe("*", "a topic", aRegisteredMessageListener); +} + +function test_notification() { + let notification: fin.OpenFinNotification; + // getCurrent + notification = fin.desktop.Notification.getCurrent(); + // close + notification.close(); + // sendMessage + notification = new fin.desktop.Notification({ + duration: 10, + url: "http://localhost:5000/Account/Register", + message: "Hello", + onShow: () => { }, + // onClose: () => { }, + onDismiss: () => { }, + // onClick: () => { }, + onMessage: () => { }, + onError: () => { } + }); + // sendMessageToApplication + notification.sendMessageToApplication("some message"); +} + +function test_system() { + // addEventListener + fin.desktop.System.addEventListener('monitor-info-changed', event => { + console.log("The monitor information has changed to: ", event); + }, () => { + console.log("The registration was successful"); + }, err => { + console.log("failure: " + err); + }); + // clearCache + fin.desktop.System.clearCache({ + cache: true, + cookies: true, + localStorage: true, + appcache: true, + userData: true + }); + // deleteCacheOnExit + fin.desktop.System.deleteCacheOnExit(() => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // downloadAsset + const dirAppAsset = { + src: 'http://local:8000/dir.zip', + alias: 'dirApp', + version: '1.23.24', + target: 'dir.bat', + args: '' + }; + fin.desktop.System.downloadAsset(dirAppAsset, progress => { + const downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100); + console.log(`Downloaded ${downloadedPercent}%`); + }, p => { + console.log(`Downlod complete, can be found on ${p.path}`); + // lets launch our application asset. + // launchDirApp(); + }, (reason, err) => { + console.log(reason, err); + }); + // downloadRuntime + fin.desktop.System.downloadRuntime({ version: '9.61.31.56' }, progress => { + console.log(progress.downloadedBytes, progress.downloadedBytes); + }, () => console.log('download complete'), err => console.error(err)); + // downloadPreloadScript + const preloadScripts = [ + { url: 'http://whatever.com/script.js' } + ]; + fin.desktop.System.downloadPreloadScripts(preloadScripts, info => { + const downloadInfo = info[0]; + console.log(downloadInfo.success, downloadInfo.url, downloadInfo.error); + }, err => { + console.log(err); + }); + // exit + fin.desktop.System.exit(() => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // flushCookieStore + fin.desktop.System.flushCookieStore(() => { + console.log('successful'); + }, err => { + console.log('failure', err); + }); + // getAllApplications + fin.desktop.System.getAllApplications(applicationInfoList => { + applicationInfoList.forEach(applicationInfo => { + console.log("Showing information for application with uuid: " + + applicationInfo.uuid); + console.log("isRunning: ", applicationInfo.isRunning); + }); + }); + // getAllExternalApplications + fin.desktop.System.getAllExternalApplications(externalAppsInfoList => { + externalAppsInfoList.forEach(appInfo => { + console.log(`External app connected to the runtime with UUID ${appInfo.uuid}`); + }); + }); + // getAllWindows + fin.desktop.System.getAllWindows(windowInfoList => { + windowInfoList.forEach(windowInfo => { + console.log("Showing information for application with uuid: ", windowInfo.uuid); + console.log("Main window: ", windowInfo.mainWindow); + console.log("Child windows: ", windowInfo.childWindows); + }); + }); + // getAppAssetInfo + fin.desktop.System.getAppAssetInfo({ alias: 'myAppAsset' }, info => { + console.log(info.alias, info.args, info.mandatory, info.src, info.target, info.version); + }, err => console.log(err)); + // getCommandLineArguments + fin.desktop.System.getCommandLineArguments(args => { + console.log("The command line arguments are " + args); + }); + // getCookieInfo + fin.desktop.System.getCookies({ name: 'myCookie1'}, cookies => { + const cookie1 = cookies[0]; + console.log(cookie1.name, cookie1.domain, cookie1.path); + }, err => console.log(err)); + // getDeviceId + fin.desktop.System.getDeviceId(id => { + console.log("The id of the device is: " + id); + }); + // getDeviceUserId + fin.desktop.System.getDeviceUserId(id => console.log(id), err => console.error(err)); + // getEntityInfo + fin.desktop.System.getEntityInfo('uuid', 'name', info => { + console.log(info.entityType, info.name, info.uuid, info.parent.name, info.parent.uuid); + }, err => console.log(err)); + // getEnvironmentVariable + fin.desktop.System.getEnvironmentVariable("APPDATA", variable => { + console.log("this is the APPDATA value", variable); + }); + // getFocusedWindow + fin.desktop.System.getFocusedWindow(win => { + console.log(win.uuid, win.name); + }, err => console.log(err)); + // getHostSpecs + fin.desktop.System.getHostSpecs(info => { + console.log(info); + }, error => { + console.log('There was an error:', error); + }); + // getLog + fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', log => { + console.log(log); + }); + // getLogList + fin.desktop.System.getLogList(logList => { + logList.forEach(logInfo => { + console.log(`The filename of the log is ${logInfo.name}, the size is ${logInfo.size}, and the date of creation is ${logInfo.date}`); + }); + }); + // getMinLogLevel + fin.desktop.System.getMinLogLevel(level => console.log(level), err => console.log(err)); + // getMonitorInfo + fin.desktop.System.getMonitorInfo(monitorInfo => { + console.log("This object contains information about all monitors: ", monitorInfo); + }); + // getMousePosition + fin.desktop.System.getMousePosition(mousePosition => { + console.log(`The mouse is located at left: ${mousePosition.left}, top: ${mousePosition.top}`); + }); + // getProcessList + fin.desktop.System.getProcessList(list => { + list.forEach(process => { + console.log(`UUID: ${process.uuid}, Application Name: ${process.name}`); + }); + }); + // getProxySettings + fin.desktop.System.getProxySettings(proxy => { + console.log(proxy); + }); + // getRvmInfo + fin.desktop.System.getRvmInfo(rvmInfoObject => { + console.log("RVM version:", rvmInfoObject.version); + console.log("RVM has been running since:", rvmInfoObject["start-time"]); + }, err => { + console.log("Failed to get rvm info, error message:", err); + }); + // getVersion + fin.desktop.System.getVersion(version => { + console.log("The version is " + version); + }); + // launchExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // launch external process with an alias + fin.desktop.System.launchExternalProcess({ + // Additionally note that the executable found in the zip file specified in appAssets + // will default to the one mentioned by appAssets.target + // If the the path below refers to a specific path it will override this default + alias: "myApp", + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + alias: "myApp", + arguments: "e f g", + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + path: "C:\Users\ExampleUser\AppData\Local\OpenFin\OpenFinRVM.exe", + arguments: "--version", + certificate: { + trusted: true, + subject: 'O=OpenFin INC., L=New York, S=NY, C=US', + thumbprint: '3c a5 28 19 83 05 fe 69 88 e6 8f 4b 3a af c5 c5 1b 07 80 5b' + }, + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log('Success:', payload.uuid); + }, error => { + console.log('Error:', error); + }); + // log + fin.desktop.System.log("info", "An example log message", () => { + console.log("message successfully logged"); + }, err => { + console.log(err); + }); + // monitorExternalProcess + fin.desktop.System.monitorExternalProcess({ + pid: 2508, + listener(result) { + console.log('the exit code', result.exitCode); + } + }, payload => { + console.log("The process is now being monitored: ", payload.uuid); + }, error => { + console.log("Error:", error); + }); + // openUrlWithBrowser + fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", () => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // readRegistryValue + fin.desktop.System.readRegistryValue('HKEY_SOMETHING', 'HARDWARE\\SOMETHING', 'BootSomething', info => { + console.log(info.data, info.rootKey, info.subkey, info.type, info.value); + }, err => console.log(err)); + // registerExternalConnection + fin.desktop.System.registerExternalConnection("remote-connection-uuid", (...args: any[]) => { + console.log(args); + }); + // releaseExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener(result) { + console.log("The exit code", result.exitCode); + } + }, result => { + console.log("Result UUID is " + result.uuid); + + // release it. + fin.desktop.System.releaseExternalProcess(result.uuid, () => { + console.log("Process has been unmapped!"); + }, reason => { + console.log("failure: " + reason); + }); + }); + // removeEventListener + fin.desktop.System.removeEventListener("monitor-info-changed", (event) => { + console.log(event); + }, () => { + console.log("successful"); + }, (err: any) => { + console.log("failure: " + err); + }); + // setMinLogLevel + fin.desktop.System.setMinLogLevel("log level", () => console.log('Success'), (err: any) => console.error(err)); + // showDeveloperTools + fin.desktop.System.showDeveloperTools("uuid", "name", () => { + console.log("successful"); + }, err => { + console.log("failure: " + err); + }); + // terminateExternalProcess + fin.desktop.System.launchExternalProcess({ + // notepad is in the system's PATH + path: "notepad", + arguments: "", + listener(result) { + console.log("The exit code", result.exitCode); + } + }, result => { + console.log("Result UUID is " + result.uuid); + + // Attempt to close the process. Terminate after 4 seconds if it + // has not done so. + fin.desktop.System.terminateExternalProcess(result.uuid, 4000, info => { + console.log("Termination result " + info.result); + }, reason => { + console.log("failure: " + reason); + }); + }); + // updateProxySettings + fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, () => { + console.log('success'); + }, err => { + console.log(err); + }); +} + +function test_system_clipboard() { + // availableFormats + fin.desktop.System.Clipboard.availableFormats(null, formats => { + formats.forEach(format => console.log(`The format ${format} is available to read`)); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readHtml + fin.desktop.System.Clipboard.readHtml(null, html => { + console.log(`This is the html from the clipboard: ${html}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readRtf + fin.desktop.System.Clipboard.readRtf(null, rtf => { + console.log(`This is the rtf from the clipboard: ${rtf}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readText + fin.desktop.System.Clipboard.readText(null, text => { + console.log(`This is the text from the clipboard: ${text}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // write + fin.desktop.System.Clipboard.write({ + text: 'Hello Text!', + html: '

      Hello Html

      ', + rtf: 'Hello Rtf' + }, null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeHtml + fin.desktop.System.Clipboard.writeHtml('

      Hello World

      ', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeRtf + fin.desktop.System.Clipboard.writeRtf('Hello World!', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeText + fin.desktop.System.Clipboard.writeText('Hello World', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); +} + +function test_window() { + let finWindow: fin.OpenFinWindow; + // constructor + finWindow = new fin.desktop.Window({ + name: "childWindow", + url: "child.html", + defaultWidth: 320, + defaultHeight: 320, + defaultTop: 10, + defaultLeft: 300, + frame: false, + resizable: false, + state: "normal" + }, () => { + const _win = finWindow.getNativeWindow(); + _win.addEventListener("DOMContentLoaded", () => { finWindow.show(); }); + }, error => { + console.log("Error creating window:", error); + }); + // getCurrent + finWindow = fin.desktop.Window.getCurrent(); + // getNativeWindow + let nativeWindow: Window; + nativeWindow = finWindow.getNativeWindow(); + // getParentApplication + let parentApp: fin.OpenFinApplication; + parentApp = finWindow.getParentApplication(); + // getParentWindow + let parentFinWindow: fin.OpenFinWindow; + parentFinWindow = finWindow.getParentWindow(); + // wrap + finWindow = fin.desktop.Window.wrap("uuid", "name"); + // addEventListener + finWindow.addEventListener("bounds-changed", event => { + console.log("The window has been moved or resized"); + }, () => { + console.log("The registration was successful"); + }, reason => { + console.log("failure:" + reason); + }); + // animate + finWindow.animate({ + opacity: { + opacity: 0.15, + duration: 1000 + }, + position: { + left: 10, + top: 10, + duration: 3000 + } + }, { + interrupt: false + }, evt => { + // Callback will only fire after both "opacity" and "position" have finished animating. + }); + // authenticate + finWindow.addEventListener('auth-requested', evt => { + finWindow.authenticate('userName', 'P@assw0rd', () => { }, (reason, err) => { + console.log("failure:", err); + }); + }); + // blur + finWindow.blur(); + // bringToFront + finWindow.bringToFront(); + // close + finWindow.close(); + // disableFrame + finWindow.disableFrame(); + // enableFrame + finWindow.enableFrame(); + // flash + finWindow.flash(); + // focus + finWindow.focus(); + // getBounds + finWindow.getBounds(bounds => { + console.log(`top: ${bounds.top} left: ${bounds.left} height: ${bounds.height} width: ${bounds.width}`); + }); + // getOptions + finWindow.getOptions(options => { + console.log(options); + }); + // getSnapshot + finWindow.getSnapshot(base64Snapshot => { + console.log("data:image/png;base64," + base64Snapshot); + }); + // getState + finWindow.getState(state => { + console.log("state: " + state); + }); + // getZoomLevel + finWindow.getZoomLevel(level => { + console.log("zoom level: " + level); + }, error => { + console.log('error:', error); + }); + // hide + finWindow.hide(); + // isShowing + finWindow.isShowing(showing => { + console.log("the window is " + (showing ? "showing" : "hidden")); + }); + // joinGroup + let secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, () => { + // When mainWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow); + }); + // leaveGroup + secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, () => { + // When finWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow, () => { + // once we are in the group, lets leave it. + secondWindow.leaveGroup(); + }); + }); + // maximize + finWindow.maximize(); + // mergeGroups + { + const finWindowOne = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowOne", + autoShow: true + }); + const finWindowTwo = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowTwo", + autoShow: true + }); + const finWindowThree = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowThree", + autoShow: true + }); + const finWindowFour = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowFour", + autoShow: true + }); + // When finWindowOne moves or is moved, finWindowTwo moves by the same amount + finWindowOne.joinGroup(finWindowTwo); + // When finWindowThree moves or is moved, finWindowFour moves by the same amount + finWindowThree.joinGroup(finWindowFour); + // finWindowOne, finWindowTwo, finWindowThree, and finWindowFour now move together in the same group + finWindowOne.mergeGroups(finWindowThree); + } + // minimize + finWindow.minimize(); + // moveBy + finWindow.moveBy(10, 10); + // moveTo + finWindow.moveTo(100, 200); + // removeEventListener + finWindow.removeEventListener("bounds-changed", event => { + console.log(event); + }); + // resizeBy + finWindow.resizeBy(10, 10, "top-right"); + // resizeTo + finWindow.resizeTo(10, 10, "top-right"); + // restore + finWindow.restore(); + // setAsForeground + finWindow.setAsForeground(); + // setBounds + finWindow.setBounds(100, 200, 400, 400); + // setZoomLevel + finWindow.setZoomLevel(10); + // show + finWindow.show(); + // showAt + finWindow.showAt(10, 10, false); + // stopFlashing + finWindow.stopFlashing(); + // updateOptions + finWindow.updateOptions({ + frame: false, + maxWidth: 500 + }); +} + +function test_frame() { + // wrap + const frame = fin.desktop.Frame.wrap('uuid', 'name'); + // getCurrent + const currentFrame = fin.desktop.Frame.getCurrent(); + // addEventlistener + frame.addEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err)); + // removeEventListener + frame.removeEventListener('event', () => console.log('on event'), () => console.log('success'), err => console.error(err)); + // getInfo + frame.getInfo(info => { + console.log(info.uuid, info.name, info.entityType, info.parent.uuid, info.parent.name); + }, err => console.error(err)); + // getParentWindow + frame.getParentWindow(parent => { + console.log(parent.uuid, parent.name, parent.entityType, parent.parent.uuid, parent.parent.name); + }, err => console.error(err)); +} diff --git a/types/openfin/v34/tsconfig.json b/types/openfin/v34/tsconfig.json new file mode 100644 index 0000000000..c446671530 --- /dev/null +++ b/types/openfin/v34/tsconfig.json @@ -0,0 +1,86 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "openfin": [ + "openfin/v34" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "openfin-tests.ts", + "_v2/api/application/application.d.ts", + "_v2/api/base.d.ts", + "_v2/api/clipboard/clipboard.d.ts", + "_v2/api/clipboard/write-request.d.ts", + "_v2/api/external-application/external-application.d.ts", + "_v2/api/fin.d.ts", + "_v2/api/frame/frame.d.ts", + "_v2/api/global-hotkey/index.d.ts", + "_v2/api/interappbus/channel/channel.d.ts", + "_v2/api/interappbus/channel/client.d.ts", + "_v2/api/interappbus/channel/index.d.ts", + "_v2/api/interappbus/channel/provider.d.ts", + "_v2/api/interappbus/interappbus.d.ts", + "_v2/api/notification/notification.d.ts", + "_v2/api/system/application.d.ts", + "_v2/api/system/clearCacheOption.d.ts", + "_v2/api/system/cookie.d.ts", + "_v2/api/system/crashReporterOption.d.ts", + "_v2/api/system/download-asset.d.ts", + "_v2/api/system/download-preload.d.ts", + "_v2/api/system/entity.d.ts", + "_v2/api/system/external-process.d.ts", + "_v2/api/system/host-specs.d.ts", + "_v2/api/system/log.d.ts", + "_v2/api/system/monitor.d.ts", + "_v2/api/system/point.d.ts", + "_v2/api/system/process.d.ts", + "_v2/api/system/proxy.d.ts", + "_v2/api/system/registry-info.d.ts", + "_v2/api/system/runtime-info.d.ts", + "_v2/api/system/rvm.d.ts", + "_v2/api/system/system.d.ts", + "_v2/api/system/window.d.ts", + "_v2/api/window/bounds-changed.d.ts", + "_v2/api/window/bounds.d.ts", + "_v2/api/window/transition.d.ts", + "_v2/api/window/window.d.ts", + "_v2/environment/environment.d.ts", + "_v2/environment/node-env.d.ts", + "_v2/environment/openfin-env.d.ts", + "_v2/environment/openfin-renderer-api.d.ts", + "_v2/identity.d.ts", + "_v2/launcher/launcher.d.ts", + "_v2/launcher/nix-launch.d.ts", + "_v2/launcher/util.d.ts", + "_v2/launcher/win-launch.d.ts", + "_v2/main.d.ts", + "_v2/of-main.d.ts", + "_v2/transport/elipc.d.ts", + "_v2/transport/port-discovery.d.ts", + "_v2/transport/transport-errors.d.ts", + "_v2/transport/transport.d.ts", + "_v2/transport/websocket.d.ts", + "_v2/transport/wire.d.ts", + "_v2/util/normalize-config.d.ts", + "_v2/util/promises.d.ts", + "_v2/util/ref-counter.d.ts" + ] +} diff --git a/types/openfin/v34/tslint.json b/types/openfin/v34/tslint.json new file mode 100644 index 0000000000..f95a4974aa --- /dev/null +++ b/types/openfin/v34/tslint.json @@ -0,0 +1,18 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": false, + "no-redundant-jsdoc-2": false, + "jsdoc-format": false, + "no-var-keyword": false, + "whitespace": false, + "semicolon": false, + "strict-export-declare-modifiers": false, + "array-type": false, + "unified-signatures": false, + "void-return": false, + "ban-types": false, + "callable-types": false, + "no-const-enum": false + } +} diff --git a/types/openjscad/index.d.ts b/types/openjscad/index.d.ts index 56026967a2..4a4f84c5b4 100644 --- a/types/openjscad/index.d.ts +++ b/types/openjscad/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/joostn/OpenJsCad // Definitions by: Dan Marshall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 /// diff --git a/types/openjscad/tslint.json b/types/openjscad/tslint.json index a41bf5d19a..d67ffb3a73 100644 --- a/types/openjscad/tslint.json +++ b/types/openjscad/tslint.json @@ -17,6 +17,7 @@ "max-line-length": false, "member-access": false, "new-parens": false, + "no-angle-bracket-type-assertion": false, "no-any-union": false, "no-boolean-literal-compare": false, "no-conditional-assignment": false, diff --git a/types/openpgp/index.d.ts b/types/openpgp/index.d.ts index b671f8484e..81b28c36a8 100644 --- a/types/openpgp/index.d.ts +++ b/types/openpgp/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for openpgp 4.0.0 +// Type definitions for openpgp 4.0.1 // Project: http://openpgpjs.org/ // Definitions by: Guillaume Lacasa // Errietta Kostala // Daniel Montesinos +// Carlos Villavicencio // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace openpgp; @@ -269,7 +270,17 @@ export namespace cleartext { verify(keys: Array): Array; } - function readArmored(armoredText: string): CleartextMessage; + /** creates new message object from binary data + @param bytes + */ + function fromBinary(bytes: string): CleartextMessage; + + /** creates new message object from text + @param text + */ + function fromText(text: string): CleartextMessage; + + function readArmored(armoredText: string): Promise; } export namespace config { @@ -514,7 +525,7 @@ export namespace key { @param armoredText text to be parsed */ - function readArmored(armoredText: string): KeyResult; + function readArmored(armoredText: string): Promise; } export namespace message { @@ -580,7 +591,7 @@ export namespace message { @param armoredText text to be parsed */ - function readArmored(armoredText: string): Message; + function readArmored(armoredText: string): Promise; /** * reads an OpenPGP message as byte array and returns a message object diff --git a/types/openpgp/openpgp-tests.ts b/types/openpgp/openpgp-tests.ts index bb34505055..e0495520e4 100644 --- a/types/openpgp/openpgp-tests.ts +++ b/types/openpgp/openpgp-tests.ts @@ -19,27 +19,51 @@ openpgp.generateKey(options).then(function (keypair) { var spubkey = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----'; -var publicKey = openpgp.key.readArmored(spubkey); -openpgp.encrypt({ - message: openpgp.message.fromText('Hello, World!'), - publicKeys: publicKey.keys -}).then(function (pgpMessage) { +openpgp.key.readArmored(spubkey) + .then(function (publicKey) { + return { + message: openpgp.message.fromText('Hello, World!'), + publicKeys: publicKey.keys + }; + }) + .then(openpgp.encrypt) + .then(function (pgpMessage) { + // success + }) + .catch(function (error) { + // failure + }); + +var sprivkey = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----'; +var pgpMessageStr = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'; + +openpgp.message.readArmored(pgpMessageStr).then(function(pgpMessage) { + const options = { + message: pgpMessage + }; + return openpgp.decrypt(options); +}).then(function (plaintext) { // success }).catch(function (error) { // failure }); -var sprivkey = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----'; -var privateKey = openpgp.key.readArmored(sprivkey).keys[0]; -privateKey.decrypt('passphrase'); +const promises: [Promise, Promise] = [ + openpgp.key.readArmored(sprivkey), + openpgp.message.readArmored(pgpMessageStr) +]; -var pgpMessageStr = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'; -var pgpMessage = openpgp.message.readArmored(pgpMessageStr); - -openpgp.decrypt({ - privateKeys: privateKey, - message: pgpMessage +Promise.all(promises).then(function (values) { + const keyObject: openpgp.key.KeyResult = values[0]; + const pgpMessage: openpgp.message.Message = values[1]; + const privateKey = keyObject.keys[0]; + privateKey.decrypt('passphrase'); + const options = { + privateKeys: privateKey, + message: pgpMessage + }; + return openpgp.decrypt(options); }).then(function (plaintext) { // success }).catch(function (error) { diff --git a/types/opossum/index.d.ts b/types/opossum/index.d.ts new file mode 100644 index 0000000000..e79a9c4bba --- /dev/null +++ b/types/opossum/index.d.ts @@ -0,0 +1,75 @@ +// Type definitions for opossum 1.9 +// Project: https://github.com/nodeshift/opossum +// Definitions by: Quinn Langille +// Willy Zhang +// Lance Ball +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// +import * as stream from "stream"; +import { EventEmitter } from "events"; + +export type Action = (...args: any[]) => any; + +export class CircuitBreaker extends EventEmitter { + clearCache(): void; + close(): void; + disable(): void; + enable(): void; + fallback(func?: (...args: any[]) => any): this; + fire(...args: any[]): Promise; + healthCheck(func: (...args: any[]) => Promise, interval?: number): Promise; + on(event: string | symbol, listener: (...args: any[]) => void): this; + open(): void; + promisify(action: Action): Promise; + stats(): stream.Transform; + + static readonly name: symbol; + static readonly group: symbol; + static readonly pendingClose: symbol; + static readonly closed: symbol; + static readonly opened: symbol; + static readonly halfOpen: symbol; + static readonly status: symbol; + static readonly hystrixStats: symbol; + static readonly enabled: symbol; + static readonly warmUp: symbol; + static readonly volumeThreshold: symbol; +} + +export enum Event { + cacheHit = 'cacheHit', + cacheMiss = 'cacheMiss', + close = 'close', + failure = 'failure', + fallback = 'fallback', + fire = 'fire', + halfOpen = 'halfOpen', + healthCheckFailed = 'health-check-failed', + open = 'open', + reject = 'reject', + semaphoreLocked = 'semaphore-locked', + success = 'success', + timeout = 'timeout' +} + +export interface CircuitBreakerOptions { + timeout?: number; + maxFailures?: number; + resetTimeout?: number; + rollingCountTimeout?: number; + rollingCountBuckets?: number; + name?: string; + rollingPercentilesEnabled?: boolean; + capacity?: number; + errorThresholdPercentage?: number; + enabled?: boolean; + allowWarmUp?: boolean; + volumeThreshold?: number; +} + +export default function circuitBreaker( + action: Action, + options?: CircuitBreakerOptions +): CircuitBreaker; diff --git a/types/opossum/opossum-tests.ts b/types/opossum/opossum-tests.ts new file mode 100644 index 0000000000..9ec5425416 --- /dev/null +++ b/types/opossum/opossum-tests.ts @@ -0,0 +1,48 @@ +import { Transform } from "stream"; +import circuitBreaker, { CircuitBreaker, CircuitBreakerOptions } from "opossum"; + +const _blank = () => {}; +const async_blank = () => new Promise(resolve => null); + +const testNoOptions: CircuitBreaker = circuitBreaker(_blank); + +const options: CircuitBreakerOptions = { + timeout: 1, + maxFailures: 1, + resetTimeout: 1, + rollingCountTimeout: 1, + rollingCountBuckets: 1, + name: "testing", + rollingPercentilesEnabled: true, + capacity: 1, + errorThresholdPercentage: 1, + enabled: true, + allowWarmUp: true, + volumeThreshold: 1 +}; + +const testWithOptions: CircuitBreaker = circuitBreaker(_blank, options); +const shouldBeAPromise: Promise = testWithOptions.promisify(_blank); +const shouldBeATransformStream: Transform = testWithOptions.stats(); + +const healthCheck: Promise = testWithOptions.healthCheck(async_blank, 8); +const shouldBeACircuitBreaker: CircuitBreaker = testWithOptions.fallback(); +const shouldBeAPromiseGeneric: Promise = testWithOptions.fire(); + +const shouldBeVoid = (): void => testWithOptions.enable(); +const shouldBeVoid2 = (): void => testWithOptions.disable(); +const shouldBeVoid3 = (): void => testWithOptions.close(); +const shouldBeVoid4 = (): void => testWithOptions.open(); +const shouldBeVoid5 = (): void => testWithOptions.clearCache(); + +const shouldBeSymbol: symbol = CircuitBreaker.name; +const shouldBeSymbol2: symbol = CircuitBreaker.group; +const shouldBeSymbol3: symbol = CircuitBreaker.pendingClose; +const shouldBeSymbol4: symbol = CircuitBreaker.closed; +const shouldBeSymbol5: symbol = CircuitBreaker.opened; +const shouldBeSymbol6: symbol = CircuitBreaker.halfOpen; +const shouldBeSymbol7: symbol = CircuitBreaker.hystrixStats; +const shouldBeSymbol8: symbol = CircuitBreaker.status; +const shouldBeSymbol9: symbol = CircuitBreaker.enabled; +const shouldBeSymbol10: symbol = CircuitBreaker.warmUp; +const shouldBeSymbol11: symbol = CircuitBreaker.volumeThreshold; diff --git a/types/opossum/tsconfig.json b/types/opossum/tsconfig.json new file mode 100644 index 0000000000..70edefe671 --- /dev/null +++ b/types/opossum/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es5", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "opossum-tests.ts" + ] +} diff --git a/types/opossum/tslint.json b/types/opossum/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/opossum/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/optics-agent/index.d.ts b/types/optics-agent/index.d.ts index 2c8ae46283..813f528af4 100644 --- a/types/optics-agent/index.d.ts +++ b/types/optics-agent/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/apollostack/optics-agent-js#readme // Definitions by: Crevil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.8 import { GraphQLSchema } from "graphql"; import { Request, Response } from "express"; diff --git a/types/optics-agent/tsconfig.json b/types/optics-agent/tsconfig.json index 046bfaad81..fe309dafd3 100644 --- a/types/optics-agent/tsconfig.json +++ b/types/optics-agent/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "esnext.asynciterable" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/oracle__oraclejet/index.d.ts b/types/oracle__oraclejet/index.d.ts new file mode 100644 index 0000000000..dd99802419 --- /dev/null +++ b/types/oracle__oraclejet/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for oraclejet 6.0 +// Project: https://github.com/oracle/oraclejet +// Definitions by: Naizam Olakara +// Jing Wu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 +import { Model, Collection } from './ojmodel'; +export namespace oj { + let revision: string; + let version: string; + function ajax(settings?: object): object; + function sync(method: string, model: Model | Collection, options?: object): object; +} +export interface baseComponent extends JetElement { + translations: object | null; + onTranslationsChanged: ((event: JetElementCustomEvent["translations"]>) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: baseComponentEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): baseComponent[T]; + getProperty(property: string): any; + setProperty(property: T, value: baseComponentSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: baseComponentSettablePropertiesLenient): void; + refresh(): void; +} +export interface baseComponentEventMap extends HTMLElementEventMap { + 'translationsChanged': JetElementCustomEvent["translations"]>; +} +export interface baseComponentSettableProperties extends JetSettableProperties { + translations: object | null; +} +export interface baseComponentSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface GenericSetter { + set(propertyName: K, propertyValue: SP[K]): void; + unset(propertyName: keyof SP): void; +} +export interface JetElement extends HTMLElement, GenericSetter { + set(propertyName: K, propertyValue: SP[K]): void; + unset(propertyName: keyof SP): void; +} +export interface JetElementCustomEvent extends CustomEvent<{ + value: V; + previousValue: V; + updatedFrom: 'external' | 'internal'; + subproperty: { + path: string; + value: any; + previousValue: any; + [key: string]: any; + }; + [key: string]: any; +}> { +} +// This interfaces is empty but required to keep the component chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface JetSettableProperties { +} +export type JetSetPropertyType = K extends keyof U ? U[K] : any; diff --git a/types/oracle__oraclejet/ojaccordion/index.d.ts b/types/oracle__oraclejet/ojaccordion/index.d.ts new file mode 100644 index 0000000000..15d843d90e --- /dev/null +++ b/types/oracle__oraclejet/ojaccordion/index.d.ts @@ -0,0 +1,66 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojAccordion extends baseComponent { + expanded: Array<{ + id?: string; + index?: number; + }> | null; + multiple: boolean; + onExpandedChanged: ((event: JetElementCustomEvent) => any) | null; + onMultipleChanged: ((event: JetElementCustomEvent) => any) | null; + onOjBeforeCollapse: ((event: ojAccordion.ojBeforeCollapse) => any) | null; + onOjBeforeExpand: ((event: ojAccordion.ojBeforeExpand) => any) | null; + onOjCollapse: ((event: ojAccordion.ojCollapse) => any) | null; + onOjExpand: ((event: ojAccordion.ojExpand) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojAccordionEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojAccordion[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojAccordionSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojAccordionSettablePropertiesLenient): void; + refresh(): void; +} +export namespace ojAccordion { + interface ojBeforeCollapse extends CustomEvent<{ + toCollapsible: Element; + fromCollapsible: Element; + [propName: string]: any; + }> { + } + interface ojBeforeExpand extends CustomEvent<{ + toCollapsible: Element; + fromCollapsible: Element; + [propName: string]: any; + }> { + } + interface ojCollapse extends CustomEvent<{ + toCollapsible: Element; + fromCollapsible: Element; + [propName: string]: any; + }> { + } + interface ojExpand extends CustomEvent<{ + toCollapsible: Element; + fromCollapsible: Element; + [propName: string]: any; + }> { + } +} +export interface ojAccordionEventMap extends baseComponentEventMap { + 'ojBeforeCollapse': ojAccordion.ojBeforeCollapse; + 'ojBeforeExpand': ojAccordion.ojBeforeExpand; + 'ojCollapse': ojAccordion.ojCollapse; + 'ojExpand': ojAccordion.ojExpand; + 'expandedChanged': JetElementCustomEvent; + 'multipleChanged': JetElementCustomEvent; +} +export interface ojAccordionSettableProperties extends baseComponentSettableProperties { + expanded: string[] | number[] | Array<{ + id?: string; + index?: number; + }> | null; + multiple: boolean; +} +export interface ojAccordionSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojanimation/index.d.ts b/types/oracle__oraclejet/ojanimation/index.d.ts new file mode 100644 index 0000000000..e4b1d6dbc2 --- /dev/null +++ b/types/oracle__oraclejet/ojanimation/index.d.ts @@ -0,0 +1,111 @@ +export function collapse(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + direction?: string; + startMaxHeight?: string; + endMaxHeight?: string; + startMaxWidth?: string; + endMaxWidth?: string; +}): Promise; +export function expand(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + direction?: string; + startMaxHeight?: string; + endMaxHeight?: string; + startMaxWidth?: string; + endMaxWidth?: string; +}): Promise; +export function fadeIn(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + startOpacity?: number; + endOpacity?: number; +}): Promise; +export function fadeOut(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + startOpacity?: number; + endOpacity?: number; +}): Promise; +export function flipIn(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + axis?: string; + startAngle?: string; + endAngle?: string; + backfaceVisibility?: string; + perspective?: string; + transformOrigin?: string; + flipTarget?: string; +}): Promise; +export function flipOut(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + axis?: string; + startAngle?: string; + endAngle?: string; + backfaceVisibility?: string; + perspective?: string; + transformOrigin?: string; + flipTarget?: string; +}): Promise; +export function ripple(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + offsetX?: string; + offsetY?: string; + color?: string; + diameter?: string; + startOpacity?: number; + endOpacity?: number; +}): Promise; +export function slideIn(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + direction?: string; + offsetX?: string; + offsetY?: string; +}): Promise; +export function slideOut(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + direction?: string; + offsetX?: string; + offsetY?: string; +}): Promise; +export function zoomIn(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + axis?: string; + transformOrigin?: string; +}): Promise; +export function zoomOut(element: Element, options?: { + delay?: string; + duration?: string; + timingFunction?: string; + persist?: string; + axis?: string; + transformOrigin?: string; +}): Promise; +// tslint:disable-next-line interface-over-type-literal +export type AnimationMethods = 'collapse' | 'expand' | 'fadeIn' | 'fadeOut' | 'flipIn' | 'flipOut' | 'ripple' | 'slideIn' | 'slideOut' | 'zoomIn' | 'zoomOut'; diff --git a/types/oracle__oraclejet/ojarraydataprovider/index.d.ts b/types/oracle__oraclejet/ojarraydataprovider/index.d.ts new file mode 100644 index 0000000000..884920c03e --- /dev/null +++ b/types/oracle__oraclejet/ojarraydataprovider/index.d.ts @@ -0,0 +1,27 @@ +import { DataProvider, SortCriterion, FetchByKeysParameters, ContainsKeysResults, FetchByKeysResults, FetchByOffsetParameters, FetchByOffsetResults, FetchListResult, + FetchListParameters } from '../ojdataprovider'; +declare class ArrayDataProvider implements DataProvider { + constructor(data: any[] | (() => any[]), options?: { + sortComparators?: ArrayDataProvider.SortComparators; + implicitSort?: Array>; + keys?: any[] | (() => any[]); + idAttribute?: string | string[]; + keyAttributes?: string | string[]; + }); + addEventListener(eventType: string, listener: EventListener): void; + containsKeys(params: FetchByKeysParameters): Promise>; + dispatchEvent(evt: Event): boolean; + fetchByKeys(params: FetchByKeysParameters): Promise>; + fetchByOffset(params: FetchByOffsetParameters): Promise>; + fetchFirst(params?: FetchListParameters): AsyncIterable>; + getCapability(capabilityName?: string): any; + getTotalSize(): Promise; + isEmpty(): 'yes' | 'no' | 'unknown'; + removeEventListener(eventType: string, listener: EventListener): void; +} +export = ArrayDataProvider; +declare namespace ArrayDataProvider { + interface SortComparators { + comparators: Map number>; + } +} diff --git a/types/oracle__oraclejet/ojarraytreedataprovider/index.d.ts b/types/oracle__oraclejet/ojarraytreedataprovider/index.d.ts new file mode 100644 index 0000000000..452b47a910 --- /dev/null +++ b/types/oracle__oraclejet/ojarraytreedataprovider/index.d.ts @@ -0,0 +1,25 @@ +import { DataProvider, SortCriterion, FetchByKeysParameters, ContainsKeysResults, FetchByKeysResults, FetchByOffsetParameters, FetchByOffsetResults, FetchListResult, + FetchListParameters } from '../ojdataprovider'; +import ArrayDataProvider = require('../ojarraydataprovider'); +import TreeDataProvider = require('../ojtreedataprovider'); +declare class ArrayTreeDataProvider implements TreeDataProvider { + constructor(data: any[] | (() => any[]), options?: { + sortComparators?: ArrayDataProvider.SortComparators; + implicitSort?: Array>; + keyAttributes?: string | string[]; + keyAttributesScope?: 'global' | 'siblings'; + childrenAttribute?: string; + }); + addEventListener(eventType: string, listener: EventListener): void; + containsKeys(params: FetchByKeysParameters): Promise>; + dispatchEvent(evt: Event): boolean; + fetchByKeys(params: FetchByKeysParameters): Promise>; + fetchByOffset(params: FetchByOffsetParameters): Promise>; + fetchFirst(params?: FetchListParameters): AsyncIterable>; + getCapability(capabilityName?: string): any; + getChildDataProvider(parentKey: any): ArrayTreeDataProvider; + getTotalSize(): Promise; + isEmpty(): 'yes' | 'no' | 'unknown'; + removeEventListener(eventType: string, listener: EventListener): void; +} +export = ArrayTreeDataProvider; diff --git a/types/oracle__oraclejet/ojattributegrouphandler/index.d.ts b/types/oracle__oraclejet/ojattributegrouphandler/index.d.ts new file mode 100644 index 0000000000..3442581069 --- /dev/null +++ b/types/oracle__oraclejet/ojattributegrouphandler/index.d.ts @@ -0,0 +1,23 @@ +export class AttributeGroupHandler { + constructor(matchRules?: { + [propName: string]: any; + }); + addMatchRule(category: string, attributeValue: any): void; + getCategoryAssignments(): Array<{ + [propName: string]: any; + }>; + getValue(category: string): any; + getValueRamp(): any[]; +} +export class ColorAttributeGroupHandler extends AttributeGroupHandler { + constructor(matchRules?: { + [propName: string]: any; + }); + getValueRamp(): string[]; +} +export class ShapeAttributeGroupHandler extends AttributeGroupHandler { + constructor(matchRules?: { + [propName: string]: any; + }); + getValueRamp(): string[]; +} diff --git a/types/oracle__oraclejet/ojavatar/index.d.ts b/types/oracle__oraclejet/ojavatar/index.d.ts new file mode 100644 index 0000000000..ed82db0a5e --- /dev/null +++ b/types/oracle__oraclejet/ojavatar/index.d.ts @@ -0,0 +1,29 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojAvatar extends JetElement { + initials: string; + size: 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; + src: string; + onInitialsChanged: ((event: JetElementCustomEvent) => any) | null; + onSizeChanged: ((event: JetElementCustomEvent) => any) | null; + onSrcChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojAvatarEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojAvatar[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojAvatarSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojAvatarSettablePropertiesLenient): void; +} +export interface ojAvatarEventMap extends HTMLElementEventMap { + 'initialsChanged': JetElementCustomEvent; + 'sizeChanged': JetElementCustomEvent; + 'srcChanged': JetElementCustomEvent; +} +export interface ojAvatarSettableProperties extends JetSettableProperties { + initials: string; + size: 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; + src: string; +} +export interface ojAvatarSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojbutton/index.d.ts b/types/oracle__oraclejet/ojbutton/index.d.ts new file mode 100644 index 0000000000..542f5eec9e --- /dev/null +++ b/types/oracle__oraclejet/ojbutton/index.d.ts @@ -0,0 +1,165 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojButton extends baseComponent { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; + onChromingChanged: ((event: JetElementCustomEvent["chroming"]>) => any) | null; + onDisabledChanged: ((event: JetElementCustomEvent["disabled"]>) => any) | null; + onDisplayChanged: ((event: JetElementCustomEvent["display"]>) => any) | null; + onOjAction: ((event: ojButton.ojAction) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojButtonEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojButton[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojButtonSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojButtonSettablePropertiesLenient): void; +} +export namespace ojButton { + interface ojAction extends CustomEvent<{ + [propName: string]: any; + }> { + } +} +export interface ojButtonEventMap extends baseComponentEventMap { + 'ojAction': ojButton.ojAction; + 'chromingChanged': JetElementCustomEvent["chroming"]>; + 'disabledChanged': JetElementCustomEvent["disabled"]>; + 'displayChanged': JetElementCustomEvent["display"]>; +} +export interface ojButtonSettableProperties extends baseComponentSettableProperties { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; +} +export interface ojButtonSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojButtonset extends baseComponent { + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojButtonsetEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojButtonset[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojButtonsetSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojButtonsetSettablePropertiesLenient): void; +} +// These interfaces are empty but required to keep the event chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface ojButtonsetEventMap extends baseComponentEventMap { +} +// These interfaces are empty but required to keep the component chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface ojButtonsetSettableProperties extends baseComponentSettableProperties { +} +export interface ojButtonsetSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojButtonsetMany extends ojButtonset { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; + focusManagement: 'oneTabstop' | 'none'; + value: any[] | null; + onChromingChanged: ((event: JetElementCustomEvent) => any) | null; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onFocusManagementChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojButtonsetManyEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojButtonsetMany[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojButtonsetManySettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojButtonsetManySettablePropertiesLenient): void; +} +export interface ojButtonsetManyEventMap extends ojButtonsetEventMap { + 'chromingChanged': JetElementCustomEvent; + 'disabledChanged': JetElementCustomEvent; + 'displayChanged': JetElementCustomEvent; + 'focusManagementChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojButtonsetManySettableProperties extends ojButtonsetSettableProperties { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; + focusManagement: 'oneTabstop' | 'none'; + value: any[] | null; +} +export interface ojButtonsetManySettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojButtonsetOne extends ojButtonset { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; + focusManagement: 'oneTabstop' | 'none'; + value: any; + onChromingChanged: ((event: JetElementCustomEvent) => any) | null; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onFocusManagementChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojButtonsetOneEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojButtonsetOne[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojButtonsetOneSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojButtonsetOneSettablePropertiesLenient): void; +} +export interface ojButtonsetOneEventMap extends ojButtonsetEventMap { + 'chromingChanged': JetElementCustomEvent; + 'disabledChanged': JetElementCustomEvent; + 'displayChanged': JetElementCustomEvent; + 'focusManagementChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojButtonsetOneSettableProperties extends ojButtonsetSettableProperties { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; + focusManagement: 'oneTabstop' | 'none'; + value: any; +} +export interface ojButtonsetOneSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojMenuButton extends ojButton { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; + onChromingChanged: ((event: JetElementCustomEvent) => any) | null; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAction: ((event: ojMenuButton.ojAction) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojMenuButtonEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojMenuButton[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojMenuButtonSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojMenuButtonSettablePropertiesLenient): void; +} +export namespace ojMenuButton { + interface ojAction extends CustomEvent<{ + [propName: string]: any; + }> { + } +} +export interface ojMenuButtonEventMap extends ojButtonEventMap { + 'ojAction': ojMenuButton.ojAction; + 'chromingChanged': JetElementCustomEvent; + 'disabledChanged': JetElementCustomEvent; + 'displayChanged': JetElementCustomEvent; +} +export interface ojMenuButtonSettableProperties extends ojButtonSettableProperties { + chroming: 'full' | 'half' | 'outlined'; + disabled: boolean; + display: 'all' | 'icons'; +} +export interface ojMenuButtonSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojchart/index.d.ts b/types/oracle__oraclejet/ojchart/index.d.ts new file mode 100644 index 0000000000..25970f316e --- /dev/null +++ b/types/oracle__oraclejet/ojchart/index.d.ts @@ -0,0 +1,2104 @@ +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojChart extends dvtBaseComponent> { + animationOnDataChange: 'auto' | 'slideToLeft' | 'slideToRight' | 'none'; + animationOnDisplay: 'auto' | 'alphaFade' | 'zoom' | 'none'; + as: string; + coordinateSystem: 'polar' | 'cartesian'; + data: DataProvider | null; + dataCursor: 'off' | 'on' | 'auto'; + dataCursorBehavior: 'smooth' | 'snap' | 'auto'; + dataCursorPosition: { + x: number | string; + y: number; + y2: number; + }; + dataLabel: ((context: ojChart.DataLabelContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + dnd: { + drag: { + groups: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + items: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + series: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + }; + drop: { + legend: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + plotArea: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + xAxis: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + y2Axis: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + yAxis: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + }; + }; + dragMode: 'pan' | 'zoom' | 'select' | 'off' | 'user'; + drilling: 'on' | 'seriesOnly' | 'groupsOnly' | 'off'; + groupComparator: ((param0: object, param1: object) => number) | null; + hiddenCategories: string[]; + hideAndShowBehavior: 'withRescale' | 'withoutRescale' | 'none'; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + initialZooming: 'first' | 'last' | 'none'; + legend: { + backgroundColor: string; + borderColor: string; + maxSize: string; + position: 'start' | 'end' | 'bottom' | 'top' | 'auto'; + referenceObjectSection: { + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }; + rendered: 'on' | 'off' | 'auto'; + scrolling: 'off' | 'asNeeded'; + sections: Array<{ + items: Array<{ + borderColor: string; + categories: string[]; + categoryVisibility: 'hidden' | 'visible'; + color: string; + id: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + markerColor: string; + markerShape?: 'circle' | 'diamond' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shortDesc: string; + source: string; + symbolType: 'line' | 'lineWithMarker' | 'image' | 'marker'; + text: string; + }>; + sections: object[]; + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }>; + seriesSection: { + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }; + size: string; + symbolHeight: number; + symbolWidth: number; + textStyle: object; + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }; + orientation: 'horizontal' | 'vertical'; + otherThreshold: number; + overview: { + content: object; + height: string; + rendered: 'on' | 'off'; + }; + pieCenter: { + converter: object; + label: string; + labelStyle: object; + renderer: ((context: ojChart.PieCenterContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + }; + plotArea: { + backgroundColor: string; + borderColor: string; + borderWidth: number; + rendered: 'off' | 'on'; + }; + polarGridShape: 'polygon' | 'circle'; + selection: K[]; + selectionMode: 'single' | 'multiple' | 'none'; + seriesComparator: ((param0: object, param1: object) => number) | null; + sorting: 'ascending' | 'descending' | 'off'; + splitDualY: 'on' | 'off' | 'auto'; + splitterPosition: number; + stack: 'on' | 'off'; + stackLabel: 'on' | 'off'; + styleDefaults: { + animationDownColor: string; + animationDuration: number; + animationIndicators: 'none' | 'all'; + animationUpColor: string; + barGapRatio: number; + borderColor: string; + borderWidth: number; + boxPlot: { + medianSvgClassName: string; + medianSvgStyle: object; + whiskerEndLength: string; + whiskerEndSvgClassName: string; + whiskerEndSvgStyle: object; + whiskerSvgClassName: string; + whiskerSvgStyle: object; + }; + colors: string[]; + dataCursor: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + markerColor: string; + markerDisplayed: 'off' | 'on'; + markerSize: number; + }; + dataItemGaps: string; + dataLabelPosition: 'center' | 'outsideSlice' | 'aboveMarker' | 'belowMarker' | 'beforeMarker' | 'afterMarker' | 'insideBarEdge' | 'outsideBarEdge' | 'none' | 'auto'; + dataLabelStyle: object | object[]; + funnelBackgroundColor: string; + groupSeparators: { + color: string; + rendered: 'off' | 'auto'; + }; + hoverBehaviorDelay: number; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'straight' | 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'none' | 'auto'; + lineWidth: number; + markerColor: string; + markerDisplayed: 'on' | 'off' | 'auto'; + markerShape?: 'auto' | 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSize: number; + marqueeBorderColor: string; + marqueeColor: string; + maxBarWidth: number; + otherColor: string; + patterns: string[]; + pieFeelerColor: string; + pieInnerRadius: number; + selectionEffect: 'explode' | 'highlightAndExplode' | 'highlight'; + seriesEffect: 'color' | 'pattern' | 'gradient'; + shapes: string[]; + stackLabelStyle: object; + stockFallingColor: string; + stockRangeColor: string; + stockRisingColor: string; + stockVolumeColor: string; + threeDEffect: 'on' | 'off'; + tooltipLabelStyle: object; + tooltipValueStyle: object; + }; + timeAxisType: 'enabled' | 'mixedFrequency' | 'skipGaps' | 'disabled' | 'auto'; + tooltip: { + renderer: ((context: ojChart.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + type: 'line' | 'area' | 'lineWithArea' | 'stock' | 'boxPlot' | 'combo' | 'pie' | 'scatter' | 'bubble' | 'funnel' | 'pyramid' | 'bar'; + valueFormats: { + close: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + group: { + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string | string[]; + }; + high: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + label: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + }; + low: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + open: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + q1: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + q2: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + q3: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + series: { + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + targetValue: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + value: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + volume: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + x: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + y: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + y2: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + z: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + }; + xAxis: { + axisLine: { + lineColor: string; + lineWidth: number; + rendered: 'off' | 'on'; + }; + baselineScaling: 'min' | 'zero'; + dataMax: number; + dataMin: number; + majorTick: { + baselineColor: 'inherit' | 'auto'; + baselineStyle: 'dotted' | 'dashed' | 'solid'; + baselineWidth: number; + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + max: number | string; + maxSize: string; + min: number | string; + minStep: number; + minorStep: number; + minorTick: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + referenceObjects: Array<{ + categories: string[]; + color: string; + displayInLegend: 'on' | 'off'; + high: number; + id: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'straight'; + lineWidth: number; + location: 'front' | 'back'; + low: number; + shortDesc: string; + svgClassName: string; + svgStyle: object; + text: string; + type: 'area' | 'line'; + value: number; + }>; + rendered: 'off' | 'on'; + scale: 'log' | 'linear'; + size: string; + step: number; + tickLabel: { + converter: object; + rendered: 'off' | 'on'; + rotation: 'none' | 'auto'; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style: object; + }; + title: string; + titleStyle: object; + viewportEndGroup: number | string; + viewportMax: number | string; + viewportMin: number | string; + viewportStartGroup: number | string; + }; + y2Axis: { + alignTickMarks: 'off' | 'on'; + axisLine: { + lineColor: string; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + baselineScaling: 'min' | 'zero'; + dataMax: number; + dataMin: number; + majorTick: { + baselineColor: 'inherit' | 'auto'; + baselineStyle: 'dotted' | 'dashed' | 'solid'; + baselineWidth: number; + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + max: number; + maxSize: string; + min: number; + minStep: number; + minorStep: number; + minorTick: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + position: 'start' | 'end' | 'top' | 'bottom' | 'auto'; + referenceObjects: Array<{ + categories: string[]; + color: string; + displayInLegend: 'on' | 'off'; + high: number; + id: string; + items: Array<{ + high: number; + low: number; + value: number; + x: number | string; + }>; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'straight'; + lineWidth: number; + location: 'front' | 'back'; + low: number; + shortDesc: string; + svgClassName: string; + svgStyle: object; + text: string; + type: 'area' | 'line'; + value: number; + }>; + rendered: 'off' | 'on'; + scale: 'log' | 'linear'; + size: string; + step: number; + tickLabel: { + converter: object; + position: 'inside' | 'outside'; + rendered: 'off' | 'on'; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style: object; + }; + title: string; + titleStyle: object; + }; + yAxis: { + axisLine: { + lineColor: string; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + baselineScaling: 'min' | 'zero'; + dataMax: number; + dataMin: number; + majorTick: { + baselineColor: 'inherit' | 'auto'; + baselineStyle: 'dotted' | 'dashed' | 'solid'; + baselineWidth: number; + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + max: number; + maxSize: string; + min: number; + minStep: number; + minorStep: number; + minorTick: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + position: 'start' | 'end' | 'top' | 'bottom' | 'auto'; + referenceObjects: Array<{ + categories: string[]; + color: string; + displayInLegend: 'on' | 'off'; + high: number; + id: string; + items: Array<{ + high: number; + low: number; + value: number; + x: number | string; + }>; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'straight'; + lineWidth: number; + location: 'front' | 'back'; + low: number; + shortDesc: string; + svgClassName: string; + svgStyle: object; + text: string; + type: 'area' | 'line'; + value: number; + }>; + rendered: 'off' | 'on'; + scale: 'log' | 'linear'; + size: string; + step: number; + tickLabel: { + converter: object; + position: 'inside' | 'outside'; + rendered: 'off' | 'on'; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style: object; + }; + title: string; + titleStyle: object; + viewportMax: number; + viewportMin: number; + }; + zoomAndScroll: 'delayedScrollOnly' | 'liveScrollOnly' | 'delayed' | 'live' | 'off'; + zoomDirection: 'x' | 'y' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelClose?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelDate?: string; + labelDefaultGroupName?: string; + labelGroup?: string; + labelHigh?: string; + labelInvalidData?: string; + labelLow?: string; + labelNoData?: string; + labelOpen?: string; + labelOther?: string; + labelPercentage?: string; + labelQ1?: string; + labelQ2?: string; + labelQ3?: string; + labelSeries?: string; + labelTargetValue?: string; + labelValue?: string; + labelVolume?: string; + labelX?: string; + labelY?: string; + labelZ?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + tooltipPan?: string; + tooltipSelect?: string; + tooltipZoom?: string; + }; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onCoordinateSystemChanged: ((event: JetElementCustomEvent["coordinateSystem"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDataCursorChanged: ((event: JetElementCustomEvent["dataCursor"]>) => any) | null; + onDataCursorBehaviorChanged: ((event: JetElementCustomEvent["dataCursorBehavior"]>) => any) | null; + onDataCursorPositionChanged: ((event: JetElementCustomEvent["dataCursorPosition"]>) => any) | null; + onDataLabelChanged: ((event: JetElementCustomEvent["dataLabel"]>) => any) | null; + onDndChanged: ((event: JetElementCustomEvent["dnd"]>) => any) | null; + onDragModeChanged: ((event: JetElementCustomEvent["dragMode"]>) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent["drilling"]>) => any) | null; + onGroupComparatorChanged: ((event: JetElementCustomEvent["groupComparator"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHideAndShowBehaviorChanged: ((event: JetElementCustomEvent["hideAndShowBehavior"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onInitialZoomingChanged: ((event: JetElementCustomEvent["initialZooming"]>) => any) | null; + onLegendChanged: ((event: JetElementCustomEvent["legend"]>) => any) | null; + onOrientationChanged: ((event: JetElementCustomEvent["orientation"]>) => any) | null; + onOtherThresholdChanged: ((event: JetElementCustomEvent["otherThreshold"]>) => any) | null; + onOverviewChanged: ((event: JetElementCustomEvent["overview"]>) => any) | null; + onPieCenterChanged: ((event: JetElementCustomEvent["pieCenter"]>) => any) | null; + onPlotAreaChanged: ((event: JetElementCustomEvent["plotArea"]>) => any) | null; + onPolarGridShapeChanged: ((event: JetElementCustomEvent["polarGridShape"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onSeriesComparatorChanged: ((event: JetElementCustomEvent["seriesComparator"]>) => any) | null; + onSortingChanged: ((event: JetElementCustomEvent["sorting"]>) => any) | null; + onSplitDualYChanged: ((event: JetElementCustomEvent["splitDualY"]>) => any) | null; + onSplitterPositionChanged: ((event: JetElementCustomEvent["splitterPosition"]>) => any) | null; + onStackChanged: ((event: JetElementCustomEvent["stack"]>) => any) | null; + onStackLabelChanged: ((event: JetElementCustomEvent["stackLabel"]>) => any) | null; + onStyleDefaultsChanged: ((event: JetElementCustomEvent["styleDefaults"]>) => any) | null; + onTimeAxisTypeChanged: ((event: JetElementCustomEvent["timeAxisType"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTouchResponseChanged: ((event: JetElementCustomEvent["touchResponse"]>) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent["type"]>) => any) | null; + onValueFormatsChanged: ((event: JetElementCustomEvent["valueFormats"]>) => any) | null; + onXAxisChanged: ((event: JetElementCustomEvent["xAxis"]>) => any) | null; + onY2AxisChanged: ((event: JetElementCustomEvent["y2Axis"]>) => any) | null; + onYAxisChanged: ((event: JetElementCustomEvent["yAxis"]>) => any) | null; + onZoomAndScrollChanged: ((event: JetElementCustomEvent["zoomAndScroll"]>) => any) | null; + onZoomDirectionChanged: ((event: JetElementCustomEvent["zoomDirection"]>) => any) | null; + onOjDrill: ((event: ojChart.ojDrill) => any) | null; + onOjSelectInput: ((event: ojChart.ojSelectInput) => any) | null; + onOjViewportChange: ((event: ojChart.ojViewportChange) => any) | null; + onOjViewportChangeInput: ((event: ojChart.ojViewportChangeInput) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojChartEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojChart[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojChartSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojChartSettablePropertiesLenient): void; + getContextByNode(node: Element): ojChart.PieCenterLabelContext | ojChart.LegendItemContext | ojChart.ReferenceObject | ojChart.GroupContext | ojChart.AxisTitleContext | ojChart.ItemContext | + ojChart.SeriesContext; + getDataItem(seriesIndex: number, groupIndex: number): object | null; + getGroup(groupIndex: string): string; + getGroupCount(): number; + getLegend(): object; + getPlotArea(): object; + getSeries(seriesIndex: string): string; + getSeriesCount(): number; + getValuesAt(x: number, y: number): object; + getXAxis(): object; + getY2Axis(): object; + getYAxis(): object; +} +export namespace ojChart { + interface ojDrill extends CustomEvent<{ + id: string; + series: string; + group: string; + data: object; + itemData: object; + seriesData: object; + groupData: any[]; + [propName: string]: any; + }> { + } + interface ojSelectInput extends CustomEvent<{ + items: any[]; + selectionData: Array<{ + data: object; + itemData: object; + groupData: any[]; + seriesData: object; + }>; + endGroup: string; + startGroup: string; + xMax: number; + xMin: number; + yMax: number; + yMin: number; + [propName: string]: any; + }> { + } + interface ojViewportChange extends CustomEvent<{ + endGroup: string; + startGroup: string; + xMax: number; + xMin: number; + yMax: number; + yMin: number; + [propName: string]: any; + }> { + } + interface ojViewportChangeInput extends CustomEvent<{ + endGroup: string; + startGroup: string; + xMax: number; + xMin: number; + yMax: number; + yMin: number; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type AxisTitleContext = { + axis: 'xAxis' | 'yAxis' | 'y2Axis'; + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type DataLabelContext = { + id: any; + series: string; + group: string | string[]; + value: number; + targetValue: number; + x: number | string; + y: number; + z: number; + low: number; + high: number; + open: number; + close: number; + volume: number; + label: string; + totalValue: number; + data: object | null; + itemData: object | null; + seriesData: object | null; + groupData: object | null; + componentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type GroupContext = { + indexPath: any[]; + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + seriesIndex: number; + itemIndex: number; + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type LegendItemContext = { + sectionIndexPath: any[]; + itemIndex: number; + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type PieCenterContext = { + outerBounds: object; + innerBounds: object; + label: string; + componentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type PieCenterLabelContext = { + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type ReferenceObject = { + axis: 'xAxis' | 'yAxis' | 'y2Axis'; + index: number; + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type SeriesContext = { + itemIndex: number; + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + parentElement: Element; + id: any; + series: string; + group: string | string[]; + label: string; + value: number; + x: number | string; + y: number; + z: number; + low: number; + high: number; + open: number; + close: number; + volume: number; + targetValue: number; + data: object | null; + itemData: object | null; + seriesData: object | null; + groupData: object | null; + componentElement: Element; + color: string; + }; +} +export interface ojChartEventMap extends dvtBaseComponentEventMap> { + 'ojDrill': ojChart.ojDrill; + 'ojSelectInput': ojChart.ojSelectInput; + 'ojViewportChange': ojChart.ojViewportChange; + 'ojViewportChangeInput': ojChart.ojViewportChangeInput; + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'coordinateSystemChanged': JetElementCustomEvent["coordinateSystem"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'dataCursorChanged': JetElementCustomEvent["dataCursor"]>; + 'dataCursorBehaviorChanged': JetElementCustomEvent["dataCursorBehavior"]>; + 'dataCursorPositionChanged': JetElementCustomEvent["dataCursorPosition"]>; + 'dataLabelChanged': JetElementCustomEvent["dataLabel"]>; + 'dndChanged': JetElementCustomEvent["dnd"]>; + 'dragModeChanged': JetElementCustomEvent["dragMode"]>; + 'drillingChanged': JetElementCustomEvent["drilling"]>; + 'groupComparatorChanged': JetElementCustomEvent["groupComparator"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'hideAndShowBehaviorChanged': JetElementCustomEvent["hideAndShowBehavior"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'initialZoomingChanged': JetElementCustomEvent["initialZooming"]>; + 'legendChanged': JetElementCustomEvent["legend"]>; + 'orientationChanged': JetElementCustomEvent["orientation"]>; + 'otherThresholdChanged': JetElementCustomEvent["otherThreshold"]>; + 'overviewChanged': JetElementCustomEvent["overview"]>; + 'pieCenterChanged': JetElementCustomEvent["pieCenter"]>; + 'plotAreaChanged': JetElementCustomEvent["plotArea"]>; + 'polarGridShapeChanged': JetElementCustomEvent["polarGridShape"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'seriesComparatorChanged': JetElementCustomEvent["seriesComparator"]>; + 'sortingChanged': JetElementCustomEvent["sorting"]>; + 'splitDualYChanged': JetElementCustomEvent["splitDualY"]>; + 'splitterPositionChanged': JetElementCustomEvent["splitterPosition"]>; + 'stackChanged': JetElementCustomEvent["stack"]>; + 'stackLabelChanged': JetElementCustomEvent["stackLabel"]>; + 'styleDefaultsChanged': JetElementCustomEvent["styleDefaults"]>; + 'timeAxisTypeChanged': JetElementCustomEvent["timeAxisType"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'touchResponseChanged': JetElementCustomEvent["touchResponse"]>; + 'typeChanged': JetElementCustomEvent["type"]>; + 'valueFormatsChanged': JetElementCustomEvent["valueFormats"]>; + 'xAxisChanged': JetElementCustomEvent["xAxis"]>; + 'y2AxisChanged': JetElementCustomEvent["y2Axis"]>; + 'yAxisChanged': JetElementCustomEvent["yAxis"]>; + 'zoomAndScrollChanged': JetElementCustomEvent["zoomAndScroll"]>; + 'zoomDirectionChanged': JetElementCustomEvent["zoomDirection"]>; +} +export interface ojChartSettableProperties extends dvtBaseComponentSettableProperties { + animationOnDataChange: 'auto' | 'slideToLeft' | 'slideToRight' | 'none'; + animationOnDisplay: 'auto' | 'alphaFade' | 'zoom' | 'none'; + as: string; + coordinateSystem: 'polar' | 'cartesian'; + data: DataProvider | null; + dataCursor: 'off' | 'on' | 'auto'; + dataCursorBehavior: 'smooth' | 'snap' | 'auto'; + dataCursorPosition: { + x: number | string; + y: number; + y2: number; + }; + dataLabel: ((context: ojChart.DataLabelContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + dnd: { + drag: { + groups: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + items: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + series: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + }; + drop: { + legend: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + plotArea: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + xAxis: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + y2Axis: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + yAxis: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + }; + }; + dragMode: 'pan' | 'zoom' | 'select' | 'off' | 'user'; + drilling: 'on' | 'seriesOnly' | 'groupsOnly' | 'off'; + groupComparator: ((param0: object, param1: object) => number) | null; + hiddenCategories: string[]; + hideAndShowBehavior: 'withRescale' | 'withoutRescale' | 'none'; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + initialZooming: 'first' | 'last' | 'none'; + legend: { + backgroundColor: string; + borderColor: string; + maxSize: string; + position: 'start' | 'end' | 'bottom' | 'top' | 'auto'; + referenceObjectSection: { + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }; + rendered: 'on' | 'off' | 'auto'; + scrolling: 'off' | 'asNeeded'; + sections: Array<{ + items: Array<{ + borderColor: string; + categories: string[]; + categoryVisibility: 'hidden' | 'visible'; + color: string; + id: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + markerColor: string; + markerShape?: 'circle' | 'diamond' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shortDesc: string; + source: string; + symbolType: 'line' | 'lineWithMarker' | 'image' | 'marker'; + text: string; + }>; + sections: object[]; + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }>; + seriesSection: { + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }; + size: string; + symbolHeight: number; + symbolWidth: number; + textStyle: object; + title: string; + titleHalign: 'center' | 'end' | 'start'; + titleStyle: object; + }; + orientation: 'horizontal' | 'vertical'; + otherThreshold: number; + overview: { + content: object; + height: string; + rendered: 'on' | 'off'; + }; + pieCenter: { + converter: object; + label: string; + labelStyle: object; + renderer: ((context: ojChart.PieCenterContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + }; + plotArea: { + backgroundColor: string; + borderColor: string; + borderWidth: number; + rendered: 'off' | 'on'; + }; + polarGridShape: 'polygon' | 'circle'; + selection: K[]; + selectionMode: 'single' | 'multiple' | 'none'; + seriesComparator: ((param0: object, param1: object) => number) | null; + sorting: 'ascending' | 'descending' | 'off'; + splitDualY: 'on' | 'off' | 'auto'; + splitterPosition: number; + stack: 'on' | 'off'; + stackLabel: 'on' | 'off'; + styleDefaults: { + animationDownColor: string; + animationDuration: number; + animationIndicators: 'none' | 'all'; + animationUpColor: string; + barGapRatio: number; + borderColor: string; + borderWidth: number; + boxPlot: { + medianSvgClassName: string; + medianSvgStyle: object; + whiskerEndLength: string; + whiskerEndSvgClassName: string; + whiskerEndSvgStyle: object; + whiskerSvgClassName: string; + whiskerSvgStyle: object; + }; + colors: string[]; + dataCursor: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + markerColor: string; + markerDisplayed: 'off' | 'on'; + markerSize: number; + }; + dataItemGaps: string; + dataLabelPosition: 'center' | 'outsideSlice' | 'aboveMarker' | 'belowMarker' | 'beforeMarker' | 'afterMarker' | 'insideBarEdge' | 'outsideBarEdge' | 'none' | 'auto'; + dataLabelStyle: object | object[]; + funnelBackgroundColor: string; + groupSeparators: { + color: string; + rendered: 'off' | 'auto'; + }; + hoverBehaviorDelay: number; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'straight' | 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'none' | 'auto'; + lineWidth: number; + markerColor: string; + markerDisplayed: 'on' | 'off' | 'auto'; + markerShape?: 'auto' | 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSize: number; + marqueeBorderColor: string; + marqueeColor: string; + maxBarWidth: number; + otherColor: string; + patterns: string[]; + pieFeelerColor: string; + pieInnerRadius: number; + selectionEffect: 'explode' | 'highlightAndExplode' | 'highlight'; + seriesEffect: 'color' | 'pattern' | 'gradient'; + shapes: string[]; + stackLabelStyle: object; + stockFallingColor: string; + stockRangeColor: string; + stockRisingColor: string; + stockVolumeColor: string; + threeDEffect: 'on' | 'off'; + tooltipLabelStyle: object; + tooltipValueStyle: object; + }; + timeAxisType: 'enabled' | 'mixedFrequency' | 'skipGaps' | 'disabled' | 'auto'; + tooltip: { + renderer: ((context: ojChart.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + type: 'line' | 'area' | 'lineWithArea' | 'stock' | 'boxPlot' | 'combo' | 'pie' | 'scatter' | 'bubble' | 'funnel' | 'pyramid' | 'bar'; + valueFormats: { + close: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + group: { + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string | string[]; + }; + high: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + label: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + }; + low: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + open: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + q1: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + q2: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + q3: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + series: { + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + targetValue: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + value: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + volume: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + x: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + y: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + y2: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + z: { + converter: object; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + tooltipDisplay: 'off' | 'auto'; + tooltipLabel: string; + }; + }; + xAxis: { + axisLine: { + lineColor: string; + lineWidth: number; + rendered: 'off' | 'on'; + }; + baselineScaling: 'min' | 'zero'; + dataMax: number; + dataMin: number; + majorTick: { + baselineColor: 'inherit' | 'auto'; + baselineStyle: 'dotted' | 'dashed' | 'solid'; + baselineWidth: number; + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + max: number | string; + maxSize: string; + min: number | string; + minStep: number; + minorStep: number; + minorTick: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + referenceObjects: Array<{ + categories: string[]; + color: string; + displayInLegend: 'on' | 'off'; + high: number; + id: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'straight'; + lineWidth: number; + location: 'front' | 'back'; + low: number; + shortDesc: string; + svgClassName: string; + svgStyle: object; + text: string; + type: 'area' | 'line'; + value: number; + }>; + rendered: 'off' | 'on'; + scale: 'log' | 'linear'; + size: string; + step: number; + tickLabel: { + converter: object; + rendered: 'off' | 'on'; + rotation: 'none' | 'auto'; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style: object; + }; + title: string; + titleStyle: object; + viewportEndGroup: number | string; + viewportMax: number | string; + viewportMin: number | string; + viewportStartGroup: number | string; + }; + y2Axis: { + alignTickMarks: 'off' | 'on'; + axisLine: { + lineColor: string; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + baselineScaling: 'min' | 'zero'; + dataMax: number; + dataMin: number; + majorTick: { + baselineColor: 'inherit' | 'auto'; + baselineStyle: 'dotted' | 'dashed' | 'solid'; + baselineWidth: number; + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + max: number; + maxSize: string; + min: number; + minStep: number; + minorStep: number; + minorTick: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + position: 'start' | 'end' | 'top' | 'bottom' | 'auto'; + referenceObjects: Array<{ + categories: string[]; + color: string; + displayInLegend: 'on' | 'off'; + high: number; + id: string; + items: Array<{ + high: number; + low: number; + value: number; + x: number | string; + }>; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'straight'; + lineWidth: number; + location: 'front' | 'back'; + low: number; + shortDesc: string; + svgClassName: string; + svgStyle: object; + text: string; + type: 'area' | 'line'; + value: number; + }>; + rendered: 'off' | 'on'; + scale: 'log' | 'linear'; + size: string; + step: number; + tickLabel: { + converter: object; + position: 'inside' | 'outside'; + rendered: 'off' | 'on'; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style: object; + }; + title: string; + titleStyle: object; + }; + yAxis: { + axisLine: { + lineColor: string; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + baselineScaling: 'min' | 'zero'; + dataMax: number; + dataMin: number; + majorTick: { + baselineColor: 'inherit' | 'auto'; + baselineStyle: 'dotted' | 'dashed' | 'solid'; + baselineWidth: number; + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + max: number; + maxSize: string; + min: number; + minStep: number; + minorStep: number; + minorTick: { + lineColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineWidth: number; + rendered: 'on' | 'off' | 'auto'; + }; + position: 'start' | 'end' | 'top' | 'bottom' | 'auto'; + referenceObjects: Array<{ + categories: string[]; + color: string; + displayInLegend: 'on' | 'off'; + high: number; + id: string; + items: Array<{ + high: number; + low: number; + value: number; + x: number | string; + }>; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'straight'; + lineWidth: number; + location: 'front' | 'back'; + low: number; + shortDesc: string; + svgClassName: string; + svgStyle: object; + text: string; + type: 'area' | 'line'; + value: number; + }>; + rendered: 'off' | 'on'; + scale: 'log' | 'linear'; + size: string; + step: number; + tickLabel: { + converter: object; + position: 'inside' | 'outside'; + rendered: 'off' | 'on'; + scaling: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style: object; + }; + title: string; + titleStyle: object; + viewportMax: number; + viewportMin: number; + }; + zoomAndScroll: 'delayedScrollOnly' | 'liveScrollOnly' | 'delayed' | 'live' | 'off'; + zoomDirection: 'x' | 'y' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelClose?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelDate?: string; + labelDefaultGroupName?: string; + labelGroup?: string; + labelHigh?: string; + labelInvalidData?: string; + labelLow?: string; + labelNoData?: string; + labelOpen?: string; + labelOther?: string; + labelPercentage?: string; + labelQ1?: string; + labelQ2?: string; + labelQ3?: string; + labelSeries?: string; + labelTargetValue?: string; + labelValue?: string; + labelVolume?: string; + labelX?: string; + labelY?: string; + labelZ?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + tooltipPan?: string; + tooltipSelect?: string; + tooltipZoom?: string; + }; +} +export interface ojChartSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojChartGroup extends JetElement { + drilling?: 'on' | 'off' | 'inherit'; + labelStyle?: object; + name?: string; + shortDesc?: string; + onDrillingChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onNameChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojChartGroupEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojChartGroup[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojChartGroupSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojChartGroupSettablePropertiesLenient): void; +} +export interface ojChartGroupEventMap extends HTMLElementEventMap { + 'drillingChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'nameChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; +} +export interface ojChartGroupSettableProperties extends JetSettableProperties { + drilling?: 'on' | 'off' | 'inherit'; + labelStyle?: object; + name?: string; + shortDesc?: string; +} +export interface ojChartGroupSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojChartItem extends JetElement { + borderColor?: string; + borderWidth?: number; + boxPlot?: { + medianSvgClassName?: string; + medianSvgStyle?: object; + q2Color?: string; + q2SvgClassName?: string; + q2SvgStyle?: object; + q3SvgClassName?: string; + q3SvgStyle?: object; + whiskerEndLength?: string; + whiskerEndSvgClassName?: string; + whiskerEndSvgStyle?: object; + whiskerSvgClassName?: string; + whiskerSvgStyle?: object; + }; + categories?: string[]; + close?: number; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + groupId: string[]; + high?: number; + items?: object[] | number[]; + label?: string | string[]; + labelPosition?: 'center' | 'outsideSlice' | 'aboveMarker' | 'belowMarker' | 'beforeMarker' | 'afterMarker' | 'insideBarEdge' | 'outsideBarEdge' | 'none' | 'auto'; + labelStyle?: object | object[]; + low?: number; + markerDisplayed?: 'on' | 'off' | 'auto'; + markerShape?: 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | 'auto' | string; + markerSize?: number; + open?: number; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'auto'; + q1?: number; + q2?: number; + q3?: number; + seriesId: string; + shortDesc?: string; + source?: string; + sourceHover?: string; + sourceHoverSelected?: string; + sourceSelected?: string; + svgClassName?: string; + svgStyle?: object; + targetValue?: number; + value?: number; + volume?: number; + x?: number | string; + y?: number; + z?: number; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onBoxPlotChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onCloseChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent) => any) | null; + onGroupIdChanged: ((event: JetElementCustomEvent) => any) | null; + onHighChanged: ((event: JetElementCustomEvent) => any) | null; + onItemsChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelPositionChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onLowChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerDisplayedChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerShapeChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerSizeChanged: ((event: JetElementCustomEvent) => any) | null; + onOpenChanged: ((event: JetElementCustomEvent) => any) | null; + onPatternChanged: ((event: JetElementCustomEvent) => any) | null; + onQ1Changed: ((event: JetElementCustomEvent) => any) | null; + onQ2Changed: ((event: JetElementCustomEvent) => any) | null; + onQ3Changed: ((event: JetElementCustomEvent) => any) | null; + onSeriesIdChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onTargetValueChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onVolumeChanged: ((event: JetElementCustomEvent) => any) | null; + onXChanged: ((event: JetElementCustomEvent) => any) | null; + onYChanged: ((event: JetElementCustomEvent) => any) | null; + onZChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojChartItemEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojChartItem[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojChartItemSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojChartItemSettablePropertiesLenient): void; +} +export interface ojChartItemEventMap extends HTMLElementEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'borderWidthChanged': JetElementCustomEvent; + 'boxPlotChanged': JetElementCustomEvent; + 'categoriesChanged': JetElementCustomEvent; + 'closeChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'drillingChanged': JetElementCustomEvent; + 'groupIdChanged': JetElementCustomEvent; + 'highChanged': JetElementCustomEvent; + 'itemsChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelPositionChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'lowChanged': JetElementCustomEvent; + 'markerDisplayedChanged': JetElementCustomEvent; + 'markerShapeChanged': JetElementCustomEvent; + 'markerSizeChanged': JetElementCustomEvent; + 'openChanged': JetElementCustomEvent; + 'patternChanged': JetElementCustomEvent; + 'q1Changed': JetElementCustomEvent; + 'q2Changed': JetElementCustomEvent; + 'q3Changed': JetElementCustomEvent; + 'seriesIdChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'sourceChanged': JetElementCustomEvent; + 'sourceHoverChanged': JetElementCustomEvent; + 'sourceHoverSelectedChanged': JetElementCustomEvent; + 'sourceSelectedChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'targetValueChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; + 'volumeChanged': JetElementCustomEvent; + 'xChanged': JetElementCustomEvent; + 'yChanged': JetElementCustomEvent; + 'zChanged': JetElementCustomEvent; +} +export interface ojChartItemSettableProperties extends JetSettableProperties { + borderColor?: string; + borderWidth?: number; + boxPlot?: { + medianSvgClassName?: string; + medianSvgStyle?: object; + q2Color?: string; + q2SvgClassName?: string; + q2SvgStyle?: object; + q3SvgClassName?: string; + q3SvgStyle?: object; + whiskerEndLength?: string; + whiskerEndSvgClassName?: string; + whiskerEndSvgStyle?: object; + whiskerSvgClassName?: string; + whiskerSvgStyle?: object; + }; + categories?: string[]; + close?: number; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + groupId: string[]; + high?: number; + items?: object[] | number[]; + label?: string | string[]; + labelPosition?: 'center' | 'outsideSlice' | 'aboveMarker' | 'belowMarker' | 'beforeMarker' | 'afterMarker' | 'insideBarEdge' | 'outsideBarEdge' | 'none' | 'auto'; + labelStyle?: object | object[]; + low?: number; + markerDisplayed?: 'on' | 'off' | 'auto'; + markerShape?: 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | 'auto' | string; + markerSize?: number; + open?: number; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'auto'; + q1?: number; + q2?: number; + q3?: number; + seriesId: string; + shortDesc?: string; + source?: string; + sourceHover?: string; + sourceHoverSelected?: string; + sourceSelected?: string; + svgClassName?: string; + svgStyle?: object; + targetValue?: number; + value?: number; + volume?: number; + x?: number | string; + y?: number; + z?: number; +} +export interface ojChartItemSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojChartSeries extends JetElement { + areaColor?: string; + areaSvgClassName?: string; + areaSvgStyle?: object; + assignedToY2?: 'on' | 'off'; + borderColor?: string; + borderWidth?: number; + boxPlot?: { + medianSvgClassName?: string; + medianSvgStyle?: object; + q2Color?: string; + q2SvgClassName?: string; + q2SvgStyle?: object; + q3Color?: string; + q3SvgClassName?: string; + q3SvgStyle?: object; + whiskerEndLength?: string; + whiskerEndSvgClassName?: string; + whiskerEndSvgStyle?: object; + whiskerSvgClassName?: string; + whiskerSvgStyle?: object; + }; + categories?: string[]; + color?: string; + displayInLegend?: 'on' | 'off' | 'auto'; + drilling?: 'on' | 'off' | 'inherit'; + lineStyle?: 'dotted' | 'dashed' | 'solid'; + lineType?: 'straight' | 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'none' | 'auto'; + lineWidth?: number; + markerColor?: string; + markerDisplayed?: 'on' | 'off' | 'auto'; + markerShape?: 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | 'auto' | string; + markerSize?: number; + markerSvgClassName?: string; + markerSvgStyle?: object; + name?: string; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'auto'; + pieSliceExplode?: number; + shortDesc?: string; + source?: string; + sourceHover?: string; + sourceHoverSelected?: string; + sourceSelected?: string; + stackCategory?: string; + svgClassName?: string; + svgStyle?: object; + type?: 'bar' | 'line' | 'area' | 'lineWithArea' | 'candlestick' | 'boxPlot' | 'auto'; + onAreaColorChanged: ((event: JetElementCustomEvent) => any) | null; + onAreaSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onAreaSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onAssignedToY2Changed: ((event: JetElementCustomEvent) => any) | null; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onBoxPlotChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onDisplayInLegendChanged: ((event: JetElementCustomEvent) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent) => any) | null; + onLineStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onLineTypeChanged: ((event: JetElementCustomEvent) => any) | null; + onLineWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerColorChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerDisplayedChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerShapeChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerSizeChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onNameChanged: ((event: JetElementCustomEvent) => any) | null; + onPatternChanged: ((event: JetElementCustomEvent) => any) | null; + onPieSliceExplodeChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onStackCategoryChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojChartSeriesEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojChartSeries[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojChartSeriesSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojChartSeriesSettablePropertiesLenient): void; +} +export interface ojChartSeriesEventMap extends HTMLElementEventMap { + 'areaColorChanged': JetElementCustomEvent; + 'areaSvgClassNameChanged': JetElementCustomEvent; + 'areaSvgStyleChanged': JetElementCustomEvent; + 'assignedToY2Changed': JetElementCustomEvent; + 'borderColorChanged': JetElementCustomEvent; + 'borderWidthChanged': JetElementCustomEvent; + 'boxPlotChanged': JetElementCustomEvent; + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'displayInLegendChanged': JetElementCustomEvent; + 'drillingChanged': JetElementCustomEvent; + 'lineStyleChanged': JetElementCustomEvent; + 'lineTypeChanged': JetElementCustomEvent; + 'lineWidthChanged': JetElementCustomEvent; + 'markerColorChanged': JetElementCustomEvent; + 'markerDisplayedChanged': JetElementCustomEvent; + 'markerShapeChanged': JetElementCustomEvent; + 'markerSizeChanged': JetElementCustomEvent; + 'markerSvgClassNameChanged': JetElementCustomEvent; + 'markerSvgStyleChanged': JetElementCustomEvent; + 'nameChanged': JetElementCustomEvent; + 'patternChanged': JetElementCustomEvent; + 'pieSliceExplodeChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'sourceChanged': JetElementCustomEvent; + 'sourceHoverChanged': JetElementCustomEvent; + 'sourceHoverSelectedChanged': JetElementCustomEvent; + 'sourceSelectedChanged': JetElementCustomEvent; + 'stackCategoryChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'typeChanged': JetElementCustomEvent; +} +export interface ojChartSeriesSettableProperties extends JetSettableProperties { + areaColor?: string; + areaSvgClassName?: string; + areaSvgStyle?: object; + assignedToY2?: 'on' | 'off'; + borderColor?: string; + borderWidth?: number; + boxPlot?: { + medianSvgClassName?: string; + medianSvgStyle?: object; + q2Color?: string; + q2SvgClassName?: string; + q2SvgStyle?: object; + q3Color?: string; + q3SvgClassName?: string; + q3SvgStyle?: object; + whiskerEndLength?: string; + whiskerEndSvgClassName?: string; + whiskerEndSvgStyle?: object; + whiskerSvgClassName?: string; + whiskerSvgStyle?: object; + }; + categories?: string[]; + color?: string; + displayInLegend?: 'on' | 'off' | 'auto'; + drilling?: 'on' | 'off' | 'inherit'; + lineStyle?: 'dotted' | 'dashed' | 'solid'; + lineType?: 'straight' | 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'none' | 'auto'; + lineWidth?: number; + markerColor?: string; + markerDisplayed?: 'on' | 'off' | 'auto'; + markerShape?: 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | 'auto' | string; + markerSize?: number; + markerSvgClassName?: string; + markerSvgStyle?: object; + name?: string; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'auto'; + pieSliceExplode?: number; + shortDesc?: string; + source?: string; + sourceHover?: string; + sourceHoverSelected?: string; + sourceSelected?: string; + stackCategory?: string; + svgClassName?: string; + svgStyle?: object; + type?: 'bar' | 'line' | 'area' | 'lineWithArea' | 'candlestick' | 'boxPlot' | 'auto'; +} +export interface ojChartSeriesSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojSparkChart extends dvtBaseComponent> { + animationDuration: number | null; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + areaColor: string; + areaSvgClassName: string; + areaSvgStyle: object; + as: string; + barGapRatio: number; + baselineScaling: 'zero' | 'min'; + color: string; + data: DataProvider | null; + firstColor: string; + highColor: string; + lastColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'none' | 'straight'; + lineWidth: number; + lowColor: string; + markerShape: 'auto' | 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSize: number; + referenceObjects: ojSparkChart.ReferenceObject[]; + svgClassName: string; + svgStyle: object; + tooltip: { + renderer: ((context: ojSparkChart.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })) | null; + }; + type: 'area' | 'lineWithArea' | 'bar' | 'line'; + visualEffects: 'none' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onAnimationDurationChanged: ((event: JetElementCustomEvent["animationDuration"]>) => any) | null; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAreaColorChanged: ((event: JetElementCustomEvent["areaColor"]>) => any) | null; + onAreaSvgClassNameChanged: ((event: JetElementCustomEvent["areaSvgClassName"]>) => any) | null; + onAreaSvgStyleChanged: ((event: JetElementCustomEvent["areaSvgStyle"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onBarGapRatioChanged: ((event: JetElementCustomEvent["barGapRatio"]>) => any) | null; + onBaselineScalingChanged: ((event: JetElementCustomEvent["baselineScaling"]>) => any) | null; + onColorChanged: ((event: JetElementCustomEvent["color"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onFirstColorChanged: ((event: JetElementCustomEvent["firstColor"]>) => any) | null; + onHighColorChanged: ((event: JetElementCustomEvent["highColor"]>) => any) | null; + onLastColorChanged: ((event: JetElementCustomEvent["lastColor"]>) => any) | null; + onLineStyleChanged: ((event: JetElementCustomEvent["lineStyle"]>) => any) | null; + onLineTypeChanged: ((event: JetElementCustomEvent["lineType"]>) => any) | null; + onLineWidthChanged: ((event: JetElementCustomEvent["lineWidth"]>) => any) | null; + onLowColorChanged: ((event: JetElementCustomEvent["lowColor"]>) => any) | null; + onMarkerShapeChanged: ((event: JetElementCustomEvent["markerShape"]>) => any) | null; + onMarkerSizeChanged: ((event: JetElementCustomEvent["markerSize"]>) => any) | null; + onReferenceObjectsChanged: ((event: JetElementCustomEvent["referenceObjects"]>) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent["svgClassName"]>) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent["svgStyle"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent["type"]>) => any) | null; + onVisualEffectsChanged: ((event: JetElementCustomEvent["visualEffects"]>) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojSparkChartEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojSparkChart[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojSparkChartSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojSparkChartSettablePropertiesLenient): void; + getDataItem(itemIndex: number): ojSparkChart.ItemContext | null; +} +export interface ojSparkChartEventMap extends dvtBaseComponentEventMap> { + 'animationDurationChanged': JetElementCustomEvent["animationDuration"]>; + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'areaColorChanged': JetElementCustomEvent["areaColor"]>; + 'areaSvgClassNameChanged': JetElementCustomEvent["areaSvgClassName"]>; + 'areaSvgStyleChanged': JetElementCustomEvent["areaSvgStyle"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'barGapRatioChanged': JetElementCustomEvent["barGapRatio"]>; + 'baselineScalingChanged': JetElementCustomEvent["baselineScaling"]>; + 'colorChanged': JetElementCustomEvent["color"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'firstColorChanged': JetElementCustomEvent["firstColor"]>; + 'highColorChanged': JetElementCustomEvent["highColor"]>; + 'lastColorChanged': JetElementCustomEvent["lastColor"]>; + 'lineStyleChanged': JetElementCustomEvent["lineStyle"]>; + 'lineTypeChanged': JetElementCustomEvent["lineType"]>; + 'lineWidthChanged': JetElementCustomEvent["lineWidth"]>; + 'lowColorChanged': JetElementCustomEvent["lowColor"]>; + 'markerShapeChanged': JetElementCustomEvent["markerShape"]>; + 'markerSizeChanged': JetElementCustomEvent["markerSize"]>; + 'referenceObjectsChanged': JetElementCustomEvent["referenceObjects"]>; + 'svgClassNameChanged': JetElementCustomEvent["svgClassName"]>; + 'svgStyleChanged': JetElementCustomEvent["svgStyle"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'typeChanged': JetElementCustomEvent["type"]>; + 'visualEffectsChanged': JetElementCustomEvent["visualEffects"]>; +} +export interface ojSparkChartSettableProperties extends dvtBaseComponentSettableProperties { + animationDuration: number | null; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + areaColor: string; + areaSvgClassName: string; + areaSvgStyle: object; + as: string; + barGapRatio: number; + baselineScaling: 'zero' | 'min'; + color: string; + data: DataProvider | null; + firstColor: string; + highColor: string; + lastColor: string; + lineStyle: 'dotted' | 'dashed' | 'solid'; + lineType: 'curved' | 'stepped' | 'centeredStepped' | 'segmented' | 'centeredSegmented' | 'none' | 'straight'; + lineWidth: number; + lowColor: string; + markerShape: 'auto' | 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSize: number; + referenceObjects: ojSparkChart.ReferenceObject[]; + svgClassName: string; + svgStyle: object; + tooltip: { + renderer: ((context: ojSparkChart.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })) | null; + }; + type: 'area' | 'lineWithArea' | 'bar' | 'line'; + visualEffects: 'none' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojSparkChartSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export namespace ojSparkChart { + // tslint:disable-next-line interface-over-type-literal + type Item = { + borderColor: string; + color: string; + date: Date; + high: number; + low: number; + markerDisplayed: 'on' | 'off'; + markerShape: 'square' | 'circle' | 'diamond' | 'plus' | 'triangleDown' | 'triangleUp' | 'human' | 'star' | 'auto' | string; + markerSize: number; + svgClassName: string; + svgStyle: object; + value: number; + }; + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + borderColor: string; + color: string; + date: Date; + high: number; + low: number; + value: number; + }; + // tslint:disable-next-line interface-over-type-literal + type ReferenceObject = { + color?: string; + high?: number; + lineWidth?: number; + lineStyle: 'dotted' | 'dashed' | 'solid'; + location: 'front' | 'back'; + low?: number; + svgClassName?: string; + svgStyle?: object; + type: 'area' | 'line'; + value?: number; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + color: string; + componentElement: Element; + parentElement: Element; + }; +} +export interface ojSparkChartItem extends JetElement { + borderColor: string; + color: string; + date: string; + high: number | null; + low: number | null; + markerDisplayed: 'off' | 'on'; + markerShape?: 'auto' | 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSize: number; + svgClassName: string; + svgStyle: object; + value: number | null; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onDateChanged: ((event: JetElementCustomEvent) => any) | null; + onHighChanged: ((event: JetElementCustomEvent) => any) | null; + onLowChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerDisplayedChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerShapeChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerSizeChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojSparkChartItemEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojSparkChartItem[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojSparkChartItemSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojSparkChartItemSettablePropertiesLenient): void; +} +export interface ojSparkChartItemEventMap extends HTMLElementEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'dateChanged': JetElementCustomEvent; + 'highChanged': JetElementCustomEvent; + 'lowChanged': JetElementCustomEvent; + 'markerDisplayedChanged': JetElementCustomEvent; + 'markerShapeChanged': JetElementCustomEvent; + 'markerSizeChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojSparkChartItemSettableProperties extends JetSettableProperties { + borderColor: string; + color: string; + date: string; + high: number | null; + low: number | null; + markerDisplayed: 'off' | 'on'; + markerShape?: 'auto' | 'circle' | 'diamond' | 'human' | 'plus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSize: number; + svgClassName: string; + svgStyle: object; + value: number | null; +} +export interface ojSparkChartItemSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojcheckboxset/index.d.ts b/types/oracle__oraclejet/ojcheckboxset/index.d.ts new file mode 100644 index 0000000000..afed42d51c --- /dev/null +++ b/types/oracle__oraclejet/ojcheckboxset/index.d.ts @@ -0,0 +1,69 @@ +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojCheckboxset extends editableValue { + disabled: boolean; + labelledBy: string | null; + required: boolean; + value: any[]; + translations: { + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelledByChanged: ((event: JetElementCustomEvent) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojCheckboxset.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojCheckboxset.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojCheckboxsetEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojCheckboxset[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojCheckboxsetSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojCheckboxsetSettablePropertiesLenient): void; + refresh(): void; + validate(): Promise; +} +export namespace ojCheckboxset { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojCheckboxsetEventMap extends editableValueEventMap { + 'ojAnimateEnd': ojCheckboxset.ojAnimateEnd; + 'ojAnimateStart': ojCheckboxset.ojAnimateStart; + 'disabledChanged': JetElementCustomEvent; + 'labelledByChanged': JetElementCustomEvent; + 'requiredChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojCheckboxsetSettableProperties extends editableValueSettableProperties { + disabled: boolean; + labelledBy: string | null; + required: boolean; + value: any[]; + translations: { + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; +} +export interface ojCheckboxsetSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojcollapsible/index.d.ts b/types/oracle__oraclejet/ojcollapsible/index.d.ts new file mode 100644 index 0000000000..1d677ed1c1 --- /dev/null +++ b/types/oracle__oraclejet/ojcollapsible/index.d.ts @@ -0,0 +1,64 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojCollapsible extends baseComponent { + disabled: boolean; + expandArea: 'header' | 'disclosureIcon'; + expanded: boolean; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onExpandAreaChanged: ((event: JetElementCustomEvent) => any) | null; + onExpandedChanged: ((event: JetElementCustomEvent) => any) | null; + onOjBeforeCollapse: ((event: ojCollapsible.ojBeforeCollapse) => any) | null; + onOjBeforeExpand: ((event: ojCollapsible.ojBeforeExpand) => any) | null; + onOjCollapse: ((event: ojCollapsible.ojCollapse) => any) | null; + onOjExpand: ((event: ojCollapsible.ojExpand) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojCollapsibleEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojCollapsible[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojCollapsibleSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojCollapsibleSettablePropertiesLenient): void; + refresh(): void; +} +export namespace ojCollapsible { + interface ojBeforeCollapse extends CustomEvent<{ + header: Element; + content: Element; + [propName: string]: any; + }> { + } + interface ojBeforeExpand extends CustomEvent<{ + header: Element; + content: Element; + [propName: string]: any; + }> { + } + interface ojCollapse extends CustomEvent<{ + header: Element; + content: Element; + [propName: string]: any; + }> { + } + interface ojExpand extends CustomEvent<{ + header: Element; + content: Element; + [propName: string]: any; + }> { + } +} +export interface ojCollapsibleEventMap extends baseComponentEventMap { + 'ojBeforeCollapse': ojCollapsible.ojBeforeCollapse; + 'ojBeforeExpand': ojCollapsible.ojBeforeExpand; + 'ojCollapse': ojCollapsible.ojCollapse; + 'ojExpand': ojCollapsible.ojExpand; + 'disabledChanged': JetElementCustomEvent; + 'expandAreaChanged': JetElementCustomEvent; + 'expandedChanged': JetElementCustomEvent; +} +export interface ojCollapsibleSettableProperties extends baseComponentSettableProperties { + disabled: boolean; + expandArea: 'header' | 'disclosureIcon'; + expanded: boolean; +} +export interface ojCollapsibleSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojcollectiondataprovider/index.d.ts b/types/oracle__oraclejet/ojcollectiondataprovider/index.d.ts new file mode 100644 index 0000000000..19b87d4f8a --- /dev/null +++ b/types/oracle__oraclejet/ojcollectiondataprovider/index.d.ts @@ -0,0 +1,16 @@ +import { Collection } from '../ojmodel'; +import { DataProvider, FetchByKeysParameters, ContainsKeysResults, FetchByKeysResults, FetchByOffsetParameters, FetchByOffsetResults, FetchListResult, FetchListParameters } from '../ojdataprovider'; +declare class CollectionDataProvider implements DataProvider { + constructor(collection: Collection); + addEventListener(eventType: string, listener: EventListener): void; + containsKeys(params: FetchByKeysParameters): Promise>; + dispatchEvent(evt: Event): boolean; + fetchByKeys(params: FetchByKeysParameters): Promise>; + fetchByOffset(params: FetchByOffsetParameters): Promise>; + fetchFirst(params?: FetchListParameters): AsyncIterable>; + getCapability(capabilityName?: string): any; + getTotalSize(): Promise; + isEmpty(): 'yes' | 'no' | 'unknown'; + removeEventListener(eventType: string, listener: EventListener): void; +} +export = CollectionDataProvider; diff --git a/types/oracle__oraclejet/ojcolor/index.d.ts b/types/oracle__oraclejet/ojcolor/index.d.ts new file mode 100644 index 0000000000..b252df9ab7 --- /dev/null +++ b/types/oracle__oraclejet/ojcolor/index.d.ts @@ -0,0 +1,182 @@ +declare class Color { + static ALICEBLUE: Color; + static ANTIQUEWHITE: Color; + static AQUA: Color; + static AQUAMARINE: Color; + static AZURE: Color; + static BEIGE: Color; + static BISQUE: Color; + static BLACK: Color; + static BLANCHEDALMOND: Color; + static BLUE: Color; + static BLUEVIOLET: Color; + static BROWN: Color; + static BURLYWOOD: Color; + static CADETBLUE: Color; + static CHARTREUSE: Color; + static CHOCOLATE: Color; + static CORAL: Color; + static CORNFLOWERBLUE: Color; + static CORNSILK: Color; + static CRIMSON: Color; + static CYAN: Color; + static DARKBLUE: Color; + static DARKCYAN: Color; + static DARKGOLDENROD: Color; + static DARKGRAY: Color; + static DARKGREEN: Color; + static DARKGREY: Color; + static DARKKHAKI: Color; + static DARKMAGENTA: Color; + static DARKOLIVEGREEN: Color; + static DARKORANGE: Color; + static DARKORCHID: Color; + static DARKRED: Color; + static DARKSALMON: Color; + static DARKSEAGREEN: Color; + static DARKSLATEBLUE: Color; + static DARKSLATEGRAY: Color; + static DARKSLATEGREY: Color; + static DARKTURQUOISE: Color; + static DARKVIOLET: Color; + static DEEPPINK: Color; + static DEEPSKYBLUE: Color; + static DIMGRAY: Color; + static DIMGREY: Color; + static DODGERBLUE: Color; + static FIREBRICK: Color; + static FLORALWHITE: Color; + static FORESTGREEN: Color; + static FUCHSIA: Color; + static GAINSBORO: Color; + static GHOSTWHITE: Color; + static GOLD: Color; + static GOLDENROD: Color; + static GRAY: Color; + static GREEN: Color; + static GREENYELLOW: Color; + static GREY: Color; + static HONEYDEW: Color; + static HOTPINK: Color; + static INDIANRED: Color; + static INDIGO: Color; + static IVORY: Color; + static KHAKI: Color; + static LAVENDER: Color; + static LAVENDERBLUSH: Color; + static LAWNGREEN: Color; + static LEMONCHIFFON: Color; + static LIGHTBLUE: Color; + static LIGHTCORAL: Color; + static LIGHTCYAN: Color; + static LIGHTGOLDENRODYELLOW: Color; + static LIGHTGRAY: Color; + static LIGHTGREEN: Color; + static LIGHTGREY: Color; + static LIGHTPINK: Color; + static LIGHTSALMON: Color; + static LIGHTSEAGREEN: Color; + static LIGHTSKYBLUE: Color; + static LIGHTSLATEGRAY: Color; + static LIGHTSLATEGREY: Color; + static LIGHTSTEELBLUE: Color; + static LIGHTYELLOW: Color; + static LIME: Color; + static LIMEGREEN: Color; + static LINEN: Color; + static MAGENTA: Color; + static MAROON: Color; + static MEDIUMAQUAMARINE: Color; + static MEDIUMBLUE: Color; + static MEDIUMORCHID: Color; + static MEDIUMPURPLE: Color; + static MEDIUMSEAGREEN: Color; + static MEDIUMSLATEBLUE: Color; + static MEDIUMSPRINGGREEN: Color; + static MEDIUMTURQUOISE: Color; + static MEDIUMVIOLETRED: Color; + static MIDNIGHTBLUE: Color; + static MINTCREAM: Color; + static MISTYROSE: Color; + static MOCCASIN: Color; + static NAVAJOWHITE: Color; + static NAVY: Color; + static OLDLACE: Color; + static OLIVE: Color; + static OLIVEDRAB: Color; + static ORANGE: Color; + static ORANGERED: Color; + static ORCHID: Color; + static PALEGOLDENROD: Color; + static PALEGREEN: Color; + static PALETURQUOISE: Color; + static PALEVIOLETRED: Color; + static PAPAYAWHIP: Color; + static PEACHPUFF: Color; + static PERU: Color; + static PINK: Color; + static PLUM: Color; + static POWDERBLUE: Color; + static PURPLE: Color; + static REBECCAPURPLE: Color; + static RED: Color; + static ROSYBROWN: Color; + static ROYALBLUE: Color; + static SADDLEBROWN: Color; + static SALMON: Color; + static SANDYBROWN: Color; + static SEAGREEN: Color; + static SEASHELL: Color; + static SIENNA: Color; + static SILVER: Color; + static SKYBLUE: Color; + static SLATEBLUE: Color; + static SLATEGRAY: Color; + static SLATEGREY: Color; + static SNOW: Color; + static SPRINGGREEN: Color; + static STEELBLUE: Color; + static TAN: Color; + static TEAL: Color; + static THISTLE: Color; + static TOMATO: Color; + static TRANSPARENT: Color; + static TURQUOISE: Color; + static VIOLET: Color; + static WHEAT: Color; + static WHITE: Color; + static WHITESMOKE: Color; + static YELLOW: Color; + static YELLOWGREEN: Color; + constructor(color: string | Color.RGBA | Color.HSLA | Color.HSVA); + getAlpha(): number; + getBlue(doNotRound?: boolean): number; + getGreen(doNotRound?: boolean): number; + getRed(doNotRound?: boolean): number; + isEqual(color: Color): boolean; + toString(): string; +} +declare namespace Color { + // tslint:disable-next-line interface-over-type-literal + type HSLA = { + h: number; + s: number; + l: number; + a?: number; + }; + // tslint:disable-next-line interface-over-type-literal + type HSVA = { + h: number; + s: number; + v: number; + a?: number; + }; + // tslint:disable-next-line interface-over-type-literal + type RGBA = { + r: number; + g: number; + b: number; + a?: number; + }; +} +export = Color; diff --git a/types/oracle__oraclejet/ojcolorpalette/index.d.ts b/types/oracle__oraclejet/ojcolorpalette/index.d.ts new file mode 100644 index 0000000000..5e0b278199 --- /dev/null +++ b/types/oracle__oraclejet/ojcolorpalette/index.d.ts @@ -0,0 +1,74 @@ +import Color = require('../ojcolor'); +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojColorPalette extends editableValue { + labelDisplay: 'auto' | 'off'; + labelledBy: string | null; + layout: 'grid' | 'list'; + palette: Array<{ + color: Color; + label?: string; + }>; + swatchSize: 'xs' | 'sm' | 'lg'; + value: Color; + translations: { + labelNone?: string; + }; + onLabelDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelledByChanged: ((event: JetElementCustomEvent) => any) | null; + onLayoutChanged: ((event: JetElementCustomEvent) => any) | null; + onPaletteChanged: ((event: JetElementCustomEvent) => any) | null; + onSwatchSizeChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojColorPalette.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojColorPalette.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojColorPaletteEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojColorPalette[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojColorPaletteSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojColorPaletteSettablePropertiesLenient): void; +} +export namespace ojColorPalette { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojColorPaletteEventMap extends editableValueEventMap { + 'ojAnimateEnd': ojColorPalette.ojAnimateEnd; + 'ojAnimateStart': ojColorPalette.ojAnimateStart; + 'labelDisplayChanged': JetElementCustomEvent; + 'labelledByChanged': JetElementCustomEvent; + 'layoutChanged': JetElementCustomEvent; + 'paletteChanged': JetElementCustomEvent; + 'swatchSizeChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojColorPaletteSettableProperties extends editableValueSettableProperties { + labelDisplay: 'auto' | 'off'; + labelledBy: string | null; + layout: 'grid' | 'list'; + palette: Array<{ + color: Color; + label?: string; + }>; + swatchSize: 'xs' | 'sm' | 'lg'; + value: Color; + translations: { + labelNone?: string; + }; +} +export interface ojColorPaletteSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojcolorspectrum/index.d.ts b/types/oracle__oraclejet/ojcolorspectrum/index.d.ts new file mode 100644 index 0000000000..a96f0c1977 --- /dev/null +++ b/types/oracle__oraclejet/ojcolorspectrum/index.d.ts @@ -0,0 +1,62 @@ +import Color = require('../ojcolor'); +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojColorSpectrum extends editableValue { + labelledBy: string | null; + readonly transientValue: Color; + value: Color; + translations: { + labelHue?: string; + labelOpacity?: string; + labelSatLum?: string; + labelThumbDesc?: string; + }; + onLabelledByChanged: ((event: JetElementCustomEvent) => any) | null; + onTransientValueChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojColorSpectrum.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojColorSpectrum.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojColorSpectrumEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojColorSpectrum[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojColorSpectrumSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojColorSpectrumSettablePropertiesLenient): void; +} +export namespace ojColorSpectrum { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojColorSpectrumEventMap extends editableValueEventMap { + 'ojAnimateEnd': ojColorSpectrum.ojAnimateEnd; + 'ojAnimateStart': ojColorSpectrum.ojAnimateStart; + 'labelledByChanged': JetElementCustomEvent; + 'transientValueChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojColorSpectrumSettableProperties extends editableValueSettableProperties { + labelledBy: string | null; + readonly transientValue: Color; + value: Color; + translations: { + labelHue?: string; + labelOpacity?: string; + labelSatLum?: string; + labelThumbDesc?: string; + }; +} +export interface ojColorSpectrumSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojcomponentcore/index.d.ts b/types/oracle__oraclejet/ojcomponentcore/index.d.ts new file mode 100644 index 0000000000..17ab67c7b9 --- /dev/null +++ b/types/oracle__oraclejet/ojcomponentcore/index.d.ts @@ -0,0 +1,6 @@ +export function subtreeAttached(node: Element): void; +export function subtreeDetached(node: Element): void; +export function subtreeHidden(node: Element): void; +export function subtreeShown(node: Element, options?: { + initialRender: boolean; +}): void; diff --git a/types/oracle__oraclejet/ojcomposite/index.d.ts b/types/oracle__oraclejet/ojcomposite/index.d.ts new file mode 100644 index 0000000000..d8ed0bbb4e --- /dev/null +++ b/types/oracle__oraclejet/ojcomposite/index.d.ts @@ -0,0 +1,45 @@ +export function getComponentMetadata(name: string): Metadata | null; +export function register(name: string, descriptor: { + metadata: Metadata; + view: string; + viewModel: ((param0: ViewModelContext) => void | object); + parseFunction: ((value: string, name: string, meta: object, defaultParseFunction: (value: string) => any) => any); +}): void; +// tslint:disable-next-line interface-over-type-literal +export type Metadata = { + name: string; + version: string; + jetVersion: string; + properties?: object; + methods?: object; + events?: object; + slots?: object; +}; +// tslint:disable-next-line interface-over-type-literal +export type PropertyChangedContext = { + property: string; + value: any; + previousValue: any; + updatedFrom: 'external' | 'internal'; + subproperty?: { + path: string; + value: any; + previousValue: any; + }; +}; +// tslint:disable-next-line interface-over-type-literal +export type ViewModel = { + activated: ((param0: ViewModelContext) => Promise | void); + connected: ((param0: ViewModelContext) => void); + bindingsApplied: ((param0: ViewModelContext) => void); + propertyChanged: ((param0: PropertyChangedContext) => void); + disconnected: ((param0: Element) => void); +}; +// tslint:disable-next-line interface-over-type-literal +export type ViewModelContext = { + element: Element; + properties: object; + slotCounts: object; + unique: string; + uniqueId: string; +}; diff --git a/types/oracle__oraclejet/ojconfig/index.d.ts b/types/oracle__oraclejet/ojconfig/index.d.ts new file mode 100644 index 0000000000..6fefb1406c --- /dev/null +++ b/types/oracle__oraclejet/ojconfig/index.d.ts @@ -0,0 +1,9 @@ +export function getAutomationMode(): string; +export function getDeviceType(): 'phone' | 'tablet' | 'others'; +export function getLocale(): string; +export function getResourceUrl(relativePath: string): string; +export function getVersionInfo(): string; +export function logVersionInfo(): undefined; +export function setAutomationMode(mode: string): undefined; +export function setLocale(locale: string, callback?: (() => void)): undefined; +export function setResourceBaseUrl(baseUrl: string): undefined; diff --git a/types/oracle__oraclejet/ojcontext/index.d.ts b/types/oracle__oraclejet/ojcontext/index.d.ts new file mode 100644 index 0000000000..0bb6a856c7 --- /dev/null +++ b/types/oracle__oraclejet/ojcontext/index.d.ts @@ -0,0 +1,39 @@ +declare class BusyContext { + addBusyState(options: { + description: object | (() => string); + }): (() => void); + applicationBootstrapComplete(): undefined; + clear(): undefined; + dump(message?: string): undefined; + getBusyStates(): Array<{ + id: string; + description: string; + }>; + isReady(): boolean; + toString(): string; + whenReady(timeout?: number): Promise<(boolean | Error)>; +} +declare namespace Context { + interface BusyContext { + addBusyState(options: { + description: object | (() => string); + }): (() => void); + applicationBootstrapComplete(): undefined; + clear(): undefined; + dump(message?: string): undefined; + getBusyStates(): Array<{ + id: string; + description: string; + }>; + isReady(): boolean; + toString(): string; + whenReady(timeout?: number): Promise<(boolean | Error)>; + } +} +declare class Context { + static getContext(node: Element): Context; + static getPageContext(): Context; + static setBusyContextDefaultTimeout(timeout: number): any; + getBusyContext(): BusyContext; +} +export = Context; diff --git a/types/oracle__oraclejet/ojconveyorbelt/index.d.ts b/types/oracle__oraclejet/ojconveyorbelt/index.d.ts new file mode 100644 index 0000000000..bacc5f7a7f --- /dev/null +++ b/types/oracle__oraclejet/ojconveyorbelt/index.d.ts @@ -0,0 +1,26 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojConveyorBelt extends baseComponent { + contentParent: string | null; + orientation: 'horizontal' | 'vertical'; + onContentParentChanged: ((event: JetElementCustomEvent) => any) | null; + onOrientationChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojConveyorBeltEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojConveyorBelt[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojConveyorBeltSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojConveyorBeltSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojConveyorBeltEventMap extends baseComponentEventMap { + 'contentParentChanged': JetElementCustomEvent; + 'orientationChanged': JetElementCustomEvent; +} +export interface ojConveyorBeltSettableProperties extends baseComponentSettableProperties { + contentParent: string | null; + orientation: 'horizontal' | 'vertical'; +} +export interface ojConveyorBeltSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojdatagrid/index.d.ts b/types/oracle__oraclejet/ojdatagrid/index.d.ts new file mode 100644 index 0000000000..073f5de2af --- /dev/null +++ b/types/oracle__oraclejet/ojdatagrid/index.d.ts @@ -0,0 +1,520 @@ +import { DataProvider } from '../ojdataprovider'; +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojDataGrid extends baseComponent> { + bandingInterval: { + column: number; + row: number; + }; + cell: { + className?: ((context: ojDataGrid.CellContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.CellContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.CellContext) => string | void | null) | string | null; + }; + currentCell: ojDataGrid.CurrentCell | null; + data: DataProvider; + dnd: { + reorder: { + row: 'enable' | 'disable'; + }; + }; + editMode: 'none' | 'cellNavigation' | 'cellEdit'; + gridlines: { + horizontal: 'visible' | 'hidden'; + vertical: 'visible' | 'hidden'; + }; + header: { + column: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height: 'enable' | 'disable'; + width?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + }; + sortable?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + columnEnd: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height: 'enable' | 'disable'; + width?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + }; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + row: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + width: 'enable' | 'disable'; + }; + sortable?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + rowEnd: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + width: 'enable' | 'disable'; + }; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + }; + scrollPolicy: 'auto' | 'loadMoreOnScroll' | 'scroll'; + scrollPolicyOptions: { + maxColumnCount: number; + maxRowCount: number; + }; + scrollPosition: { + x?: number; + y?: number; + rowIndex?: number; + columnIndex?: number; + rowKey?: K; + columnKey?: K; + offsetX?: number; + offsetY?: number; + }; + selection: Array>; + selectionMode: { + cell: 'none' | 'single' | 'multiple'; + row: 'none' | 'single' | 'multiple'; + }; + translations: { + accessibleActionableMode?: string; + accessibleColumnContext?: string; + accessibleColumnEndHeaderContext?: string; + accessibleColumnHeaderContext?: string; + accessibleColumnSelected?: string; + accessibleColumnSpanContext?: string; + accessibleFirstColumn?: string; + accessibleFirstRow?: string; + accessibleLastColumn?: string; + accessibleLastRow?: string; + accessibleLevelContext?: string; + accessibleMultiCellSelected?: string; + accessibleNavigationMode?: string; + accessibleRangeSelectModeOff?: string; + accessibleRangeSelectModeOn?: string; + accessibleRowCollapsed?: string; + accessibleRowContext?: string; + accessibleRowEndHeaderContext?: string; + accessibleRowExpanded?: string; + accessibleRowHeaderContext?: string; + accessibleRowSelected?: string; + accessibleRowSpanContext?: string; + accessibleSelectionAffordanceBottom?: string; + accessibleSelectionAffordanceTop?: string; + accessibleSortAscending?: string; + accessibleSortDescending?: string; + accessibleStateSelected?: string; + accessibleSummaryEstimate?: string; + accessibleSummaryExact?: string; + accessibleSummaryExpanded?: string; + labelCut?: string; + labelDisableNonContiguous?: string; + labelEnableNonContiguous?: string; + labelPaste?: string; + labelResize?: string; + labelResizeDialogSubmit?: string; + labelResizeHeight?: string; + labelResizeWidth?: string; + labelSortCol?: string; + labelSortColAsc?: string; + labelSortColDsc?: string; + labelSortRow?: string; + labelSortRowAsc?: string; + labelSortRowDsc?: string; + msgFetchingData?: string; + msgNoData?: string; + }; + onBandingIntervalChanged: ((event: JetElementCustomEvent["bandingInterval"]>) => any) | null; + onCellChanged: ((event: JetElementCustomEvent["cell"]>) => any) | null; + onCurrentCellChanged: ((event: JetElementCustomEvent["currentCell"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDndChanged: ((event: JetElementCustomEvent["dnd"]>) => any) | null; + onEditModeChanged: ((event: JetElementCustomEvent["editMode"]>) => any) | null; + onGridlinesChanged: ((event: JetElementCustomEvent["gridlines"]>) => any) | null; + onHeaderChanged: ((event: JetElementCustomEvent["header"]>) => any) | null; + onScrollPolicyChanged: ((event: JetElementCustomEvent["scrollPolicy"]>) => any) | null; + onScrollPolicyOptionsChanged: ((event: JetElementCustomEvent["scrollPolicyOptions"]>) => any) | null; + onScrollPositionChanged: ((event: JetElementCustomEvent["scrollPosition"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onOjBeforeCurrentCell: ((event: ojDataGrid.ojBeforeCurrentCell) => any) | null; + onOjBeforeEdit: ((event: ojDataGrid.ojBeforeEdit) => any) | null; + onOjBeforeEditEnd: ((event: ojDataGrid.ojBeforeEditEnd) => any) | null; + onOjResize: ((event: ojDataGrid.ojResize) => any) | null; + onOjScroll: ((event: ojDataGrid.ojScroll) => any) | null; + onOjSort: ((event: ojDataGrid.ojSort) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojDataGridEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojDataGrid[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojDataGridSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojDataGridSettablePropertiesLenient): void; + getContextByNode(node: Element): ojDataGrid.CellContext & { + subId: 'oj-datagrid-cell'; + } | ojDataGrid.HeaderContext & { + subId: 'oj-datagrid-header'; + } | ojDataGrid.LabelContext & { + subId: 'oj-datagrid-header-label'; + }; + refresh(): void; +} +export namespace ojDataGrid { + interface ojBeforeCurrentCell extends CustomEvent<{ + currentCell: CurrentCell; + previousCurrentCell: CurrentCell; + [propName: string]: any; + }> { + } + interface ojBeforeEdit extends CustomEvent<{ + cellContext: CellContext; + [propName: string]: any; + }> { + } + interface ojBeforeEditEnd extends CustomEvent<{ + cellContext: CellContext; + cancelEdit: boolean; + [propName: string]: any; + }> { + } + interface ojResize extends CustomEvent<{ + header: string | number; + oldDimensions: { + width: number; + height: number; + }; + newDimensions: { + width: number; + height: number; + }; + [propName: string]: any; + }> { + } + interface ojScroll extends CustomEvent<{ + scrollX: number; + scrollY: number; + [propName: string]: any; + }> { + } + interface ojSort extends CustomEvent<{ + header: any; + direction: 'ascending' | 'descending'; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type CellContext = { + componentElement: Element; + parentElement: Element; + cell: D; + data: D; + datasource: DataProvider | null; + indexes: { + row: number; + column: number; + }; + keys: { + row: K; + column: K; + }; + extents: { + row: number; + column: number; + }; + mode: 'edit' | 'navigation'; + }; + // tslint:disable-next-line interface-over-type-literal + type CurrentCell = { + type: 'cell' | 'header' | 'label'; + axis?: 'column' | 'columnEnd' | 'row' | 'rowEnd'; + index?: number; + level?: number; + key?: any; + indexes?: { + row: number; + column: number; + }; + keys?: { + row: K; + column: K; + }; + }; + // tslint:disable-next-line interface-over-type-literal + type HeaderContext = { + componentElement: Element; + parentElement: Element; + data: D; + datasource: DataProvider | null; + axis: 'column' | 'columnEnd' | 'row' | 'rowEnd'; + index: number; + key: K; + level: number; + extent: number; + depth: number; + }; + // tslint:disable-next-line interface-over-type-literal + type LabelContext = { + componentElement: Element; + parentElement: Element; + datasource: DataProvider | null; + axis: 'column' | 'columnEnd' | 'row' | 'rowEnd'; + key: K; + level: number; + }; + // tslint:disable-next-line interface-over-type-literal + type Selection = { + startIndex?: { + row: number; + column?: number; + }; + startKey?: { + row: K; + column?: K; + }; + endIndex?: { + row: number; + column?: number; + }; + endKey?: { + row: K; + column?: K; + }; + }; +} +export interface ojDataGridEventMap extends baseComponentEventMap> { + 'ojBeforeCurrentCell': ojDataGrid.ojBeforeCurrentCell; + 'ojBeforeEdit': ojDataGrid.ojBeforeEdit; + 'ojBeforeEditEnd': ojDataGrid.ojBeforeEditEnd; + 'ojResize': ojDataGrid.ojResize; + 'ojScroll': ojDataGrid.ojScroll; + 'ojSort': ojDataGrid.ojSort; + 'bandingIntervalChanged': JetElementCustomEvent["bandingInterval"]>; + 'cellChanged': JetElementCustomEvent["cell"]>; + 'currentCellChanged': JetElementCustomEvent["currentCell"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'dndChanged': JetElementCustomEvent["dnd"]>; + 'editModeChanged': JetElementCustomEvent["editMode"]>; + 'gridlinesChanged': JetElementCustomEvent["gridlines"]>; + 'headerChanged': JetElementCustomEvent["header"]>; + 'scrollPolicyChanged': JetElementCustomEvent["scrollPolicy"]>; + 'scrollPolicyOptionsChanged': JetElementCustomEvent["scrollPolicyOptions"]>; + 'scrollPositionChanged': JetElementCustomEvent["scrollPosition"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; +} +export interface ojDataGridSettableProperties extends baseComponentSettableProperties { + bandingInterval: { + column: number; + row: number; + }; + cell: { + className?: ((context: ojDataGrid.CellContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.CellContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.CellContext) => string | void | null) | string | null; + }; + currentCell: ojDataGrid.CurrentCell | null; + data: DataProvider | null; + dnd: { + reorder: { + row: 'enable' | 'disable'; + }; + }; + editMode: 'none' | 'cellNavigation' | 'cellEdit'; + gridlines: { + horizontal: 'visible' | 'hidden'; + vertical: 'visible' | 'hidden'; + }; + header: { + column: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height: 'enable' | 'disable'; + width?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + }; + sortable?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + columnEnd: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height: 'enable' | 'disable'; + width?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + }; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + row: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + width: 'enable' | 'disable'; + }; + sortable?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + rowEnd: { + className?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + label: { + className?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + renderer?: ((context: ojDataGrid.LabelContext) => { + insert: HTMLElement | string; + } | void | null) | null; + style?: ((context: ojDataGrid.LabelContext) => string | void | null) | string | null; + }; + renderer?: ((context: ojDataGrid.HeaderContext) => { + insert: HTMLElement | string; + } | void | null) | null; + resizable: { + height?: ((context: ojDataGrid.HeaderContext) => string) | string | null; + width: 'enable' | 'disable'; + }; + style?: ((context: ojDataGrid.HeaderContext) => string | void | null) | string | null; + }; + }; + scrollPolicy: 'auto' | 'loadMoreOnScroll' | 'scroll'; + scrollPolicyOptions: { + maxColumnCount: number; + maxRowCount: number; + }; + scrollPosition: { + x?: number; + y?: number; + rowIndex?: number; + columnIndex?: number; + rowKey?: K; + columnKey?: K; + offsetX?: number; + offsetY?: number; + }; + selection: Array>; + selectionMode: { + cell: 'none' | 'single' | 'multiple'; + row: 'none' | 'single' | 'multiple'; + }; + translations: { + accessibleActionableMode?: string; + accessibleColumnContext?: string; + accessibleColumnEndHeaderContext?: string; + accessibleColumnHeaderContext?: string; + accessibleColumnSelected?: string; + accessibleColumnSpanContext?: string; + accessibleFirstColumn?: string; + accessibleFirstRow?: string; + accessibleLastColumn?: string; + accessibleLastRow?: string; + accessibleLevelContext?: string; + accessibleMultiCellSelected?: string; + accessibleNavigationMode?: string; + accessibleRangeSelectModeOff?: string; + accessibleRangeSelectModeOn?: string; + accessibleRowCollapsed?: string; + accessibleRowContext?: string; + accessibleRowEndHeaderContext?: string; + accessibleRowExpanded?: string; + accessibleRowHeaderContext?: string; + accessibleRowSelected?: string; + accessibleRowSpanContext?: string; + accessibleSelectionAffordanceBottom?: string; + accessibleSelectionAffordanceTop?: string; + accessibleSortAscending?: string; + accessibleSortDescending?: string; + accessibleStateSelected?: string; + accessibleSummaryEstimate?: string; + accessibleSummaryExact?: string; + accessibleSummaryExpanded?: string; + labelCut?: string; + labelDisableNonContiguous?: string; + labelEnableNonContiguous?: string; + labelPaste?: string; + labelResize?: string; + labelResizeDialogSubmit?: string; + labelResizeHeight?: string; + labelResizeWidth?: string; + labelSortCol?: string; + labelSortColAsc?: string; + labelSortColDsc?: string; + labelSortRow?: string; + labelSortRowAsc?: string; + labelSortRowDsc?: string; + msgFetchingData?: string; + msgNoData?: string; + }; +} +export interface ojDataGridSettablePropertiesLenient extends Partial> { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojdataprovider/index.d.ts b/types/oracle__oraclejet/ojdataprovider/index.d.ts new file mode 100644 index 0000000000..accc1f25bc --- /dev/null +++ b/types/oracle__oraclejet/ojdataprovider/index.d.ts @@ -0,0 +1,111 @@ +export interface AttributeFilterOperator { + attribute: string; + op: AttributeFilterOperator.AttributeOperator; + value: any; +} +export namespace AttributeFilterOperator { + type AttributeOperator = "$co" | "$eq" | "$ew" | "$pr" | "$gt" | "$ge" | "$lt" | "$le" | "$ne" | "$regex" | "$sw"; +} +export interface CompoundFilterOperator { + criteria: Array>; + op: CompoundFilterOperator.CompoundOperator; +} +export namespace CompoundFilterOperator { + type CompoundOperator = "$and" | "$or"; +} +export interface ContainsKeysResults { + containsParameters: FetchByKeysParameters; + results: Set; +} +export interface DataMapping { + mapFields: (item: Item) => Item; + mapFilterCriterion?: (filterCriterion: Array>) => Array>; + mapSortCriteria?: (sortCriteria: Array>) => Array>; + unmapSortCriteria?: (sortCriteria: Array>) => Array>; +} +export interface DataProvider extends EventTarget { + containsKeys(parameters: FetchByKeysParameters): Promise>; + fetchByKeys(parameters: FetchByKeysParameters): Promise>; + fetchByOffset(parameters: FetchByOffsetParameters): Promise>; + fetchFirst(parameters?: FetchListParameters): AsyncIterable>; + getCapability(capabilityName: string): any; + getTotalSize(): Promise; + isEmpty(): 'yes' | 'no' | 'unknown'; +} +export interface DataProviderAddOperationEventDetail extends DataProviderOperationEventDetail { + addBeforeKeys?: K[]; + parentKeys?: K[]; +} +export interface DataProviderMutationEventDetail { + add?: DataProviderAddOperationEventDetail; + remove?: DataProviderOperationEventDetail; + update?: DataProviderOperationEventDetail; +} +export interface DataProviderOperationEventDetail { + data?: D[]; + indexes?: number[]; + keys: Set; + metadata?: Array>; +} +export interface FetchByKeysCapability { + implementation: 'iteration' | 'lookup'; +} +export namespace FetchByKeysMixin { + function applyMixin(derivedCtor: { + new (): DataProvider; + }): any; +} +export interface FetchByKeysParameters { + keys: Set; +} +export interface FetchByKeysResults { + fetchParameters: FetchByKeysParameters; + results: Map>; +} +export interface FetchByOffsetCapability { + implementation: 'iteration' | 'randomAccess'; +} +export namespace FetchByOffsetMixin { + function applyMixin(derivedCtor: { + new (): DataProvider; + }): any; +} +export interface FetchByOffsetParameters extends FetchListParameters { + offset: number; +} +export interface FetchByOffsetResults { + done: boolean; + fetchParameters: FetchByOffsetParameters; + results: Array>; +} +export interface FetchListParameters { + filterCriterion?: FilterOperator; + size: number; + sortCriteria?: Array>; +} +export interface FetchListResult { + data: D[]; + fetchParameters: FetchListParameters; + metadata: Array>; +} +export interface FilterCapability { + operators: string[]; +} +export interface FilterOperator { + op: AttributeFilterOperator.AttributeOperator | CompoundFilterOperator.CompoundOperator; + filter(data: any[]): any[]; +} +export interface Item { + data: D; + metadata: ItemMetadata; +} +export interface ItemMetadata { + key: K; +} +export interface SortCapability { + attributes: 'none' | 'single' | 'multiple'; +} +export interface SortCriterion { + attribute: keyof D; + direction: string; +} diff --git a/types/oracle__oraclejet/ojdatetimepicker/index.d.ts b/types/oracle__oraclejet/ojdatetimepicker/index.d.ts new file mode 100644 index 0000000000..914dd06df7 --- /dev/null +++ b/types/oracle__oraclejet/ojdatetimepicker/index.d.ts @@ -0,0 +1,639 @@ +import { Converter, Validator, Validation } from '../ojvalidation-base'; +import { inputBase, inputBaseEventMap, inputBaseSettableProperties } from '../ojinputtext'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojDatePicker extends ojInputDate { + keyboardEdit: 'disabled'; + max: string | null; + min: string | null; + renderMode: 'jet'; + value: string; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojDatePicker.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojDatePicker.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojDatePickerEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojDatePicker[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojDatePickerSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojDatePickerSettablePropertiesLenient): void; +} +export namespace ojDatePicker { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojDatePickerEventMap extends ojInputDateEventMap { + 'ojAnimateEnd': ojDatePicker.ojAnimateEnd; + 'ojAnimateStart': ojDatePicker.ojAnimateStart; + 'maxChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojDatePickerSettableProperties extends ojInputDateSettableProperties { + keyboardEdit: 'disabled'; + max: string | null; + min: string | null; + renderMode: 'jet'; + value: string; +} +export interface ojDatePickerSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojDateTimePicker extends ojInputDateTime { + keyboardEdit: 'disabled'; + max: string | null; + min: string | null; + renderMode: 'jet'; + value: string; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojDateTimePicker.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojDateTimePicker.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojDateTimePickerEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojDateTimePicker[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojDateTimePickerSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojDateTimePickerSettablePropertiesLenient): void; +} +export namespace ojDateTimePicker { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojDateTimePickerEventMap extends ojInputDateTimeEventMap { + 'ojAnimateEnd': ojDateTimePicker.ojAnimateEnd; + 'ojAnimateStart': ojDateTimePicker.ojAnimateStart; + 'maxChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojDateTimePickerSettableProperties extends ojInputDateTimeSettableProperties { + keyboardEdit: 'disabled'; + max: string | null; + min: string | null; + renderMode: 'jet'; + value: string; +} +export interface ojDateTimePickerSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojInputDate extends inputBase { + converter: Converter | Validation.RegisteredConverter; + datePicker: { + changeMonth: 'select' | 'none'; + changeYear: 'select' | 'none'; + currentMonthPos: number; + daysOutsideMonth: 'hidden' | 'visible' | 'selectable'; + footerLayout: '' | 'today'; + numberOfMonths: number; + showOn: 'focus' | 'image'; + stepBigMonths: number; + stepMonths: 'numberOfMonths' | number; + weekDisplay: 'number' | 'none'; + yearRange: string; + }; + dayFormatter: (param: ojInputDate.DayFormatterInput) => (null | 'all' | ojInputDate.DayFormatterOutput); + dayMetaData: { + [key: string]: { + [key: string]: { + [key: string]: { + disabled?: boolean; + className?: string; + tooltip?: string; + }; + }; + }; + }; + keyboardEdit: 'enabled' | 'disabled'; + max: string | null; + min: string | null; + pickerAttributes: { + style?: string; + class?: string; + }; + renderMode: 'jet' | 'native'; + validators: Array | Validation.RegisteredValidator> | null; + value: string; + translations: { + currentText?: string; + dateRestriction?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + dateTimeRange?: { + hint?: { + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + nextText?: string; + prevText?: string; + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipCalendar?: string; + tooltipCalendarDisabled?: string; + tooltipCalendarTime?: string; + tooltipCalendarTimeDisabled?: string; + weekHeader?: string; + }; + onConverterChanged: ((event: JetElementCustomEvent["converter"]>) => any) | null; + onDatePickerChanged: ((event: JetElementCustomEvent["datePicker"]>) => any) | null; + onDayFormatterChanged: ((event: JetElementCustomEvent["dayFormatter"]>) => any) | null; + onDayMetaDataChanged: ((event: JetElementCustomEvent["dayMetaData"]>) => any) | null; + onKeyboardEditChanged: ((event: JetElementCustomEvent["keyboardEdit"]>) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent["max"]>) => any) | null; + onMinChanged: ((event: JetElementCustomEvent["min"]>) => any) | null; + onPickerAttributesChanged: ((event: JetElementCustomEvent["pickerAttributes"]>) => any) | null; + onRenderModeChanged: ((event: JetElementCustomEvent["renderMode"]>) => any) | null; + onValidatorsChanged: ((event: JetElementCustomEvent["validators"]>) => any) | null; + onValueChanged: ((event: JetElementCustomEvent["value"]>) => any) | null; + onOjAnimateEnd: ((event: ojInputDate.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojInputDate.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojInputDateEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojInputDate[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojInputDateSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojInputDateSettablePropertiesLenient): void; + hide(): void; + refresh(): void; + show(): void; +} +export namespace ojInputDate { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type DayFormatterInput = { + fullYear: number; + month: number; + date: number; + }; + // tslint:disable-next-line interface-over-type-literal + type DayFormatterOutput = { + disabled?: boolean; + className?: string; + tooltip?: string; + }; +} +export interface ojInputDateEventMap extends inputBaseEventMap { + 'ojAnimateEnd': ojInputDate.ojAnimateEnd; + 'ojAnimateStart': ojInputDate.ojAnimateStart; + 'converterChanged': JetElementCustomEvent["converter"]>; + 'datePickerChanged': JetElementCustomEvent["datePicker"]>; + 'dayFormatterChanged': JetElementCustomEvent["dayFormatter"]>; + 'dayMetaDataChanged': JetElementCustomEvent["dayMetaData"]>; + 'keyboardEditChanged': JetElementCustomEvent["keyboardEdit"]>; + 'maxChanged': JetElementCustomEvent["max"]>; + 'minChanged': JetElementCustomEvent["min"]>; + 'pickerAttributesChanged': JetElementCustomEvent["pickerAttributes"]>; + 'renderModeChanged': JetElementCustomEvent["renderMode"]>; + 'validatorsChanged': JetElementCustomEvent["validators"]>; + 'valueChanged': JetElementCustomEvent["value"]>; +} +export interface ojInputDateSettableProperties extends inputBaseSettableProperties { + converter: Converter | Validation.RegisteredConverter; + datePicker: { + changeMonth: 'select' | 'none'; + changeYear: 'select' | 'none'; + currentMonthPos: number; + daysOutsideMonth: 'hidden' | 'visible' | 'selectable'; + footerLayout: '' | 'today'; + numberOfMonths: number; + showOn: 'focus' | 'image'; + stepBigMonths: number; + stepMonths: 'numberOfMonths' | number; + weekDisplay: 'number' | 'none'; + yearRange: string; + }; + dayFormatter: (param: ojInputDate.DayFormatterInput) => (null | 'all' | ojInputDate.DayFormatterOutput); + dayMetaData: { + [key: string]: { + [key: string]: { + [key: string]: { + disabled?: boolean; + className?: string; + tooltip?: string; + }; + }; + }; + }; + keyboardEdit: 'enabled' | 'disabled'; + max: string | null; + min: string | null; + pickerAttributes: { + style?: string; + class?: string; + }; + renderMode: 'jet' | 'native'; + validators: Array | Validation.RegisteredValidator> | null; + value: string; + translations: { + currentText?: string; + dateRestriction?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + dateTimeRange?: { + hint?: { + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + nextText?: string; + prevText?: string; + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipCalendar?: string; + tooltipCalendarDisabled?: string; + tooltipCalendarTime?: string; + tooltipCalendarTimeDisabled?: string; + weekHeader?: string; + }; +} +export interface ojInputDateSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojInputDateTime extends ojInputDate { + converter: Converter | Validation.RegisteredConverter; + max: string | null; + min: string | null; + renderMode: 'jet' | 'native'; + timePicker: { + footerLayout: '' | 'now'; + showOn: 'focus' | 'image'; + timeIncrement: string; + }; + validators: Array | Validation.RegisteredValidator> | null; + value: string; + translations: { + cancel?: string; + currentText?: string; + dateRestriction?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + dateTimeRange?: { + hint?: { + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + done?: string; + nextText?: string; + prevText?: string; + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipCalendar?: string; + tooltipCalendarDisabled?: string; + tooltipCalendarTime?: string; + tooltipCalendarTimeDisabled?: string; + weekHeader?: string; + }; + onConverterChanged: ((event: JetElementCustomEvent["converter"]>) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent["max"]>) => any) | null; + onMinChanged: ((event: JetElementCustomEvent["min"]>) => any) | null; + onRenderModeChanged: ((event: JetElementCustomEvent["renderMode"]>) => any) | null; + onTimePickerChanged: ((event: JetElementCustomEvent["timePicker"]>) => any) | null; + onValidatorsChanged: ((event: JetElementCustomEvent["validators"]>) => any) | null; + onValueChanged: ((event: JetElementCustomEvent["value"]>) => any) | null; + onOjAnimateEnd: ((event: ojInputDateTime.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojInputDateTime.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojInputDateTimeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojInputDateTime[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojInputDateTimeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojInputDateTimeSettablePropertiesLenient): void; + hideTimePicker(): void; + show(): void; + showTimePicker(): void; +} +export namespace ojInputDateTime { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojInputDateTimeEventMap extends ojInputDateEventMap { + 'ojAnimateEnd': ojInputDateTime.ojAnimateEnd; + 'ojAnimateStart': ojInputDateTime.ojAnimateStart; + 'converterChanged': JetElementCustomEvent["converter"]>; + 'maxChanged': JetElementCustomEvent["max"]>; + 'minChanged': JetElementCustomEvent["min"]>; + 'renderModeChanged': JetElementCustomEvent["renderMode"]>; + 'timePickerChanged': JetElementCustomEvent["timePicker"]>; + 'validatorsChanged': JetElementCustomEvent["validators"]>; + 'valueChanged': JetElementCustomEvent["value"]>; +} +export interface ojInputDateTimeSettableProperties extends ojInputDateSettableProperties { + converter: Converter | Validation.RegisteredConverter; + max: string | null; + min: string | null; + renderMode: 'jet' | 'native'; + timePicker: { + footerLayout: '' | 'now'; + showOn: 'focus' | 'image'; + timeIncrement: string; + }; + validators: Array | Validation.RegisteredValidator> | null; + value: string; + translations: { + cancel?: string; + currentText?: string; + dateRestriction?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + dateTimeRange?: { + hint?: { + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + done?: string; + nextText?: string; + prevText?: string; + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipCalendar?: string; + tooltipCalendarDisabled?: string; + tooltipCalendarTime?: string; + tooltipCalendarTimeDisabled?: string; + weekHeader?: string; + }; +} +export interface ojInputDateTimeSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojInputTime extends inputBase { + converter: Converter | Validation.RegisteredConverter; + keyboardEdit: 'enabled' | 'disabled'; + max: string | null; + min: string | null; + pickerAttributes: { + style?: string; + class?: string; + }; + renderMode: 'jet' | 'native'; + timePicker: { + footerLayout: '' | 'now'; + showOn: 'focus' | 'image'; + timeIncrement: string; + }; + validators: Array | Validation.RegisteredValidator> | null; + value: string; + translations: { + ampmWheelLabel?: string; + cancelText?: string; + currentTimeText?: string; + dateTimeRange?: { + hint?: { + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + hourWheelLabel?: string; + minuteWheelLabel?: string; + okText?: string; + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipTime?: string; + tooltipTimeDisabled?: string; + }; + onConverterChanged: ((event: JetElementCustomEvent) => any) | null; + onKeyboardEditChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onPickerAttributesChanged: ((event: JetElementCustomEvent) => any) | null; + onRenderModeChanged: ((event: JetElementCustomEvent) => any) | null; + onTimePickerChanged: ((event: JetElementCustomEvent) => any) | null; + onValidatorsChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojInputTime.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojInputTime.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojInputTimeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojInputTime[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojInputTimeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojInputTimeSettablePropertiesLenient): void; + hide(): void; + refresh(): void; + show(): void; +} +export namespace ojInputTime { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojInputTimeEventMap extends inputBaseEventMap { + 'ojAnimateEnd': ojInputTime.ojAnimateEnd; + 'ojAnimateStart': ojInputTime.ojAnimateStart; + 'converterChanged': JetElementCustomEvent; + 'keyboardEditChanged': JetElementCustomEvent; + 'maxChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'pickerAttributesChanged': JetElementCustomEvent; + 'renderModeChanged': JetElementCustomEvent; + 'timePickerChanged': JetElementCustomEvent; + 'validatorsChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojInputTimeSettableProperties extends inputBaseSettableProperties { + converter: Converter | Validation.RegisteredConverter; + keyboardEdit: 'enabled' | 'disabled'; + max: string | null; + min: string | null; + pickerAttributes: { + style?: string; + class?: string; + }; + renderMode: 'jet' | 'native'; + timePicker: { + footerLayout: '' | 'now'; + showOn: 'focus' | 'image'; + timeIncrement: string; + }; + validators: Array | Validation.RegisteredValidator> | null; + value: string; + translations: { + ampmWheelLabel?: string; + cancelText?: string; + currentTimeText?: string; + dateTimeRange?: { + hint?: { + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + hourWheelLabel?: string; + minuteWheelLabel?: string; + okText?: string; + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipTime?: string; + tooltipTimeDisabled?: string; + }; +} +export interface ojInputTimeSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojdefer/index.d.ts b/types/oracle__oraclejet/ojdefer/index.d.ts new file mode 100644 index 0000000000..03eefbd714 --- /dev/null +++ b/types/oracle__oraclejet/ojdefer/index.d.ts @@ -0,0 +1,21 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojDefer extends JetElement { + addEventListener(type: T, listener: (this: HTMLElement, ev: ojDeferEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojDefer[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojDeferSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojDeferSettablePropertiesLenient): void; +} +// These interfaces are empty but required to keep the event chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface ojDeferEventMap extends HTMLElementEventMap { +} +// These interfaces are empty but required to keep the component chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface ojDeferSettableProperties extends JetSettableProperties { +} +export interface ojDeferSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojdeferreddataprovider/index.d.ts b/types/oracle__oraclejet/ojdeferreddataprovider/index.d.ts new file mode 100644 index 0000000000..e2332cac46 --- /dev/null +++ b/types/oracle__oraclejet/ojdeferreddataprovider/index.d.ts @@ -0,0 +1,16 @@ +import { DataProvider, SortCriterion, FetchByKeysParameters, ContainsKeysResults, FetchByKeysResults, FetchByOffsetParameters, FetchByOffsetResults, FetchListResult, + FetchListParameters } from '../ojdataprovider'; +declare class DeferredDataProvider implements DataProvider { + constructor(dataProvider: Promise>, capabilityFunc: (capabilityName: string) => any); + addEventListener(eventType: string, listener: EventListener): any; + containsKeys(params: FetchByKeysParameters): Promise>; + dispatchEvent(evt: Event): boolean; + fetchByKeys(params: FetchByKeysParameters): Promise>; + fetchByOffset(params: FetchByOffsetParameters): Promise>; + fetchFirst(params?: FetchListParameters): AsyncIterable>; + getCapability(capabilityName: string): object; + getTotalSize(): Promise; + isEmpty(): 'yes' | 'no' | 'unknown'; + removeEventListener(eventType: string, listener: EventListener): any; +} +export = DeferredDataProvider; diff --git a/types/oracle__oraclejet/ojdiagram/index.d.ts b/types/oracle__oraclejet/ojdiagram/index.d.ts new file mode 100644 index 0000000000..db79f4b2be --- /dev/null +++ b/types/oracle__oraclejet/ojdiagram/index.d.ts @@ -0,0 +1,790 @@ +import { KeySet } from '../ojkeyset'; +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface DvtDiagramLayoutContext { + getCommonContainer(nodeId1: any, nodeId2: any): any; + getComponentSize(): { + x: number; + y: number; + w: number; + h: number; + }; + getCurrentViewport(): { + x: number; + y: number; + w: number; + h: number; + }; + getEventData(): object; + getLinkById(id: any): DvtDiagramLayoutContextLink; + getLinkByIndex(index: number): DvtDiagramLayoutContextLink; + getLinkCount(): number; + getNodeById(id: any): DvtDiagramLayoutContextNode; + getNodeByIndex(index: number): DvtDiagramLayoutContextNode; + getNodeCount(): number; + getViewport(): { + x: number; + y: number; + w: number; + h: number; + }; + isLocaleR2L(): boolean; + setViewport(viewport: { + x: number; + y: number; + w: number; + h: number; + }): void; +} +export interface DvtDiagramLayoutContextLink { + getCoordinateSpace(): any; + getData(): object | any[]; + getEndConnectorOffset(): number; + getEndId(): any; + getId(): any; + getLabelBounds(): { + x: number; + y: number; + w: number; + h: number; + }; + getLabelHalign(): 'left' | 'center' | 'right'; + getLabelPosition(): { + x: number; + y: number; + }; + getLabelRotationAngle(): number; + getLabelRotationPoint(): { + x: number; + y: number; + }; + getLabelValign(): 'top' | 'middle' | 'bottom' | 'baseline'; + getLinkWidth(): number; + getPoints(): any[]; + getSelected(): boolean; + getStartConnectorOffset(): number; + getStartId(): any; + isPromoted(): boolean; + setCoordinateSpace(containerId: any): void; + setLabelHalign(halign: 'left' | 'center' | 'right'): void; + setLabelPosition(pos: { + x: number; + y: number; + }): void; + setLabelRotationAngle(angle: number): void; + setLabelRotationPoint(point: { + x: number; + y: number; + }): void; + setLabelValign(valign: 'top' | 'middle' | 'bottom' | 'baseline'): void; + setPoints(points: any[]): void; +} +export interface DvtDiagramLayoutContextNode { + getBounds(): { + x: number; + y: number; + w: number; + h: number; + }; + getChildNodes(): any[]; + getContentBounds(): { + x: number; + y: number; + w: number; + h: number; + }; + getData(): object; + getId(): any; + getLabelBounds(): { + x: number; + y: number; + w: number; + h: number; + }; + getLabelHalign(): 'left' | 'center' | 'right'; + getLabelPosition(): { + x: number; + y: number; + }; + getLabelRotationAngle(): number; + getLabelRotationPoint(): { + x: number; + y: number; + }; + getLabelValign(): 'top' | 'middle' | 'bottom' | 'baseline'; + getPosition(): { + x: number; + y: number; + }; + getRelativePosition(containerId: any): { + x: number; + y: number; + }; + getSelected(): boolean; + isDisclosed(): boolean; + setLabelHalign(halign: 'left' | 'center' | 'right'): void; + setLabelPosition(pos: { + x: number; + y: number; + }): void; + setLabelRotationAngle(angle: number): void; + setLabelRotationPoint(point: { + x: number; + y: number; + }): void; + setLabelValign(valign: 'top' | 'middle' | 'bottom' | 'baseline'): void; + setPosition(pos: { + x: number; + y: number; + }): void; +} +export interface ojDiagram extends dvtBaseComponent> { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + dnd: { + drag: { + nodes: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + ports: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + linkStyle: ((param0: object) => void); + selector: string; + }; + }; + drop: { + background: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + links: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + nodes: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + ports: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + selector: string; + }; + }; + }; + expanded: KeySet; + focusRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + layout: ((param0: DvtDiagramLayoutContext) => void); + linkData: DataProvider | null; + linkHighlightMode: 'linkAndNodes' | 'link'; + maxZoom: number; + minZoom: number; + nodeData: DataProvider | null; + nodeHighlightMode: 'nodeAndIncomingLinks' | 'nodeAndOutgoingLinks' | 'nodeAndLinks' | 'node'; + overview: { + halign: 'start' | 'end' | 'center'; + height: number; + rendered: 'on' | 'off'; + valign: 'top' | 'bottom' | 'middle'; + width: number; + }; + panDirection: 'x' | 'y' | 'auto'; + panning: 'auto' | 'none'; + promotedLinkBehavior: 'none' | 'full' | 'lazy'; + renderer: ((context: ojDiagram.RendererContext) => ({ + insert: SVGElement; + })); + selection: Array; + selectionMode: 'single' | 'multiple' | 'none'; + selectionRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + styleDefaults: { + animationDuration: number; + hoverBehaviorDelay: number; + linkDefaults: { + color: string; + endConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + labelStyle: object; + startConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + svgClassName: string; + svgStyle: object; + width: number; + }; + nodeDefaults: { + icon: { + borderColor: string; + borderRadius: string; + borderWidth: number; + color: string; + height: number; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source: string; + sourceHover: string; + sourceHoverSelected: string; + sourceSelected: string; + svgClassName: string; + svgStyle: object; + width: number; + }; + labelStyle: object; + showDisclosure: 'off' | 'on'; + }; + promotedLink: { + color: string; + endConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + startConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + svgClassName: string; + svgStyle: object; + width: number; + }; + }; + tooltip: { + renderer: ((context: ojDiagram.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + zoomRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + zooming: 'auto' | 'none'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + promotedLink?: string; + promotedLinkAriaDesc?: string; + promotedLinks?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onDndChanged: ((event: JetElementCustomEvent["dnd"]>) => any) | null; + onExpandedChanged: ((event: JetElementCustomEvent["expanded"]>) => any) | null; + onFocusRendererChanged: ((event: JetElementCustomEvent["focusRenderer"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onHoverRendererChanged: ((event: JetElementCustomEvent["hoverRenderer"]>) => any) | null; + onLayoutChanged: ((event: JetElementCustomEvent["layout"]>) => any) | null; + onLinkDataChanged: ((event: JetElementCustomEvent["linkData"]>) => any) | null; + onLinkHighlightModeChanged: ((event: JetElementCustomEvent["linkHighlightMode"]>) => any) | null; + onMaxZoomChanged: ((event: JetElementCustomEvent["maxZoom"]>) => any) | null; + onMinZoomChanged: ((event: JetElementCustomEvent["minZoom"]>) => any) | null; + onNodeDataChanged: ((event: JetElementCustomEvent["nodeData"]>) => any) | null; + onNodeHighlightModeChanged: ((event: JetElementCustomEvent["nodeHighlightMode"]>) => any) | null; + onOverviewChanged: ((event: JetElementCustomEvent["overview"]>) => any) | null; + onPanDirectionChanged: ((event: JetElementCustomEvent["panDirection"]>) => any) | null; + onPanningChanged: ((event: JetElementCustomEvent["panning"]>) => any) | null; + onPromotedLinkBehaviorChanged: ((event: JetElementCustomEvent["promotedLinkBehavior"]>) => any) | null; + onRendererChanged: ((event: JetElementCustomEvent["renderer"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onSelectionRendererChanged: ((event: JetElementCustomEvent["selectionRenderer"]>) => any) | null; + onStyleDefaultsChanged: ((event: JetElementCustomEvent["styleDefaults"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTouchResponseChanged: ((event: JetElementCustomEvent["touchResponse"]>) => any) | null; + onZoomRendererChanged: ((event: JetElementCustomEvent["zoomRenderer"]>) => any) | null; + onZoomingChanged: ((event: JetElementCustomEvent["zooming"]>) => any) | null; + onOjBeforeCollapse: ((event: ojDiagram.ojBeforeCollapse) => any) | null; + onOjBeforeExpand: ((event: ojDiagram.ojBeforeExpand) => any) | null; + onOjCollapse: ((event: ojDiagram.ojCollapse) => any) | null; + onOjExpand: ((event: ojDiagram.ojExpand) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojDiagramEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojDiagram[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojDiagramSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojDiagramSettablePropertiesLenient): void; + getContextByNode(node: Element): object | null; + getLink(linkIndex: number): object | null; + getLinkCount(): number; + getNode(nodeIndex: number): object | null; + getNodeCount(): number; + getPromotedLink(startNodeIndex: number, endNodeIndex: number): object | null; +} +export namespace ojDiagram { + interface ojBeforeCollapse extends CustomEvent<{ + nodeId: any; + [propName: string]: any; + }> { + } + interface ojBeforeExpand extends CustomEvent<{ + nodeId: any; + [propName: string]: any; + }> { + } + interface ojCollapse extends CustomEvent<{ + nodeId: any; + [propName: string]: any; + }> { + } + interface ojExpand extends CustomEvent<{ + nodeId: any; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type RendererContext = { + parentElement: Element; + componentElement: Element; + data: object; + itemData: D1; + content: { + element: Element; + width: number; + height: number; + }; + state: { + hovered: boolean; + selected: boolean; + focused: boolean; + expanded: boolean; + zoom: number; + }; + previousState: { + hovered: boolean; + selected: boolean; + focused: boolean; + expanded: boolean; + zoom: number; + }; + id: K1; + type: string; + renderDefaultFocus: (() => void); + renderDefaultHover: (() => void); + renderDefaultSelection: (() => void); + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + parentElement: Element; + componentElement: Element; + id: K1 | K2; + type: string; + label: string; + data: object | object[]; + itemData: D1 | D2 | D2[]; + }; +} +export interface ojDiagramEventMap extends dvtBaseComponentEventMap> { + 'ojBeforeCollapse': ojDiagram.ojBeforeCollapse; + 'ojBeforeExpand': ojDiagram.ojBeforeExpand; + 'ojCollapse': ojDiagram.ojCollapse; + 'ojExpand': ojDiagram.ojExpand; + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'dndChanged': JetElementCustomEvent["dnd"]>; + 'expandedChanged': JetElementCustomEvent["expanded"]>; + 'focusRendererChanged': JetElementCustomEvent["focusRenderer"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'hoverRendererChanged': JetElementCustomEvent["hoverRenderer"]>; + 'layoutChanged': JetElementCustomEvent["layout"]>; + 'linkDataChanged': JetElementCustomEvent["linkData"]>; + 'linkHighlightModeChanged': JetElementCustomEvent["linkHighlightMode"]>; + 'maxZoomChanged': JetElementCustomEvent["maxZoom"]>; + 'minZoomChanged': JetElementCustomEvent["minZoom"]>; + 'nodeDataChanged': JetElementCustomEvent["nodeData"]>; + 'nodeHighlightModeChanged': JetElementCustomEvent["nodeHighlightMode"]>; + 'overviewChanged': JetElementCustomEvent["overview"]>; + 'panDirectionChanged': JetElementCustomEvent["panDirection"]>; + 'panningChanged': JetElementCustomEvent["panning"]>; + 'promotedLinkBehaviorChanged': JetElementCustomEvent["promotedLinkBehavior"]>; + 'rendererChanged': JetElementCustomEvent["renderer"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'selectionRendererChanged': JetElementCustomEvent["selectionRenderer"]>; + 'styleDefaultsChanged': JetElementCustomEvent["styleDefaults"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'touchResponseChanged': JetElementCustomEvent["touchResponse"]>; + 'zoomRendererChanged': JetElementCustomEvent["zoomRenderer"]>; + 'zoomingChanged': JetElementCustomEvent["zooming"]>; +} +export interface ojDiagramSettableProperties extends dvtBaseComponentSettableProperties { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + dnd: { + drag: { + nodes: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + }; + ports: { + dataTypes: string | string[]; + drag: ((param0: Event) => void); + dragEnd: ((param0: Event) => void); + dragStart: ((param0: Event, param1: object) => void); + linkStyle: ((param0: object) => void); + selector: string; + }; + }; + drop: { + background: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + links: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + nodes: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + }; + ports: { + dataTypes: string | string[]; + dragEnter: ((param0: Event, param1: object) => void); + dragLeave: ((param0: Event, param1: object) => void); + dragOver: ((param0: Event, param1: object) => void); + drop: ((param0: Event, param1: object) => void); + selector: string; + }; + }; + }; + expanded: KeySet; + focusRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + layout: ((param0: DvtDiagramLayoutContext) => void); + linkData: DataProvider | null; + linkHighlightMode: 'linkAndNodes' | 'link'; + maxZoom: number; + minZoom: number; + nodeData: DataProvider | null; + nodeHighlightMode: 'nodeAndIncomingLinks' | 'nodeAndOutgoingLinks' | 'nodeAndLinks' | 'node'; + overview: { + halign: 'start' | 'end' | 'center'; + height: number; + rendered: 'on' | 'off'; + valign: 'top' | 'bottom' | 'middle'; + width: number; + }; + panDirection: 'x' | 'y' | 'auto'; + panning: 'auto' | 'none'; + promotedLinkBehavior: 'none' | 'full' | 'lazy'; + renderer: ((context: ojDiagram.RendererContext) => ({ + insert: SVGElement; + })); + selection: Array; + selectionMode: 'single' | 'multiple' | 'none'; + selectionRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + styleDefaults: { + animationDuration: number; + hoverBehaviorDelay: number; + linkDefaults: { + color: string; + endConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + labelStyle: object; + startConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + svgClassName: string; + svgStyle: object; + width: number; + }; + nodeDefaults: { + icon: { + borderColor: string; + borderRadius: string; + borderWidth: number; + color: string; + height: number; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source: string; + sourceHover: string; + sourceHoverSelected: string; + sourceSelected: string; + svgClassName: string; + svgStyle: object; + width: number; + }; + labelStyle: object; + showDisclosure: 'off' | 'on'; + }; + promotedLink: { + color: string; + endConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + startConnectorType: 'arrowOpen' | 'arrow' | 'arrowConcave' | 'circle' | 'rectangle' | 'rectangleRounded' | 'none'; + svgClassName: string; + svgStyle: object; + width: number; + }; + }; + tooltip: { + renderer: ((context: ojDiagram.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + zoomRenderer: ((context: ojDiagram.RendererContext) => { + insert: SVGElement; + } | void) | null; + zooming: 'auto' | 'none'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + promotedLink?: string; + promotedLinkAriaDesc?: string; + promotedLinks?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojDiagramSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojDiagramLink extends JetElement { + categories: string[]; + color?: string; + endConnectorType?: 'arrow' | 'arrowConcave' | 'arrowOpen' | 'circle' | 'none' | 'rectangle' | 'rectangleRounded'; + endNode: any; + label?: string; + labelStyle?: object | null; + selectable?: 'auto' | 'off'; + shortDesc?: string; + startConnectorType?: 'arrow' | 'arrowConcave' | 'arrowOpen' | 'circle' | 'none' | 'rectangle' | 'rectangleRounded'; + startNode: any; + svgClassName?: string; + svgStyle?: object; + width?: number; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onEndConnectorTypeChanged: ((event: JetElementCustomEvent) => any) | null; + onEndNodeChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectableChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onStartConnectorTypeChanged: ((event: JetElementCustomEvent) => any) | null; + onStartNodeChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onWidthChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojDiagramLinkEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojDiagramLink[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojDiagramLinkSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojDiagramLinkSettablePropertiesLenient): void; +} +export interface ojDiagramLinkEventMap extends HTMLElementEventMap { + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'endConnectorTypeChanged': JetElementCustomEvent; + 'endNodeChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'selectableChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'startConnectorTypeChanged': JetElementCustomEvent; + 'startNodeChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'widthChanged': JetElementCustomEvent; +} +export interface ojDiagramLinkSettableProperties extends JetSettableProperties { + categories: string[]; + color?: string; + endConnectorType?: 'arrow' | 'arrowConcave' | 'arrowOpen' | 'circle' | 'none' | 'rectangle' | 'rectangleRounded'; + endNode: any; + label?: string; + labelStyle?: object | null; + selectable?: 'auto' | 'off'; + shortDesc?: string; + startConnectorType?: 'arrow' | 'arrowConcave' | 'arrowOpen' | 'circle' | 'none' | 'rectangle' | 'rectangleRounded'; + startNode: any; + svgClassName?: string; + svgStyle?: object; + width?: number; +} +export interface ojDiagramLinkSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojDiagramNode extends JetElement { + categories?: string[]; + descendantsConnectivity?: 'connected' | 'disjoint' | 'unknown'; + icon?: { + borderColor?: string; + borderRadius?: string; + borderWidth?: number; + color?: string; + height?: number; + opacity?: number; + pattern?: 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none' | 'mallChecker' | 'smallCrosshatch' | + 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source?: string; + sourceHover?: string; + sourceHoverSelected?: string; + sourceSelected?: string; + svgClassName?: string; + svgStyle?: object; + width?: number; + }; + label?: string; + labelStyle?: object | null; + overview?: { + icon?: { + shape?: 'inherit' | 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + svgClassName?: string; + svgStyle?: object; + }; + }; + selectable?: 'auto' | 'off'; + shortDesc?: string; + showDisclosure?: 'on' | 'off'; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onDescendantsConnectivityChanged: ((event: JetElementCustomEvent) => any) | null; + onIconChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onOverviewChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectableChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onShowDisclosureChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojDiagramNodeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojDiagramNode[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojDiagramNodeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojDiagramNodeSettablePropertiesLenient): void; +} +export interface ojDiagramNodeEventMap extends HTMLElementEventMap { + 'categoriesChanged': JetElementCustomEvent; + 'descendantsConnectivityChanged': JetElementCustomEvent; + 'iconChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'overviewChanged': JetElementCustomEvent; + 'selectableChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'showDisclosureChanged': JetElementCustomEvent; +} +export interface ojDiagramNodeSettableProperties extends JetSettableProperties { + categories?: string[]; + descendantsConnectivity?: 'connected' | 'disjoint' | 'unknown'; + icon?: { + borderColor?: string; + borderRadius?: string; + borderWidth?: number; + color?: string; + height?: number; + opacity?: number; + pattern?: 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none' | 'mallChecker' | 'smallCrosshatch' | + 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source?: string; + sourceHover?: string; + sourceHoverSelected?: string; + sourceSelected?: string; + svgClassName?: string; + svgStyle?: object; + width?: number; + }; + label?: string; + labelStyle?: object | null; + overview?: { + icon?: { + shape?: 'inherit' | 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + svgClassName?: string; + svgStyle?: object; + }; + }; + selectable?: 'auto' | 'off'; + shortDesc?: string; + showDisclosure?: 'on' | 'off'; +} +export interface ojDiagramNodeSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojdialog/index.d.ts b/types/oracle__oraclejet/ojdialog/index.d.ts new file mode 100644 index 0000000000..42a8569bd4 --- /dev/null +++ b/types/oracle__oraclejet/ojdialog/index.d.ts @@ -0,0 +1,148 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojDialog extends baseComponent { + cancelBehavior: 'icon' | 'escape' | 'none'; + dragAffordance: 'title-bar' | 'none'; + initialVisibility: 'hide' | 'show'; + modality: 'modal' | 'modeless'; + position: ojDialog.Position; + resizeBehavior: 'resizable' | 'none'; + role: string; + translations: { + labelCloseIcon?: string; + }; + onCancelBehaviorChanged: ((event: JetElementCustomEvent) => any) | null; + onDragAffordanceChanged: ((event: JetElementCustomEvent) => any) | null; + onInitialVisibilityChanged: ((event: JetElementCustomEvent) => any) | null; + onModalityChanged: ((event: JetElementCustomEvent) => any) | null; + onPositionChanged: ((event: JetElementCustomEvent) => any) | null; + onResizeBehaviorChanged: ((event: JetElementCustomEvent) => any) | null; + onRoleChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojDialog.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojDialog.ojAnimateStart) => any) | null; + onOjBeforeClose: ((event: ojDialog.ojBeforeClose) => any) | null; + onOjBeforeOpen: ((event: ojDialog.ojBeforeOpen) => any) | null; + onOjClose: ((event: ojDialog.ojClose) => any) | null; + onOjFocus: ((event: ojDialog.ojFocus) => any) | null; + onOjOpen: ((event: ojDialog.ojOpen) => any) | null; + onOjResize: ((event: ojDialog.ojResize) => any) | null; + onOjResizeStart: ((event: ojDialog.ojResizeStart) => any) | null; + onOjResizeStop: ((event: ojDialog.ojResizeStop) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojDialogEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojDialog[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojDialogSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojDialogSettablePropertiesLenient): void; + close(): void; + isOpen(): boolean; + open(): void; + refresh(): void; +} +export namespace ojDialog { + interface ojAnimateEnd extends CustomEvent<{ + element: Element; + action: 'open' | 'close'; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: 'open' | 'close'; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeClose extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojBeforeOpen extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojClose extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojFocus extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojOpen extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojResize extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojResizeStart extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojResizeStop extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type Position = { + my?: PositionAlign; + at?: PositionAlign; + offset?: PositionPoint; + of?: string | PositionPoint; + collision?: 'flip' | 'fit' | 'flipfit' | 'none'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionAlign = { + vertical?: 'top' | 'bottom' | 'center'; + horizontal?: 'start' | 'end' | 'left' | 'center' | 'bottom'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionPoint = { + x?: number; + y?: number; + }; +} +export interface ojDialogEventMap extends baseComponentEventMap { + 'ojAnimateEnd': ojDialog.ojAnimateEnd; + 'ojAnimateStart': ojDialog.ojAnimateStart; + 'ojBeforeClose': ojDialog.ojBeforeClose; + 'ojBeforeOpen': ojDialog.ojBeforeOpen; + 'ojClose': ojDialog.ojClose; + 'ojFocus': ojDialog.ojFocus; + 'ojOpen': ojDialog.ojOpen; + 'ojResize': ojDialog.ojResize; + 'ojResizeStart': ojDialog.ojResizeStart; + 'ojResizeStop': ojDialog.ojResizeStop; + 'cancelBehaviorChanged': JetElementCustomEvent; + 'dragAffordanceChanged': JetElementCustomEvent; + 'initialVisibilityChanged': JetElementCustomEvent; + 'modalityChanged': JetElementCustomEvent; + 'positionChanged': JetElementCustomEvent; + 'resizeBehaviorChanged': JetElementCustomEvent; + 'roleChanged': JetElementCustomEvent; +} +export interface ojDialogSettableProperties extends baseComponentSettableProperties { + cancelBehavior: 'icon' | 'escape' | 'none'; + dragAffordance: 'title-bar' | 'none'; + initialVisibility: 'hide' | 'show'; + modality: 'modal' | 'modeless'; + position: ojDialog.Position; + resizeBehavior: 'resizable' | 'none'; + role: string; + translations: { + labelCloseIcon?: string; + }; +} +export interface ojDialogSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojdvt-base/index.d.ts b/types/oracle__oraclejet/ojdvt-base/index.d.ts new file mode 100644 index 0000000000..04e1cca484 --- /dev/null +++ b/types/oracle__oraclejet/ojdvt-base/index.d.ts @@ -0,0 +1,57 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface dvtBaseComponent extends baseComponent { + trackResize: 'on' | 'off'; + translations: { + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onTrackResizeChanged: ((event: JetElementCustomEvent["trackResize"]>) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: dvtBaseComponentEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): dvtBaseComponent[T]; + getProperty(property: string): any; + setProperty(property: T, value: dvtBaseComponentSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: dvtBaseComponentSettablePropertiesLenient): void; +} +export interface dvtBaseComponentEventMap extends baseComponentEventMap { + 'trackResizeChanged': JetElementCustomEvent["trackResize"]>; +} +export interface dvtBaseComponentSettableProperties extends baseComponentSettableProperties { + trackResize: 'on' | 'off'; + translations: { + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface dvtBaseComponentSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojeditablevalue/index.d.ts b/types/oracle__oraclejet/ojeditablevalue/index.d.ts new file mode 100644 index 0000000000..44f714b3a7 --- /dev/null +++ b/types/oracle__oraclejet/ojeditablevalue/index.d.ts @@ -0,0 +1,96 @@ +import Message = require('../ojmessaging'); +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface editableValue, SV = V, RV = V> extends baseComponent { + describedBy: string | null; + disabled: boolean; + displayOptions: { + converterHint: Array<'placeholder' | 'notewindow' | 'none'> | 'placeholder' | 'notewindow' | 'none'; + helpInstruction: Array<'notewindow' | 'none'> | 'notewindow' | 'none'; + messages: Array<'inline' | 'notewindow' | 'none'> | 'inline' | 'notewindow' | 'none'; + validatorHint: Array<'notewindow' | 'none'> | 'notewindow' | 'none'; + }; + help: { + instruction?: string; + }; + helpHints: { + definition?: string; + source?: string; + }; + labelHint: string; + messagesCustom: Message[]; + readonly valid: 'valid' | 'pending' | 'invalidHidden' | 'invalidShown'; + value: V; + onDescribedByChanged: ((event: JetElementCustomEvent["describedBy"]>) => any) | null; + onDisabledChanged: ((event: JetElementCustomEvent["disabled"]>) => any) | null; + onDisplayOptionsChanged: ((event: JetElementCustomEvent["displayOptions"]>) => any) | null; + onHelpChanged: ((event: JetElementCustomEvent["help"]>) => any) | null; + onHelpHintsChanged: ((event: JetElementCustomEvent["helpHints"]>) => any) | null; + onLabelHintChanged: ((event: JetElementCustomEvent["labelHint"]>) => any) | null; + onMessagesCustomChanged: ((event: JetElementCustomEvent["messagesCustom"]>) => any) | null; + onValidChanged: ((event: JetElementCustomEvent["valid"]>) => any) | null; + onValueChanged: ((event: JetElementCustomEvent["value"]>) => any) | null; + onOjAnimateEnd: ((event: editableValue.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: editableValue.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: editableValueEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): editableValue[T]; + getProperty(property: string): any; + setProperty>(property: T, value: editableValueSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: editableValueSettablePropertiesLenient): void; + refresh(): void; + reset(): void; + showMessages(): void; +} +export namespace editableValue { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface editableValueEventMap, SV = V, RV = V> extends baseComponentEventMap { + 'ojAnimateEnd': editableValue.ojAnimateEnd; + 'ojAnimateStart': editableValue.ojAnimateStart; + 'describedByChanged': JetElementCustomEvent["describedBy"]>; + 'disabledChanged': JetElementCustomEvent["disabled"]>; + 'displayOptionsChanged': JetElementCustomEvent["displayOptions"]>; + 'helpChanged': JetElementCustomEvent["help"]>; + 'helpHintsChanged': JetElementCustomEvent["helpHints"]>; + 'labelHintChanged': JetElementCustomEvent["labelHint"]>; + 'messagesCustomChanged': JetElementCustomEvent["messagesCustom"]>; + 'validChanged': JetElementCustomEvent["valid"]>; + 'valueChanged': JetElementCustomEvent["value"]>; +} +export interface editableValueSettableProperties extends baseComponentSettableProperties { + describedBy: string | null; + disabled: boolean; + displayOptions: { + converterHint: Array<'placeholder' | 'notewindow' | 'none'> | 'placeholder' | 'notewindow' | 'none'; + helpInstruction: Array<'notewindow' | 'none'> | 'notewindow' | 'none'; + messages: Array<'inline' | 'notewindow' | 'none'> | 'inline' | 'notewindow' | 'none'; + validatorHint: Array<'notewindow' | 'none'> | 'notewindow' | 'none'; + }; + help: { + instruction?: string; + }; + helpHints: { + definition?: string; + source?: string; + }; + labelHint: string; + messagesCustom: Message[]; + readonly valid: 'valid' | 'pending' | 'invalidHidden' | 'invalidShown'; + value: SV; +} +export interface editableValueSettablePropertiesLenient extends Partial> { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojexpressionutils/index.d.ts b/types/oracle__oraclejet/ojexpressionutils/index.d.ts new file mode 100644 index 0000000000..e8c48ff994 --- /dev/null +++ b/types/oracle__oraclejet/ojexpressionutils/index.d.ts @@ -0,0 +1,5 @@ +export function createGenericExpressionEvaluator(expressionText: string): (context: any) => any; +export function getExpressionInfo(expression: string): { + expr: (null | string); + downstreamOnly: boolean; +}; diff --git a/types/oracle__oraclejet/ojfilepicker/index.d.ts b/types/oracle__oraclejet/ojfilepicker/index.d.ts new file mode 100644 index 0000000000..69f63531fa --- /dev/null +++ b/types/oracle__oraclejet/ojfilepicker/index.d.ts @@ -0,0 +1,43 @@ +import { ProgressItem } from '../ojprogresslist'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface FileUploadTransport { + flush(): void; + queue(fileList: FileList): ProgressItem[]; +} +export interface ojFilePicker extends JetElement { + accept: string[] | null; + selectOn: 'auto' | 'click' | 'drop' | 'clickAndDrop'; + selectionMode: 'multiple' | 'single'; + onAcceptChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectOnChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent) => any) | null; + onOjSelect: ((event: ojFilePicker.ojSelect) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojFilePickerEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojFilePicker[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojFilePickerSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojFilePickerSettablePropertiesLenient): void; +} +export namespace ojFilePicker { + interface ojSelect extends CustomEvent<{ + files: FileList; + [propName: string]: any; + }> { + } +} +export interface ojFilePickerEventMap extends HTMLElementEventMap { + 'ojSelect': ojFilePicker.ojSelect; + 'acceptChanged': JetElementCustomEvent; + 'selectOnChanged': JetElementCustomEvent; + 'selectionModeChanged': JetElementCustomEvent; +} +export interface ojFilePickerSettableProperties extends JetSettableProperties { + accept: string[] | null; + selectOn: 'auto' | 'click' | 'drop' | 'clickAndDrop'; + selectionMode: 'multiple' | 'single'; +} +export interface ojFilePickerSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojfilmstrip/index.d.ts b/types/oracle__oraclejet/ojfilmstrip/index.d.ts new file mode 100644 index 0000000000..35716daf3e --- /dev/null +++ b/types/oracle__oraclejet/ojfilmstrip/index.d.ts @@ -0,0 +1,63 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojFilmStrip extends baseComponent { + arrowPlacement: 'adjacent' | 'overlay'; + arrowVisibility: 'visible' | 'hidden' | 'hover' | 'auto'; + currentItem: { + id?: string; + index?: number; + }; + looping: 'off' | 'page'; + maxItemsPerPage: number; + orientation: 'horizontal' | 'vertical'; + translations: { + labelAccArrowNextPage?: string; + labelAccArrowPreviousPage?: string; + labelAccFilmStrip?: string; + tipArrowNextPage?: string; + tipArrowPreviousPage?: string; + }; + onArrowPlacementChanged: ((event: JetElementCustomEvent) => any) | null; + onArrowVisibilityChanged: ((event: JetElementCustomEvent) => any) | null; + onCurrentItemChanged: ((event: JetElementCustomEvent) => any) | null; + onLoopingChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxItemsPerPageChanged: ((event: JetElementCustomEvent) => any) | null; + onOrientationChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojFilmStripEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojFilmStrip[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojFilmStripSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojFilmStripSettablePropertiesLenient): void; + getItemsPerPage(): number; + refresh(): void; +} +export interface ojFilmStripEventMap extends baseComponentEventMap { + 'arrowPlacementChanged': JetElementCustomEvent; + 'arrowVisibilityChanged': JetElementCustomEvent; + 'currentItemChanged': JetElementCustomEvent; + 'loopingChanged': JetElementCustomEvent; + 'maxItemsPerPageChanged': JetElementCustomEvent; + 'orientationChanged': JetElementCustomEvent; +} +export interface ojFilmStripSettableProperties extends baseComponentSettableProperties { + arrowPlacement: 'adjacent' | 'overlay'; + arrowVisibility: 'visible' | 'hidden' | 'hover' | 'auto'; + currentItem: { + id?: string; + index?: number; + }; + looping: 'off' | 'page'; + maxItemsPerPage: number; + orientation: 'horizontal' | 'vertical'; + translations: { + labelAccArrowNextPage?: string; + labelAccArrowPreviousPage?: string; + labelAccFilmStrip?: string; + tipArrowNextPage?: string; + tipArrowPreviousPage?: string; + }; +} +export interface ojFilmStripSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojformlayout/index.d.ts b/types/oracle__oraclejet/ojformlayout/index.d.ts new file mode 100644 index 0000000000..c9fe49b34a --- /dev/null +++ b/types/oracle__oraclejet/ojformlayout/index.d.ts @@ -0,0 +1,38 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojFormLayout extends JetElement { + direction: 'column' | 'row'; + labelEdge: 'start' | 'top'; + labelWidth: string; + labelWrapping: 'truncate' | 'wrap'; + maxColumns: number; + onDirectionChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelEdgeChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelWrappingChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxColumnsChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojFormLayoutEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojFormLayout[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojFormLayoutSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojFormLayoutSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojFormLayoutEventMap extends HTMLElementEventMap { + 'directionChanged': JetElementCustomEvent; + 'labelEdgeChanged': JetElementCustomEvent; + 'labelWidthChanged': JetElementCustomEvent; + 'labelWrappingChanged': JetElementCustomEvent; + 'maxColumnsChanged': JetElementCustomEvent; +} +export interface ojFormLayoutSettableProperties extends JetSettableProperties { + direction: 'column' | 'row'; + labelEdge: 'start' | 'top'; + labelWidth: string; + labelWrapping: 'truncate' | 'wrap'; + maxColumns: number; +} +export interface ojFormLayoutSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojgantt/index.d.ts b/types/oracle__oraclejet/ojgantt/index.d.ts new file mode 100644 index 0000000000..18ded2ebeb --- /dev/null +++ b/types/oracle__oraclejet/ojgantt/index.d.ts @@ -0,0 +1,679 @@ +import { ojTimeAxis } from '../ojtimeaxis'; +import { Converter } from '../ojvalidation-base'; +import { DataProvider } from '../ojdataprovider'; +import { dvtTimeComponent, dvtTimeComponentEventMap, dvtTimeComponentSettableProperties } from '../ojtime-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojGantt extends dvtTimeComponent> { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + axisPosition: 'bottom' | 'top'; + dependencyData?: (DataProvider); + dnd: { + move?: { + tasks?: 'disabled' | 'enabled'; + }; + }; + end: string; + gridlines: { + horizontal?: 'hidden' | 'visible' | 'auto'; + vertical?: 'hidden' | 'visible' | 'auto'; + }; + majorAxis: { + converter?: (ojTimeAxis.Converters | Converter); + height?: number; + scale: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'; + zoomOrder?: string[]; + }; + minorAxis: { + converter?: (ojTimeAxis.Converters | Converter); + height?: number; + scale: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'; + zoomOrder?: string[]; + }; + referenceObjects: ojGantt.ReferenceObject[]; + rowAxis: { + label?: { + renderer: ((context: ojGantt.RowAxisLabelRendererContext) => ({ + insert: Element; + })); + }; + maxWidth?: string; + rendered?: 'on' | 'off'; + width?: string; + }; + rowDefaults: { + height?: number; + }; + scrollPosition: { + offsetY?: number; + rowIndex?: number; + y?: number; + }; + selection: K2[]; + selectionMode: 'single' | 'multiple' | 'none'; + start: string; + taskData?: (DataProvider); + taskDefaults: { + baseline?: { + borderRadius?: string; + height?: number; + svgClassName?: string; + svgStyle?: object; + }; + borderRadius?: string; + height?: number; + labelPosition?: (string | string[]); + progress?: { + borderRadius?: string; + height?: string; + svgClassName?: string; + svgStyle?: object; + }; + svgClassName?: string; + svgStyle?: object; + type?: 'normal' | 'milestone' | 'summary' | 'auto'; + }; + tooltip: { + renderer: ((context: ojGantt.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + valueFormats: { + baselineDate?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + baselineEnd?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + baselineStart?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + date?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + end?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + label?: { + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + progress?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + row?: { + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + start?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + }; + viewportEnd: string; + viewportStart: string; + translations: { + accessibleDependencyInfo?: string; + accessiblePredecessorInfo?: string; + accessibleSuccessorInfo?: string; + accessibleTaskTypeMilestone?: string; + accessibleTaskTypeSummary?: string; + componentName?: string; + finishFinishDependencyAriaDesc?: string; + finishStartDependencyAriaDesc?: string; + labelAndValue?: string; + labelBaselineDate?: string; + labelBaselineEnd?: string; + labelBaselineStart?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelDate?: string; + labelEnd?: string; + labelInvalidData?: string; + labelLabel?: string; + labelMoveBy?: string; + labelNoData?: string; + labelProgress?: string; + labelRow?: string; + labelStart?: string; + startFinishDependencyAriaDesc?: string; + startStartDependencyAriaDesc?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + taskMoveCancelled?: string; + taskMoveFinalized?: string; + taskMoveInitiated?: string; + taskMoveInitiatedInstruction?: string; + taskMoveSelectionInfo?: string; + tooltipZoomIn?: string; + tooltipZoomOut?: string; + }; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onAxisPositionChanged: ((event: JetElementCustomEvent["axisPosition"]>) => any) | null; + onDependencyDataChanged: ((event: JetElementCustomEvent["dependencyData"]>) => any) | null; + onDndChanged: ((event: JetElementCustomEvent["dnd"]>) => any) | null; + onEndChanged: ((event: JetElementCustomEvent["end"]>) => any) | null; + onGridlinesChanged: ((event: JetElementCustomEvent["gridlines"]>) => any) | null; + onMajorAxisChanged: ((event: JetElementCustomEvent["majorAxis"]>) => any) | null; + onMinorAxisChanged: ((event: JetElementCustomEvent["minorAxis"]>) => any) | null; + onReferenceObjectsChanged: ((event: JetElementCustomEvent["referenceObjects"]>) => any) | null; + onRowAxisChanged: ((event: JetElementCustomEvent["rowAxis"]>) => any) | null; + onRowDefaultsChanged: ((event: JetElementCustomEvent["rowDefaults"]>) => any) | null; + onScrollPositionChanged: ((event: JetElementCustomEvent["scrollPosition"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onStartChanged: ((event: JetElementCustomEvent["start"]>) => any) | null; + onTaskDataChanged: ((event: JetElementCustomEvent["taskData"]>) => any) | null; + onTaskDefaultsChanged: ((event: JetElementCustomEvent["taskDefaults"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onValueFormatsChanged: ((event: JetElementCustomEvent["valueFormats"]>) => any) | null; + onViewportEndChanged: ((event: JetElementCustomEvent["viewportEnd"]>) => any) | null; + onViewportStartChanged: ((event: JetElementCustomEvent["viewportStart"]>) => any) | null; + onOjMove: ((event: ojGantt.ojMove) => any) | null; + onOjViewportChange: ((event: ojGantt.ojViewportChange) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojGanttEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojGantt[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojGanttSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojGanttSettablePropertiesLenient): void; + getContextByNode(node: Element): { + subId: 'oj-gantt-row-label'; + index: number; + } | { + subId: 'oj-gantt-taskbar'; + rowIndex: number; + index: number; + } | null; +} +export namespace ojGantt { + interface ojMove extends CustomEvent<{ + taskContexts: Array<{ + data: RowTask; + rowData: Row; + itemData: D2 | null; + color: string; + }>; + value: string; + start: string; + end: string; + baselineStart: string; + baselineEnd: string; + rowContext: { + rowData: Row; + componentElement: Element; + }; + [propName: string]: any; + }> { + } + interface ojViewportChange extends CustomEvent<{ + viewportStart: string; + viewportEnd: string; + majorAxisScale: string; + minorAxisScale: string; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type Dependency = { + id: K1; + predecessorTaskId: K2; + shortDesc?: string; + successorTaskId: K2; + svgClassName?: string; + svgStyle?: object; + type?: 'startStart' | 'startFinish' | 'finishFinish' | 'finishStart'; + }; + // tslint:disable-next-line interface-over-type-literal + type ReferenceObject = { + svgClassName?: string; + svgStyle?: object; + value?: string; + }; + // tslint:disable-next-line interface-over-type-literal + type Row = { + id?: any; + label?: string; + labelStyle?: object; + tasks?: Array>; + }; + // tslint:disable-next-line interface-over-type-literal + type RowAxisLabelRendererContext = { + parentElement: Element; + rowData: Row; + itemData: D2[]; + componentElement: Element; + maxWidth: number; + maxHeight: number; + }; + // tslint:disable-next-line interface-over-type-literal + type RowTask = { + borderRadius?: string; + end?: string; + height?: number; + id: K2; + label?: string; + labelPosition?: string | string[]; + labelStyle?: object; + start?: string; + shortDesc?: string; + svgClassName?: string; + svgStyle?: object; + type?: 'normal' | 'milestone' | 'summary' | 'auto'; + progress?: { + borderRadius?: string; + height?: string; + svgClassName?: string; + svgStyle?: object; + value?: number; + }; + baseline?: { + borderRadius?: string; + end?: string; + height?: number; + start?: string; + svgClassName?: string; + svgStyle?: object; + }; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + parentElement: Element; + data: RowTask; + rowData: Row; + itemData: D2; + componentElement: Element; + color: string; + }; +} +export interface ojGanttEventMap extends dvtTimeComponentEventMap> { + 'ojMove': ojGantt.ojMove; + 'ojViewportChange': ojGantt.ojViewportChange; + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'axisPositionChanged': JetElementCustomEvent["axisPosition"]>; + 'dependencyDataChanged': JetElementCustomEvent["dependencyData"]>; + 'dndChanged': JetElementCustomEvent["dnd"]>; + 'endChanged': JetElementCustomEvent["end"]>; + 'gridlinesChanged': JetElementCustomEvent["gridlines"]>; + 'majorAxisChanged': JetElementCustomEvent["majorAxis"]>; + 'minorAxisChanged': JetElementCustomEvent["minorAxis"]>; + 'referenceObjectsChanged': JetElementCustomEvent["referenceObjects"]>; + 'rowAxisChanged': JetElementCustomEvent["rowAxis"]>; + 'rowDefaultsChanged': JetElementCustomEvent["rowDefaults"]>; + 'scrollPositionChanged': JetElementCustomEvent["scrollPosition"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'startChanged': JetElementCustomEvent["start"]>; + 'taskDataChanged': JetElementCustomEvent["taskData"]>; + 'taskDefaultsChanged': JetElementCustomEvent["taskDefaults"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'valueFormatsChanged': JetElementCustomEvent["valueFormats"]>; + 'viewportEndChanged': JetElementCustomEvent["viewportEnd"]>; + 'viewportStartChanged': JetElementCustomEvent["viewportStart"]>; +} +export interface ojGanttSettableProperties extends dvtTimeComponentSettableProperties { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + axisPosition: 'bottom' | 'top'; + dependencyData?: (DataProvider); + dnd: { + move?: { + tasks?: 'disabled' | 'enabled'; + }; + }; + end: string; + gridlines: { + horizontal?: 'hidden' | 'visible' | 'auto'; + vertical?: 'hidden' | 'visible' | 'auto'; + }; + majorAxis: { + converter?: (ojTimeAxis.Converters | Converter); + height?: number; + scale: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'; + zoomOrder?: string[]; + }; + minorAxis: { + converter?: (ojTimeAxis.Converters | Converter); + height?: number; + scale: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'; + zoomOrder?: string[]; + }; + referenceObjects: ojGantt.ReferenceObject[]; + rowAxis: { + label?: { + renderer: ((context: ojGantt.RowAxisLabelRendererContext) => ({ + insert: Element; + })); + }; + maxWidth?: string; + rendered?: 'on' | 'off'; + width?: string; + }; + rowDefaults: { + height?: number; + }; + scrollPosition: { + offsetY?: number; + rowIndex?: number; + y?: number; + }; + selection: K2[]; + selectionMode: 'single' | 'multiple' | 'none'; + start: string; + taskData?: (DataProvider); + taskDefaults: { + baseline?: { + borderRadius?: string; + height?: number; + svgClassName?: string; + svgStyle?: object; + }; + borderRadius?: string; + height?: number; + labelPosition?: (string | string[]); + progress?: { + borderRadius?: string; + height?: string; + svgClassName?: string; + svgStyle?: object; + }; + svgClassName?: string; + svgStyle?: object; + type?: 'normal' | 'milestone' | 'summary' | 'auto'; + }; + tooltip: { + renderer: ((context: ojGantt.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + valueFormats: { + baselineDate?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + baselineEnd?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + baselineStart?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + date?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + end?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + label?: { + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + progress?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + row?: { + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + start?: { + converter?: (Converter); + tooltipDisplay?: 'off' | 'auto'; + tooltipLabel?: string; + }; + }; + viewportEnd: string; + viewportStart: string; + translations: { + accessibleDependencyInfo?: string; + accessiblePredecessorInfo?: string; + accessibleSuccessorInfo?: string; + accessibleTaskTypeMilestone?: string; + accessibleTaskTypeSummary?: string; + componentName?: string; + finishFinishDependencyAriaDesc?: string; + finishStartDependencyAriaDesc?: string; + labelAndValue?: string; + labelBaselineDate?: string; + labelBaselineEnd?: string; + labelBaselineStart?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelDate?: string; + labelEnd?: string; + labelInvalidData?: string; + labelLabel?: string; + labelMoveBy?: string; + labelNoData?: string; + labelProgress?: string; + labelRow?: string; + labelStart?: string; + startFinishDependencyAriaDesc?: string; + startStartDependencyAriaDesc?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + taskMoveCancelled?: string; + taskMoveFinalized?: string; + taskMoveInitiated?: string; + taskMoveInitiatedInstruction?: string; + taskMoveSelectionInfo?: string; + tooltipZoomIn?: string; + tooltipZoomOut?: string; + }; +} +export interface ojGanttSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojGanttDependency extends JetElement { + predecessorTaskId: any; + shortDesc: string | null; + successorTaskId: any; + svgClassName: string; + svgStyle: object; + type: 'finishStart' | 'finishFinish' | 'startStart' | 'startFinish'; + onPredecessorTaskIdChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSuccessorTaskIdChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojGanttDependencyEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojGanttDependency[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojGanttDependencySettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojGanttDependencySettablePropertiesLenient): void; +} +export interface ojGanttDependencyEventMap extends HTMLElementEventMap { + 'predecessorTaskIdChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'successorTaskIdChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'typeChanged': JetElementCustomEvent; +} +export interface ojGanttDependencySettableProperties extends JetSettableProperties { + predecessorTaskId: any; + shortDesc: string | null; + successorTaskId: any; + svgClassName: string; + svgStyle: object; + type: 'finishStart' | 'finishFinish' | 'startStart' | 'startFinish'; +} +export interface ojGanttDependencySettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojGanttRow extends JetElement { + label: string; + labelStyle: object; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojGanttRowEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojGanttRow[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojGanttRowSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojGanttRowSettablePropertiesLenient): void; +} +export interface ojGanttRowEventMap extends HTMLElementEventMap { + 'labelChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; +} +export interface ojGanttRowSettableProperties extends JetSettableProperties { + label: string; + labelStyle: object; +} +export interface ojGanttRowSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojGanttTask extends JetElement { + baseline: { + borderRadius?: string; + end?: string; + height?: number; + start?: string; + svgClassName?: string; + svgStyle?: object; + }; + borderRadius: string; + end: string; + height: number | null; + label: string; + labelPosition: 'start' | 'innerCenter' | 'innerStart' | 'innerEnd' | 'end' | 'none'; + labelStyle: object; + progress: { + borderRadius?: string; + height?: string; + svgClassName?: string; + svgStyle?: object; + value?: number; + }; + rowId?: any; + shortDesc: string | null; + start: string; + svgClassName: string; + svgStyle: object; + type: 'normal' | 'milestone' | 'summary' | 'auto'; + onBaselineChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderRadiusChanged: ((event: JetElementCustomEvent) => any) | null; + onEndChanged: ((event: JetElementCustomEvent) => any) | null; + onHeightChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelPositionChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onProgressChanged: ((event: JetElementCustomEvent) => any) | null; + onRowIdChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onStartChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojGanttTaskEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojGanttTask[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojGanttTaskSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojGanttTaskSettablePropertiesLenient): void; +} +export interface ojGanttTaskEventMap extends HTMLElementEventMap { + 'baselineChanged': JetElementCustomEvent; + 'borderRadiusChanged': JetElementCustomEvent; + 'endChanged': JetElementCustomEvent; + 'heightChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelPositionChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'progressChanged': JetElementCustomEvent; + 'rowIdChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'startChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'typeChanged': JetElementCustomEvent; +} +export interface ojGanttTaskSettableProperties extends JetSettableProperties { + baseline: { + borderRadius?: string; + end?: string; + height?: number; + start?: string; + svgClassName?: string; + svgStyle?: object; + }; + borderRadius: string; + end: string; + height: number | null; + label: string; + labelPosition: 'start' | 'innerCenter' | 'innerStart' | 'innerEnd' | 'end' | 'none'; + labelStyle: object; + progress: { + borderRadius?: string; + height?: string; + svgClassName?: string; + svgStyle?: object; + value?: number; + }; + rowId?: any; + shortDesc: string | null; + start: string; + svgClassName: string; + svgStyle: object; + type: 'normal' | 'milestone' | 'summary' | 'auto'; +} +export interface ojGanttTaskSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojganttutils/index.d.ts b/types/oracle__oraclejet/ojganttutils/index.d.ts new file mode 100644 index 0000000000..0eb146049c --- /dev/null +++ b/types/oracle__oraclejet/ojganttutils/index.d.ts @@ -0,0 +1,4 @@ +export function computeTableColumnHeaderHeight(table: Element, gantt: Element, axisInfo: { + majorAxis: object; + minorAxis: object; +}): number; diff --git a/types/oracle__oraclejet/ojgauge/index.d.ts b/types/oracle__oraclejet/ojgauge/index.d.ts new file mode 100644 index 0000000000..d3ccbbd487 --- /dev/null +++ b/types/oracle__oraclejet/ojgauge/index.d.ts @@ -0,0 +1,574 @@ +import { Converter } from '../ojvalidation-base'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface dvtBaseGauge extends dvtBaseComponent { + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + addEventListener>(type: T, listener: (this: HTMLElement, ev: dvtBaseGaugeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): dvtBaseGauge[T]; + getProperty(property: string): any; + setProperty(property: T, value: dvtBaseGaugeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: dvtBaseGaugeSettablePropertiesLenient): void; +} +// These interfaces are empty but required to keep the event chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface dvtBaseGaugeEventMap extends dvtBaseComponentEventMap { +} +export interface dvtBaseGaugeSettableProperties extends dvtBaseComponentSettableProperties { + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface dvtBaseGaugeSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojLedGauge extends dvtBaseGauge { + borderColor: string; + color: string; + label: { + style?: object; + text?: string; + }; + max: number; + metricLabel: { + converter?: Converter; + rendered?: 'on' | 'off'; + scaling?: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style?: object; + text?: string; + textType?: 'percent' | 'number'; + }; + min: number; + rotation: 90 | 180 | 270 | 0; + size: number; + svgClassName: string; + svgStyle: object; + thresholds: ojLedGauge.Threshold[]; + tooltip: { + renderer: ((context: ojLedGauge.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + type: 'arrow' | 'diamond' | 'square' | 'rectangle' | 'triangle' | 'star' | 'human' | 'circle'; + value: number | null; + visualEffects: 'none' | 'auto'; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMetricLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onRotationChanged: ((event: JetElementCustomEvent) => any) | null; + onSizeChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onThresholdsChanged: ((event: JetElementCustomEvent) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onVisualEffectsChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojLedGaugeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojLedGauge[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojLedGaugeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojLedGaugeSettablePropertiesLenient): void; + getMetricLabel(): string; +} +export interface ojLedGaugeEventMap extends dvtBaseGaugeEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'maxChanged': JetElementCustomEvent; + 'metricLabelChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'rotationChanged': JetElementCustomEvent; + 'sizeChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'thresholdsChanged': JetElementCustomEvent; + 'tooltipChanged': JetElementCustomEvent; + 'typeChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; + 'visualEffectsChanged': JetElementCustomEvent; +} +export interface ojLedGaugeSettableProperties extends dvtBaseGaugeSettableProperties { + borderColor: string; + color: string; + label: { + style?: object; + text?: string; + }; + max: number; + metricLabel: { + converter?: Converter; + rendered?: 'on' | 'off'; + scaling?: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style?: object; + text?: string; + textType?: 'percent' | 'number'; + }; + min: number; + rotation: 90 | 180 | 270 | 0; + size: number; + svgClassName: string; + svgStyle: object; + thresholds: ojLedGauge.Threshold[]; + tooltip: { + renderer: ((context: ojLedGauge.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + type: 'arrow' | 'diamond' | 'square' | 'rectangle' | 'triangle' | 'star' | 'human' | 'circle'; + value: number | null; + visualEffects: 'none' | 'auto'; +} +export interface ojLedGaugeSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export namespace ojLedGauge { + // tslint:disable-next-line interface-over-type-literal + type Threshold = { + borderColor?: string; + color?: string; + max?: number; + shortDesc?: string; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + color: string; + componentElement: Element; + label: string; + parentElement: Element; + }; +} +export interface ojRatingGauge extends dvtBaseGauge { + changed: boolean; + changedState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + hoverState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + max: number; + min: number; + orientation: 'vertical' | 'horizontal'; + preserveAspectRatio: 'none' | 'meet'; + readonly: boolean; + selectedState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + step: 0.5 | 1; + thresholds: ojRatingGauge.Threshold[]; + tooltip: { + renderer: ((context: ojRatingGauge.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + readonly transientValue: number | null; + unselectedState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + value: number | null; + visualEffects: 'none' | 'auto'; + onChangedChanged: ((event: JetElementCustomEvent) => any) | null; + onChangedStateChanged: ((event: JetElementCustomEvent) => any) | null; + onHoverStateChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onOrientationChanged: ((event: JetElementCustomEvent) => any) | null; + onPreserveAspectRatioChanged: ((event: JetElementCustomEvent) => any) | null; + onReadonlyChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectedStateChanged: ((event: JetElementCustomEvent) => any) | null; + onStepChanged: ((event: JetElementCustomEvent) => any) | null; + onThresholdsChanged: ((event: JetElementCustomEvent) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent) => any) | null; + onTransientValueChanged: ((event: JetElementCustomEvent) => any) | null; + onUnselectedStateChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onVisualEffectsChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojRatingGaugeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojRatingGauge[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojRatingGaugeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojRatingGaugeSettablePropertiesLenient): void; +} +export interface ojRatingGaugeEventMap extends dvtBaseGaugeEventMap { + 'changedChanged': JetElementCustomEvent; + 'changedStateChanged': JetElementCustomEvent; + 'hoverStateChanged': JetElementCustomEvent; + 'maxChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'orientationChanged': JetElementCustomEvent; + 'preserveAspectRatioChanged': JetElementCustomEvent; + 'readonlyChanged': JetElementCustomEvent; + 'selectedStateChanged': JetElementCustomEvent; + 'stepChanged': JetElementCustomEvent; + 'thresholdsChanged': JetElementCustomEvent; + 'tooltipChanged': JetElementCustomEvent; + 'transientValueChanged': JetElementCustomEvent; + 'unselectedStateChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; + 'visualEffectsChanged': JetElementCustomEvent; +} +export interface ojRatingGaugeSettableProperties extends dvtBaseGaugeSettableProperties { + changed: boolean; + changedState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + hoverState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + max: number; + min: number; + orientation: 'vertical' | 'horizontal'; + preserveAspectRatio: 'none' | 'meet'; + readonly: boolean; + selectedState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + step: 0.5 | 1; + thresholds: ojRatingGauge.Threshold[]; + tooltip: { + renderer: ((context: ojRatingGauge.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + readonly transientValue: number | null; + unselectedState: { + borderColor?: string; + color?: string; + shape?: 'circle' | 'diamond' | 'human' | 'square' | 'star' | 'triangle' | string; + source?: string; + svgClassName?: string; + svgStyle?: object; + }; + value: number | null; + visualEffects: 'none' | 'auto'; +} +export interface ojRatingGaugeSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export namespace ojRatingGauge { + // tslint:disable-next-line interface-over-type-literal + type Threshold = { + borderColor?: string; + color?: string; + max?: number; + shortDesc?: string; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + color: string; + componentElement: Element; + label: string; + parentElement: Element; + }; +} +export interface ojStatusMeterGauge extends dvtBaseGauge { + angleExtent: number; + animationDuration?: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + borderColor: string; + borderRadius: string; + center: { + renderer: ((context: ojStatusMeterGauge.CenterContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + color: string; + indicatorSize: number; + innerRadius: number; + label: { + position?: 'center' | 'start' | 'auto'; + style?: object; + text?: string; + }; + max: number; + metricLabel: { + converter?: Converter; + position?: 'center' | 'insideIndicatorEdge' | 'outsideIndicatorEdge' | 'outsidePlotArea' | 'withLabel' | 'auto'; + rendered?: 'on' | 'off' | 'auto'; + scaling?: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style?: object; + text?: string; + textType?: 'percent' | 'number'; + }; + min: number; + orientation: 'circular' | 'vertical' | 'horizontal'; + plotArea: { + borderColor?: string; + borderRadius?: string; + color?: string; + rendered?: 'on' | 'off' | 'auto'; + svgClassName?: string; + svgStyle?: object; + }; + readonly: boolean; + referenceLines: ojStatusMeterGauge.ReferenceLine[]; + startAngle: number; + step: number | null; + svgClassName: string; + svgStyle: object; + thresholdDisplay: 'currentOnly' | 'all' | 'onIndicator'; + thresholds: ojStatusMeterGauge.Threshold[]; + tooltip: { + renderer: ((context: ojStatusMeterGauge.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + readonly transientValue: number | null; + value: number | null; + visualEffects: 'none' | 'auto'; + onAngleExtentChanged: ((event: JetElementCustomEvent) => any) | null; + onAnimationDurationChanged: ((event: JetElementCustomEvent) => any) | null; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderRadiusChanged: ((event: JetElementCustomEvent) => any) | null; + onCenterChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onIndicatorSizeChanged: ((event: JetElementCustomEvent) => any) | null; + onInnerRadiusChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMetricLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onOrientationChanged: ((event: JetElementCustomEvent) => any) | null; + onPlotAreaChanged: ((event: JetElementCustomEvent) => any) | null; + onReadonlyChanged: ((event: JetElementCustomEvent) => any) | null; + onReferenceLinesChanged: ((event: JetElementCustomEvent) => any) | null; + onStartAngleChanged: ((event: JetElementCustomEvent) => any) | null; + onStepChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onThresholdDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onThresholdsChanged: ((event: JetElementCustomEvent) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent) => any) | null; + onTransientValueChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onVisualEffectsChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojStatusMeterGaugeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojStatusMeterGauge[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojStatusMeterGaugeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojStatusMeterGaugeSettablePropertiesLenient): void; + getMetricLabel(): string; +} +export interface ojStatusMeterGaugeEventMap extends dvtBaseGaugeEventMap { + 'angleExtentChanged': JetElementCustomEvent; + 'animationDurationChanged': JetElementCustomEvent; + 'animationOnDataChangeChanged': JetElementCustomEvent; + 'animationOnDisplayChanged': JetElementCustomEvent; + 'borderColorChanged': JetElementCustomEvent; + 'borderRadiusChanged': JetElementCustomEvent; + 'centerChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'indicatorSizeChanged': JetElementCustomEvent; + 'innerRadiusChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'maxChanged': JetElementCustomEvent; + 'metricLabelChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'orientationChanged': JetElementCustomEvent; + 'plotAreaChanged': JetElementCustomEvent; + 'readonlyChanged': JetElementCustomEvent; + 'referenceLinesChanged': JetElementCustomEvent; + 'startAngleChanged': JetElementCustomEvent; + 'stepChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'thresholdDisplayChanged': JetElementCustomEvent; + 'thresholdsChanged': JetElementCustomEvent; + 'tooltipChanged': JetElementCustomEvent; + 'transientValueChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; + 'visualEffectsChanged': JetElementCustomEvent; +} +export interface ojStatusMeterGaugeSettableProperties extends dvtBaseGaugeSettableProperties { + angleExtent: number; + animationDuration?: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + borderColor: string; + borderRadius: string; + center: { + renderer: ((context: ojStatusMeterGauge.CenterContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + color: string; + indicatorSize: number; + innerRadius: number; + label: { + position?: 'center' | 'start' | 'auto'; + style?: object; + text?: string; + }; + max: number; + metricLabel: { + converter?: Converter; + position?: 'center' | 'insideIndicatorEdge' | 'outsideIndicatorEdge' | 'outsidePlotArea' | 'withLabel' | 'auto'; + rendered?: 'on' | 'off' | 'auto'; + scaling?: 'none' | 'thousand' | 'million' | 'billion' | 'trillion' | 'quadrillion' | 'auto'; + style?: object; + text?: string; + textType?: 'percent' | 'number'; + }; + min: number; + orientation: 'circular' | 'vertical' | 'horizontal'; + plotArea: { + borderColor?: string; + borderRadius?: string; + color?: string; + rendered?: 'on' | 'off' | 'auto'; + svgClassName?: string; + svgStyle?: object; + }; + readonly: boolean; + referenceLines: ojStatusMeterGauge.ReferenceLine[]; + startAngle: number; + step: number | null; + svgClassName: string; + svgStyle: object; + thresholdDisplay: 'currentOnly' | 'all' | 'onIndicator'; + thresholds: ojStatusMeterGauge.Threshold[]; + tooltip: { + renderer: ((context: ojStatusMeterGauge.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + readonly transientValue: number | null; + value: number | null; + visualEffects: 'none' | 'auto'; +} +export interface ojStatusMeterGaugeSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export namespace ojStatusMeterGauge { + // tslint:disable-next-line interface-over-type-literal + type Bounds = { + x: number; + y: number; + width: number; + height: number; + }; + // tslint:disable-next-line interface-over-type-literal + type CenterContext = { + componentElement: Element; + innerBounds: Bounds; + metricLabel: string; + outerBounds: Bounds; + }; + // tslint:disable-next-line interface-over-type-literal + type ReferenceLine = { + color?: string; + value?: number; + }; + // tslint:disable-next-line interface-over-type-literal + type Threshold = { + borderColor?: string; + color?: string; + max?: number; + shortDesc?: string; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + color: string; + componentElement: Element; + label: string; + parentElement: Element; + }; +} diff --git a/types/oracle__oraclejet/ojinputnumber/index.d.ts b/types/oracle__oraclejet/ojinputnumber/index.d.ts new file mode 100644 index 0000000000..533ec04873 --- /dev/null +++ b/types/oracle__oraclejet/ojinputnumber/index.d.ts @@ -0,0 +1,150 @@ +import { Converter, Validator, Validation, AsyncValidator } from '../ojvalidation-base'; +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojInputNumber extends editableValue { + asyncValidators: Array>; + autocomplete: 'on' | 'off' | string; + autofocus: boolean; + converter: Converter | Validation.RegisteredConverter; + max: number | null; + min: number | null; + placeholder: string | null; + readonly rawValue: string; + readonly: boolean | null; + required: boolean; + step: number | null; + validators: Array | Validation.RegisteredValidator>; + value: number | null; + virtualKeyboard: 'auto' | 'number' | 'text'; + translations: { + numberRange?: { + hint?: { + exact?: string; + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + exact?: string; + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipDecrement?: string; + tooltipIncrement?: string; + }; + onAsyncValidatorsChanged: ((event: JetElementCustomEvent) => any) | null; + onAutocompleteChanged: ((event: JetElementCustomEvent) => any) | null; + onAutofocusChanged: ((event: JetElementCustomEvent) => any) | null; + onConverterChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onPlaceholderChanged: ((event: JetElementCustomEvent) => any) | null; + onRawValueChanged: ((event: JetElementCustomEvent) => any) | null; + onReadonlyChanged: ((event: JetElementCustomEvent) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent) => any) | null; + onStepChanged: ((event: JetElementCustomEvent) => any) | null; + onValidatorsChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onVirtualKeyboardChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojInputNumber.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojInputNumber.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojInputNumberEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojInputNumber[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojInputNumberSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojInputNumberSettablePropertiesLenient): void; + refresh(): void; + stepDown(steps?: number): void; + stepUp(steps?: number): void; + validate(): Promise; +} +export namespace ojInputNumber { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojInputNumberEventMap extends editableValueEventMap { + 'ojAnimateEnd': ojInputNumber.ojAnimateEnd; + 'ojAnimateStart': ojInputNumber.ojAnimateStart; + 'asyncValidatorsChanged': JetElementCustomEvent; + 'autocompleteChanged': JetElementCustomEvent; + 'autofocusChanged': JetElementCustomEvent; + 'converterChanged': JetElementCustomEvent; + 'maxChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'placeholderChanged': JetElementCustomEvent; + 'rawValueChanged': JetElementCustomEvent; + 'readonlyChanged': JetElementCustomEvent; + 'requiredChanged': JetElementCustomEvent; + 'stepChanged': JetElementCustomEvent; + 'validatorsChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; + 'virtualKeyboardChanged': JetElementCustomEvent; +} +export interface ojInputNumberSettableProperties extends editableValueSettableProperties { + asyncValidators: Array>; + autocomplete: 'on' | 'off' | string; + autofocus: boolean; + converter: Converter | Validation.RegisteredConverter; + max: number | null; + min: number | null; + placeholder: string | null; + readonly rawValue: string; + readonly: boolean | null; + required: boolean; + step: number | null; + validators: Array | Validation.RegisteredValidator>; + value: number | null; + virtualKeyboard: 'auto' | 'number' | 'text'; + translations: { + numberRange?: { + hint?: { + exact?: string; + inRange?: string; + max?: string; + min?: string; + }; + messageDetail?: { + exact?: string; + rangeOverflow?: string; + rangeUnderflow?: string; + }; + messageSummary?: { + rangeOverflow?: string; + rangeUnderflow?: string; + }; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + tooltipDecrement?: string; + tooltipIncrement?: string; + }; +} +export interface ojInputNumberSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojinputtext/index.d.ts b/types/oracle__oraclejet/ojinputtext/index.d.ts new file mode 100644 index 0000000000..6caca00923 --- /dev/null +++ b/types/oracle__oraclejet/ojinputtext/index.d.ts @@ -0,0 +1,249 @@ +import { Converter, Validator, Validation, AsyncValidator } from '../ojvalidation-base'; +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface inputBase, SV = V, RV = V> extends editableValue { + asyncValidators: Array>; + autocomplete: 'on' | 'off' | string; + autofocus: boolean; + placeholder: string; + readonly rawValue: RV; + readonly: boolean; + required: boolean; + validators: Array | Validation.RegisteredValidator> | null; + translations: { + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; + onAsyncValidatorsChanged: ((event: JetElementCustomEvent["asyncValidators"]>) => any) | null; + onAutocompleteChanged: ((event: JetElementCustomEvent["autocomplete"]>) => any) | null; + onAutofocusChanged: ((event: JetElementCustomEvent["autofocus"]>) => any) | null; + onPlaceholderChanged: ((event: JetElementCustomEvent["placeholder"]>) => any) | null; + onRawValueChanged: ((event: JetElementCustomEvent["rawValue"]>) => any) | null; + onReadonlyChanged: ((event: JetElementCustomEvent["readonly"]>) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent["required"]>) => any) | null; + onValidatorsChanged: ((event: JetElementCustomEvent["validators"]>) => any) | null; + onOjAnimateEnd: ((event: inputBase.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: inputBase.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: inputBaseEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): inputBase[T]; + getProperty(property: string): any; + setProperty>(property: T, value: inputBaseSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: inputBaseSettablePropertiesLenient): void; + refresh(): void; + validate(): Promise<'valid' | 'invalid'>; +} +export namespace inputBase { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface inputBaseEventMap, SV = V, RV = V> extends editableValueEventMap { + 'ojAnimateEnd': inputBase.ojAnimateEnd; + 'ojAnimateStart': inputBase.ojAnimateStart; + 'asyncValidatorsChanged': JetElementCustomEvent["asyncValidators"]>; + 'autocompleteChanged': JetElementCustomEvent["autocomplete"]>; + 'autofocusChanged': JetElementCustomEvent["autofocus"]>; + 'placeholderChanged': JetElementCustomEvent["placeholder"]>; + 'rawValueChanged': JetElementCustomEvent["rawValue"]>; + 'readonlyChanged': JetElementCustomEvent["readonly"]>; + 'requiredChanged': JetElementCustomEvent["required"]>; + 'validatorsChanged': JetElementCustomEvent["validators"]>; +} +export interface inputBaseSettableProperties extends editableValueSettableProperties { + asyncValidators: Array>; + autocomplete: 'on' | 'off' | string; + autofocus: boolean; + placeholder: string; + readonly rawValue: RV; + readonly: boolean; + required: boolean; + validators: Array | Validation.RegisteredValidator> | null; + translations: { + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; +} +export interface inputBaseSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojInputPassword extends inputBase { + value: string | null; + translations: { + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojInputPassword.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojInputPassword.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojInputPasswordEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojInputPassword[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojInputPasswordSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojInputPasswordSettablePropertiesLenient): void; +} +export namespace ojInputPassword { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojInputPasswordEventMap extends inputBaseEventMap { + 'ojAnimateEnd': ojInputPassword.ojAnimateEnd; + 'ojAnimateStart': ojInputPassword.ojAnimateStart; + 'valueChanged': JetElementCustomEvent; +} +export interface ojInputPasswordSettableProperties extends inputBaseSettableProperties { + value: string | null; + translations: { + regexp?: { + messageDetail?: string; + messageSummary?: string; + }; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; +} +export interface ojInputPasswordSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojInputText extends inputBase { + clearIcon: 'never' | 'always' | 'conditional'; + converter: Converter | Validation.RegisteredConverter | null; + list: string; + virtualKeyboard: 'auto' | 'email' | 'number' | 'search' | 'tel' | 'text' | 'url'; + onClearIconChanged: ((event: JetElementCustomEvent) => any) | null; + onConverterChanged: ((event: JetElementCustomEvent) => any) | null; + onListChanged: ((event: JetElementCustomEvent) => any) | null; + onVirtualKeyboardChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojInputText.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojInputText.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojInputTextEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojInputText[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojInputTextSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojInputTextSettablePropertiesLenient): void; +} +export namespace ojInputText { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojInputTextEventMap extends inputBaseEventMap { + 'ojAnimateEnd': ojInputText.ojAnimateEnd; + 'ojAnimateStart': ojInputText.ojAnimateStart; + 'clearIconChanged': JetElementCustomEvent; + 'converterChanged': JetElementCustomEvent; + 'listChanged': JetElementCustomEvent; + 'virtualKeyboardChanged': JetElementCustomEvent; +} +export interface ojInputTextSettableProperties extends inputBaseSettableProperties { + clearIcon: 'never' | 'always' | 'conditional'; + converter: Converter | Validation.RegisteredConverter | null; + list: string; + virtualKeyboard: 'auto' | 'email' | 'number' | 'search' | 'tel' | 'text' | 'url'; +} +export interface ojInputTextSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojTextArea extends inputBase { + converter: Converter | Validation.RegisteredConverter | null; + rows: number; + onConverterChanged: ((event: JetElementCustomEvent) => any) | null; + onRowsChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojTextArea.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojTextArea.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojTextAreaEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojTextArea[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojTextAreaSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojTextAreaSettablePropertiesLenient): void; +} +export namespace ojTextArea { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojTextAreaEventMap extends inputBaseEventMap { + 'ojAnimateEnd': ojTextArea.ojAnimateEnd; + 'ojAnimateStart': ojTextArea.ojAnimateStart; + 'converterChanged': JetElementCustomEvent; + 'rowsChanged': JetElementCustomEvent; +} +export interface ojTextAreaSettableProperties extends inputBaseSettableProperties { + converter: Converter | Validation.RegisteredConverter | null; + rows: number; +} +export interface ojTextAreaSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojkeyset/index.d.ts b/types/oracle__oraclejet/ojkeyset/index.d.ts new file mode 100644 index 0000000000..7ffa8547b4 --- /dev/null +++ b/types/oracle__oraclejet/ojkeyset/index.d.ts @@ -0,0 +1,28 @@ +export class ExpandAllKeySet extends KeySet { + constructor(); + add(keys: Set | K[]): ExpandAllKeySet; + addAll(): ExpandAllKeySet; + clear(): ExpandedKeySet; + delete(keys: Set | K[]): ExpandAllKeySet; + deletedValues(): Set; + has(key: K): boolean; + isAddAll(): boolean; +} +export class ExpandedKeySet extends KeySet { + constructor(keys?: Set | K[]); + add(keys: Set | K[]): ExpandedKeySet; + addAll(): ExpandAllKeySet; + clear(): ExpandedKeySet; + delete(keys: Set | K[]): ExpandedKeySet; + has(key: K): boolean; + isAddAll(): boolean; + values(): Set; +} +export abstract class KeySet { + abstract add(keys: Set | K[]): KeySet; + abstract addAll(): KeySet; + abstract clear(): KeySet; + abstract delete(keys: Set | K[]): KeySet; + abstract has(key: K): boolean; + abstract isAddAll(): boolean; +} diff --git a/types/oracle__oraclejet/ojknockout-keyset/index.d.ts b/types/oracle__oraclejet/ojknockout-keyset/index.d.ts new file mode 100644 index 0000000000..55b1beebc0 --- /dev/null +++ b/types/oracle__oraclejet/ojknockout-keyset/index.d.ts @@ -0,0 +1,8 @@ +import { ExpandedKeySet, ExpandAllKeySet } from '../ojkeyset'; +export class ObservableExpandedKeySet { + constructor(initialValue?: ExpandedKeySet | ExpandAllKeySet); + add(keys: Set | K[]): ObservableExpandedKeySet; + addAll(): ObservableExpandedKeySet; + clear(): ObservableExpandedKeySet; + delete(keys: Set | K[]): ObservableExpandedKeySet; +} diff --git a/types/oracle__oraclejet/ojknockout-model/index.d.ts b/types/oracle__oraclejet/ojknockout-model/index.d.ts new file mode 100644 index 0000000000..f73c4773c7 --- /dev/null +++ b/types/oracle__oraclejet/ojknockout-model/index.d.ts @@ -0,0 +1,3 @@ +/// +/// +export function map(m: object, callback?: ((param0: object) => void), array?: boolean): Array> | KnockoutObservableArray; diff --git a/types/oracle__oraclejet/ojknockouttemplateutils/index.d.ts b/types/oracle__oraclejet/ojknockouttemplateutils/index.d.ts new file mode 100644 index 0000000000..3c307cb427 --- /dev/null +++ b/types/oracle__oraclejet/ojknockouttemplateutils/index.d.ts @@ -0,0 +1 @@ +export function getRenderer(template: string, bReplaceNode?: boolean): ((param0: object) => void); diff --git a/types/oracle__oraclejet/ojlabel/index.d.ts b/types/oracle__oraclejet/ojlabel/index.d.ts new file mode 100644 index 0000000000..f6b0de7c4f --- /dev/null +++ b/types/oracle__oraclejet/ojlabel/index.d.ts @@ -0,0 +1,48 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojLabel extends baseComponent { + for: string | null; + help: { + definition?: string | null; + source?: string | null; + }; + labelId: string | null; + showRequired: boolean | null; + translations: { + tooltipHelp?: string; + tooltipRequired?: string; + }; + onForChanged: ((event: JetElementCustomEvent) => any) | null; + onHelpChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelIdChanged: ((event: JetElementCustomEvent) => any) | null; + onShowRequiredChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojLabelEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojLabel[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojLabelSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojLabelSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojLabelEventMap extends baseComponentEventMap { + 'forChanged': JetElementCustomEvent; + 'helpChanged': JetElementCustomEvent; + 'labelIdChanged': JetElementCustomEvent; + 'showRequiredChanged': JetElementCustomEvent; +} +export interface ojLabelSettableProperties extends baseComponentSettableProperties { + for: string | null; + help: { + definition?: string | null; + source?: string | null; + }; + labelId: string | null; + showRequired: boolean | null; + translations: { + tooltipHelp?: string; + tooltipRequired?: string; + }; +} +export interface ojLabelSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojlabelvalue/index.d.ts b/types/oracle__oraclejet/ojlabelvalue/index.d.ts new file mode 100644 index 0000000000..0f51f259a6 --- /dev/null +++ b/types/oracle__oraclejet/ojlabelvalue/index.d.ts @@ -0,0 +1,26 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojLabelValue extends JetElement { + labelEdge: 'start' | 'top' | 'inherit'; + labelWidth: string; + onLabelEdgeChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelWidthChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojLabelValueEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojLabelValue[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojLabelValueSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojLabelValueSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojLabelValueEventMap extends HTMLElementEventMap { + 'labelEdgeChanged': JetElementCustomEvent; + 'labelWidthChanged': JetElementCustomEvent; +} +export interface ojLabelValueSettableProperties extends JetSettableProperties { + labelEdge: 'start' | 'top' | 'inherit'; + labelWidth: string; +} +export interface ojLabelValueSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojlegend/index.d.ts b/types/oracle__oraclejet/ojlegend/index.d.ts new file mode 100644 index 0000000000..609212c1a5 --- /dev/null +++ b/types/oracle__oraclejet/ojlegend/index.d.ts @@ -0,0 +1,286 @@ +import { KeySet } from '../ojkeyset'; +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojLegend extends dvtBaseComponent> { + as: string; + data: DataProvider | null; + drilling: 'on' | 'off'; + expanded: KeySet | null; + halign: 'center' | 'end' | 'start'; + hiddenCategories: string[]; + hideAndShowBehavior: 'on' | 'off'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + orientation: 'horizontal' | 'vertical'; + scrolling: 'off' | 'asNeeded'; + symbolHeight: number; + symbolWidth: number; + textStyle?: object; + valign: 'middle' | 'bottom' | 'top'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent["drilling"]>) => any) | null; + onExpandedChanged: ((event: JetElementCustomEvent["expanded"]>) => any) | null; + onHalignChanged: ((event: JetElementCustomEvent["halign"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHideAndShowBehaviorChanged: ((event: JetElementCustomEvent["hideAndShowBehavior"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onHoverBehaviorDelayChanged: ((event: JetElementCustomEvent["hoverBehaviorDelay"]>) => any) | null; + onOrientationChanged: ((event: JetElementCustomEvent["orientation"]>) => any) | null; + onScrollingChanged: ((event: JetElementCustomEvent["scrolling"]>) => any) | null; + onSymbolHeightChanged: ((event: JetElementCustomEvent["symbolHeight"]>) => any) | null; + onSymbolWidthChanged: ((event: JetElementCustomEvent["symbolWidth"]>) => any) | null; + onTextStyleChanged: ((event: JetElementCustomEvent["textStyle"]>) => any) | null; + onValignChanged: ((event: JetElementCustomEvent["valign"]>) => any) | null; + onOjDrill: ((event: ojLegend.ojDrill) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojLegendEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojLegend[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojLegendSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojLegendSettablePropertiesLenient): void; + getContextByNode(node: Element): ojLegend.NodeContext | null; + getItem(subIdPath: any[]): ojLegend.ItemContext | null; + getPreferredSize(): ojLegend.PreferredSize | null; + getSection(subIdPath: any[]): ojLegend.SectionContext | null; +} +export namespace ojLegend { + interface ojDrill extends CustomEvent<{ + id: any; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + text: string; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + itemIndex: number; + sectionIndexPath: number[]; + subId: string; + }; + // tslint:disable-next-line interface-over-type-literal + type PreferredSize = { + width: number; + height: number; + }; + // tslint:disable-next-line interface-over-type-literal + type SectionContext = { + title: string; + sections: object[]; + items: object[]; + getSection: { + title: string; + sections: string; + items: boolean; + }; + getItems: { + text: string; + }; + }; +} +export interface ojLegendEventMap extends dvtBaseComponentEventMap> { + 'ojDrill': ojLegend.ojDrill; + 'asChanged': JetElementCustomEvent["as"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'drillingChanged': JetElementCustomEvent["drilling"]>; + 'expandedChanged': JetElementCustomEvent["expanded"]>; + 'halignChanged': JetElementCustomEvent["halign"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'hideAndShowBehaviorChanged': JetElementCustomEvent["hideAndShowBehavior"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'hoverBehaviorDelayChanged': JetElementCustomEvent["hoverBehaviorDelay"]>; + 'orientationChanged': JetElementCustomEvent["orientation"]>; + 'scrollingChanged': JetElementCustomEvent["scrolling"]>; + 'symbolHeightChanged': JetElementCustomEvent["symbolHeight"]>; + 'symbolWidthChanged': JetElementCustomEvent["symbolWidth"]>; + 'textStyleChanged': JetElementCustomEvent["textStyle"]>; + 'valignChanged': JetElementCustomEvent["valign"]>; +} +export interface ojLegendSettableProperties extends dvtBaseComponentSettableProperties { + as: string; + data: DataProvider | null; + drilling: 'on' | 'off'; + expanded: KeySet | null; + halign: 'center' | 'end' | 'start'; + hiddenCategories: string[]; + hideAndShowBehavior: 'on' | 'off'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + orientation: 'horizontal' | 'vertical'; + scrolling: 'off' | 'asNeeded'; + symbolHeight: number; + symbolWidth: number; + textStyle?: object; + valign: 'middle' | 'bottom' | 'top'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojLegendSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojLegendItem extends JetElement { + borderColor?: string; + categories?: string[]; + categoryVisibility?: 'hidden' | 'visible'; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + lineStyle?: 'dotted' | 'dashed' | 'solid'; + lineWidth?: number; + markerColor?: string; + markerShape: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSvgClassName?: string; + markerSvgStyle?: object; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shortDesc?: string; + source?: string; + svgClassName?: string; + svgStyle?: object; + symbolType?: 'line' | 'lineWithMarker' | 'image' | 'marker'; + text: string; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoryVisibilityChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent) => any) | null; + onLineStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onLineWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerColorChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerShapeChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onMarkerSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onPatternChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onSymbolTypeChanged: ((event: JetElementCustomEvent) => any) | null; + onTextChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojLegendItemEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojLegendItem[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojLegendItemSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojLegendItemSettablePropertiesLenient): void; +} +export interface ojLegendItemEventMap extends HTMLElementEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'categoriesChanged': JetElementCustomEvent; + 'categoryVisibilityChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'drillingChanged': JetElementCustomEvent; + 'lineStyleChanged': JetElementCustomEvent; + 'lineWidthChanged': JetElementCustomEvent; + 'markerColorChanged': JetElementCustomEvent; + 'markerShapeChanged': JetElementCustomEvent; + 'markerSvgClassNameChanged': JetElementCustomEvent; + 'markerSvgStyleChanged': JetElementCustomEvent; + 'patternChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'sourceChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'symbolTypeChanged': JetElementCustomEvent; + 'textChanged': JetElementCustomEvent; +} +export interface ojLegendItemSettableProperties extends JetSettableProperties { + borderColor?: string; + categories?: string[]; + categoryVisibility?: 'hidden' | 'visible'; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + lineStyle?: 'dotted' | 'dashed' | 'solid'; + lineWidth?: number; + markerColor?: string; + markerShape: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + markerSvgClassName?: string; + markerSvgStyle?: object; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shortDesc?: string; + source?: string; + svgClassName?: string; + svgStyle?: object; + symbolType?: 'line' | 'lineWithMarker' | 'image' | 'marker'; + text: string; +} +export interface ojLegendItemSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojLegendSection extends JetElement { + collapsible?: 'on' | 'off'; + text?: string; + textHalign?: 'center' | 'end' | 'start'; + textStyle?: object; + onCollapsibleChanged: ((event: JetElementCustomEvent) => any) | null; + onTextChanged: ((event: JetElementCustomEvent) => any) | null; + onTextHalignChanged: ((event: JetElementCustomEvent) => any) | null; + onTextStyleChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojLegendSectionEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojLegendSection[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojLegendSectionSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojLegendSectionSettablePropertiesLenient): void; +} +export interface ojLegendSectionEventMap extends HTMLElementEventMap { + 'collapsibleChanged': JetElementCustomEvent; + 'textChanged': JetElementCustomEvent; + 'textHalignChanged': JetElementCustomEvent; + 'textStyleChanged': JetElementCustomEvent; +} +export interface ojLegendSectionSettableProperties extends JetSettableProperties { + collapsible?: 'on' | 'off'; + text?: string; + textHalign?: 'center' | 'end' | 'start'; + textStyle?: object; +} +export interface ojLegendSectionSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojlistdataproviderview/index.d.ts b/types/oracle__oraclejet/ojlistdataproviderview/index.d.ts new file mode 100644 index 0000000000..031611e08e --- /dev/null +++ b/types/oracle__oraclejet/ojlistdataproviderview/index.d.ts @@ -0,0 +1,25 @@ +import { DataProvider, SortCriterion, FetchByKeysParameters, ContainsKeysResults, FetchByKeysResults, FetchByOffsetParameters, FetchByOffsetResults, DataMapping, FetchListResult, + FetchListParameters } from '../ojdataprovider'; +declare class ListDataProviderView implements DataProvider { + dataMapping: DataMapping; + from: any; + offset: number; + sortCriteria: Array>; + constructor(dataProvider: DataProvider, options?: { + from?: object; + offset?: number; + sortCriteria?: Array>; + dataMapping?: DataMapping; + }); + addEventListener(eventType: string, listener: EventListener): void; + containsKeys(params: FetchByKeysParameters): Promise>; + dispatchEvent(evt: Event): boolean; + fetchByKeys(params: FetchByKeysParameters): Promise>; + fetchByOffset(params: FetchByOffsetParameters): Promise>; + fetchFirst(params?: FetchListParameters): AsyncIterable>; + getCapability(capabilityName: string): any; + getTotalSize(): Promise; + isEmpty(): 'yes' | 'no' | 'unknown'; + removeEventListener(eventType: string, listener: EventListener): void; +} +export = ListDataProviderView; diff --git a/types/oracle__oraclejet/ojlistview/index.d.ts b/types/oracle__oraclejet/ojlistview/index.d.ts new file mode 100644 index 0000000000..97a77c52ea --- /dev/null +++ b/types/oracle__oraclejet/ojlistview/index.d.ts @@ -0,0 +1,335 @@ +import { KeySet } from '../ojkeyset'; +import { DataProvider } from '../ojdataprovider'; +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojListView extends baseComponent> { + as: string; + currentItem: K; + data: DataProvider; + dnd: { + drag?: { + items: { + dataTypes?: string | string[]; + drag?: ((param0: Event) => void); + dragEnd?: ((param0: Event) => void); + dragStart?: ((param0: Event, param1: { + items: Element[]; + }) => void); + }; + }; + drop?: { + items: { + dataTypes?: string | string[]; + dragEnter?: ((param0: Event, param1: { + item: Element; + }) => void); + dragLeave?: ((param0: Event, param1: { + item: Element; + }) => void); + dragOver?: ((param0: Event, param1: { + item: Element; + }) => void); + drop?: ((param0: Event, param1: ojListView.ItemsDropContext) => void); + }; + }; + reorder: { + items: 'enabled' | 'disabled'; + }; + }; + drillMode: 'collapsible' | 'none'; + expanded: KeySet; + readonly firstSelectedItem: { + key: K; + data: D; + }; + groupHeaderPosition: 'static' | 'sticky'; + item: { + focusable?: ((param0: ojListView.ItemContext) => boolean) | boolean; + renderer?: ((param0: ojListView.ItemContext) => { + insert: Element | string; + } | undefined) | null; + selectable?: ((param0: ojListView.ItemContext) => boolean) | boolean; + }; + scrollPolicy: 'auto' | 'loadMoreOnScroll'; + scrollPolicyOptions: { + fetchSize?: number; + maxCount?: number; + scroller?: Element; + }; + scrollPosition: { + x?: number; + y?: number; + index?: number; + parent?: K; + key?: K; + offsetX?: number; + offsetY?: number; + }; + selection: K[]; + selectionMode: 'none' | 'single' | 'multiple'; + selectionRequired: boolean; + translations: { + accessibleNavigateSkipItems?: string; + accessibleReorderAfterItem?: string; + accessibleReorderBeforeItem?: string; + accessibleReorderInsideItem?: string; + accessibleReorderTouchInstructionText?: string; + indexerCharacters?: string; + labelCopy?: string; + labelCut?: string; + labelPaste?: string; + labelPasteAfter?: string; + labelPasteBefore?: string; + msgFetchingData?: string; + msgNoData?: string; + }; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onCurrentItemChanged: ((event: JetElementCustomEvent["currentItem"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDndChanged: ((event: JetElementCustomEvent["dnd"]>) => any) | null; + onDrillModeChanged: ((event: JetElementCustomEvent["drillMode"]>) => any) | null; + onExpandedChanged: ((event: JetElementCustomEvent["expanded"]>) => any) | null; + onFirstSelectedItemChanged: ((event: JetElementCustomEvent["firstSelectedItem"]>) => any) | null; + onGroupHeaderPositionChanged: ((event: JetElementCustomEvent["groupHeaderPosition"]>) => any) | null; + onItemChanged: ((event: JetElementCustomEvent["item"]>) => any) | null; + onScrollPolicyChanged: ((event: JetElementCustomEvent["scrollPolicy"]>) => any) | null; + onScrollPolicyOptionsChanged: ((event: JetElementCustomEvent["scrollPolicyOptions"]>) => any) | null; + onScrollPositionChanged: ((event: JetElementCustomEvent["scrollPosition"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onSelectionRequiredChanged: ((event: JetElementCustomEvent["selectionRequired"]>) => any) | null; + onOjAnimateEnd: ((event: ojListView.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojListView.ojAnimateStart) => any) | null; + onOjBeforeCollapse: ((event: ojListView.ojBeforeCollapse) => any) | null; + onOjBeforeCurrentItem: ((event: ojListView.ojBeforeCurrentItem) => any) | null; + onOjBeforeExpand: ((event: ojListView.ojBeforeExpand) => any) | null; + onOjCollapse: ((event: ojListView.ojCollapse) => any) | null; + onOjCopy: ((event: ojListView.ojCopy) => any) | null; + onOjCut: ((event: ojListView.ojCut) => any) | null; + onOjExpand: ((event: ojListView.ojExpand) => any) | null; + onOjPaste: ((event: ojListView.ojPaste) => any) | null; + onOjReorder: ((event: ojListView.ojReorder) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojListViewEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojListView[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojListViewSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojListViewSettablePropertiesLenient): void; + getContextByNode(node: Element): ojListView.ContextByNode | null; + getDataForVisibleItem(context: { + key?: K; + index?: number; + parent?: Element; + }): D; + refresh(): void; + scrollToItem(item: { + key: K; + }): void; +} +export namespace ojListView { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeCollapse extends CustomEvent<{ + key: K; + item: Element; + [propName: string]: any; + }> { + } + interface ojBeforeCurrentItem extends CustomEvent<{ + previousKey: K; + previousItem: Element; + key: K; + item: Element; + [propName: string]: any; + }> { + } + interface ojBeforeExpand extends CustomEvent<{ + key: K; + item: Element; + [propName: string]: any; + }> { + } + interface ojCollapse extends CustomEvent<{ + key: K; + item: Element; + [propName: string]: any; + }> { + } + interface ojCopy extends CustomEvent<{ + items: Element[]; + [propName: string]: any; + }> { + } + interface ojCut extends CustomEvent<{ + items: Element[]; + [propName: string]: any; + }> { + } + interface ojExpand extends CustomEvent<{ + key: K; + item: Element; + [propName: string]: any; + }> { + } + interface ojPaste extends CustomEvent<{ + item: Element; + [propName: string]: any; + }> { + } + interface ojReorder extends CustomEvent<{ + items: Element[]; + position: string; + reference: Element; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type ContextByNode = { + subId: string; + key: K; + index: number; + parent?: Element; + group?: boolean; + }; + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + datasource: DataProvider; + index: number; + key: K; + data: D; + parentElement: Element; + depth?: number; + parentKey?: K; + leaf?: boolean; + }; + // tslint:disable-next-line interface-over-type-literal + type ItemsDropContext = { + item: Element; + position: 'before' | 'after' | 'inside'; + reorder: boolean; + }; +} +export interface ojListViewEventMap extends baseComponentEventMap> { + 'ojAnimateEnd': ojListView.ojAnimateEnd; + 'ojAnimateStart': ojListView.ojAnimateStart; + 'ojBeforeCollapse': ojListView.ojBeforeCollapse; + 'ojBeforeCurrentItem': ojListView.ojBeforeCurrentItem; + 'ojBeforeExpand': ojListView.ojBeforeExpand; + 'ojCollapse': ojListView.ojCollapse; + 'ojCopy': ojListView.ojCopy; + 'ojCut': ojListView.ojCut; + 'ojExpand': ojListView.ojExpand; + 'ojPaste': ojListView.ojPaste; + 'ojReorder': ojListView.ojReorder; + 'asChanged': JetElementCustomEvent["as"]>; + 'currentItemChanged': JetElementCustomEvent["currentItem"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'dndChanged': JetElementCustomEvent["dnd"]>; + 'drillModeChanged': JetElementCustomEvent["drillMode"]>; + 'expandedChanged': JetElementCustomEvent["expanded"]>; + 'firstSelectedItemChanged': JetElementCustomEvent["firstSelectedItem"]>; + 'groupHeaderPositionChanged': JetElementCustomEvent["groupHeaderPosition"]>; + 'itemChanged': JetElementCustomEvent["item"]>; + 'scrollPolicyChanged': JetElementCustomEvent["scrollPolicy"]>; + 'scrollPolicyOptionsChanged': JetElementCustomEvent["scrollPolicyOptions"]>; + 'scrollPositionChanged': JetElementCustomEvent["scrollPosition"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'selectionRequiredChanged': JetElementCustomEvent["selectionRequired"]>; +} +export interface ojListViewSettableProperties extends baseComponentSettableProperties { + as: string; + currentItem: K; + data: DataProvider; + dnd: { + drag?: { + items: { + dataTypes?: string | string[]; + drag?: ((param0: Event) => void); + dragEnd?: ((param0: Event) => void); + dragStart?: ((param0: Event, param1: { + items: Element[]; + }) => void); + }; + }; + drop?: { + items: { + dataTypes?: string | string[]; + dragEnter?: ((param0: Event, param1: { + item: Element; + }) => void); + dragLeave?: ((param0: Event, param1: { + item: Element; + }) => void); + dragOver?: ((param0: Event, param1: { + item: Element; + }) => void); + drop?: ((param0: Event, param1: ojListView.ItemsDropContext) => void); + }; + }; + reorder: { + items: 'enabled' | 'disabled'; + }; + }; + drillMode: 'collapsible' | 'none'; + expanded: KeySet; + readonly firstSelectedItem: { + key: K; + data: D; + }; + groupHeaderPosition: 'static' | 'sticky'; + item: { + focusable?: ((param0: ojListView.ItemContext) => boolean) | boolean; + renderer?: ((param0: ojListView.ItemContext) => { + insert: Element | string; + } | undefined) | null; + selectable?: ((param0: ojListView.ItemContext) => boolean) | boolean; + }; + scrollPolicy: 'auto' | 'loadMoreOnScroll'; + scrollPolicyOptions: { + fetchSize?: number; + maxCount?: number; + scroller?: Element; + }; + scrollPosition: { + x?: number; + y?: number; + index?: number; + parent?: K; + key?: K; + offsetX?: number; + offsetY?: number; + }; + selection: K[]; + selectionMode: 'none' | 'single' | 'multiple'; + selectionRequired: boolean; + translations: { + accessibleNavigateSkipItems?: string; + accessibleReorderAfterItem?: string; + accessibleReorderBeforeItem?: string; + accessibleReorderInsideItem?: string; + accessibleReorderTouchInstructionText?: string; + indexerCharacters?: string; + labelCopy?: string; + labelCut?: string; + labelPaste?: string; + labelPasteAfter?: string; + labelPasteBefore?: string; + msgFetchingData?: string; + msgNoData?: string; + }; +} +export interface ojListViewSettablePropertiesLenient extends Partial> { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojlocaledata/index.d.ts b/types/oracle__oraclejet/ojlocaledata/index.d.ts new file mode 100644 index 0000000000..980d4fa2de --- /dev/null +++ b/types/oracle__oraclejet/ojlocaledata/index.d.ts @@ -0,0 +1,7 @@ +export function getDayNames(type?: 'abbreviated' | 'narrow' | 'wide'): string[]; +export function getFirstDayOfWeek(): number; +export function getMonthNames(type?: 'abbreviated' | 'narrow' | 'wide'): string[]; +export function getWeekendEnd(): number; +export function getWeekendStart(): number; +export function isMonthPriorToYear(): boolean; +export function setBundle(bundle: object): void; diff --git a/types/oracle__oraclejet/ojlogger/index.d.ts b/types/oracle__oraclejet/ojlogger/index.d.ts new file mode 100644 index 0000000000..493f251f55 --- /dev/null +++ b/types/oracle__oraclejet/ojlogger/index.d.ts @@ -0,0 +1,10 @@ +export let LEVEL_ERROR: number; +export let LEVEL_INFO: number; +export let LEVEL_LOG: number; +export let LEVEL_NONE: number; +export let LEVEL_WARN: number; +export function error(...args: Array): void; +export function info(...args: Array): void; +export function log(...args: Array): void; +export function option(key?: object | string, value?: any): any; +export function warn(...args: Array): void; diff --git a/types/oracle__oraclejet/ojmasonrylayout/index.d.ts b/types/oracle__oraclejet/ojmasonrylayout/index.d.ts new file mode 100644 index 0000000000..0de1b7ccb7 --- /dev/null +++ b/types/oracle__oraclejet/ojmasonrylayout/index.d.ts @@ -0,0 +1,119 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojMasonryLayout extends baseComponent { + reorderHandle: string | null; + translations: { + labelCut?: string; + labelPasteAfter?: string; + labelPasteBefore?: string; + }; + onReorderHandleChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojMasonryLayout.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojMasonryLayout.ojAnimateStart) => any) | null; + onOjBeforeInsert: ((event: ojMasonryLayout.ojBeforeInsert) => any) | null; + onOjBeforeRemove: ((event: ojMasonryLayout.ojBeforeRemove) => any) | null; + onOjBeforeReorder: ((event: ojMasonryLayout.ojBeforeReorder) => any) | null; + onOjBeforeResize: ((event: ojMasonryLayout.ojBeforeResize) => any) | null; + onOjInsert: ((event: ojMasonryLayout.ojInsert) => any) | null; + onOjRemove: ((event: ojMasonryLayout.ojRemove) => any) | null; + onOjReorder: ((event: ojMasonryLayout.ojReorder) => any) | null; + onOjResize: ((event: ojMasonryLayout.ojResize) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojMasonryLayoutEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojMasonryLayout[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojMasonryLayoutSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojMasonryLayoutSettablePropertiesLenient): void; + insertTile(selector: string, index: number): void; + refresh(): void; + removeTile(selector: string): void; + resizeTile(selector: string, sizeStyleClass: string): void; +} +export namespace ojMasonryLayout { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeInsert extends CustomEvent<{ + tile: Element; + index: number; + [propName: string]: any; + }> { + } + interface ojBeforeRemove extends CustomEvent<{ + tile: Element; + [propName: string]: any; + }> { + } + interface ojBeforeReorder extends CustomEvent<{ + tile: Element; + fromIndex: number; + [propName: string]: any; + }> { + } + interface ojBeforeResize extends CustomEvent<{ + tile: Element; + previousSizeStyleClass: string; + sizeStyleClass: string; + [propName: string]: any; + }> { + } + interface ojInsert extends CustomEvent<{ + tile: Element; + index: number; + [propName: string]: any; + }> { + } + interface ojRemove extends CustomEvent<{ + tile: Element; + [propName: string]: any; + }> { + } + interface ojReorder extends CustomEvent<{ + tile: Element; + fromIndex: number; + toIndex: number; + [propName: string]: any; + }> { + } + interface ojResize extends CustomEvent<{ + tile: Element; + previousSizeStyleClass: string; + sizeStyleClass: string; + [propName: string]: any; + }> { + } +} +export interface ojMasonryLayoutEventMap extends baseComponentEventMap { + 'ojAnimateEnd': ojMasonryLayout.ojAnimateEnd; + 'ojAnimateStart': ojMasonryLayout.ojAnimateStart; + 'ojBeforeInsert': ojMasonryLayout.ojBeforeInsert; + 'ojBeforeRemove': ojMasonryLayout.ojBeforeRemove; + 'ojBeforeReorder': ojMasonryLayout.ojBeforeReorder; + 'ojBeforeResize': ojMasonryLayout.ojBeforeResize; + 'ojInsert': ojMasonryLayout.ojInsert; + 'ojRemove': ojMasonryLayout.ojRemove; + 'ojReorder': ojMasonryLayout.ojReorder; + 'ojResize': ojMasonryLayout.ojResize; + 'reorderHandleChanged': JetElementCustomEvent; +} +export interface ojMasonryLayoutSettableProperties extends baseComponentSettableProperties { + reorderHandle: string | null; + translations: { + labelCut?: string; + labelPasteAfter?: string; + labelPasteBefore?: string; + }; +} +export interface ojMasonryLayoutSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojmenu/index.d.ts b/types/oracle__oraclejet/ojmenu/index.d.ts new file mode 100644 index 0000000000..b6b1c8a9cb --- /dev/null +++ b/types/oracle__oraclejet/ojmenu/index.d.ts @@ -0,0 +1,105 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojMenu extends baseComponent { + disabled: boolean; + openOptions: ojMenu.OpenOptions; + translations: { + ariaFocusSkipLink?: string; + labelCancel?: string; + }; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onOpenOptionsChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAction: ((event: ojMenu.ojAction) => any) | null; + onOjAnimateEnd: ((event: ojMenu.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojMenu.ojAnimateStart) => any) | null; + onOjBeforeOpen: ((event: ojMenu.ojBeforeOpen) => any) | null; + onOjClose: ((event: ojMenu.ojClose) => any) | null; + onOjOpen: ((event: ojMenu.ojOpen) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojMenuEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojMenu[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojMenuSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojMenuSettablePropertiesLenient): void; + open(event?: object, openOptions?: ojMenu.OpenOptions): void; + refresh(): void; +} +export namespace ojMenu { + interface ojAction extends CustomEvent<{ + [propName: string]: any; + }> { + } + interface ojAnimateEnd extends CustomEvent<{ + element: Element; + action: 'open' | 'close'; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: 'open' | 'close'; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeOpen extends CustomEvent<{ + [propName: string]: any; + }> { + } + interface ojClose extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + interface ojOpen extends CustomEvent<{ + event: Event; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type OpenOptions = { + display?: string; + initialFocus?: string; + launcher?: string | Element; + position?: Position; + }; + // tslint:disable-next-line interface-over-type-literal + type Position = { + my?: PositionAlign; + at?: PositionAlign; + offset?: PositionPoint; + of?: string | PositionPoint; + collision?: 'flip' | 'fit' | 'flipfit' | 'flipcenter' | 'none'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionAlign = { + vertical?: 'top' | 'bottom' | 'center'; + horizontal?: 'start' | 'end' | 'left' | 'center' | 'bottom'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionPoint = { + x?: number; + y?: number; + }; +} +export interface ojMenuEventMap extends baseComponentEventMap { + 'ojAction': ojMenu.ojAction; + 'ojAnimateEnd': ojMenu.ojAnimateEnd; + 'ojAnimateStart': ojMenu.ojAnimateStart; + 'ojBeforeOpen': ojMenu.ojBeforeOpen; + 'ojClose': ojMenu.ojClose; + 'ojOpen': ojMenu.ojOpen; + 'disabledChanged': JetElementCustomEvent; + 'openOptionsChanged': JetElementCustomEvent; +} +export interface ojMenuSettableProperties extends baseComponentSettableProperties { + disabled: boolean; + openOptions: ojMenu.OpenOptions; + translations: { + ariaFocusSkipLink?: string; + labelCancel?: string; + }; +} +export interface ojMenuSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojmenuselectmany/index.d.ts b/types/oracle__oraclejet/ojmenuselectmany/index.d.ts new file mode 100644 index 0000000000..f79a0b985d --- /dev/null +++ b/types/oracle__oraclejet/ojmenuselectmany/index.d.ts @@ -0,0 +1,39 @@ +import { DataProvider } from '../ojdataprovider'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojMenuSelectMany extends JetElement { + disabled: boolean; + options: ojMenuSelectMany.Option[] | DataProvider | null; + value: any[]; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onOptionsChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojMenuSelectManyEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojMenuSelectMany[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojMenuSelectManySettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojMenuSelectManySettablePropertiesLenient): void; +} +export interface ojMenuSelectManyEventMap extends HTMLElementEventMap { + 'disabledChanged': JetElementCustomEvent; + 'optionsChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojMenuSelectManySettableProperties extends JetSettableProperties { + disabled: boolean; + options: ojMenuSelectMany.Option[] | DataProvider | null; + value: any[]; +} +export interface ojMenuSelectManySettablePropertiesLenient extends Partial { + [key: string]: any; +} +export namespace ojMenuSelectMany { + // tslint:disable-next-line interface-over-type-literal + type Option = { + id?: string; + disabled?: boolean; + label: string; + value: any; + }; +} diff --git a/types/oracle__oraclejet/ojmessage/index.d.ts b/types/oracle__oraclejet/ojmessage/index.d.ts new file mode 100644 index 0000000000..55e905ba8d --- /dev/null +++ b/types/oracle__oraclejet/ojmessage/index.d.ts @@ -0,0 +1,80 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojMessage extends JetElement { + message: ojMessage.Message; + translations: { + categories?: { + confirmation?: string; + error?: string; + info?: string; + warning?: string; + }; + labelCloseIcon?: string; + }; + onMessageChanged: ((event: JetElementCustomEvent) => any) | null; + onTranslationsChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojMessage.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojMessage.ojAnimateStart) => any) | null; + onOjClose: ((event: ojMessage.ojClose) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojMessageEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojMessage[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojMessageSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojMessageSettablePropertiesLenient): void; + close(): void; +} +export namespace ojMessage { + interface ojAnimateEnd extends CustomEvent<{ + element: Element; + action: 'open' | 'close'; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + element: Element; + action: 'open' | 'close'; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojClose extends CustomEvent<{ + message: object; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type Message = { + icon?: string; + category?: string; + severity?: 'error' | 'warning' | 'confirmation' | 'info' | 'none'; + timestamp?: string; + summary?: string; + detail?: string; + autoTimeout?: number; + closeAffordance?: 'none' | 'defaults'; + sound?: string; + }; +} +export interface ojMessageEventMap extends HTMLElementEventMap { + 'ojAnimateEnd': ojMessage.ojAnimateEnd; + 'ojAnimateStart': ojMessage.ojAnimateStart; + 'ojClose': ojMessage.ojClose; + 'messageChanged': JetElementCustomEvent; + 'translationsChanged': JetElementCustomEvent; +} +export interface ojMessageSettableProperties extends JetSettableProperties { + message: ojMessage.Message; + translations: { + categories?: { + confirmation?: string; + error?: string; + info?: string; + warning?: string; + }; + labelCloseIcon?: string; + }; +} +export interface ojMessageSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojmessages/index.d.ts b/types/oracle__oraclejet/ojmessages/index.d.ts new file mode 100644 index 0000000000..0b410266a3 --- /dev/null +++ b/types/oracle__oraclejet/ojmessages/index.d.ts @@ -0,0 +1,73 @@ +import { DataProvider } from '../ojdataprovider'; +import { ojMessage } from '../ojmessage'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojMessages extends JetElement { + display: 'general' | 'notification'; + messages: ojMessage.Message[] | null | DataProvider; + position: ojMessages.Position | null; + translations: { + ariaLiveRegion?: { + navigationFromKeyboard?: string; + navigationToKeyboard?: string; + navigationToTouch?: string; + newMessage?: string; + }; + labelLandmark?: string; + }; + onDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onMessagesChanged: ((event: JetElementCustomEvent) => any) | null; + onPositionChanged: ((event: JetElementCustomEvent) => any) | null; + onTranslationsChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojMessagesEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojMessages[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojMessagesSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojMessagesSettablePropertiesLenient): void; + close(associated: object): void; + closeAll(closeFilter?: (message: ojMessage.Message) => boolean): void; +} +export interface ojMessagesEventMap extends HTMLElementEventMap { + 'displayChanged': JetElementCustomEvent; + 'messagesChanged': JetElementCustomEvent; + 'positionChanged': JetElementCustomEvent; + 'translationsChanged': JetElementCustomEvent; +} +export interface ojMessagesSettableProperties extends JetSettableProperties { + display: 'general' | 'notification'; + messages: ojMessage.Message[] | null | DataProvider; + position: ojMessages.Position | null; + translations: { + ariaLiveRegion?: { + navigationFromKeyboard?: string; + navigationToKeyboard?: string; + navigationToTouch?: string; + newMessage?: string; + }; + labelLandmark?: string; + }; +} +export interface ojMessagesSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export namespace ojMessages { + // tslint:disable-next-line interface-over-type-literal + type Position = { + my?: PositionAlign; + at?: PositionAlign; + offset?: PositionPoint; + of?: string | PositionPoint; + collision?: 'flip' | 'fit' | 'flipfit' | 'none'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionAlign = { + vertical?: 'top' | 'bottom' | 'center'; + horizontal?: 'start' | 'end' | 'left' | 'center' | 'bottom'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionPoint = { + x?: number; + y?: number; + }; +} diff --git a/types/oracle__oraclejet/ojmessaging/index.d.ts b/types/oracle__oraclejet/ojmessaging/index.d.ts new file mode 100644 index 0000000000..0af2305ef7 --- /dev/null +++ b/types/oracle__oraclejet/ojmessaging/index.d.ts @@ -0,0 +1,15 @@ +declare class Message { + detail: string; + severity: Message.SEVERITY_TYPE | Message.SEVERITY_LEVEL; + summary: string; + constructor(summary: string, detail: string, severity?: Message.SEVERITY_TYPE | Message.SEVERITY_LEVEL); + static getMaxSeverity(messages?: Message[]): Message.SEVERITY_LEVEL | -1; + static getSeverityLevel(severity?: Message.SEVERITY_TYPE | Message.SEVERITY_LEVEL): Message.SEVERITY_LEVEL; + static getSeverityType(level?: Message.SEVERITY_TYPE | Message.SEVERITY_LEVEL): Message.SEVERITY_TYPE; + static isValid(messages: Message[]): boolean; +} +declare namespace Message { + type SEVERITY_LEVEL = 5 | 4 | 3 | 2 | 1; + type SEVERITY_TYPE = "confirmation" | "info" | "warning" | "error" | "fatal"; +} +export = Message; diff --git a/types/oracle__oraclejet/ojmodel/index.d.ts b/types/oracle__oraclejet/ojmodel/index.d.ts new file mode 100644 index 0000000000..d2ffaf54f6 --- /dev/null +++ b/types/oracle__oraclejet/ojmodel/index.d.ts @@ -0,0 +1,280 @@ +export class Collection { + changes: number[]; + comparator: null | string | ((param0: Model, param1?: Model) => number); + customPagingOptions: ((response: object) => Collection.CustomPagingOptionsReturn | null) | null; + customURL: ((param0: string, param1: Collection, param2: object) => string | object | null) | null; + fetchSize: number; + hasMore: boolean; + lastFetchCount: number; + lastFetchSize: number; + length: number; + model: object; + modelLimit: number; + models: Model[]; + offset: number; + omitLanguageHeader: boolean; + parse: ((param0: object) => object); + sortDirection: number; + totalResults: number; + url: null | string | (() => string); + constructor(models?: Model[], options?: object); + static extend(properties?: { + parse?: (data: any) => any; + model?: Model; + url?: string; + initialize?: (models: Model[], options: object) => void; + comparator?: null | string | ((model1: Model, model2?: Model) => number); + fetchSize?: number; + modelLimit?: number; + [propName: string]: any; + }, classProperties?: object): any; + abort(): Promise; + add(m: Model | object | object[] | Model[], options?: { + silent?: boolean; + at?: number; + merge?: boolean; + sort?: boolean; + force?: boolean; + deferred?: boolean; + [propName: string]: any; + }): Promise | Model[]; + any(iterator: ((param0: object) => void), context?: object): boolean; + at(index: number, options?: { + fetchSize?: number; + deferred?: boolean; + [propName: string]: any; + }): Model | Promise | null; + clone(): Collection; + contains(model: object, options?: object): boolean | Promise; + create(attributes?: object, options?: { + silent?: boolean; + at?: number; + merge?: boolean; + sort?: boolean; + force?: boolean; + deferred?: boolean; + [propName: string]: any; + }): Model | boolean | Promise; + difference(...var_args: Model[][]): Model[]; + each(iterator: ((param0: Model) => void), context?: object): undefined; + fetch(options?: { + success?: (collection: Collection, response: any, options: object) => void; + error?: (collection: Collection, xhr: any, options: object) => void; + add?: boolean; + set?: boolean; + startIndex?: number; + startID?: any; + since?: any; + until?: any; + fetchSize?: number; + [propName: string]: any; + }): object; + filter(iterator: ((param0: Model) => void), context?: object): Model[]; + findWhere(attrs: object | object[], options?: { + deferred?: boolean; + [propName: string]: any; + }): Model | Promise; + first(n?: number, options?: object): Model[] | null | Promise; + get(id: object | string, options?: object): Model | null | Promise; + getByCid(clientId: string): Model | null; + groupBy(iterator: string | ((param0: Model) => object), context?: object): object; + include(model: object, options?: object): boolean | Promise; + indexBy(iterator: string | ((param0: Model) => void), context?: object): object; + indexOf(model: object, options?: object): number | Promise; + initial(n?: number): Model[]; + isEmpty(): boolean; + isRangeLocal(start: number, count: number): boolean; + last(n?: number, options?: object): Promise | Model[] | null; + lastIndexOf(model: Model, fromIndex?: number): number; + listenTo(otherObj: object, eventType: string, callback: (eventType: string, data: object) => void): undefined; + listenToOnce(otherObj: object, eventType: string, callback: (eventType: string, data: object) => void): undefined; + map(iterator: ((param0: Model) => object), context?: object): object[]; + max(iterator: ((param0: Model) => object), context?: object): object; + min(iterator: ((param0: object) => void), context?: object): object; + modelId(attrs: object): null | string; + next(n: number, options?: { + success?: (collection: Collection, response: any, options: object) => void; + error?: (collection: Collection, xhr: any, options: object) => void; + [propName: string]: any; + }): object | null; + off(eventType?: string | object, callback?: (eventType: string, data: object) => void, context?: object): undefined; + on(eventType: string | object, callback: (eventType: string, data: object) => void, context?: object): undefined; + once(eventType: string, callback: (eventType: string, data: object) => void, context?: object): undefined; + pluck(attr: string): object[]; + pop(options?: { + silent?: boolean; + deferred?: boolean; + [propName: string]: any; + }): Model | Promise; + previous(n: number, options?: { + success?: (collection: Collection, response: any, options: object) => void; + error?: (collection: Collection, xhr: any, options: object) => void; + [propName: string]: any; + }): object; + push(m: Model | object, options?: { + silent?: boolean; + at?: number; + merge?: boolean; + sort?: boolean; + force?: boolean; + deferred?: boolean; + [propName: string]: any; + }): Promise | undefined; + refresh(options?: { + silent?: boolean; + startIndex?: number; + [propName: string]: any; + }): Promise; + remove(m: Model | Model[], options?: object): Model[] | object; + reset(data?: object, options?: { + silent?: boolean; + [propName: string]: any; + }): Model | Model[]; + rest(n?: number, options?: object): object[] | Promise; + set(models: object, options?: { + add?: boolean; + remove?: boolean; + merge?: boolean; + silent?: boolean; + deferred?: boolean; + [propName: string]: any; + }): Promise | null; + setFetchSize(n: number): undefined; + setModelLimit(n: number): undefined; + setRangeLocal(start: number, count: number): Promise; + shift(options?: object): Model | Promise | null; + size(): number; + slice(start: number, end?: number, options?: object): Promise | Model[]; + sort(options?: { + silent?: boolean; + startIndex?: number; + [propName: string]: any; + }): Promise | null; + sortBy(iterator: string | ((param0: Model) => object), context?: object): Model[]; + sortedIndex(comparator: string | ((param0: Model, param1?: Model) => object)): number; + stopListening(otherObj?: object, eventType?: string, callback?: (eventType: string, data: object) => void): undefined; + sync(method: string, collection: Collection, options?: { + success?: (json?: any[]) => void; + error?: (xhr: any, status: any, error: any) => void; + [propName: string]: any; + }): object; + toJSON(): object[]; + trigger(eventType: string): undefined; + unshift(m: object, options?: { + silent?: boolean; + at?: number; + merge?: boolean; + sort?: boolean; + force?: boolean; + deferred?: boolean; + [propName: string]: any; + }): Promise | Model[]; + whenReady(): Promise; + where(attrs: object | object[], options?: object): Promise | Model[]; + whereToCollection(attrs: object | object[], options?: object): Collection | Promise; + without(...var_args: Model[]): Model[]; +} +export namespace Collection { + // tslint:disable-next-line interface-over-type-literal + type CustomPagingOptionsReturn = { + totalResults?: number; + limit?: number; + count?: number; + offset?: number; + hasMore?: boolean; + }; + // tslint:disable-next-line interface-over-type-literal + type SetRangeLocalPromise = { + start: number; + count: number; + models: Model[]; + }; +} +export class Model { + attributes: object; + customURL: ((param0: string, param1: Model, param2: object) => string | object | null) | null; + defaults: object; + id: string | null; + idAttribute: string | null; + omitLanguageHeader: boolean; + parse: ((param0: object) => object); + parseSave: ((param0: object) => object); + urlRoot: string | null; + validate: ((param0: object, param1: object) => string | object | null) | null; + validationError: string | object | null; + constructor(attributes?: object, options?: object); + static extend(properties?: { + parse?: (data: any) => any; + parseSave?: (data: any) => any; + urlRoot?: string; + initialize?: (models: Model[], options: object) => void; + validate?: null | object | string | ((attributes: object, options?: Model) => number); + [propName: string]: any; + }, classProperties?: object): any; + changedAttributes(attributes?: object): object | boolean; + clear(options?: object): Model | boolean; + clone(): Model; + destroy(options?: { + success?: (model: Model, response: any, options: object) => void; + error?: (model: Model, xhr: any, options: object) => void; + wait?: boolean; + [propName: string]: any; + }): boolean; + fetch(options?: { + success?: (model: Model, response: any, options: object) => void; + error?: (model: Model, xhr: any, options: object) => void; + [propName: string]: any; + }): object; + get(property: string): object; + has(property: string): boolean; + hasChanged(attribute?: string): boolean; + invert(): object; + isNew(): boolean; + isValid(): boolean; + keys(): object[]; + listenTo(otherObj: object, eventType: string, callback: (eventType: string, data: object) => void): undefined; + listenToOnce(otherObj: object, eventType: string, callback: (eventType: string, data: object) => void): undefined; + matches(attrs: object): ((param0: Model) => boolean); + off(eventType?: string | object, callback?: (eventType: string, data: object) => void, context?: object): undefined; + omit(keys: object[] | object): object; + on(eventType: string | object, callback: (eventType: string, data: object) => void, context?: object): undefined; + once(eventType: string, callback: (eventType: string, data: object) => void, context?: object): undefined; + pairs(): object; + pick(keys: object[] | object): object; + previous(attr: string): object; + previousAttributes(): object; + save(attributes?: object, options?: { + success?: (model: Model, response: any, options: object) => void; + error?: (model: Model, xhr: any, options: object) => void; + contentType?: string; + valdiate?: boolean; + wait?: boolean; + patch?: boolean; + attrs?: object; + [propName: string]: any; + }): object | boolean; + set(property: string | object, value?: object, options?: object): Model | boolean; + stopListening(otherObj?: object, eventType?: string, callback?: (eventType: string, data: object) => void): undefined; + sync(method: string, model: Model, options?: object): object; + toJSON(): object; + trigger(eventType: string): undefined; + unset(property: string, options?: object): boolean; + url(): string | null; + values(): object[]; +} +export class OAuth { + constructor(attributes: object, header: string); + cleanAccessTokenRequest(): undefined; + cleanAccessTokenResponse(): undefined; + clientCredentialGrant(): undefined; + getAccessTokenRequest(): object; + getAccessTokenResponse(): object; + getHeader(): object; + isInitialized(): boolean; + setAccessTokenRequest(data: object): undefined; + setAccessTokenResponse(data: object): undefined; +} +// tslint:disable-next-line no-unnecessary-class +export class URLError { + constructor(); +} diff --git a/types/oracle__oraclejet/ojmodule-element-utils/index.d.ts b/types/oracle__oraclejet/ojmodule-element-utils/index.d.ts new file mode 100644 index 0000000000..4489ac1f28 --- /dev/null +++ b/types/oracle__oraclejet/ojmodule-element-utils/index.d.ts @@ -0,0 +1,8 @@ +export function createView(options: { + viewPath: string; + require?: ((module: string) => any) | ((modules: string[], ready?: any, errback?: any) => void); +}): Promise; +export function createViewModel(options: { + viewModelPath: string; + require?: ((module: string) => any) | ((modules: string[], ready?: any, errback?: any) => void); +}): Promise; diff --git a/types/oracle__oraclejet/ojmodule-element/index.d.ts b/types/oracle__oraclejet/ojmodule-element/index.d.ts new file mode 100644 index 0000000000..693cb518f6 --- /dev/null +++ b/types/oracle__oraclejet/ojmodule-element/index.d.ts @@ -0,0 +1,89 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ModuleElementAnimation { + animate(context: { + node: Node; + isInitial: boolean; + oldViewModel: object; + newViewModel: object; + newViewParent: Node; + oldViewParent: Node; + removeOldView: () => undefined; + insertNewView: () => undefined; + oldDomNodes: any[]; + }): Promise; + canAnimate(context: { + node: Node; + isInitial: boolean; + oldViewModel: object; + newViewModel: object; + }): boolean; + prepareAnimation(context: { + node: Node; + isInitial: boolean; + oldViewModel: object; + newViewModel: object; + }): object; +} +export interface ojModule extends JetElement { + animation: object; + config: { + cleanupMode: 'onDisconnect' | 'none'; + view: Node[]; + viewModel: object; + }; + onAnimationChanged: ((event: JetElementCustomEvent) => any) | null; + onConfigChanged: ((event: JetElementCustomEvent) => any) | null; + onOjTransitionEnd: ((event: ojModule.ojTransitionEnd) => any) | null; + onOjTransitionStart: ((event: ojModule.ojTransitionStart) => any) | null; + onOjViewConnected: ((event: ojModule.ojViewConnected) => any) | null; + onOjViewDisconnected: ((event: ojModule.ojViewDisconnected) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojModuleEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojModule[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojModuleSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojModuleSettablePropertiesLenient): void; +} +export namespace ojModule { + interface ojTransitionEnd extends CustomEvent<{ + viewModel: object; + [propName: string]: any; + }> { + } + interface ojTransitionStart extends CustomEvent<{ + viewModel: object; + [propName: string]: any; + }> { + } + interface ojViewConnected extends CustomEvent<{ + viewModel: object; + [propName: string]: any; + }> { + } + interface ojViewDisconnected extends CustomEvent<{ + viewModel: object; + view: Node[]; + [propName: string]: any; + }> { + } +} +export interface ojModuleEventMap extends HTMLElementEventMap { + 'ojTransitionEnd': ojModule.ojTransitionEnd; + 'ojTransitionStart': ojModule.ojTransitionStart; + 'ojViewConnected': ojModule.ojViewConnected; + 'ojViewDisconnected': ojModule.ojViewDisconnected; + 'animationChanged': JetElementCustomEvent; + 'configChanged': JetElementCustomEvent; +} +export interface ojModuleSettableProperties extends JetSettableProperties { + animation: object; + config: { + cleanupMode: 'onDisconnect' | 'none'; + view: Node[]; + viewModel: object; + }; +} +export interface ojModuleSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojmoduleanimations/index.d.ts b/types/oracle__oraclejet/ojmoduleanimations/index.d.ts new file mode 100644 index 0000000000..65e98ba0a7 --- /dev/null +++ b/types/oracle__oraclejet/ojmoduleanimations/index.d.ts @@ -0,0 +1,34 @@ +import { ModuleElementAnimation } from '../ojmodule-element'; +import AnimationUtils = require('../ojanimation'); +export let coverStart: ModuleElementAnimation; +export let coverUp: ModuleElementAnimation; +export let fade: ModuleElementAnimation; +export let navChild: ModuleElementAnimation; +export let navParent: ModuleElementAnimation; +export let navSiblingEarlier: ModuleElementAnimation; +export let navSiblingLater: ModuleElementAnimation; +export let pushEnd: ModuleElementAnimation; +export let pushStart: ModuleElementAnimation; +export let revealDown: ModuleElementAnimation; +export let revealEnd: ModuleElementAnimation; +export let zoomIn: ModuleElementAnimation; +export let zoomOut: ModuleElementAnimation; +export function createAnimation(oldViewEffect: { + effect: AnimationUtils.AnimationMethods; + [key: string]: any; +} | AnimationUtils.AnimationMethods | null, newViewEffect: { + effect: AnimationUtils.AnimationMethods; + [key: string]: any; +} | AnimationUtils.AnimationMethods | null, newViewOnTop: boolean): ModuleElementAnimation; +export function switcher(callback: (param0: SwitcherCallBackParam) => Animations): ModuleElementAnimation; +// tslint:disable-next-line interface-over-type-literal +export type Animations = 'coverStart' | 'coverUp' | 'fade' | 'navChild' | 'navParent' | 'navSiblingEarlier' | 'navSiblingLater' | 'pushEnd' | 'pushStart' | 'revealDown' | 'revealEnd' | 'zoomIn' | + 'zoomOut'; +// tslint:disable-next-line interface-over-type-literal +export type SwitcherCallBackParam = { + node: Element; + valueAccessor: (() => any); + isInitial: boolean; + oldViewModel: any; + newViewModel: any; +}; diff --git a/types/oracle__oraclejet/ojnavigationlist/index.d.ts b/types/oracle__oraclejet/ojnavigationlist/index.d.ts new file mode 100644 index 0000000000..d18459c5ba --- /dev/null +++ b/types/oracle__oraclejet/ojnavigationlist/index.d.ts @@ -0,0 +1,360 @@ +import { KeySet } from '../ojkeyset'; +import { DataProvider } from '../ojdataprovider'; +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojNavigationList extends baseComponent> { + as: string; + currentItem: K; + data: DataProvider | null; + display: 'all' | 'icons'; + drillMode: 'none' | 'collapsible' | 'sliding'; + edge: 'top' | 'start'; + expanded: KeySet; + hierarchyMenuThreshold: number; + item: { + renderer?: (((context: ojNavigationList.ItemContext) => void) | null); + selectable?: (((context: ojNavigationList.ItemContext) => boolean) | boolean); + }; + overflow: 'popup' | 'hidden'; + rootLabel: string | null; + selection: K; + translations: { + defaultRootLabel?: string; + hierMenuBtnLabel?: string; + previousIcon?: string; + }; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onCurrentItemChanged: ((event: JetElementCustomEvent["currentItem"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDisplayChanged: ((event: JetElementCustomEvent["display"]>) => any) | null; + onDrillModeChanged: ((event: JetElementCustomEvent["drillMode"]>) => any) | null; + onEdgeChanged: ((event: JetElementCustomEvent["edge"]>) => any) | null; + onExpandedChanged: ((event: JetElementCustomEvent["expanded"]>) => any) | null; + onHierarchyMenuThresholdChanged: ((event: JetElementCustomEvent["hierarchyMenuThreshold"]>) => any) | null; + onItemChanged: ((event: JetElementCustomEvent["item"]>) => any) | null; + onOverflowChanged: ((event: JetElementCustomEvent["overflow"]>) => any) | null; + onRootLabelChanged: ((event: JetElementCustomEvent["rootLabel"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onOjAnimateEnd: ((event: ojNavigationList.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojNavigationList.ojAnimateStart) => any) | null; + onOjBeforeCollapse: ((event: ojNavigationList.ojBeforeCollapse) => any) | null; + onOjBeforeCurrentItem: ((event: ojNavigationList.ojBeforeCurrentItem) => any) | null; + onOjBeforeExpand: ((event: ojNavigationList.ojBeforeExpand) => any) | null; + onOjBeforeSelect: ((event: ojNavigationList.ojBeforeSelect) => any) | null; + onOjCollapse: ((event: ojNavigationList.ojCollapse) => any) | null; + onOjExpand: ((event: ojNavigationList.ojExpand) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojNavigationListEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojNavigationList[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojNavigationListSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojNavigationListSettablePropertiesLenient): void; + getContextByNode(node: Element): ojNavigationList.NodeContext | null; + refresh(): void; +} +export namespace ojNavigationList { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeCollapse extends CustomEvent<{ + key: any; + item: Element; + [propName: string]: any; + }> { + } + interface ojBeforeCurrentItem extends CustomEvent<{ + previousKey: any; + previousItem: Element; + key: any; + item: Element; + [propName: string]: any; + }> { + } + interface ojBeforeExpand extends CustomEvent<{ + key: any; + item: Element; + [propName: string]: any; + }> { + } + interface ojBeforeSelect extends CustomEvent<{ + key: any; + item: Element; + [propName: string]: any; + }> { + } + interface ojCollapse extends CustomEvent<{ + key: any; + item: Element; + [propName: string]: any; + }> { + } + interface ojExpand extends CustomEvent<{ + key: any; + item: Element; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + componentElement: Element; + datasource?: DataProvider; + index: number; + key: any; + data: any; + parentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + subId: string; + index: number; + key: K; + group: boolean; + parent?: Element; + }; +} +export interface ojNavigationListEventMap extends baseComponentEventMap> { + 'ojAnimateEnd': ojNavigationList.ojAnimateEnd; + 'ojAnimateStart': ojNavigationList.ojAnimateStart; + 'ojBeforeCollapse': ojNavigationList.ojBeforeCollapse; + 'ojBeforeCurrentItem': ojNavigationList.ojBeforeCurrentItem; + 'ojBeforeExpand': ojNavigationList.ojBeforeExpand; + 'ojBeforeSelect': ojNavigationList.ojBeforeSelect; + 'ojCollapse': ojNavigationList.ojCollapse; + 'ojExpand': ojNavigationList.ojExpand; + 'asChanged': JetElementCustomEvent["as"]>; + 'currentItemChanged': JetElementCustomEvent["currentItem"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'displayChanged': JetElementCustomEvent["display"]>; + 'drillModeChanged': JetElementCustomEvent["drillMode"]>; + 'edgeChanged': JetElementCustomEvent["edge"]>; + 'expandedChanged': JetElementCustomEvent["expanded"]>; + 'hierarchyMenuThresholdChanged': JetElementCustomEvent["hierarchyMenuThreshold"]>; + 'itemChanged': JetElementCustomEvent["item"]>; + 'overflowChanged': JetElementCustomEvent["overflow"]>; + 'rootLabelChanged': JetElementCustomEvent["rootLabel"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; +} +export interface ojNavigationListSettableProperties extends baseComponentSettableProperties { + as: string; + currentItem: K; + data: DataProvider | null; + display: 'all' | 'icons'; + drillMode: 'none' | 'collapsible' | 'sliding'; + edge: 'top' | 'start'; + expanded: KeySet; + hierarchyMenuThreshold: number; + item: { + renderer?: (((context: ojNavigationList.ItemContext) => void) | null); + selectable?: (((context: ojNavigationList.ItemContext) => boolean) | boolean); + }; + overflow: 'popup' | 'hidden'; + rootLabel: string | null; + selection: K; + translations: { + defaultRootLabel?: string; + hierMenuBtnLabel?: string; + previousIcon?: string; + }; +} +export interface ojNavigationListSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojTabBar extends baseComponent> { + as: string; + currentItem: any; + data: DataProvider | null; + display: 'all' | 'icons'; + edge: 'top' | 'bottom' | 'start' | 'end'; + item: { + renderer?: (((context: ojTabBar.ItemContext) => void) | null); + selectable?: (((context: ojTabBar.ItemContext) => boolean) | boolean); + }; + overflow: 'popup' | 'hidden'; + reorderable: 'enabled' | 'disabled'; + selection: any; + truncation: 'none' | 'progressive'; + translations: { + accessibleReorderAfterItem?: string; + accessibleReorderBeforeItem?: string; + accessibleReorderTouchInstructionText?: string; + labelCut?: string; + labelPasteAfter?: string; + labelPasteBefore?: string; + labelRemove?: string; + msgFetchingData?: string; + msgNoData?: string; + overflowItemLabel?: string; + removeCueText?: string; + selectedLabel?: string; + }; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onCurrentItemChanged: ((event: JetElementCustomEvent["currentItem"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDisplayChanged: ((event: JetElementCustomEvent["display"]>) => any) | null; + onEdgeChanged: ((event: JetElementCustomEvent["edge"]>) => any) | null; + onItemChanged: ((event: JetElementCustomEvent["item"]>) => any) | null; + onOverflowChanged: ((event: JetElementCustomEvent["overflow"]>) => any) | null; + onReorderableChanged: ((event: JetElementCustomEvent["reorderable"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onTruncationChanged: ((event: JetElementCustomEvent["truncation"]>) => any) | null; + onOjAnimateEnd: ((event: ojTabBar.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojTabBar.ojAnimateStart) => any) | null; + onOjBeforeCurrentItem: ((event: ojTabBar.ojBeforeCurrentItem) => any) | null; + onOjBeforeDeselect: ((event: ojTabBar.ojBeforeDeselect) => any) | null; + onOjBeforeRemove: ((event: ojTabBar.ojBeforeRemove) => any) | null; + onOjBeforeSelect: ((event: ojTabBar.ojBeforeSelect) => any) | null; + onOjDeselect: ((event: ojTabBar.ojDeselect) => any) | null; + onOjRemove: ((event: ojTabBar.ojRemove) => any) | null; + onOjReorder: ((event: ojTabBar.ojReorder) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojTabBarEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojTabBar[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojTabBarSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojTabBarSettablePropertiesLenient): void; + getContextByNode(node: Element): ojTabBar.NodeContext | null; + refresh(): void; +} +export namespace ojTabBar { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeCurrentItem extends CustomEvent<{ + previousKey: any; + previousItem: Element; + key: any; + item: Element; + [propName: string]: any; + }> { + } + interface ojBeforeDeselect extends CustomEvent<{ + fromKey: any; + fromItem: Element; + toKey: any; + toItem: Element; + [propName: string]: any; + }> { + } + interface ojBeforeRemove extends CustomEvent<{ + item: Element; + key: any; + [propName: string]: any; + }> { + } + interface ojBeforeSelect extends CustomEvent<{ + key: any; + item: Element; + [propName: string]: any; + }> { + } + interface ojDeselect extends CustomEvent<{ + fromKey: any; + fromItem: Element; + toKey: any; + toItem: Element; + [propName: string]: any; + }> { + } + interface ojRemove extends CustomEvent<{ + item: Element; + key: any; + [propName: string]: any; + }> { + } + interface ojReorder extends CustomEvent<{ + item: Element; + position: 'before' | 'after'; + reference: Element; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + componentElement: Element; + datasource?: DataProvider; + index: number; + key: K; + data: D; + parentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + subId: string; + index: number; + key: K; + }; +} +export interface ojTabBarEventMap extends baseComponentEventMap> { + 'ojAnimateEnd': ojTabBar.ojAnimateEnd; + 'ojAnimateStart': ojTabBar.ojAnimateStart; + 'ojBeforeCurrentItem': ojTabBar.ojBeforeCurrentItem; + 'ojBeforeDeselect': ojTabBar.ojBeforeDeselect; + 'ojBeforeRemove': ojTabBar.ojBeforeRemove; + 'ojBeforeSelect': ojTabBar.ojBeforeSelect; + 'ojDeselect': ojTabBar.ojDeselect; + 'ojRemove': ojTabBar.ojRemove; + 'ojReorder': ojTabBar.ojReorder; + 'asChanged': JetElementCustomEvent["as"]>; + 'currentItemChanged': JetElementCustomEvent["currentItem"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'displayChanged': JetElementCustomEvent["display"]>; + 'edgeChanged': JetElementCustomEvent["edge"]>; + 'itemChanged': JetElementCustomEvent["item"]>; + 'overflowChanged': JetElementCustomEvent["overflow"]>; + 'reorderableChanged': JetElementCustomEvent["reorderable"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'truncationChanged': JetElementCustomEvent["truncation"]>; +} +export interface ojTabBarSettableProperties extends baseComponentSettableProperties { + as: string; + currentItem: any; + data: DataProvider | null; + display: 'all' | 'icons'; + edge: 'top' | 'bottom' | 'start' | 'end'; + item: { + renderer?: (((context: ojTabBar.ItemContext) => void) | null); + selectable?: (((context: ojTabBar.ItemContext) => boolean) | boolean); + }; + overflow: 'popup' | 'hidden'; + reorderable: 'enabled' | 'disabled'; + selection: any; + truncation: 'none' | 'progressive'; + translations: { + accessibleReorderAfterItem?: string; + accessibleReorderBeforeItem?: string; + accessibleReorderTouchInstructionText?: string; + labelCut?: string; + labelPasteAfter?: string; + labelPasteBefore?: string; + labelRemove?: string; + msgFetchingData?: string; + msgNoData?: string; + overflowItemLabel?: string; + removeCueText?: string; + selectedLabel?: string; + }; +} +export interface ojTabBarSettablePropertiesLenient extends Partial> { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojnbox/index.d.ts b/types/oracle__oraclejet/ojnbox/index.d.ts new file mode 100644 index 0000000000..9b7f31cdad --- /dev/null +++ b/types/oracle__oraclejet/ojnbox/index.d.ts @@ -0,0 +1,490 @@ +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojNBox extends dvtBaseComponent> { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + cellContent: 'counts' | 'auto'; + cellMaximize: 'off' | 'on'; + cells: Promise | null; + columns: Promise | null; + columnsTitle: string; + countLabel: ((context: ojNBox.CountLabelContext) => (string | null)); + data: DataProvider | null; + groupAttributes: 'color' | 'indicatorColor' | 'indicatorIconColor' | 'indicatorIconPattern' | 'indicatorIconShape'; + groupBehavior: 'acrossCells' | 'none' | 'withinCell'; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + labelTruncation: 'ifRequired' | 'on'; + maximizedColumn: string; + maximizedRow: string; + otherColor: string; + otherThreshold: number; + rows: Promise | null; + rowsTitle: string; + selection: K[]; + selectionMode: 'none' | 'single' | 'multiple'; + styleDefaults: { + animationDuration: number; + cellDefaults: { + labelHalign: 'center' | 'end' | 'start'; + labelStyle: object; + maximizedSvgStyle: object; + minimizedSvgStyle: object; + showCount: 'on' | 'off' | 'auto'; + svgStyle: object; + }; + columnLabelStyle: object; + columnsTitleStyle: object; + hoverBehaviorDelay: number; + nodeDefaults: { + borderColor: string; + borderWidth: number; + color: string; + iconDefaults: { + borderColor: string; + borderRadius: string; + borderWidth: number; + color: string; + height: number; + opacity: number; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shape: 'circle' | 'ellipse' | 'square' | 'plus' | 'diamond' | 'triangleUp' | 'triangleDown' | 'human' | 'rectangle' | 'star'; + source: string; + width: number; + }; + indicatorColor: string; + indicatorIconDefaults: { + borderColor: string; + borderRadius: string; + borderWidth: number; + color: string; + height: number; + opacity: number; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shape: 'circle' | 'ellipse' | 'square' | 'plus' | 'diamond' | 'triangleUp' | 'triangleDown' | 'human' | 'rectangle' | 'star'; + source: string; + width: number; + }; + labelStyle: object; + secondaryLabelStyle: object; + }; + rowLabelStyle: object; + rowsTitleStyle: object; + }; + tooltip: { + renderer: ((context: ojNBox.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })) | null; + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + highlightedCount?: string; + labelAdditionalData?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelGroup?: string; + labelInvalidData?: string; + labelNoData?: string; + labelOther?: string; + labelSize?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onCellContentChanged: ((event: JetElementCustomEvent["cellContent"]>) => any) | null; + onCellMaximizeChanged: ((event: JetElementCustomEvent["cellMaximize"]>) => any) | null; + onCellsChanged: ((event: JetElementCustomEvent["cells"]>) => any) | null; + onColumnsChanged: ((event: JetElementCustomEvent["columns"]>) => any) | null; + onColumnsTitleChanged: ((event: JetElementCustomEvent["columnsTitle"]>) => any) | null; + onCountLabelChanged: ((event: JetElementCustomEvent["countLabel"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onGroupAttributesChanged: ((event: JetElementCustomEvent["groupAttributes"]>) => any) | null; + onGroupBehaviorChanged: ((event: JetElementCustomEvent["groupBehavior"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onLabelTruncationChanged: ((event: JetElementCustomEvent["labelTruncation"]>) => any) | null; + onMaximizedColumnChanged: ((event: JetElementCustomEvent["maximizedColumn"]>) => any) | null; + onMaximizedRowChanged: ((event: JetElementCustomEvent["maximizedRow"]>) => any) | null; + onOtherColorChanged: ((event: JetElementCustomEvent["otherColor"]>) => any) | null; + onOtherThresholdChanged: ((event: JetElementCustomEvent["otherThreshold"]>) => any) | null; + onRowsChanged: ((event: JetElementCustomEvent["rows"]>) => any) | null; + onRowsTitleChanged: ((event: JetElementCustomEvent["rowsTitle"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onStyleDefaultsChanged: ((event: JetElementCustomEvent["styleDefaults"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTouchResponseChanged: ((event: JetElementCustomEvent["touchResponse"]>) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojNBoxEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojNBox[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojNBoxSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojNBoxSettablePropertiesLenient): void; + getCell(rowValue: string, columnValue: string): object | null; + getColumn(columnValue: string): object | null; + getColumnCount(): number; + getColumnsTitle(): string; + getContextByNode(node: Element): object | null; + getDialog(): object | null; + getGroupBehavior(): string; + getGroupNode(groupCategory: string): object | null; + getRow(rowValue: string): object | null; + getRowCount(): number; + getRowsTitle(): string; +} +export interface ojNBoxEventMap extends dvtBaseComponentEventMap> { + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'cellContentChanged': JetElementCustomEvent["cellContent"]>; + 'cellMaximizeChanged': JetElementCustomEvent["cellMaximize"]>; + 'cellsChanged': JetElementCustomEvent["cells"]>; + 'columnsChanged': JetElementCustomEvent["columns"]>; + 'columnsTitleChanged': JetElementCustomEvent["columnsTitle"]>; + 'countLabelChanged': JetElementCustomEvent["countLabel"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'groupAttributesChanged': JetElementCustomEvent["groupAttributes"]>; + 'groupBehaviorChanged': JetElementCustomEvent["groupBehavior"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'labelTruncationChanged': JetElementCustomEvent["labelTruncation"]>; + 'maximizedColumnChanged': JetElementCustomEvent["maximizedColumn"]>; + 'maximizedRowChanged': JetElementCustomEvent["maximizedRow"]>; + 'otherColorChanged': JetElementCustomEvent["otherColor"]>; + 'otherThresholdChanged': JetElementCustomEvent["otherThreshold"]>; + 'rowsChanged': JetElementCustomEvent["rows"]>; + 'rowsTitleChanged': JetElementCustomEvent["rowsTitle"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'styleDefaultsChanged': JetElementCustomEvent["styleDefaults"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'touchResponseChanged': JetElementCustomEvent["touchResponse"]>; +} +export interface ojNBoxSettableProperties extends dvtBaseComponentSettableProperties { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + cellContent: 'counts' | 'auto'; + cellMaximize: 'off' | 'on'; + cells: ojNBox.Cell[] | Promise | null; + columns: ojNBox.Column[] | Promise | null; + columnsTitle: string; + countLabel: ((context: ojNBox.CountLabelContext) => (string | null)); + data: DataProvider | null; + groupAttributes: 'color' | 'indicatorColor' | 'indicatorIconColor' | 'indicatorIconPattern' | 'indicatorIconShape'; + groupBehavior: 'acrossCells' | 'none' | 'withinCell'; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + labelTruncation: 'ifRequired' | 'on'; + maximizedColumn: string; + maximizedRow: string; + otherColor: string; + otherThreshold: number; + rows: ojNBox.Row[] | Promise | null; + rowsTitle: string; + selection: K[]; + selectionMode: 'none' | 'single' | 'multiple'; + styleDefaults: { + animationDuration: number; + cellDefaults: { + labelHalign: 'center' | 'end' | 'start'; + labelStyle: object; + maximizedSvgStyle: object; + minimizedSvgStyle: object; + showCount: 'on' | 'off' | 'auto'; + svgStyle: object; + }; + columnLabelStyle: object; + columnsTitleStyle: object; + hoverBehaviorDelay: number; + nodeDefaults: { + borderColor: string; + borderWidth: number; + color: string; + iconDefaults: { + borderColor: string; + borderRadius: string; + borderWidth: number; + color: string; + height: number; + opacity: number; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shape: 'circle' | 'ellipse' | 'square' | 'plus' | 'diamond' | 'triangleUp' | 'triangleDown' | 'human' | 'rectangle' | 'star'; + source: string; + width: number; + }; + indicatorColor: string; + indicatorIconDefaults: { + borderColor: string; + borderRadius: string; + borderWidth: number; + color: string; + height: number; + opacity: number; + pattern: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + shape: 'circle' | 'ellipse' | 'square' | 'plus' | 'diamond' | 'triangleUp' | 'triangleDown' | 'human' | 'rectangle' | 'star'; + source: string; + width: number; + }; + labelStyle: object; + secondaryLabelStyle: object; + }; + rowLabelStyle: object; + rowsTitleStyle: object; + }; + tooltip: { + renderer: ((context: ojNBox.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })) | null; + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + highlightedCount?: string; + labelAdditionalData?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelGroup?: string; + labelInvalidData?: string; + labelNoData?: string; + labelOther?: string; + labelSize?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojNBoxSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export namespace ojNBox { + // tslint:disable-next-line interface-over-type-literal + type Cell = { + label?: string; + column: string; + labelHalign?: string; + labelStyle?: object; + svgClassName?: string; + svgStyle?: object; + maximizedSvgStyle?: object; + maximizedSvgClassName?: string; + minimizedSvgStyle?: object; + minimizedSvgClassName?: string; + row: string; + showCount?: 'on' | 'off' | 'auto' | string; + shortDesc?: string; + }; + // tslint:disable-next-line interface-over-type-literal + type Column = { + id: string; + label?: string; + labelStyle?: object; + }; + // tslint:disable-next-line interface-over-type-literal + type CountLabelContext = { + row: string; + column: string; + nodeCount: number; + totalNodeCount: number; + highlightedNodeCount: number; + }; + // tslint:disable-next-line interface-over-type-literal + type Row = { + id: string; + label?: string; + labelStyle?: object; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + parentElement: Element; + id: K; + label: string; + secondaryLabel: string; + row: string; + column: string; + color: string; + indicatorColor: string; + componentElement: Element; + }; +} +export interface ojNBoxNode extends JetElement { + borderColor: string; + borderWidth: number; + categories: string[]; + color?: string; + column: string; + groupCategory?: string; + icon?: { + borderColor?: string; + borderRadius?: string; + borderWidth: number; + color?: string; + height?: number | null; + opacity: number; + pattern?: 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none' | 'mallChecker' | 'smallCrosshatch' | + 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source?: string; + svgClassName: string; + svgStyle?: object; + width?: number | null; + }; + indicatorColor?: string; + indicatorIcon?: { + borderColor?: string; + borderRadius?: string; + borderWidth: number; + color?: string; + height?: number | null; + opacity: number; + pattern?: 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none' | 'smallChecker' | 'smallCrosshatch' | + 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source?: string | null; + svgClassName: string; + svgStyle?: object | null; + width?: number | null; + }; + label: string; + row: string; + secondaryLabel: string; + shortDesc: string; + svgClassName: string; + svgStyle: object | null; + xPercentage?: number | null; + yPercentage?: number | null; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onColumnChanged: ((event: JetElementCustomEvent) => any) | null; + onGroupCategoryChanged: ((event: JetElementCustomEvent) => any) | null; + onIconChanged: ((event: JetElementCustomEvent) => any) | null; + onIndicatorColorChanged: ((event: JetElementCustomEvent) => any) | null; + onIndicatorIconChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onRowChanged: ((event: JetElementCustomEvent) => any) | null; + onSecondaryLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onXPercentageChanged: ((event: JetElementCustomEvent) => any) | null; + onYPercentageChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojNBoxNodeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojNBoxNode[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojNBoxNodeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojNBoxNodeSettablePropertiesLenient): void; +} +export interface ojNBoxNodeEventMap extends HTMLElementEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'borderWidthChanged': JetElementCustomEvent; + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'columnChanged': JetElementCustomEvent; + 'groupCategoryChanged': JetElementCustomEvent; + 'iconChanged': JetElementCustomEvent; + 'indicatorColorChanged': JetElementCustomEvent; + 'indicatorIconChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'rowChanged': JetElementCustomEvent; + 'secondaryLabelChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'xPercentageChanged': JetElementCustomEvent; + 'yPercentageChanged': JetElementCustomEvent; +} +export interface ojNBoxNodeSettableProperties extends JetSettableProperties { + borderColor: string; + borderWidth: number; + categories: string[]; + color?: string; + column: string; + groupCategory?: string; + icon?: { + borderColor?: string; + borderRadius?: string; + borderWidth: number; + color?: string; + height?: number | null; + opacity: number; + pattern?: 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none' | 'mallChecker' | 'smallCrosshatch' | + 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source?: string; + svgClassName: string; + svgStyle?: object; + width?: number | null; + }; + indicatorColor?: string; + indicatorIcon?: { + borderColor?: string; + borderRadius?: string; + borderWidth: number; + color?: string; + height?: number | null; + opacity: number; + pattern?: 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none' | 'smallChecker' | 'smallCrosshatch' | + 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + source?: string | null; + svgClassName: string; + svgStyle?: object | null; + width?: number | null; + }; + label: string; + row: string; + secondaryLabel: string; + shortDesc: string; + svgClassName: string; + svgStyle: object | null; + xPercentage?: number | null; + yPercentage?: number | null; +} +export interface ojNBoxNodeSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojoptgroup/index.d.ts b/types/oracle__oraclejet/ojoptgroup/index.d.ts new file mode 100644 index 0000000000..af7d72e004 --- /dev/null +++ b/types/oracle__oraclejet/ojoptgroup/index.d.ts @@ -0,0 +1,26 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojOptgroup extends JetElement { + disabled: boolean; + label: string; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojOptgroupEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojOptgroup[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojOptgroupSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojOptgroupSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojOptgroupEventMap extends HTMLElementEventMap { + 'disabledChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; +} +export interface ojOptgroupSettableProperties extends JetSettableProperties { + disabled: boolean; + label: string; +} +export interface ojOptgroupSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojoption/index.d.ts b/types/oracle__oraclejet/ojoption/index.d.ts new file mode 100644 index 0000000000..f969e1e320 --- /dev/null +++ b/types/oracle__oraclejet/ojoption/index.d.ts @@ -0,0 +1,26 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojOption extends JetElement { + disabled: boolean; + value: any; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojOptionEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojOption[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojOptionSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojOptionSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojOptionEventMap extends HTMLElementEventMap { + 'disabledChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojOptionSettableProperties extends JetSettableProperties { + disabled: boolean; + value: any; +} +export interface ojOptionSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojpictochart/index.d.ts b/types/oracle__oraclejet/ojpictochart/index.d.ts new file mode 100644 index 0000000000..caf85f6dee --- /dev/null +++ b/types/oracle__oraclejet/ojpictochart/index.d.ts @@ -0,0 +1,268 @@ +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojPictoChart extends dvtBaseComponent> { + animationDuration?: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'popIn' | 'alphaFade' | 'zoom' | 'none'; + as: string; + columnCount: number | null; + columnWidth: number | null; + data: DataProvider | null; + drilling: 'on' | 'off'; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + layout: 'vertical' | 'horizontal'; + layoutOrigin: 'topEnd' | 'bottomStart' | 'bottomEnd' | 'topStart'; + rowCount: number | null; + rowHeight: number | null; + selection: K[]; + selectionMode: 'single' | 'multiple' | 'none'; + tooltip: { + renderer: ((context: ojPictoChart.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })) | null; + }; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onAnimationDurationChanged: ((event: JetElementCustomEvent["animationDuration"]>) => any) | null; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onColumnCountChanged: ((event: JetElementCustomEvent["columnCount"]>) => any) | null; + onColumnWidthChanged: ((event: JetElementCustomEvent["columnWidth"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent["drilling"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onHoverBehaviorDelayChanged: ((event: JetElementCustomEvent["hoverBehaviorDelay"]>) => any) | null; + onLayoutChanged: ((event: JetElementCustomEvent["layout"]>) => any) | null; + onLayoutOriginChanged: ((event: JetElementCustomEvent["layoutOrigin"]>) => any) | null; + onRowCountChanged: ((event: JetElementCustomEvent["rowCount"]>) => any) | null; + onRowHeightChanged: ((event: JetElementCustomEvent["rowHeight"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onOjDrill: ((event: ojPictoChart.ojDrill) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojPictoChartEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojPictoChart[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojPictoChartSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojPictoChartSettablePropertiesLenient): void; + getContextByNode(node: Element): ojPictoChart.NodeContext | null; + getItem(index: number): ojPictoChart.ItemContext | null; + getItemCount(): number; +} +export namespace ojPictoChart { + interface ojDrill extends CustomEvent<{ + id: any; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + color: string; + count: number; + id: K; + name: string; + selected: boolean; + tooltip: string; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + subId: string; + index: number; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + parentElement: Element; + id: K; + name: string; + count: number; + color: string; + componentElement: Element; + }; +} +export interface ojPictoChartEventMap extends dvtBaseComponentEventMap> { + 'ojDrill': ojPictoChart.ojDrill; + 'animationDurationChanged': JetElementCustomEvent["animationDuration"]>; + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'columnCountChanged': JetElementCustomEvent["columnCount"]>; + 'columnWidthChanged': JetElementCustomEvent["columnWidth"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'drillingChanged': JetElementCustomEvent["drilling"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'hoverBehaviorDelayChanged': JetElementCustomEvent["hoverBehaviorDelay"]>; + 'layoutChanged': JetElementCustomEvent["layout"]>; + 'layoutOriginChanged': JetElementCustomEvent["layoutOrigin"]>; + 'rowCountChanged': JetElementCustomEvent["rowCount"]>; + 'rowHeightChanged': JetElementCustomEvent["rowHeight"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; +} +export interface ojPictoChartSettableProperties extends dvtBaseComponentSettableProperties { + animationDuration?: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'popIn' | 'alphaFade' | 'zoom' | 'none'; + as: string; + columnCount: number | null; + columnWidth: number | null; + data: DataProvider | null; + drilling: 'on' | 'off'; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + layout: 'vertical' | 'horizontal'; + layoutOrigin: 'topEnd' | 'bottomStart' | 'bottomEnd' | 'topStart'; + rowCount: number | null; + rowHeight: number | null; + selection: K[]; + selectionMode: 'single' | 'multiple' | 'none'; + tooltip: { + renderer: ((context: ojPictoChart.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })) | null; + }; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojPictoChartSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojPictoChartItem extends JetElement { + borderColor: string; + borderWidth: number; + categories: string[]; + color: string; + columnSpan: number; + count: number; + drilling: 'inherit' | 'off' | 'on'; + name: string; + rowSpan: number; + shape?: 'circle' | 'diamond' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | 'none' | string; + shortDesc: string; + source: string; + sourceHover: string; + sourceHoverSelected: string; + sourceSelected: string; + svgClassName: string; + svgStyle: object; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onColumnSpanChanged: ((event: JetElementCustomEvent) => any) | null; + onCountChanged: ((event: JetElementCustomEvent) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent) => any) | null; + onNameChanged: ((event: JetElementCustomEvent) => any) | null; + onRowSpanChanged: ((event: JetElementCustomEvent) => any) | null; + onShapeChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojPictoChartItemEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojPictoChartItem[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojPictoChartItemSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojPictoChartItemSettablePropertiesLenient): void; +} +export interface ojPictoChartItemEventMap extends HTMLElementEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'borderWidthChanged': JetElementCustomEvent; + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'columnSpanChanged': JetElementCustomEvent; + 'countChanged': JetElementCustomEvent; + 'drillingChanged': JetElementCustomEvent; + 'nameChanged': JetElementCustomEvent; + 'rowSpanChanged': JetElementCustomEvent; + 'shapeChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'sourceChanged': JetElementCustomEvent; + 'sourceHoverChanged': JetElementCustomEvent; + 'sourceHoverSelectedChanged': JetElementCustomEvent; + 'sourceSelectedChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; +} +export interface ojPictoChartItemSettableProperties extends JetSettableProperties { + borderColor: string; + borderWidth: number; + categories: string[]; + color: string; + columnSpan: number; + count: number; + drilling: 'inherit' | 'off' | 'on'; + name: string; + rowSpan: number; + shape?: 'circle' | 'diamond' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | 'none' | string; + shortDesc: string; + source: string; + sourceHover: string; + sourceHoverSelected: string; + sourceSelected: string; + svgClassName: string; + svgStyle: object; +} +export interface ojPictoChartItemSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojpopup/index.d.ts b/types/oracle__oraclejet/ojpopup/index.d.ts new file mode 100644 index 0000000000..9ade7e2c21 --- /dev/null +++ b/types/oracle__oraclejet/ojpopup/index.d.ts @@ -0,0 +1,128 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojPopup extends baseComponent { + autoDismiss: 'none' | 'focusLoss'; + chrome: 'default' | 'none'; + initialFocus: 'auto' | 'none' | 'firstFocusable' | 'popup'; + modality: 'modeless' | 'modal'; + position: ojPopup.Position; + tail: 'none' | 'simple'; + translations: { + ariaCloseSkipLink?: string; + ariaFocusSkipLink?: string; + ariaLiveRegionInitialFocusFirstFocusable?: string; + ariaLiveRegionInitialFocusFirstFocusableTouch?: string; + ariaLiveRegionInitialFocusNone?: string; + ariaLiveRegionInitialFocusNoneTouch?: string; + }; + onAutoDismissChanged: ((event: JetElementCustomEvent) => any) | null; + onChromeChanged: ((event: JetElementCustomEvent) => any) | null; + onInitialFocusChanged: ((event: JetElementCustomEvent) => any) | null; + onModalityChanged: ((event: JetElementCustomEvent) => any) | null; + onPositionChanged: ((event: JetElementCustomEvent) => any) | null; + onTailChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojPopup.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojPopup.ojAnimateStart) => any) | null; + onOjBeforeClose: ((event: ojPopup.ojBeforeClose) => any) | null; + onOjBeforeOpen: ((event: ojPopup.ojBeforeOpen) => any) | null; + onOjClose: ((event: ojPopup.ojClose) => any) | null; + onOjFocus: ((event: ojPopup.ojFocus) => any) | null; + onOjOpen: ((event: ojPopup.ojOpen) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojPopupEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojPopup[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojPopupSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojPopupSettablePropertiesLenient): void; + close(): void; + isOpen(): boolean; + open(launcher: string | Element, position?: ojPopup.Position): void; + refresh(): void; +} +export namespace ojPopup { + interface ojAnimateEnd extends CustomEvent<{ + element: Element; + action: 'open' | 'close'; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: 'open' | 'close'; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeClose extends CustomEvent<{ + [propName: string]: any; + }> { + } + interface ojBeforeOpen extends CustomEvent<{ + [propName: string]: any; + }> { + } + interface ojClose extends CustomEvent<{ + [propName: string]: any; + }> { + } + interface ojFocus extends CustomEvent<{ + [propName: string]: any; + }> { + } + interface ojOpen extends CustomEvent<{ + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type Position = { + my?: PositionAlign; + at?: PositionAlign; + offset?: PositionPoint; + of?: string | PositionPoint; + collision?: 'flip' | 'fit' | 'flipfit' | 'flipcenter' | 'none'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionAlign = { + vertical?: 'top' | 'bottom' | 'center'; + horizontal?: 'start' | 'end' | 'left' | 'center' | 'bottom'; + }; + // tslint:disable-next-line interface-over-type-literal + type PositionPoint = { + x?: number; + y?: number; + }; +} +export interface ojPopupEventMap extends baseComponentEventMap { + 'ojAnimateEnd': ojPopup.ojAnimateEnd; + 'ojAnimateStart': ojPopup.ojAnimateStart; + 'ojBeforeClose': ojPopup.ojBeforeClose; + 'ojBeforeOpen': ojPopup.ojBeforeOpen; + 'ojClose': ojPopup.ojClose; + 'ojFocus': ojPopup.ojFocus; + 'ojOpen': ojPopup.ojOpen; + 'autoDismissChanged': JetElementCustomEvent; + 'chromeChanged': JetElementCustomEvent; + 'initialFocusChanged': JetElementCustomEvent; + 'modalityChanged': JetElementCustomEvent; + 'positionChanged': JetElementCustomEvent; + 'tailChanged': JetElementCustomEvent; +} +export interface ojPopupSettableProperties extends baseComponentSettableProperties { + autoDismiss: 'none' | 'focusLoss'; + chrome: 'default' | 'none'; + initialFocus: 'auto' | 'none' | 'firstFocusable' | 'popup'; + modality: 'modeless' | 'modal'; + position: ojPopup.Position; + tail: 'none' | 'simple'; + translations: { + ariaCloseSkipLink?: string; + ariaFocusSkipLink?: string; + ariaLiveRegionInitialFocusFirstFocusable?: string; + ariaLiveRegionInitialFocusFirstFocusableTouch?: string; + ariaLiveRegionInitialFocusNone?: string; + ariaLiveRegionInitialFocusNoneTouch?: string; + }; +} +export interface ojPopupSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojprogress/index.d.ts b/types/oracle__oraclejet/ojprogress/index.d.ts new file mode 100644 index 0000000000..779031816c --- /dev/null +++ b/types/oracle__oraclejet/ojprogress/index.d.ts @@ -0,0 +1,35 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojProgress extends baseComponent { + max: number; + type: 'bar' | 'circle'; + value: number; + translations: { + ariaIndeterminateProgressText?: string; + }; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojProgressEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojProgress[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojProgressSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojProgressSettablePropertiesLenient): void; +} +export interface ojProgressEventMap extends baseComponentEventMap { + 'maxChanged': JetElementCustomEvent; + 'typeChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojProgressSettableProperties extends baseComponentSettableProperties { + max: number; + type: 'bar' | 'circle'; + value: number; + translations: { + ariaIndeterminateProgressText?: string; + }; +} +export interface ojProgressSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojprogresslist/index.d.ts b/types/oracle__oraclejet/ojprogresslist/index.d.ts new file mode 100644 index 0000000000..22e91c465d --- /dev/null +++ b/types/oracle__oraclejet/ojprogresslist/index.d.ts @@ -0,0 +1,30 @@ +import { DataProvider } from '../ojdataprovider'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojProgressList extends JetElement { + data: DataProvider | null; + onDataChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojProgressListEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojProgressList[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojProgressListSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojProgressListSettablePropertiesLenient): void; +} +export interface ojProgressListEventMap extends HTMLElementEventMap { + 'dataChanged': JetElementCustomEvent; +} +export interface ojProgressListSettableProperties extends JetSettableProperties { + data: DataProvider | null; +} +export interface ojProgressListSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ProgressItem { + addEventListener(eventType: ProgressItem.EventType, listener: EventListener): void; + removeEventListener(eventType: ProgressItem.EventType, listener: EventListener): void; +} +export namespace ProgressItem { + type EventType = "loadstart" | "progress" | "abort" | "error" | "load" | "timeout" | "loadend"; + type Status = "queued" | "loadstarted" | "aborted" | "errored" | "timedout" | "loaded"; +} diff --git a/types/oracle__oraclejet/ojpulltorefresh/index.d.ts b/types/oracle__oraclejet/ojpulltorefresh/index.d.ts new file mode 100644 index 0000000000..86db5b3db1 --- /dev/null +++ b/types/oracle__oraclejet/ojpulltorefresh/index.d.ts @@ -0,0 +1,6 @@ +export function setupPullToRefresh(element: Element, refreshFunc: (() => Promise), options?: { + threshold?: number; + primaryText?: string; + secondaryText?: string; +}): void; +export function tearDownPullToRefresh(element: Element): void; diff --git a/types/oracle__oraclejet/ojradioset/index.d.ts b/types/oracle__oraclejet/ojradioset/index.d.ts new file mode 100644 index 0000000000..4b910c22fd --- /dev/null +++ b/types/oracle__oraclejet/ojradioset/index.d.ts @@ -0,0 +1,69 @@ +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojRadioset extends editableValue { + disabled: boolean; + labelledBy: string | null; + required: boolean; + value: any; + translations: { + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelledByChanged: ((event: JetElementCustomEvent) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojRadioset.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojRadioset.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojRadiosetEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojRadioset[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojRadiosetSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojRadiosetSettablePropertiesLenient): void; + refresh(): void; + validate(): Promise; +} +export namespace ojRadioset { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojRadiosetEventMap extends editableValueEventMap { + 'ojAnimateEnd': ojRadioset.ojAnimateEnd; + 'ojAnimateStart': ojRadioset.ojAnimateStart; + 'disabledChanged': JetElementCustomEvent; + 'labelledByChanged': JetElementCustomEvent; + 'requiredChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojRadiosetSettableProperties extends editableValueSettableProperties { + disabled: boolean; + labelledBy: string | null; + required: boolean; + value: any; + translations: { + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; +} +export interface ojRadiosetSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojrefresher/index.d.ts b/types/oracle__oraclejet/ojrefresher/index.d.ts new file mode 100644 index 0000000000..a80f9cc805 --- /dev/null +++ b/types/oracle__oraclejet/ojrefresher/index.d.ts @@ -0,0 +1,33 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojRefresher extends baseComponent { + refreshContent: (() => Promise); + target: Element; + text: string; + threshold: number; + onRefreshContentChanged: ((event: JetElementCustomEvent) => any) | null; + onTargetChanged: ((event: JetElementCustomEvent) => any) | null; + onTextChanged: ((event: JetElementCustomEvent) => any) | null; + onThresholdChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojRefresherEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojRefresher[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojRefresherSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojRefresherSettablePropertiesLenient): void; +} +export interface ojRefresherEventMap extends baseComponentEventMap { + 'refreshContentChanged': JetElementCustomEvent; + 'targetChanged': JetElementCustomEvent; + 'textChanged': JetElementCustomEvent; + 'thresholdChanged': JetElementCustomEvent; +} +export interface ojRefresherSettableProperties extends baseComponentSettableProperties { + refreshContent: (() => Promise); + target: Element; + text: string; + threshold: number; +} +export interface ojRefresherSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojresponsiveknockoututils/index.d.ts b/types/oracle__oraclejet/ojresponsiveknockoututils/index.d.ts new file mode 100644 index 0000000000..6969cc607c --- /dev/null +++ b/types/oracle__oraclejet/ojresponsiveknockoututils/index.d.ts @@ -0,0 +1,4 @@ +/// +/// +export function createMediaQueryObservable(queryString: string): KnockoutObservable; +export function createScreenRangeObservable(): KnockoutObservable; diff --git a/types/oracle__oraclejet/ojresponsiveutils/index.d.ts b/types/oracle__oraclejet/ojresponsiveutils/index.d.ts new file mode 100644 index 0000000000..3fa2d5dab5 --- /dev/null +++ b/types/oracle__oraclejet/ojresponsiveutils/index.d.ts @@ -0,0 +1,4 @@ +export function compare(size1: SCREEN_RANGE, size2: SCREEN_RANGE): number; +export function getFrameworkQuery(frameworkQueryKey: FRAMEWORK_QUERY_KEY): string | null; +export type FRAMEWORK_QUERY_KEY = "sm-up" | "md-up" | "lg-up" | "xl-up" | "xxl-up" | "sm-only" | "md-only" | "lg-only" | "xl-only" | "md-down" | "lg-down" | "xl-down" | "high-resolution"; +export type SCREEN_RANGE = "sm" | "md" | "lg" | "xl" | "xxl"; diff --git a/types/oracle__oraclejet/ojrouter/index.d.ts b/types/oracle__oraclejet/ojrouter/index.d.ts new file mode 100644 index 0000000000..afe93fb476 --- /dev/null +++ b/types/oracle__oraclejet/ojrouter/index.d.ts @@ -0,0 +1,131 @@ +/// +/// +declare class Router { + readonly currentState: (() => RouterState | undefined); + readonly currentValue: (() => string | undefined); + defaultStateId: string | undefined; + static defaults: { + urlAdapter?: Router.urlPathAdapter | Router.urlParamAdapter; + baseUrl?: string; + rootInstanceName?: string; + }; + readonly direction: string | undefined; + readonly moduleConfig: { + name: KnockoutObservable; + params: { + ojRouter: { + parentRouter: Router; + direction: string; + }; + }; + lifecycleListener: { + attached: ((param0: string) => void); + }; + }; + readonly name: string; + readonly observableModuleConfig: KnockoutObservable; + readonly parent: Router | undefined; + static readonly rootInstance: Router; + readonly stateId: ((param0?: string) => string); + readonly states: RouterState[] | null; + static readonly transitionedToState: object; + static sync(): Promise<{ + hasChanged: boolean; + }>; + configure(option: { + [key: string]: RouterState.ConfigOptions; + } | ((id: string) => RouterState | undefined | null)): any; + createChildRouter(name: string, parentStateId?: string): Router; + dispose(): undefined; + getChildRouter(name: string): Router | undefined; + getCurrentChildRouter(): Router | undefined; + getState(stateId: string): RouterState | undefined; + go(stateIdPath?: string | string[], options?: { + historyUpdate: string; + }): Promise<{ + hasChanged: boolean; + }>; + retrieve(): any; + store(data: object): undefined; +} +declare namespace Router { + // tslint:disable-next-line interface-over-type-literal + type ModuleConfigType = { + name: KnockoutObservable; + params: { + ojRouter: { + parentRouter: Router; + direction: string; + parameters: object; + }; + }; + lifecycleListener: { + attached: ((param0: object) => void); + }; + }; + // tslint:disable-next-line no-unnecessary-class + class urlParamAdapter { + constructor(); + } + // tslint:disable-next-line no-unnecessary-class + class urlPathAdapter { + constructor(); + } + interface RouterState { + canEnter: (() => boolean) | (() => Promise); + canExit: (() => boolean) | (() => Promise); + enter: (() => void) | (() => Promise); + exit: (() => void) | (() => Promise); + readonly id: string; + label: string | undefined; + parameters: object; + title: string | (() => string | undefined); + value: any; + // constructor(id: string, options?: RouterState.ConfigOptions, router?: Router); + go(): Promise<{ + hasChanged: boolean; + }>; + isCurrent(): boolean; + } + namespace RouterState { + // tslint:disable-next-line interface-over-type-literal + type ConfigOptions = { + label?: string; + value?: any; + isDefault?: boolean; + canEnter?: (() => boolean) | (() => Promise); + enter?: (() => void) | (() => Promise); + canExit?: (() => boolean) | (() => Promise); + exit?: (() => void) | (() => Promise); + }; + } +} +export = Router; +declare class RouterState { + canEnter: (() => boolean) | (() => Promise); + canExit: (() => boolean) | (() => Promise); + enter: (() => void) | (() => Promise); + exit: (() => void) | (() => Promise); + readonly id: string; + label: string | undefined; + parameters: object; + title: string | (() => string | undefined); + value: any; + constructor(id: string, options?: RouterState.ConfigOptions, router?: Router); + go(): Promise<{ + hasChanged: boolean; + }>; + isCurrent(): boolean; +} +declare namespace RouterState { + // tslint:disable-next-line interface-over-type-literal + type ConfigOptions = { + label?: string; + value?: any; + isDefault?: boolean; + canEnter?: (() => boolean) | (() => Promise); + enter?: (() => void) | (() => Promise); + canExit?: (() => boolean) | (() => Promise); + exit?: (() => void) | (() => Promise); + }; +} diff --git a/types/oracle__oraclejet/ojselectcombobox/index.d.ts b/types/oracle__oraclejet/ojselectcombobox/index.d.ts new file mode 100644 index 0000000000..2444c99c4c --- /dev/null +++ b/types/oracle__oraclejet/ojselectcombobox/index.d.ts @@ -0,0 +1,714 @@ +import { Converter, Validator, Validation, AsyncValidator } from '../ojvalidation-base'; +import { DataProvider } from '../ojdataprovider'; +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojCombobox, SV = V, RV = V> extends editableValue { + onOjAnimateEnd: ((event: ojCombobox.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojCombobox.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojComboboxEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojCombobox[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojComboboxSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojComboboxSettablePropertiesLenient): void; + refresh(): void; + validate(): Promise; +} +export namespace ojCombobox { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type Optgroup = { + disabled?: boolean; + label: string; + children: Array<(Option | Optgroup)>; + }; + // tslint:disable-next-line interface-over-type-literal + type Option = { + disabled?: boolean; + label?: string; + value: any; + }; + // tslint:disable-next-line interface-over-type-literal + type OptionContext = { + component: Element; + parent: Element; + index: number; + depth: number; + leaf: boolean; + data: object; + parentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type OptionsKeys = { + label?: string; + value?: string; + children?: string; + childKeys?: OptionsKeys; + }; +} +export interface ojComboboxEventMap, SV = V, RV = V> extends editableValueEventMap { + 'ojAnimateEnd': ojCombobox.ojAnimateEnd; + 'ojAnimateStart': ojCombobox.ojAnimateStart; +} +// These interfaces are empty but required to keep the component chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface ojComboboxSettableProperties extends editableValueSettableProperties { +} +export interface ojComboboxSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojComboboxMany extends ojCombobox, any[] | null, string> { + asyncValidators: Array>; + converter: Converter | Validation.RegisteredConverter | null; + minLength: number; + optionRenderer?: ((param0: ojCombobox.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys: { + label?: string; + value?: string; + children?: string; + childKeys?: ojCombobox.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + readonly rawValue: string | null; + required: boolean; + validators: Array | Validation.RegisteredValidator> | null; + value: any[] | null; + valueOptions: Array<{ + value: any; + label?: string; + }> | null; + translations: { + filterFurther?: string; + noMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; + onAsyncValidatorsChanged: ((event: JetElementCustomEvent["asyncValidators"]>) => any) | null; + onConverterChanged: ((event: JetElementCustomEvent["converter"]>) => any) | null; + onMinLengthChanged: ((event: JetElementCustomEvent["minLength"]>) => any) | null; + onOptionRendererChanged: ((event: JetElementCustomEvent["optionRenderer"]>) => any) | null; + onOptionsChanged: ((event: JetElementCustomEvent["options"]>) => any) | null; + onOptionsKeysChanged: ((event: JetElementCustomEvent["optionsKeys"]>) => any) | null; + onPickerAttributesChanged: ((event: JetElementCustomEvent["pickerAttributes"]>) => any) | null; + onPlaceholderChanged: ((event: JetElementCustomEvent["placeholder"]>) => any) | null; + onRawValueChanged: ((event: JetElementCustomEvent["rawValue"]>) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent["required"]>) => any) | null; + onValidatorsChanged: ((event: JetElementCustomEvent["validators"]>) => any) | null; + onValueChanged: ((event: JetElementCustomEvent["value"]>) => any) | null; + onValueOptionsChanged: ((event: JetElementCustomEvent["valueOptions"]>) => any) | null; + onOjAnimateEnd: ((event: ojComboboxMany.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojComboboxMany.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojComboboxManyEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojComboboxMany[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojComboboxManySettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojComboboxManySettablePropertiesLenient): void; +} +export namespace ojComboboxMany { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojComboboxManyEventMap extends ojComboboxEventMap, any[] | null, string> { + 'ojAnimateEnd': ojComboboxMany.ojAnimateEnd; + 'ojAnimateStart': ojComboboxMany.ojAnimateStart; + 'asyncValidatorsChanged': JetElementCustomEvent["asyncValidators"]>; + 'converterChanged': JetElementCustomEvent["converter"]>; + 'minLengthChanged': JetElementCustomEvent["minLength"]>; + 'optionRendererChanged': JetElementCustomEvent["optionRenderer"]>; + 'optionsChanged': JetElementCustomEvent["options"]>; + 'optionsKeysChanged': JetElementCustomEvent["optionsKeys"]>; + 'pickerAttributesChanged': JetElementCustomEvent["pickerAttributes"]>; + 'placeholderChanged': JetElementCustomEvent["placeholder"]>; + 'rawValueChanged': JetElementCustomEvent["rawValue"]>; + 'requiredChanged': JetElementCustomEvent["required"]>; + 'validatorsChanged': JetElementCustomEvent["validators"]>; + 'valueChanged': JetElementCustomEvent["value"]>; + 'valueOptionsChanged': JetElementCustomEvent["valueOptions"]>; +} +export interface ojComboboxManySettableProperties extends ojComboboxSettableProperties { + asyncValidators: Array>; + converter: Converter | Validation.RegisteredConverter | null; + minLength: number; + optionRenderer?: ((param0: ojCombobox.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys: { + label?: string; + value?: string; + children?: string; + childKeys?: ojCombobox.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + readonly rawValue: string | null; + required: boolean; + validators: Array | Validation.RegisteredValidator> | null; + value: any[] | null; + valueOptions: Array<{ + value: any; + label?: string; + }> | null; + translations: { + filterFurther?: string; + noMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; +} +export interface ojComboboxManySettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojComboboxOne extends ojCombobox, any, string> { + asyncValidators: Array>; + converter: Converter | Validation.RegisteredConverter | null; + filterOnOpen: 'none' | 'rawValue'; + minLength: number; + optionRenderer?: ((param0: ojCombobox.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys: { + label?: string; + value?: string; + children?: string; + childKeys?: ojCombobox.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + readonly rawValue: string | null; + required: boolean; + validators: Array | Validation.RegisteredValidator> | null; + value: any; + valueOption: { + value: any; + label?: string; + }; + translations: { + filterFurther?: string; + noMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; + onAsyncValidatorsChanged: ((event: JetElementCustomEvent["asyncValidators"]>) => any) | null; + onConverterChanged: ((event: JetElementCustomEvent["converter"]>) => any) | null; + onFilterOnOpenChanged: ((event: JetElementCustomEvent["filterOnOpen"]>) => any) | null; + onMinLengthChanged: ((event: JetElementCustomEvent["minLength"]>) => any) | null; + onOptionRendererChanged: ((event: JetElementCustomEvent["optionRenderer"]>) => any) | null; + onOptionsChanged: ((event: JetElementCustomEvent["options"]>) => any) | null; + onOptionsKeysChanged: ((event: JetElementCustomEvent["optionsKeys"]>) => any) | null; + onPickerAttributesChanged: ((event: JetElementCustomEvent["pickerAttributes"]>) => any) | null; + onPlaceholderChanged: ((event: JetElementCustomEvent["placeholder"]>) => any) | null; + onRawValueChanged: ((event: JetElementCustomEvent["rawValue"]>) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent["required"]>) => any) | null; + onValidatorsChanged: ((event: JetElementCustomEvent["validators"]>) => any) | null; + onValueChanged: ((event: JetElementCustomEvent["value"]>) => any) | null; + onValueOptionChanged: ((event: JetElementCustomEvent["valueOption"]>) => any) | null; + onOjAnimateEnd: ((event: ojComboboxOne.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojComboboxOne.ojAnimateStart) => any) | null; + onOjValueUpdated: ((event: ojComboboxOne.ojValueUpdated) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojComboboxOneEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojComboboxOne[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojComboboxOneSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojComboboxOneSettablePropertiesLenient): void; +} +export namespace ojComboboxOne { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojValueUpdated extends CustomEvent<{ + value: any; + previousValue: any; + [propName: string]: any; + }> { + } +} +export interface ojComboboxOneEventMap extends ojComboboxEventMap, any, string> { + 'ojAnimateEnd': ojComboboxOne.ojAnimateEnd; + 'ojAnimateStart': ojComboboxOne.ojAnimateStart; + 'ojValueUpdated': ojComboboxOne.ojValueUpdated; + 'asyncValidatorsChanged': JetElementCustomEvent["asyncValidators"]>; + 'converterChanged': JetElementCustomEvent["converter"]>; + 'filterOnOpenChanged': JetElementCustomEvent["filterOnOpen"]>; + 'minLengthChanged': JetElementCustomEvent["minLength"]>; + 'optionRendererChanged': JetElementCustomEvent["optionRenderer"]>; + 'optionsChanged': JetElementCustomEvent["options"]>; + 'optionsKeysChanged': JetElementCustomEvent["optionsKeys"]>; + 'pickerAttributesChanged': JetElementCustomEvent["pickerAttributes"]>; + 'placeholderChanged': JetElementCustomEvent["placeholder"]>; + 'rawValueChanged': JetElementCustomEvent["rawValue"]>; + 'requiredChanged': JetElementCustomEvent["required"]>; + 'validatorsChanged': JetElementCustomEvent["validators"]>; + 'valueChanged': JetElementCustomEvent["value"]>; + 'valueOptionChanged': JetElementCustomEvent["valueOption"]>; +} +export interface ojComboboxOneSettableProperties extends ojComboboxSettableProperties { + asyncValidators: Array>; + converter: Converter | Validation.RegisteredConverter | null; + filterOnOpen: 'none' | 'rawValue'; + minLength: number; + optionRenderer?: ((param0: ojCombobox.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys: { + label?: string; + value?: string; + children?: string; + childKeys?: ojCombobox.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + readonly rawValue: string | null; + required: boolean; + validators: Array | Validation.RegisteredValidator> | null; + value: any; + valueOption: { + value: any; + label?: string; + }; + translations: { + filterFurther?: string; + noMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + }; +} +export interface ojComboboxOneSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojSelect, SV = V> extends editableValue { + onOjAnimateEnd: ((event: ojSelect.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojSelect.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojSelectEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojSelect[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojSelectSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojSelectSettablePropertiesLenient): void; + refresh(): void; + validate(): Promise; +} +export namespace ojSelect { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type Optgroup = { + disabled?: boolean; + label: string; + children: Array<(Option | Optgroup)>; + }; + // tslint:disable-next-line interface-over-type-literal + type Option = { + disabled?: boolean; + label?: string; + value: any; + }; + // tslint:disable-next-line interface-over-type-literal + type OptionContext = { + component: Element; + parent: Element; + index: number; + depth: number; + leaf: boolean; + data: object; + parentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type OptionsKeys = { + label?: string; + value?: string; + children?: string; + childKeys?: OptionsKeys; + }; +} +export interface ojSelectEventMap, SV = V> extends editableValueEventMap { + 'ojAnimateEnd': ojSelect.ojAnimateEnd; + 'ojAnimateStart': ojSelect.ojAnimateStart; +} +// These interfaces are empty but required to keep the component chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface ojSelectSettableProperties extends editableValueSettableProperties { +} +export interface ojSelectSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojSelectMany extends ojSelect> { + minimumResultsForSearch: number; + optionRenderer?: ((param0: ojSelect.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys?: { + label?: string; + value?: string; + children?: string; + childKeys?: ojSelect.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + renderMode: 'jet' | 'native'; + required: boolean; + value: any[] | null; + valueOptions: Array<{ + value: any; + label?: string; + }> | null; + translations: { + filterFurther?: string; + moreMatchesFound?: string; + noMatchesFound?: string; + oneMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + searchField?: string; + }; + onMinimumResultsForSearchChanged: ((event: JetElementCustomEvent["minimumResultsForSearch"]>) => any) | null; + onOptionRendererChanged: ((event: JetElementCustomEvent["optionRenderer"]>) => any) | null; + onOptionsChanged: ((event: JetElementCustomEvent["options"]>) => any) | null; + onOptionsKeysChanged: ((event: JetElementCustomEvent["optionsKeys"]>) => any) | null; + onPickerAttributesChanged: ((event: JetElementCustomEvent["pickerAttributes"]>) => any) | null; + onPlaceholderChanged: ((event: JetElementCustomEvent["placeholder"]>) => any) | null; + onRenderModeChanged: ((event: JetElementCustomEvent["renderMode"]>) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent["required"]>) => any) | null; + onValueChanged: ((event: JetElementCustomEvent["value"]>) => any) | null; + onValueOptionsChanged: ((event: JetElementCustomEvent["valueOptions"]>) => any) | null; + onOjAnimateEnd: ((event: ojSelectMany.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojSelectMany.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojSelectManyEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojSelectMany[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojSelectManySettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojSelectManySettablePropertiesLenient): void; +} +export namespace ojSelectMany { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojSelectManyEventMap extends ojSelectEventMap> { + 'ojAnimateEnd': ojSelectMany.ojAnimateEnd; + 'ojAnimateStart': ojSelectMany.ojAnimateStart; + 'minimumResultsForSearchChanged': JetElementCustomEvent["minimumResultsForSearch"]>; + 'optionRendererChanged': JetElementCustomEvent["optionRenderer"]>; + 'optionsChanged': JetElementCustomEvent["options"]>; + 'optionsKeysChanged': JetElementCustomEvent["optionsKeys"]>; + 'pickerAttributesChanged': JetElementCustomEvent["pickerAttributes"]>; + 'placeholderChanged': JetElementCustomEvent["placeholder"]>; + 'renderModeChanged': JetElementCustomEvent["renderMode"]>; + 'requiredChanged': JetElementCustomEvent["required"]>; + 'valueChanged': JetElementCustomEvent["value"]>; + 'valueOptionsChanged': JetElementCustomEvent["valueOptions"]>; +} +export interface ojSelectManySettableProperties extends ojSelectSettableProperties { + minimumResultsForSearch: number; + optionRenderer?: ((param0: ojSelect.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys?: { + label?: string; + value?: string; + children?: string; + childKeys?: ojSelect.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + renderMode: 'jet' | 'native'; + required: boolean; + value: any[] | null; + valueOptions: Array<{ + value: any; + label?: string; + }> | null; + translations: { + filterFurther?: string; + moreMatchesFound?: string; + noMatchesFound?: string; + oneMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + searchField?: string; + }; +} +export interface ojSelectManySettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojSelectOne extends ojSelect> { + minimumResultsForSearch: number; + optionRenderer?: ((param0: ojSelect.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys?: { + label?: string; + value?: string; + children?: string; + childKeys?: ojSelect.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + renderMode: 'jet' | 'native'; + required: boolean; + value: any; + valueOption: { + value: any; + label?: string; + }; + translations: { + filterFurther?: string; + moreMatchesFound?: string; + noMatchesFound?: string; + oneMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + searchField?: string; + }; + onMinimumResultsForSearchChanged: ((event: JetElementCustomEvent["minimumResultsForSearch"]>) => any) | null; + onOptionRendererChanged: ((event: JetElementCustomEvent["optionRenderer"]>) => any) | null; + onOptionsChanged: ((event: JetElementCustomEvent["options"]>) => any) | null; + onOptionsKeysChanged: ((event: JetElementCustomEvent["optionsKeys"]>) => any) | null; + onPickerAttributesChanged: ((event: JetElementCustomEvent["pickerAttributes"]>) => any) | null; + onPlaceholderChanged: ((event: JetElementCustomEvent["placeholder"]>) => any) | null; + onRenderModeChanged: ((event: JetElementCustomEvent["renderMode"]>) => any) | null; + onRequiredChanged: ((event: JetElementCustomEvent["required"]>) => any) | null; + onValueChanged: ((event: JetElementCustomEvent["value"]>) => any) | null; + onValueOptionChanged: ((event: JetElementCustomEvent["valueOption"]>) => any) | null; + onOjAnimateEnd: ((event: ojSelectOne.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojSelectOne.ojAnimateStart) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojSelectOneEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojSelectOne[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojSelectOneSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojSelectOneSettablePropertiesLenient): void; +} +export namespace ojSelectOne { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojSelectOneEventMap extends ojSelectEventMap> { + 'ojAnimateEnd': ojSelectOne.ojAnimateEnd; + 'ojAnimateStart': ojSelectOne.ojAnimateStart; + 'minimumResultsForSearchChanged': JetElementCustomEvent["minimumResultsForSearch"]>; + 'optionRendererChanged': JetElementCustomEvent["optionRenderer"]>; + 'optionsChanged': JetElementCustomEvent["options"]>; + 'optionsKeysChanged': JetElementCustomEvent["optionsKeys"]>; + 'pickerAttributesChanged': JetElementCustomEvent["pickerAttributes"]>; + 'placeholderChanged': JetElementCustomEvent["placeholder"]>; + 'renderModeChanged': JetElementCustomEvent["renderMode"]>; + 'requiredChanged': JetElementCustomEvent["required"]>; + 'valueChanged': JetElementCustomEvent["value"]>; + 'valueOptionChanged': JetElementCustomEvent["valueOption"]>; +} +export interface ojSelectOneSettableProperties extends ojSelectSettableProperties { + minimumResultsForSearch: number; + optionRenderer?: ((param0: ojSelect.OptionContext) => { + insert: Element; + } | undefined) | null; + options: Array | DataProvider | null; + optionsKeys: { + childKeys?: { + label?: string; + value?: string; + children?: string; + childKeys?: ojSelect.OptionsKeys; + }; + children?: string; + label?: string; + value?: string; + }; + pickerAttributes: { + style?: string; + class?: string; + }; + placeholder: string | null; + renderMode: 'jet' | 'native'; + required: boolean; + value: any; + valueOption: { + value: any; + label?: string; + }; + translations: { + filterFurther?: string; + moreMatchesFound?: string; + noMatchesFound?: string; + oneMatchesFound?: string; + required?: { + hint?: string; + messageDetail?: string; + messageSummary?: string; + }; + searchField?: string; + }; +} +export interface ojSelectOneSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface Optgroup { + children: Array<(Option | Optgroup)>; + disabled?: boolean; + label: string; +} +export interface Option { + disabled?: boolean; + label?: string; + value: object; +} diff --git a/types/oracle__oraclejet/ojslider/index.d.ts b/types/oracle__oraclejet/ojslider/index.d.ts new file mode 100644 index 0000000000..37d98b11f4 --- /dev/null +++ b/types/oracle__oraclejet/ojslider/index.d.ts @@ -0,0 +1,83 @@ +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojSlider extends editableValue { + disabled: boolean; + max: number | null; + min: number | null; + orientation: 'horizontal' | 'vertical'; + step: number | null; + readonly transientValue: number; + type: 'fromMin' | 'fromMax' | 'single'; + value: number | null; + translations: { + invalidStep?: string; + maxMin?: string; + noValue?: string; + optionNum?: string; + valueRange?: string; + }; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onMaxChanged: ((event: JetElementCustomEvent) => any) | null; + onMinChanged: ((event: JetElementCustomEvent) => any) | null; + onOrientationChanged: ((event: JetElementCustomEvent) => any) | null; + onStepChanged: ((event: JetElementCustomEvent) => any) | null; + onTransientValueChanged: ((event: JetElementCustomEvent) => any) | null; + onTypeChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojSlider.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojSlider.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojSliderEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojSlider[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojSliderSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojSliderSettablePropertiesLenient): void; +} +export namespace ojSlider { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojSliderEventMap extends editableValueEventMap { + 'ojAnimateEnd': ojSlider.ojAnimateEnd; + 'ojAnimateStart': ojSlider.ojAnimateStart; + 'disabledChanged': JetElementCustomEvent; + 'maxChanged': JetElementCustomEvent; + 'minChanged': JetElementCustomEvent; + 'orientationChanged': JetElementCustomEvent; + 'stepChanged': JetElementCustomEvent; + 'transientValueChanged': JetElementCustomEvent; + 'typeChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojSliderSettableProperties extends editableValueSettableProperties { + disabled: boolean; + max: number | null; + min: number | null; + orientation: 'horizontal' | 'vertical'; + step: number | null; + readonly transientValue: number; + type: 'fromMin' | 'fromMax' | 'single'; + value: number | null; + translations: { + invalidStep?: string; + maxMin?: string; + noValue?: string; + optionNum?: string; + valueRange?: string; + }; +} +export interface ojSliderSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojsunburst/index.d.ts b/types/oracle__oraclejet/ojsunburst/index.d.ts new file mode 100644 index 0000000000..ebe8b4968e --- /dev/null +++ b/types/oracle__oraclejet/ojsunburst/index.d.ts @@ -0,0 +1,407 @@ +import { KeySet } from '../ojkeyset'; +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojSunburst extends dvtBaseComponent> { + animationDuration: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + animationUpdateColor: string; + as: string; + colorLabel: string; + data: DataProvider | null; + displayLevels: number; + drilling: 'on' | 'off'; + expanded: KeySet; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + nodeDefaults: { + borderColor: string; + borderWidth: number; + hoverColor: string; + labelDisplay: 'horizontal' | 'rotated' | 'off' | 'auto'; + labelHalign: 'inner' | 'outer' | 'center'; + labelMinLength: number; + labelStyle: object; + selectedInnerColor: string; + selectedOuterColor: string; + showDisclosure: 'on' | 'off'; + }; + rootNode: any; + rootNodeContent: { + renderer: ((context: ojSunburst.RootNodeContext) => ({ + insert: Element | string; + })); + }; + rotation: 'off' | 'on'; + selection: any[]; + selectionMode: 'none' | 'single' | 'multiple'; + sizeLabel: string; + sorting: 'on' | 'off'; + startAngle: number; + tooltip: { + renderer: ((context: ojSunburst.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelColor?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + labelSize?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + tooltipCollapse?: string; + tooltipExpand?: string; + }; + onAnimationDurationChanged: ((event: JetElementCustomEvent["animationDuration"]>) => any) | null; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAnimationUpdateColorChanged: ((event: JetElementCustomEvent["animationUpdateColor"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onColorLabelChanged: ((event: JetElementCustomEvent["colorLabel"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDisplayLevelsChanged: ((event: JetElementCustomEvent["displayLevels"]>) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent["drilling"]>) => any) | null; + onExpandedChanged: ((event: JetElementCustomEvent["expanded"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onHoverBehaviorDelayChanged: ((event: JetElementCustomEvent["hoverBehaviorDelay"]>) => any) | null; + onNodeDefaultsChanged: ((event: JetElementCustomEvent["nodeDefaults"]>) => any) | null; + onRootNodeChanged: ((event: JetElementCustomEvent["rootNode"]>) => any) | null; + onRootNodeContentChanged: ((event: JetElementCustomEvent["rootNodeContent"]>) => any) | null; + onRotationChanged: ((event: JetElementCustomEvent["rotation"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onSizeLabelChanged: ((event: JetElementCustomEvent["sizeLabel"]>) => any) | null; + onSortingChanged: ((event: JetElementCustomEvent["sorting"]>) => any) | null; + onStartAngleChanged: ((event: JetElementCustomEvent["startAngle"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTouchResponseChanged: ((event: JetElementCustomEvent["touchResponse"]>) => any) | null; + onOjBeforeCollapse: ((event: ojSunburst.ojBeforeCollapse) => any) | null; + onOjBeforeDrill: ((event: ojSunburst.ojBeforeDrill) => any) | null; + onOjBeforeExpand: ((event: ojSunburst.ojBeforeExpand) => any) | null; + onOjCollapse: ((event: ojSunburst.ojCollapse) => any) | null; + onOjDrill: ((event: ojSunburst.ojDrill) => any) | null; + onOjExpand: ((event: ojSunburst.ojExpand) => any) | null; + onOjRotateInput: ((event: ojSunburst.ojRotateInput) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojSunburstEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojSunburst[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojSunburstSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojSunburstSettablePropertiesLenient): void; + getContextByNode(node: Element): ojSunburst.NodeContext | null; + getNode(subIdPath: any[]): ojSunburst.DataContext | null; +} +export namespace ojSunburst { + interface ojBeforeCollapse extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + interface ojBeforeDrill extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + interface ojBeforeExpand extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + interface ojCollapse extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + interface ojDrill extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + interface ojExpand extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + interface ojRotateInput extends CustomEvent<{ + value: number; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type DataContext = { + color: string; + label: string; + selected: boolean; + size: number; + tooltip: string; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + subId: string; + indexPath: number[]; + }; + // tslint:disable-next-line interface-over-type-literal + type RootNodeContext = { + outerBounds: { + x: number; + y: number; + width: number; + height: number; + }; + innerBounds: { + x: number; + y: number; + width: number; + height: number; + }; + id: K; + data: object; + itemData: D; + componentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + parentElement: Element; + id: K; + label: string; + value: number; + radius: number; + color: string; + data: object; + itemData: D; + componentElement: Element; + }; +} +export interface ojSunburstEventMap extends dvtBaseComponentEventMap> { + 'ojBeforeCollapse': ojSunburst.ojBeforeCollapse; + 'ojBeforeDrill': ojSunburst.ojBeforeDrill; + 'ojBeforeExpand': ojSunburst.ojBeforeExpand; + 'ojCollapse': ojSunburst.ojCollapse; + 'ojDrill': ojSunburst.ojDrill; + 'ojExpand': ojSunburst.ojExpand; + 'ojRotateInput': ojSunburst.ojRotateInput; + 'animationDurationChanged': JetElementCustomEvent["animationDuration"]>; + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'animationUpdateColorChanged': JetElementCustomEvent["animationUpdateColor"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'colorLabelChanged': JetElementCustomEvent["colorLabel"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'displayLevelsChanged': JetElementCustomEvent["displayLevels"]>; + 'drillingChanged': JetElementCustomEvent["drilling"]>; + 'expandedChanged': JetElementCustomEvent["expanded"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'hoverBehaviorDelayChanged': JetElementCustomEvent["hoverBehaviorDelay"]>; + 'nodeDefaultsChanged': JetElementCustomEvent["nodeDefaults"]>; + 'rootNodeChanged': JetElementCustomEvent["rootNode"]>; + 'rootNodeContentChanged': JetElementCustomEvent["rootNodeContent"]>; + 'rotationChanged': JetElementCustomEvent["rotation"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'sizeLabelChanged': JetElementCustomEvent["sizeLabel"]>; + 'sortingChanged': JetElementCustomEvent["sorting"]>; + 'startAngleChanged': JetElementCustomEvent["startAngle"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'touchResponseChanged': JetElementCustomEvent["touchResponse"]>; +} +export interface ojSunburstSettableProperties extends dvtBaseComponentSettableProperties { + animationDuration: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + animationUpdateColor: string; + as: string; + colorLabel: string; + data: DataProvider | null; + displayLevels: number; + drilling: 'on' | 'off'; + expanded: KeySet; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + nodeDefaults: { + borderColor: string; + borderWidth: number; + hoverColor: string; + labelDisplay: 'horizontal' | 'rotated' | 'off' | 'auto'; + labelHalign: 'inner' | 'outer' | 'center'; + labelMinLength: number; + labelStyle: object; + selectedInnerColor: string; + selectedOuterColor: string; + showDisclosure: 'on' | 'off'; + }; + rootNode: any; + rootNodeContent: { + renderer: ((context: ojSunburst.RootNodeContext) => ({ + insert: Element | string; + })); + }; + rotation: 'off' | 'on'; + selection: any[]; + selectionMode: 'none' | 'single' | 'multiple'; + sizeLabel: string; + sorting: 'on' | 'off'; + startAngle: number; + tooltip: { + renderer: ((context: ojSunburst.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelColor?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + labelSize?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + tooltipCollapse?: string; + tooltipExpand?: string; + }; +} +export interface ojSunburstSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojSunburstNode extends JetElement { + borderColor?: string; + borderWidth?: number; + categories?: string[]; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + label?: string; + labelDisplay?: 'horizontal' | 'rotated' | 'off' | 'auto'; + labelHalign?: 'inner' | 'outer' | 'center'; + labelStyle?: object; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + radius?: number; + selectable?: 'off' | 'auto'; + shortDesc?: string; + showDisclosure?: 'on' | 'off' | 'inherit'; + svgClassName?: string; + svgStyle?: object; + value: number; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelHalignChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onPatternChanged: ((event: JetElementCustomEvent) => any) | null; + onRadiusChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectableChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onShowDisclosureChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojSunburstNodeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojSunburstNode[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojSunburstNodeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojSunburstNodeSettablePropertiesLenient): void; +} +export interface ojSunburstNodeEventMap extends HTMLElementEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'borderWidthChanged': JetElementCustomEvent; + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'drillingChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelDisplayChanged': JetElementCustomEvent; + 'labelHalignChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'patternChanged': JetElementCustomEvent; + 'radiusChanged': JetElementCustomEvent; + 'selectableChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'showDisclosureChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojSunburstNodeSettableProperties extends JetSettableProperties { + borderColor?: string; + borderWidth?: number; + categories?: string[]; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + label?: string; + labelDisplay?: 'horizontal' | 'rotated' | 'off' | 'auto'; + labelHalign?: 'inner' | 'outer' | 'center'; + labelStyle?: object; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + radius?: number; + selectable?: 'off' | 'auto'; + shortDesc?: string; + showDisclosure?: 'on' | 'off' | 'inherit'; + svgClassName?: string; + svgStyle?: object; + value: number; +} +export interface ojSunburstNodeSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojswipeactions/index.d.ts b/types/oracle__oraclejet/ojswipeactions/index.d.ts new file mode 100644 index 0000000000..cb309b2668 --- /dev/null +++ b/types/oracle__oraclejet/ojswipeactions/index.d.ts @@ -0,0 +1,36 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojSwipeActions extends baseComponent { + translations: { + ariaHideActionsDescription?: string; + ariaShowEndActionsDescription?: string; + ariaShowStartActionsDescription?: string; + }; + onOjAction: ((event: ojSwipeActions.ojAction) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojSwipeActionsEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojSwipeActions[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojSwipeActionsSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojSwipeActionsSettablePropertiesLenient): void; + refresh(): void; +} +export namespace ojSwipeActions { + interface ojAction extends CustomEvent<{ + [propName: string]: any; + }> { + } +} +export interface ojSwipeActionsEventMap extends baseComponentEventMap { + 'ojAction': ojSwipeActions.ojAction; +} +export interface ojSwipeActionsSettableProperties extends baseComponentSettableProperties { + translations: { + ariaHideActionsDescription?: string; + ariaShowEndActionsDescription?: string; + ariaShowStartActionsDescription?: string; + }; +} +export interface ojSwipeActionsSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojswipetoreveal/index.d.ts b/types/oracle__oraclejet/ojswipetoreveal/index.d.ts new file mode 100644 index 0000000000..ec2587ee47 --- /dev/null +++ b/types/oracle__oraclejet/ojswipetoreveal/index.d.ts @@ -0,0 +1,4 @@ +export function setupSwipeActions(elem: Element, options?: { + threshold?: number; +}): void; +export function tearDownSwipeActions(elem: Element): void; diff --git a/types/oracle__oraclejet/ojswitch/index.d.ts b/types/oracle__oraclejet/ojswitch/index.d.ts new file mode 100644 index 0000000000..775bb8a1f9 --- /dev/null +++ b/types/oracle__oraclejet/ojswitch/index.d.ts @@ -0,0 +1,49 @@ +import { editableValue, editableValueEventMap, editableValueSettableProperties } from '../ojeditablevalue'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojSwitch extends editableValue { + disabled: boolean; + readonly: boolean; + value: boolean; + onDisabledChanged: ((event: JetElementCustomEvent) => any) | null; + onReadonlyChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onOjAnimateEnd: ((event: ojSwitch.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojSwitch.ojAnimateStart) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojSwitchEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojSwitch[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojSwitchSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojSwitchSettablePropertiesLenient): void; +} +export namespace ojSwitch { + interface ojAnimateEnd extends CustomEvent<{ + action: string; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: string; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } +} +export interface ojSwitchEventMap extends editableValueEventMap { + 'ojAnimateEnd': ojSwitch.ojAnimateEnd; + 'ojAnimateStart': ojSwitch.ojAnimateStart; + 'disabledChanged': JetElementCustomEvent; + 'readonlyChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojSwitchSettableProperties extends editableValueSettableProperties { + disabled: boolean; + readonly: boolean; + value: boolean; +} +export interface ojSwitchSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojswitcher/index.d.ts b/types/oracle__oraclejet/ojswitcher/index.d.ts new file mode 100644 index 0000000000..7d4ffc5bcd --- /dev/null +++ b/types/oracle__oraclejet/ojswitcher/index.d.ts @@ -0,0 +1,22 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojSwitcher extends JetElement { + value: string; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojSwitcherEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojSwitcher[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojSwitcherSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojSwitcherSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojSwitcherEventMap extends HTMLElementEventMap { + 'valueChanged': JetElementCustomEvent; +} +export interface ojSwitcherSettableProperties extends JetSettableProperties { + value: string; +} +export interface ojSwitcherSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojtable/index.d.ts b/types/oracle__oraclejet/ojtable/index.d.ts new file mode 100644 index 0000000000..4282815f2e --- /dev/null +++ b/types/oracle__oraclejet/ojtable/index.d.ts @@ -0,0 +1,595 @@ +import { DataProvider } from '../ojdataprovider'; +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojTable extends baseComponent> { + accessibility: { + rowHeader: string; + }; + as: string; + columns: Array<{ + className?: string | null; + field?: string | null; + footerClassName?: string | null; + footerRenderer?: ((context: ojTable.FooterRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + footerStyle?: string | null; + footerTemplate?: { + componentElement: Element; + }; + headerClassName?: string | null; + headerRenderer?: ((context: ojTable.HeaderRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + headerStyle?: string | null; + headerTemplate?: { + componentElement: Element; + data: object; + }; + headerText?: string | null; + id?: string | null; + renderer?: ((context: ojTable.ColumnsRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + resizable?: 'enabled' | 'disabled'; + sortProperty?: string | null; + sortable?: 'auto' | 'enabled' | 'disabled'; + style?: string | null; + template?: { + componentElement: Element; + data: object; + row: object; + index: number; + columnIndex: number; + key: any; + mode: string; + }; + width?: number | null; + }> | null; + columnsDefault: { + className?: string | null; + field?: string | null; + footerClassName?: string | null; + footerRenderer?: ((context: ojTable.FooterRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + footerStyle?: string | null; + footerTemplate?: { + componentElement: Element; + }; + headerClassName?: string | null; + headerRenderer?: ((context: ojTable.HeaderRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + headerStyle?: string | null; + headerTemplate?: { + componentElement: Element; + data: object; + }; + headerText?: string | null; + renderer?: ((context: ojTable.ColumnsRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + resizable?: 'enabled' | 'disabled'; + sortProperty?: string | null; + sortable?: 'auto' | 'enabled' | 'disabled'; + style?: string | null; + template?: { + componentElement: Element; + data: object; + row: object; + index: number; + columnIndex: number; + key: any; + mode: string; + }; + width?: number | null; + }; + currentRow: ojTable.CurrentRow | null; + data: DataProvider | null; + display: 'list' | 'grid'; + dnd: { + drag: { + rows: { + dataTypes?: string | string[]; + dragStart?: ((param0: DragEvent, param1: ojTable.DragRowContext) => void); + drag?: ((param0: DragEvent) => void); + dragEnd?: ((param0: DragEvent) => void); + }; + }; + drop: { + columns: { + dataTypes: string | string[]; + dragEnter?: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + dragOver?: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + dragLeave?: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + drop: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + }; + rows: { + dataTypes: string | string[]; + dragEnter?: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + dragOver?: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + dragLeave?: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + drop: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + }; + }; + reorder: { + columns: 'enabled' | 'disabled'; + }; + }; + editMode: 'none' | 'rowEdit'; + readonly firstSelectedRow: object; + horizontalGridVisible: 'auto' | 'enabled' | 'disabled'; + rowRenderer: ((context: ojTable.RowRendererContext) => string | HTMLElement | void) | null; + scrollPolicy: 'auto' | 'loadMoreOnScroll'; + scrollPolicyOptions: { + fetchSize: number; + maxCount: number; + }; + scrollPosition: { + x?: number; + y?: number; + columnIndex?: number; + rowIndex?: number; + columnKey?: any; + rowKey?: any; + offsetX?: number; + offsetY?: number; + }; + selection: Array & ojTable.RowSelectionEnd> | Array & ojTable.ColumnSelectionEnd>; + selectionMode: { + column: 'single' | 'multiple'; + row: 'single' | 'multiple'; + }; + selectionRequired: boolean; + verticalGridVisible: 'auto' | 'enabled' | 'disabled'; + translations: { + labelAccSelectionAffordanceBottom?: string; + labelAccSelectionAffordanceTop?: string; + labelDisableNonContiguousSelection?: string; + labelEditRow?: string; + labelEnableNonContiguousSelection?: string; + labelResize?: string; + labelResizePopupSpinner?: string; + labelResizePopupSubmit?: string; + labelSelectAndEditRow?: string; + labelSelectColum?: string; + labelSelectRow?: string; + labelSort?: string; + labelSortAsc?: string; + labelSortDsc?: string; + msgColumnResizeWidthValidation?: string; + msgFetchingData?: string; + msgInitializing?: string; + msgNoData?: string; + msgScrollPolicyMaxCountDetail?: string; + msgScrollPolicyMaxCountSummary?: string; + msgStatusSortAscending?: string; + msgStatusSortDescending?: string; + }; + onAccessibilityChanged: ((event: JetElementCustomEvent["accessibility"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onColumnsChanged: ((event: JetElementCustomEvent["columns"]>) => any) | null; + onColumnsDefaultChanged: ((event: JetElementCustomEvent["columnsDefault"]>) => any) | null; + onCurrentRowChanged: ((event: JetElementCustomEvent["currentRow"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDisplayChanged: ((event: JetElementCustomEvent["display"]>) => any) | null; + onDndChanged: ((event: JetElementCustomEvent["dnd"]>) => any) | null; + onEditModeChanged: ((event: JetElementCustomEvent["editMode"]>) => any) | null; + onFirstSelectedRowChanged: ((event: JetElementCustomEvent["firstSelectedRow"]>) => any) | null; + onHorizontalGridVisibleChanged: ((event: JetElementCustomEvent["horizontalGridVisible"]>) => any) | null; + onRowRendererChanged: ((event: JetElementCustomEvent["rowRenderer"]>) => any) | null; + onScrollPolicyChanged: ((event: JetElementCustomEvent["scrollPolicy"]>) => any) | null; + onScrollPolicyOptionsChanged: ((event: JetElementCustomEvent["scrollPolicyOptions"]>) => any) | null; + onScrollPositionChanged: ((event: JetElementCustomEvent["scrollPosition"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onSelectionRequiredChanged: ((event: JetElementCustomEvent["selectionRequired"]>) => any) | null; + onVerticalGridVisibleChanged: ((event: JetElementCustomEvent["verticalGridVisible"]>) => any) | null; + onOjAnimateEnd: ((event: ojTable.ojAnimateEnd) => any) | null; + onOjAnimateStart: ((event: ojTable.ojAnimateStart) => any) | null; + onOjBeforeCurrentRow: ((event: ojTable.ojBeforeCurrentRow) => any) | null; + onOjBeforeRowEdit: ((event: ojTable.ojBeforeRowEdit) => any) | null; + onOjBeforeRowEditEnd: ((event: ojTable.ojBeforeRowEditEnd) => any) | null; + onOjSort: ((event: ojTable.ojSort) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojTableEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojTable[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojTableSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojTableSettablePropertiesLenient): void; + getContextByNode(node: Element): { + subId: 'oj-table-cell'; + rowIndex: number; + columnIndex: number; + key: string; + } | { + subId: 'oj-table-footer' | 'oj-table-header'; + index: number; + }; + getDataForVisibleRow(rowIndex: number): { + data: D; + index: number; + key: K; + } | null; + refresh(): void; + refreshRow(rowIdx: number): Promise; +} +export namespace ojTable { + interface ojAnimateEnd extends CustomEvent<{ + action: 'add' | 'remove' | 'update'; + element: Element; + [propName: string]: any; + }> { + } + interface ojAnimateStart extends CustomEvent<{ + action: 'add' | 'remove' | 'update'; + element: Element; + endCallback: (() => void); + [propName: string]: any; + }> { + } + interface ojBeforeCurrentRow extends CustomEvent<{ + currentRow: CurrentRow; + previousCurrentRow: CurrentRow; + [propName: string]: any; + }> { + } + interface ojBeforeRowEdit extends CustomEvent<{ + rowContext: object; + [propName: string]: any; + }> { + } + interface ojBeforeRowEditEnd extends CustomEvent<{ + rowContext: object; + cancelEdit: object; + [propName: string]: any; + }> { + } + interface ojSort extends CustomEvent<{ + header: Element; + direction: 'ascending' | 'descending'; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type ColumnSelectionEnd = { + endIndex: { + column: number; + }; + endKey?: { + column: K; + }; + } | { + endIndex?: { + column: number; + }; + endKey: { + column: K; + }; + }; + // tslint:disable-next-line interface-over-type-literal + type ColumnSelectionStart = { + startIndex: { + column: number; + }; + startKey?: { + column: K; + }; + } | { + startIndex?: { + column: number; + }; + startKey: { + column: K; + }; + }; + // tslint:disable-next-line interface-over-type-literal + type ColumnsRendererContext = { + cellContext: { + datasource: DataProvider | null; + mode: 'edit' | 'navigation'; + status: ContextStatus; + }; + columnIndex: number; + componentElement: Element; + data: D; + parentElement: Element; + row: { + [name: string]: any; + }; + }; + // tslint:disable-next-line interface-over-type-literal + type ContextStatus = { + rowIndex: number; + rowKey: K; + currentRow: CurrentRow; + }; + // tslint:disable-next-line interface-over-type-literal + type CurrentRow = { + rowIndex: number; + rowKey?: K; + } | { + rowIndex?: number; + rowKey: K; + }; + // tslint:disable-next-line interface-over-type-literal + type DragRowContext = { + rows: Array<{ + data: D; + index: number; + key: K; + }>; + }; + // tslint:disable-next-line interface-over-type-literal + type DropColumnContext = { + columnIndex: number; + }; + // tslint:disable-next-line interface-over-type-literal + type DropRowContext = { + rowIndex: number; + }; + // tslint:disable-next-line interface-over-type-literal + type FooterRendererContext = { + columnIndex: number; + componentElement: Element; + footerContext: { + datasource: DataProvider | null; + }; + parentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type HeaderRendererContext = { + columnIndex: number; + columnHeaderDefaultRenderer?: ((param0: object, param1: ((param0: object) => void)) => void); + columnHeaderSortableIconRenderer?: ((param0: object, param1: ((param0: object) => void)) => void); + componentElement: Element; + data: string; + headerContext: { + datasource: DataProvider | null; + }; + parentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type RowRendererContext = { + componentElement: Element; + data: { + [name: string]: any; + }; + parentElement: Element; + rowContext: { + datasource: DataProvider | null; + mode: 'edit' | 'navigation'; + status: ContextStatus; + }; + }; + // tslint:disable-next-line interface-over-type-literal + type RowSelectionEnd = { + endIndex: { + row: number; + }; + endKey?: { + row: K; + }; + } | { + endIndex?: { + row: number; + }; + endKey: { + row: K; + }; + }; + // tslint:disable-next-line interface-over-type-literal + type RowSelectionStart = { + startIndex: { + row: number; + }; + startKey?: { + row: K; + }; + } | { + startIndex?: { + row: number; + }; + startKey: { + row: K; + }; + }; +} +export interface ojTableEventMap extends baseComponentEventMap> { + 'ojAnimateEnd': ojTable.ojAnimateEnd; + 'ojAnimateStart': ojTable.ojAnimateStart; + 'ojBeforeCurrentRow': ojTable.ojBeforeCurrentRow; + 'ojBeforeRowEdit': ojTable.ojBeforeRowEdit; + 'ojBeforeRowEditEnd': ojTable.ojBeforeRowEditEnd; + 'ojSort': ojTable.ojSort; + 'accessibilityChanged': JetElementCustomEvent["accessibility"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'columnsChanged': JetElementCustomEvent["columns"]>; + 'columnsDefaultChanged': JetElementCustomEvent["columnsDefault"]>; + 'currentRowChanged': JetElementCustomEvent["currentRow"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'displayChanged': JetElementCustomEvent["display"]>; + 'dndChanged': JetElementCustomEvent["dnd"]>; + 'editModeChanged': JetElementCustomEvent["editMode"]>; + 'firstSelectedRowChanged': JetElementCustomEvent["firstSelectedRow"]>; + 'horizontalGridVisibleChanged': JetElementCustomEvent["horizontalGridVisible"]>; + 'rowRendererChanged': JetElementCustomEvent["rowRenderer"]>; + 'scrollPolicyChanged': JetElementCustomEvent["scrollPolicy"]>; + 'scrollPolicyOptionsChanged': JetElementCustomEvent["scrollPolicyOptions"]>; + 'scrollPositionChanged': JetElementCustomEvent["scrollPosition"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'selectionRequiredChanged': JetElementCustomEvent["selectionRequired"]>; + 'verticalGridVisibleChanged': JetElementCustomEvent["verticalGridVisible"]>; +} +export interface ojTableSettableProperties extends baseComponentSettableProperties { + accessibility: { + rowHeader: string; + }; + as: string; + columns: Array<{ + className?: string | null; + field?: string | null; + footerClassName?: string | null; + footerRenderer?: ((context: ojTable.FooterRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + footerStyle?: string | null; + footerTemplate?: { + componentElement: Element; + }; + headerClassName?: string | null; + headerRenderer?: ((context: ojTable.HeaderRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + headerStyle?: string | null; + headerTemplate?: { + componentElement: Element; + data: object; + }; + headerText?: string | null; + id?: string | null; + renderer?: ((context: ojTable.ColumnsRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + resizable?: 'enabled' | 'disabled'; + sortProperty?: string | null; + sortable?: 'auto' | 'enabled' | 'disabled'; + style?: string | null; + template?: { + componentElement: Element; + data: object; + row: object; + index: number; + columnIndex: number; + key: any; + mode: string; + }; + width?: number | null; + }> | null; + columnsDefault: { + className?: string | null; + field?: string | null; + footerClassName?: string | null; + footerRenderer?: ((context: ojTable.FooterRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + footerStyle?: string | null; + footerTemplate?: { + componentElement: Element; + }; + headerClassName?: string | null; + headerRenderer?: ((context: ojTable.HeaderRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + headerStyle?: string | null; + headerTemplate?: { + componentElement: Element; + data: object; + }; + headerText?: string | null; + renderer?: ((context: ojTable.ColumnsRendererContext) => { + insert: HTMLElement | string; + } | void) | null; + resizable?: 'enabled' | 'disabled'; + sortProperty?: string | null; + sortable?: 'auto' | 'enabled' | 'disabled'; + style?: string | null; + template?: { + componentElement: Element; + data: object; + row: object; + index: number; + columnIndex: number; + key: any; + mode: string; + }; + width?: number | null; + }; + currentRow: ojTable.CurrentRow | null; + data: DataProvider | null; + display: 'list' | 'grid'; + dnd: { + drag: { + rows: { + dataTypes?: string | string[]; + dragStart?: ((param0: DragEvent, param1: ojTable.DragRowContext) => void); + drag?: ((param0: DragEvent) => void); + dragEnd?: ((param0: DragEvent) => void); + }; + }; + drop: { + columns: { + dataTypes: string | string[]; + dragEnter?: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + dragOver?: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + dragLeave?: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + drop: ((param0: DragEvent, param1: ojTable.DropColumnContext) => void); + }; + rows: { + dataTypes: string | string[]; + dragEnter?: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + dragOver?: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + dragLeave?: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + drop: ((param0: DragEvent, param1: ojTable.DropRowContext) => void); + }; + }; + reorder: { + columns: 'enabled' | 'disabled'; + }; + }; + editMode: 'none' | 'rowEdit'; + readonly firstSelectedRow: object; + horizontalGridVisible: 'auto' | 'enabled' | 'disabled'; + rowRenderer: ((context: ojTable.RowRendererContext) => string | HTMLElement | void) | null; + scrollPolicy: 'auto' | 'loadMoreOnScroll'; + scrollPolicyOptions: { + fetchSize: number; + maxCount: number; + }; + scrollPosition: { + x?: number; + y?: number; + columnIndex?: number; + rowIndex?: number; + columnKey?: any; + rowKey?: any; + offsetX?: number; + offsetY?: number; + }; + selection: Array & ojTable.RowSelectionEnd> | Array & ojTable.ColumnSelectionEnd>; + selectionMode: { + column: 'single' | 'multiple'; + row: 'single' | 'multiple'; + }; + selectionRequired: boolean; + verticalGridVisible: 'auto' | 'enabled' | 'disabled'; + translations: { + labelAccSelectionAffordanceBottom?: string; + labelAccSelectionAffordanceTop?: string; + labelDisableNonContiguousSelection?: string; + labelEditRow?: string; + labelEnableNonContiguousSelection?: string; + labelResize?: string; + labelResizePopupSpinner?: string; + labelResizePopupSubmit?: string; + labelSelectAndEditRow?: string; + labelSelectColum?: string; + labelSelectRow?: string; + labelSort?: string; + labelSortAsc?: string; + labelSortDsc?: string; + msgColumnResizeWidthValidation?: string; + msgFetchingData?: string; + msgInitializing?: string; + msgNoData?: string; + msgScrollPolicyMaxCountDetail?: string; + msgScrollPolicyMaxCountSummary?: string; + msgStatusSortAscending?: string; + msgStatusSortDescending?: string; + }; +} +export interface ojTableSettablePropertiesLenient extends Partial> { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojtagcloud/index.d.ts b/types/oracle__oraclejet/ojtagcloud/index.d.ts new file mode 100644 index 0000000000..17bc2397a5 --- /dev/null +++ b/types/oracle__oraclejet/ojtagcloud/index.d.ts @@ -0,0 +1,208 @@ +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojTagCloud extends dvtBaseComponent> { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + data: DataProvider | null; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + layout: 'cloud' | 'rectangular'; + selection: K[]; + selectionMode: 'single' | 'multiple' | 'none'; + styleDefaults: { + animationDuration?: number; + hoverBehaviorDelay?: number; + svgStyle?: object; + }; + tooltip: { + renderer: ((context: ojTagCloud.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onLayoutChanged: ((event: JetElementCustomEvent["layout"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onStyleDefaultsChanged: ((event: JetElementCustomEvent["styleDefaults"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTouchResponseChanged: ((event: JetElementCustomEvent["touchResponse"]>) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojTagCloudEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojTagCloud[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojTagCloudSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojTagCloudSettablePropertiesLenient): void; + getContextByNode(node: Element): ojTagCloud.NodeContext | null; + getItem(index: number): ojTagCloud.ItemContext | null; + getItemCount(): number; +} +export interface ojTagCloudEventMap extends dvtBaseComponentEventMap> { + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'layoutChanged': JetElementCustomEvent["layout"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'styleDefaultsChanged': JetElementCustomEvent["styleDefaults"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'touchResponseChanged': JetElementCustomEvent["touchResponse"]>; +} +export interface ojTagCloudSettableProperties extends dvtBaseComponentSettableProperties { + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + as: string; + data: DataProvider | null; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + layout: 'cloud' | 'rectangular'; + selection: K[]; + selectionMode: 'single' | 'multiple' | 'none'; + styleDefaults: { + animationDuration?: number; + hoverBehaviorDelay?: number; + svgStyle?: object; + }; + tooltip: { + renderer: ((context: ojTagCloud.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojTagCloudSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export namespace ojTagCloud { + // tslint:disable-next-line interface-over-type-literal + type ItemContext = { + color: string; + label: string; + selected: boolean; + tooltip: string; + value: number; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + subId: string; + index: number; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + color: string; + componentElement: Element; + id: K; + label: string; + parentElement: Element; + value: number; + }; +} +export interface ojTagCloudItem extends JetElement { + categories: string[]; + color?: string; + label: string; + shortDesc: string; + svgClassName: string; + svgStyle: object; + url: string; + value: number | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onUrlChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojTagCloudItemEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojTagCloudItem[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojTagCloudItemSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojTagCloudItemSettablePropertiesLenient): void; +} +export interface ojTagCloudItemEventMap extends HTMLElementEventMap { + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'urlChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojTagCloudItemSettableProperties extends JetSettableProperties { + categories: string[]; + color?: string; + label: string; + shortDesc: string; + svgClassName: string; + svgStyle: object; + url: string; + value: number | null; +} +export interface ojTagCloudItemSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojthematicmap/index.d.ts b/types/oracle__oraclejet/ojthematicmap/index.d.ts new file mode 100644 index 0000000000..45bbd3b907 --- /dev/null +++ b/types/oracle__oraclejet/ojthematicmap/index.d.ts @@ -0,0 +1,576 @@ +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojThematicMap extends dvtBaseComponent> { + animationDuration: number; + animationOnDisplay: 'auto' | 'none'; + areaData: DataProvider | null; + as: string; + focusRenderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverRenderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + initialZooming: 'auto' | 'none'; + isolatedItem: K1; + labelDisplay: 'on' | 'off' | 'auto'; + labelType: 'long' | 'short'; + linkData: DataProvider | null; + mapProvider: { + geo: object; + propertiesKeys: { + id: string; + longLabel?: string; + shortLabel?: string; + }; + }; + markerData: DataProvider | null; + markerZoomBehavior: 'zoom' | 'fixed'; + maxZoom: number; + panning: 'auto' | 'none'; + renderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + selection: Array; + selectionMode: 'single' | 'multiple' | 'none'; + selectionRenderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + styleDefaults: { + areaSvgStyle?: object; + dataAreaDefaults?: { + borderColor?: string; + hoverColor?: string; + selectedInnerColor?: string; + selectedOuterColor?: string; + }; + dataMarkerDefaults?: { + borderColor?: string; + borderStyle?: 'none' | 'solid'; + borderWidth?: number; + color?: string; + height?: number; + labelStyle?: object; + opacity?: number; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + width?: number; + }; + hoverBehaviorDelay?: number; + labelStyle?: object; + linkDefaults?: { + color?: string; + width?: number; + }; + }; + tooltip: { + renderer: ((context: ojThematicMap.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + tooltipDisplay: 'auto' | 'labelAndShortDesc' | 'none' | 'shortDesc'; + touchResponse: 'touchStart' | 'auto'; + zooming: 'auto' | 'none'; + translations: { + areasRegion?: string; + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + linksRegion?: string; + markersRegion?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onAnimationDurationChanged: ((event: JetElementCustomEvent["animationDuration"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAreaDataChanged: ((event: JetElementCustomEvent["areaData"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onFocusRendererChanged: ((event: JetElementCustomEvent["focusRenderer"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onHoverRendererChanged: ((event: JetElementCustomEvent["hoverRenderer"]>) => any) | null; + onInitialZoomingChanged: ((event: JetElementCustomEvent["initialZooming"]>) => any) | null; + onIsolatedItemChanged: ((event: JetElementCustomEvent["isolatedItem"]>) => any) | null; + onLabelDisplayChanged: ((event: JetElementCustomEvent["labelDisplay"]>) => any) | null; + onLabelTypeChanged: ((event: JetElementCustomEvent["labelType"]>) => any) | null; + onLinkDataChanged: ((event: JetElementCustomEvent["linkData"]>) => any) | null; + onMapProviderChanged: ((event: JetElementCustomEvent["mapProvider"]>) => any) | null; + onMarkerDataChanged: ((event: JetElementCustomEvent["markerData"]>) => any) | null; + onMarkerZoomBehaviorChanged: ((event: JetElementCustomEvent["markerZoomBehavior"]>) => any) | null; + onMaxZoomChanged: ((event: JetElementCustomEvent["maxZoom"]>) => any) | null; + onPanningChanged: ((event: JetElementCustomEvent["panning"]>) => any) | null; + onRendererChanged: ((event: JetElementCustomEvent["renderer"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onSelectionRendererChanged: ((event: JetElementCustomEvent["selectionRenderer"]>) => any) | null; + onStyleDefaultsChanged: ((event: JetElementCustomEvent["styleDefaults"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTooltipDisplayChanged: ((event: JetElementCustomEvent["tooltipDisplay"]>) => any) | null; + onTouchResponseChanged: ((event: JetElementCustomEvent["touchResponse"]>) => any) | null; + onZoomingChanged: ((event: JetElementCustomEvent["zooming"]>) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojThematicMapEventMap[T]) => any, + useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojThematicMap[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojThematicMapSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojThematicMapSettablePropertiesLenient): void; + getArea(index: number): ojThematicMap.DataContext | null; + getContextByNode(node: Element): ojThematicMap.NodeContext | null; + getLink(index: number): ojThematicMap.DataContext | null; + getMarker(index: number): ojThematicMap.DataContext | null; +} +export interface ojThematicMapEventMap extends dvtBaseComponentEventMap> { + 'animationDurationChanged': JetElementCustomEvent["animationDuration"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'areaDataChanged': JetElementCustomEvent["areaData"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'focusRendererChanged': JetElementCustomEvent["focusRenderer"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'hoverRendererChanged': JetElementCustomEvent["hoverRenderer"]>; + 'initialZoomingChanged': JetElementCustomEvent["initialZooming"]>; + 'isolatedItemChanged': JetElementCustomEvent["isolatedItem"]>; + 'labelDisplayChanged': JetElementCustomEvent["labelDisplay"]>; + 'labelTypeChanged': JetElementCustomEvent["labelType"]>; + 'linkDataChanged': JetElementCustomEvent["linkData"]>; + 'mapProviderChanged': JetElementCustomEvent["mapProvider"]>; + 'markerDataChanged': JetElementCustomEvent["markerData"]>; + 'markerZoomBehaviorChanged': JetElementCustomEvent["markerZoomBehavior"]>; + 'maxZoomChanged': JetElementCustomEvent["maxZoom"]>; + 'panningChanged': JetElementCustomEvent["panning"]>; + 'rendererChanged': JetElementCustomEvent["renderer"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'selectionRendererChanged': JetElementCustomEvent["selectionRenderer"]>; + 'styleDefaultsChanged': JetElementCustomEvent["styleDefaults"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'tooltipDisplayChanged': JetElementCustomEvent["tooltipDisplay"]>; + 'touchResponseChanged': JetElementCustomEvent["touchResponse"]>; + 'zoomingChanged': JetElementCustomEvent["zooming"]>; +} +export interface ojThematicMapSettableProperties extends dvtBaseComponentSettableProperties { + animationDuration: number; + animationOnDisplay: 'auto' | 'none'; + areaData: DataProvider | null; + as: string; + focusRenderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverRenderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + initialZooming: 'auto' | 'none'; + isolatedItem: K1; + labelDisplay: 'on' | 'off' | 'auto'; + labelType: 'long' | 'short'; + linkData: DataProvider | null; + mapProvider: { + geo: object; + propertiesKeys: { + id: string; + longLabel?: string; + shortLabel?: string; + }; + }; + markerData: DataProvider | null; + markerZoomBehavior: 'zoom' | 'fixed'; + maxZoom: number; + panning: 'auto' | 'none'; + renderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + selection: Array; + selectionMode: 'single' | 'multiple' | 'none'; + selectionRenderer: ((context: ojThematicMap.RendererContext) => { + insert: SVGElement; + } | void) | null; + styleDefaults: { + areaSvgStyle?: object; + dataAreaDefaults?: { + borderColor?: string; + hoverColor?: string; + selectedInnerColor?: string; + selectedOuterColor?: string; + }; + dataMarkerDefaults?: { + borderColor?: string; + borderStyle?: 'none' | 'solid'; + borderWidth?: number; + color?: string; + height?: number; + labelStyle?: object; + opacity?: number; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + width?: number; + }; + hoverBehaviorDelay?: number; + labelStyle?: object; + linkDefaults?: { + color?: string; + width?: number; + }; + }; + tooltip: { + renderer: ((context: ojThematicMap.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + tooltipDisplay: 'auto' | 'labelAndShortDesc' | 'none' | 'shortDesc'; + touchResponse: 'touchStart' | 'auto'; + zooming: 'auto' | 'none'; + translations: { + areasRegion?: string; + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + linksRegion?: string; + markersRegion?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojThematicMapSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export namespace ojThematicMap { + // tslint:disable-next-line interface-over-type-literal + type DataContext = { + color: string; + label: string; + selected: boolean; + tooltip: string; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + subId: string; + index: number; + }; + // tslint:disable-next-line interface-over-type-literal + type RendererContext = { + color: string; + componentElement: Element; + data: object; + id: K1 | K2 | K3; + itemData: D1 | D2 | D3; + label: string; + location: string | null; + parentElement: Element; + previousState: { + hovered: boolean; + selected: boolean; + focused: boolean; + }; + renderDefaultFocus: (() => void); + renderDefaultHover: (() => void); + renderDefaultSelection: (() => void); + root: Element | null; + state: { + hovered: boolean; + selected: boolean; + focused: boolean; + }; + x: number | null; + y: number | null; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + color: string | null; + componentElement: Element; + data: object | null; + id: K1 | K2 | K3; + itemData: D1 | D2 | D3; + label: string | null; + location: string | null; + locationName: string | null; + parentElement: Element; + tooltip: string; + x: number; + y: number; + }; +} +export interface ojThematicMapArea extends JetElement { + categories: string[]; + color: string; + label: string; + labelStyle: object; + location: string; + opacity: number; + selectable: 'auto' | 'off'; + shortDesc: string; + svgClassName: string; + svgStyle: object; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onLocationChanged: ((event: JetElementCustomEvent) => any) | null; + onOpacityChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectableChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojThematicMapAreaEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojThematicMapArea[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojThematicMapAreaSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojThematicMapAreaSettablePropertiesLenient): void; +} +export interface ojThematicMapAreaEventMap extends HTMLElementEventMap { + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'locationChanged': JetElementCustomEvent; + 'opacityChanged': JetElementCustomEvent; + 'selectableChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; +} +export interface ojThematicMapAreaSettableProperties extends JetSettableProperties { + categories: string[]; + color: string; + label: string; + labelStyle: object; + location: string; + opacity: number; + selectable: 'auto' | 'off'; + shortDesc: string; + svgClassName: string; + svgStyle: object; +} +export interface ojThematicMapAreaSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojThematicMapLink extends JetElement { + categories: string[]; + color: string; + endLocation: { + id?: any; + location?: string; + x?: number; + y?: number; + }; + selectable: 'auto' | 'off'; + shortDesc: string; + startLocation: { + id?: any; + location?: string; + x?: number; + y?: number; + }; + svgClassName: string; + svgStyle: object; + width: number; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onEndLocationChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectableChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onStartLocationChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onWidthChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojThematicMapLinkEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojThematicMapLink[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojThematicMapLinkSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojThematicMapLinkSettablePropertiesLenient): void; +} +export interface ojThematicMapLinkEventMap extends HTMLElementEventMap { + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'endLocationChanged': JetElementCustomEvent; + 'selectableChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'startLocationChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'widthChanged': JetElementCustomEvent; +} +export interface ojThematicMapLinkSettableProperties extends JetSettableProperties { + categories: string[]; + color: string; + endLocation: { + id?: any; + location?: string; + x?: number; + y?: number; + }; + selectable: 'auto' | 'off'; + shortDesc: string; + startLocation: { + id?: any; + location?: string; + x?: number; + y?: number; + }; + svgClassName: string; + svgStyle: object; + width: number; +} +export interface ojThematicMapLinkSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export interface ojThematicMapMarker extends JetElement { + borderColor: string; + borderStyle: 'solid' | 'none'; + borderWidth: number; + categories: string[]; + color: string; + height: number; + label: string; + labelPosition: 'bottom' | 'center' | 'top'; + labelStyle: object; + location: string; + opacity: number; + rotation: number; + selectable: 'auto' | 'off'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + shortDesc: string; + source: string; + sourceHover: string; + sourceHoverSelected: string; + sourceSelected: string; + svgClassName: string; + svgStyle: object; + value: number; + width: number; + x: number | null; + y: number | null; + onBorderColorChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onBorderWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onHeightChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelPositionChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onLocationChanged: ((event: JetElementCustomEvent) => any) | null; + onOpacityChanged: ((event: JetElementCustomEvent) => any) | null; + onRotationChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectableChanged: ((event: JetElementCustomEvent) => any) | null; + onShapeChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceHoverSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onSourceSelectedChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + onWidthChanged: ((event: JetElementCustomEvent) => any) | null; + onXChanged: ((event: JetElementCustomEvent) => any) | null; + onYChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojThematicMapMarkerEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojThematicMapMarker[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojThematicMapMarkerSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojThematicMapMarkerSettablePropertiesLenient): void; +} +export interface ojThematicMapMarkerEventMap extends HTMLElementEventMap { + 'borderColorChanged': JetElementCustomEvent; + 'borderStyleChanged': JetElementCustomEvent; + 'borderWidthChanged': JetElementCustomEvent; + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'heightChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelPositionChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'locationChanged': JetElementCustomEvent; + 'opacityChanged': JetElementCustomEvent; + 'rotationChanged': JetElementCustomEvent; + 'selectableChanged': JetElementCustomEvent; + 'shapeChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'sourceChanged': JetElementCustomEvent; + 'sourceHoverChanged': JetElementCustomEvent; + 'sourceHoverSelectedChanged': JetElementCustomEvent; + 'sourceSelectedChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; + 'widthChanged': JetElementCustomEvent; + 'xChanged': JetElementCustomEvent; + 'yChanged': JetElementCustomEvent; +} +export interface ojThematicMapMarkerSettableProperties extends JetSettableProperties { + borderColor: string; + borderStyle: 'solid' | 'none'; + borderWidth: number; + categories: string[]; + color: string; + height: number; + label: string; + labelPosition: 'bottom' | 'center' | 'top'; + labelStyle: object; + location: string; + opacity: number; + rotation: number; + selectable: 'auto' | 'off'; + shape?: 'circle' | 'diamond' | 'ellipse' | 'human' | 'plus' | 'rectangle' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | string; + shortDesc: string; + source: string; + sourceHover: string; + sourceHoverSelected: string; + sourceSelected: string; + svgClassName: string; + svgStyle: object; + value: number; + width: number; + x: number | null; + y: number | null; +} +export interface ojThematicMapMarkerSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojthemeutils/index.d.ts b/types/oracle__oraclejet/ojthemeutils/index.d.ts new file mode 100644 index 0000000000..de718ebef9 --- /dev/null +++ b/types/oracle__oraclejet/ojthemeutils/index.d.ts @@ -0,0 +1,4 @@ +export function clearCache(): void; +export function getThemeName(): string | null; +export function getThemeTargetPlatform(): string | null; +export function parseJSONFromFontFamily(selector: string): any; diff --git a/types/oracle__oraclejet/ojtime-base/index.d.ts b/types/oracle__oraclejet/ojtime-base/index.d.ts new file mode 100644 index 0000000000..c5841cd8ec --- /dev/null +++ b/types/oracle__oraclejet/ojtime-base/index.d.ts @@ -0,0 +1,22 @@ +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface dvtTimeComponent extends dvtBaseComponent { + addEventListener>(type: T, listener: (this: HTMLElement, ev: dvtTimeComponentEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): dvtTimeComponent[T]; + getProperty(property: string): any; + setProperty(property: T, value: dvtTimeComponentSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: dvtTimeComponentSettablePropertiesLenient): void; +} +// These interfaces are empty but required to keep the event chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface dvtTimeComponentEventMap extends dvtBaseComponentEventMap { +} +// These interfaces are empty but required to keep the component chain intact. Avoid lint-rule +// tslint:disable-next-line no-empty-interface +export interface dvtTimeComponentSettableProperties extends dvtBaseComponentSettableProperties { +} +export interface dvtTimeComponentSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojtimeaxis/index.d.ts b/types/oracle__oraclejet/ojtimeaxis/index.d.ts new file mode 100644 index 0000000000..2505fef16f --- /dev/null +++ b/types/oracle__oraclejet/ojtimeaxis/index.d.ts @@ -0,0 +1,87 @@ +import { Converter } from '../ojvalidation-base'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojTimeAxis extends dvtBaseComponent { + converter: ojTimeAxis.Converters | Converter; + end: string; + scale: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'; + start: string; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; + onConverterChanged: ((event: JetElementCustomEvent) => any) | null; + onEndChanged: ((event: JetElementCustomEvent) => any) | null; + onScaleChanged: ((event: JetElementCustomEvent) => any) | null; + onStartChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojTimeAxisEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojTimeAxis[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojTimeAxisSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojTimeAxisSettablePropertiesLenient): void; +} +export interface ojTimeAxisEventMap extends dvtBaseComponentEventMap { + 'converterChanged': JetElementCustomEvent; + 'endChanged': JetElementCustomEvent; + 'scaleChanged': JetElementCustomEvent; + 'startChanged': JetElementCustomEvent; +} +export interface ojTimeAxisSettableProperties extends dvtBaseComponentSettableProperties { + converter: ojTimeAxis.Converters | Converter; + end: string; + scale: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'; + start: string; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + }; +} +export interface ojTimeAxisSettablePropertiesLenient extends Partial { + [key: string]: any; +} +export namespace ojTimeAxis { + // tslint:disable-next-line interface-over-type-literal + type Converters = { + default?: Converter; + seconds?: Converter; + minutes?: Converter; + hours?: Converter; + days?: Converter; + weeks?: Converter; + months?: Converter; + quarters?: Converter; + years?: Converter; + }; +} diff --git a/types/oracle__oraclejet/ojtimeutils/index.d.ts b/types/oracle__oraclejet/ojtimeutils/index.d.ts new file mode 100644 index 0000000000..a77d0f4d36 --- /dev/null +++ b/types/oracle__oraclejet/ojtimeutils/index.d.ts @@ -0,0 +1,3 @@ +export function getDate(pos: number, rangeStartTime: Date | string | number, rangeEndTime: Date | string | number, rangeWidth: number): number; +export function getLength(startTime: Date | string | number, endTime: Date | string | number, rangeStartTime: Date | string | number, rangeEndTime: Date | string | number, rangeWidth: number): number; +export function getPosition(time: Date | string | number, rangeStartTime: Date | string | number, rangeEndTime: Date | string | number, rangeWidth: number): number; diff --git a/types/oracle__oraclejet/ojtoolbar/index.d.ts b/types/oracle__oraclejet/ojtoolbar/index.d.ts new file mode 100644 index 0000000000..c310c831c7 --- /dev/null +++ b/types/oracle__oraclejet/ojtoolbar/index.d.ts @@ -0,0 +1,22 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojToolbar extends baseComponent { + chroming: 'full' | 'half' | 'outlined'; + onChromingChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojToolbarEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojToolbar[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojToolbarSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojToolbarSettablePropertiesLenient): void; + refresh(): void; +} +export interface ojToolbarEventMap extends baseComponentEventMap { + 'chromingChanged': JetElementCustomEvent; +} +export interface ojToolbarSettableProperties extends baseComponentSettableProperties { + chroming: 'full' | 'half' | 'outlined'; +} +export interface ojToolbarSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojtrain/index.d.ts b/types/oracle__oraclejet/ojtrain/index.d.ts new file mode 100644 index 0000000000..233592fd61 --- /dev/null +++ b/types/oracle__oraclejet/ojtrain/index.d.ts @@ -0,0 +1,78 @@ +import { baseComponent, baseComponentEventMap, baseComponentSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojTrain extends baseComponent { + selectedStep: string; + steps: ojTrain.Step[]; + onSelectedStepChanged: ((event: JetElementCustomEvent) => any) | null; + onStepsChanged: ((event: JetElementCustomEvent) => any) | null; + onOjBeforeDeselect: ((event: ojTrain.ojBeforeDeselect) => any) | null; + onOjBeforeSelect: ((event: ojTrain.ojBeforeSelect) => any) | null; + onOjDeselect: ((event: ojTrain.ojDeselect) => any) | null; + onOjSelect: ((event: ojTrain.ojSelect) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojTrainEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojTrain[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojTrainSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojTrainSettablePropertiesLenient): void; + getNextSelectableStep(): string | null; + getPreviousSelectableStep(): string | null; + getStep(id: string): ojTrain.Step | null; + refresh(): void; + updateStep(id: string, stepProperties: { + id?: string; + label?: string; + disabled?: boolean; + visited?: boolean; + messageType?: 'info' | 'error' | 'fatal' | 'warning'; + }): void; +} +export namespace ojTrain { + interface ojBeforeDeselect extends CustomEvent<{ + toStep: string; + fromStep: string; + [propName: string]: any; + }> { + } + interface ojBeforeSelect extends CustomEvent<{ + toStep: string; + fromStep: string; + [propName: string]: any; + }> { + } + interface ojDeselect extends CustomEvent<{ + toStep: string; + fromStep: string; + [propName: string]: any; + }> { + } + interface ojSelect extends CustomEvent<{ + toStep: string; + fromStep: string; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type Step = { + id: string; + label: string; + disabled?: boolean; + visited?: boolean; + messageType?: 'info' | 'error' | 'fatal' | 'warning'; + }; +} +export interface ojTrainEventMap extends baseComponentEventMap { + 'ojBeforeDeselect': ojTrain.ojBeforeDeselect; + 'ojBeforeSelect': ojTrain.ojBeforeSelect; + 'ojDeselect': ojTrain.ojDeselect; + 'ojSelect': ojTrain.ojSelect; + 'selectedStepChanged': JetElementCustomEvent; + 'stepsChanged': JetElementCustomEvent; +} +export interface ojTrainSettableProperties extends baseComponentSettableProperties { + selectedStep: string; + steps: ojTrain.Step[]; +} +export interface ojTrainSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojtranslation/index.d.ts b/types/oracle__oraclejet/ojtranslation/index.d.ts new file mode 100644 index 0000000000..69957f1980 --- /dev/null +++ b/types/oracle__oraclejet/ojtranslation/index.d.ts @@ -0,0 +1,5 @@ +export function applyParameters(pattern: string, parameters: object | any[]): string | null; +export function getComponentTranslations(componentName: string): object; +export function getResource(key: string): object | string | null; +export function getTranslatedString(key: string, ...var_args: Array): string; +export function setBundle(bundle: object): void; diff --git a/types/oracle__oraclejet/ojtreedataprovider/index.d.ts b/types/oracle__oraclejet/ojtreedataprovider/index.d.ts new file mode 100644 index 0000000000..88d877d363 --- /dev/null +++ b/types/oracle__oraclejet/ojtreedataprovider/index.d.ts @@ -0,0 +1,5 @@ +import { DataProvider } from '../ojdataprovider'; +interface TreeDataProvider extends DataProvider { + getChildDataProvider(parentKey: any): TreeDataProvider; +} +export = TreeDataProvider; diff --git a/types/oracle__oraclejet/ojtreemap/index.d.ts b/types/oracle__oraclejet/ojtreemap/index.d.ts new file mode 100644 index 0000000000..56bfb35de9 --- /dev/null +++ b/types/oracle__oraclejet/ojtreemap/index.d.ts @@ -0,0 +1,392 @@ +import { DataProvider } from '../ojdataprovider'; +import { dvtBaseComponent, dvtBaseComponentEventMap, dvtBaseComponentSettableProperties } from '../ojdvt-base'; +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojTreemap extends dvtBaseComponent> { + animationDuration: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + animationUpdateColor: string; + as: string; + colorLabel: string; + data: DataProvider | null; + displayLevels: number; + drilling: 'on' | 'off'; + groupGaps: 'all' | 'none' | 'outer'; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + isolatedNode: any; + layout: 'sliceAndDiceHorizontal' | 'sliceAndDiceVertical' | 'squarified'; + nodeContent: { + renderer: ((context: ojTreemap.NodeContentContext) => ({ + insert: Element | string; + })); + }; + nodeDefaults: { + groupLabelDisplay: 'node' | 'off' | 'header'; + header: { + backgroundColor: string; + borderColor: string; + hoverBackgroundColor: string; + hoverInnerColor: string; + hoverOuterColor: string; + isolate: 'off' | 'on'; + labelHalign: 'center' | 'end' | 'start'; + labelStyle: object; + selectedBackgroundColor: string; + selectedInnerColor: string; + selectedOuterColor: string; + useNodeColor: 'on' | 'off'; + }; + hoverColor: string; + labelDisplay: 'off' | 'node'; + labelHalign: 'start' | 'end' | 'center'; + labelMinLength: number; + labelStyle: object; + labelValign: 'top' | 'bottom' | 'center'; + selectedInnerColor: string; + selectedOuterColor: string; + }; + nodeSeparators: 'bevels' | 'gaps'; + rootNode: any; + selection: any[]; + selectionMode: 'none' | 'single' | 'multiple'; + sizeLabel: string; + sorting: 'on' | 'off'; + tooltip: { + renderer: ((context: ojTreemap.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelColor?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + labelSize?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + tooltipIsolate?: string; + tooltipRestore?: string; + }; + onAnimationDurationChanged: ((event: JetElementCustomEvent["animationDuration"]>) => any) | null; + onAnimationOnDataChangeChanged: ((event: JetElementCustomEvent["animationOnDataChange"]>) => any) | null; + onAnimationOnDisplayChanged: ((event: JetElementCustomEvent["animationOnDisplay"]>) => any) | null; + onAnimationUpdateColorChanged: ((event: JetElementCustomEvent["animationUpdateColor"]>) => any) | null; + onAsChanged: ((event: JetElementCustomEvent["as"]>) => any) | null; + onColorLabelChanged: ((event: JetElementCustomEvent["colorLabel"]>) => any) | null; + onDataChanged: ((event: JetElementCustomEvent["data"]>) => any) | null; + onDisplayLevelsChanged: ((event: JetElementCustomEvent["displayLevels"]>) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent["drilling"]>) => any) | null; + onGroupGapsChanged: ((event: JetElementCustomEvent["groupGaps"]>) => any) | null; + onHiddenCategoriesChanged: ((event: JetElementCustomEvent["hiddenCategories"]>) => any) | null; + onHighlightMatchChanged: ((event: JetElementCustomEvent["highlightMatch"]>) => any) | null; + onHighlightedCategoriesChanged: ((event: JetElementCustomEvent["highlightedCategories"]>) => any) | null; + onHoverBehaviorChanged: ((event: JetElementCustomEvent["hoverBehavior"]>) => any) | null; + onHoverBehaviorDelayChanged: ((event: JetElementCustomEvent["hoverBehaviorDelay"]>) => any) | null; + onIsolatedNodeChanged: ((event: JetElementCustomEvent["isolatedNode"]>) => any) | null; + onLayoutChanged: ((event: JetElementCustomEvent["layout"]>) => any) | null; + onNodeContentChanged: ((event: JetElementCustomEvent["nodeContent"]>) => any) | null; + onNodeDefaultsChanged: ((event: JetElementCustomEvent["nodeDefaults"]>) => any) | null; + onNodeSeparatorsChanged: ((event: JetElementCustomEvent["nodeSeparators"]>) => any) | null; + onRootNodeChanged: ((event: JetElementCustomEvent["rootNode"]>) => any) | null; + onSelectionChanged: ((event: JetElementCustomEvent["selection"]>) => any) | null; + onSelectionModeChanged: ((event: JetElementCustomEvent["selectionMode"]>) => any) | null; + onSizeLabelChanged: ((event: JetElementCustomEvent["sizeLabel"]>) => any) | null; + onSortingChanged: ((event: JetElementCustomEvent["sorting"]>) => any) | null; + onTooltipChanged: ((event: JetElementCustomEvent["tooltip"]>) => any) | null; + onTouchResponseChanged: ((event: JetElementCustomEvent["touchResponse"]>) => any) | null; + onOjBeforeDrill: ((event: ojTreemap.ojBeforeDrill) => any) | null; + onOjDrill: ((event: ojTreemap.ojDrill) => any) | null; + addEventListener>(type: T, listener: (this: HTMLElement, ev: ojTreemapEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty>(property: T): ojTreemap[T]; + getProperty(property: string): any; + setProperty>(property: T, value: ojTreemapSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType>): void; + setProperties(properties: ojTreemapSettablePropertiesLenient): void; + getContextByNode(node: Element): ojTreemap.NodeContext | null; + getNode(subIdPath: any[]): ojTreemap.DataContext | null; +} +export namespace ojTreemap { + interface ojBeforeDrill extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + interface ojDrill extends CustomEvent<{ + id: any; + data: object; + itemData: object; + [propName: string]: any; + }> { + } + // tslint:disable-next-line interface-over-type-literal + type DataContext = { + color: string; + label: string; + selected: boolean; + size: number; + tooltip: string; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContentContext = { + bounds: { + x: number; + y: number; + width: number; + height: number; + }; + id: K; + data: object; + itemData: D; + componentElement: Element; + }; + // tslint:disable-next-line interface-over-type-literal + type NodeContext = { + subId: string; + indexPath: number[]; + }; + // tslint:disable-next-line interface-over-type-literal + type TooltipContext = { + parentElement: Element; + id: K; + label: string; + value: number; + color: string; + data: object; + itemData: D; + componentElement: Element; + }; +} +export interface ojTreemapEventMap extends dvtBaseComponentEventMap> { + 'ojBeforeDrill': ojTreemap.ojBeforeDrill; + 'ojDrill': ojTreemap.ojDrill; + 'animationDurationChanged': JetElementCustomEvent["animationDuration"]>; + 'animationOnDataChangeChanged': JetElementCustomEvent["animationOnDataChange"]>; + 'animationOnDisplayChanged': JetElementCustomEvent["animationOnDisplay"]>; + 'animationUpdateColorChanged': JetElementCustomEvent["animationUpdateColor"]>; + 'asChanged': JetElementCustomEvent["as"]>; + 'colorLabelChanged': JetElementCustomEvent["colorLabel"]>; + 'dataChanged': JetElementCustomEvent["data"]>; + 'displayLevelsChanged': JetElementCustomEvent["displayLevels"]>; + 'drillingChanged': JetElementCustomEvent["drilling"]>; + 'groupGapsChanged': JetElementCustomEvent["groupGaps"]>; + 'hiddenCategoriesChanged': JetElementCustomEvent["hiddenCategories"]>; + 'highlightMatchChanged': JetElementCustomEvent["highlightMatch"]>; + 'highlightedCategoriesChanged': JetElementCustomEvent["highlightedCategories"]>; + 'hoverBehaviorChanged': JetElementCustomEvent["hoverBehavior"]>; + 'hoverBehaviorDelayChanged': JetElementCustomEvent["hoverBehaviorDelay"]>; + 'isolatedNodeChanged': JetElementCustomEvent["isolatedNode"]>; + 'layoutChanged': JetElementCustomEvent["layout"]>; + 'nodeContentChanged': JetElementCustomEvent["nodeContent"]>; + 'nodeDefaultsChanged': JetElementCustomEvent["nodeDefaults"]>; + 'nodeSeparatorsChanged': JetElementCustomEvent["nodeSeparators"]>; + 'rootNodeChanged': JetElementCustomEvent["rootNode"]>; + 'selectionChanged': JetElementCustomEvent["selection"]>; + 'selectionModeChanged': JetElementCustomEvent["selectionMode"]>; + 'sizeLabelChanged': JetElementCustomEvent["sizeLabel"]>; + 'sortingChanged': JetElementCustomEvent["sorting"]>; + 'tooltipChanged': JetElementCustomEvent["tooltip"]>; + 'touchResponseChanged': JetElementCustomEvent["touchResponse"]>; +} +export interface ojTreemapSettableProperties extends dvtBaseComponentSettableProperties { + animationDuration: number; + animationOnDataChange: 'auto' | 'none'; + animationOnDisplay: 'auto' | 'none'; + animationUpdateColor: string; + as: string; + colorLabel: string; + data: DataProvider | null; + displayLevels: number; + drilling: 'on' | 'off'; + groupGaps: 'all' | 'none' | 'outer'; + hiddenCategories: string[]; + highlightMatch: 'any' | 'all'; + highlightedCategories: string[]; + hoverBehavior: 'dim' | 'none'; + hoverBehaviorDelay: number; + isolatedNode: any; + layout: 'sliceAndDiceHorizontal' | 'sliceAndDiceVertical' | 'squarified'; + nodeContent: { + renderer: ((context: ojTreemap.NodeContentContext) => ({ + insert: Element | string; + })); + }; + nodeDefaults: { + groupLabelDisplay: 'node' | 'off' | 'header'; + header: { + backgroundColor: string; + borderColor: string; + hoverBackgroundColor: string; + hoverInnerColor: string; + hoverOuterColor: string; + isolate: 'off' | 'on'; + labelHalign: 'center' | 'end' | 'start'; + labelStyle: object; + selectedBackgroundColor: string; + selectedInnerColor: string; + selectedOuterColor: string; + useNodeColor: 'on' | 'off'; + }; + hoverColor: string; + labelDisplay: 'off' | 'node'; + labelHalign: 'start' | 'end' | 'center'; + labelMinLength: number; + labelStyle: object; + labelValign: 'top' | 'bottom' | 'center'; + selectedInnerColor: string; + selectedOuterColor: string; + }; + nodeSeparators: 'bevels' | 'gaps'; + rootNode: any; + selection: any[]; + selectionMode: 'none' | 'single' | 'multiple'; + sizeLabel: string; + sorting: 'on' | 'off'; + tooltip: { + renderer: ((context: ojTreemap.TooltipContext) => ({ + insert: Element | string; + } | { + preventDefault: boolean; + })); + }; + touchResponse: 'touchStart' | 'auto'; + translations: { + componentName?: string; + labelAndValue?: string; + labelClearSelection?: string; + labelColor?: string; + labelCountWithTotal?: string; + labelDataVisualization?: string; + labelInvalidData?: string; + labelNoData?: string; + labelSize?: string; + stateCollapsed?: string; + stateDrillable?: string; + stateExpanded?: string; + stateHidden?: string; + stateIsolated?: string; + stateMaximized?: string; + stateMinimized?: string; + stateSelected?: string; + stateUnselected?: string; + stateVisible?: string; + tooltipIsolate?: string; + tooltipRestore?: string; + }; +} +export interface ojTreemapSettablePropertiesLenient extends Partial> { + [key: string]: any; +} +export interface ojTreemapNode extends JetElement { + categories?: string[]; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + groupLabelDisplay?: 'node' | 'off' | 'header'; + header?: { + isolate?: 'off' | 'on'; + labelHalign?: 'center' | 'end' | 'start'; + labelStyle?: object; + useNodeColor?: 'on' | 'off'; + }; + label?: string; + labelDisplay?: 'off' | 'node'; + labelHalign?: 'start' | 'end' | 'center'; + labelStyle?: object; + labelValign?: 'top' | 'bottom' | 'center'; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + selectable?: 'off' | 'auto'; + shortDesc?: string; + svgClassName?: string; + svgStyle?: object; + value: number; + onCategoriesChanged: ((event: JetElementCustomEvent) => any) | null; + onColorChanged: ((event: JetElementCustomEvent) => any) | null; + onDrillingChanged: ((event: JetElementCustomEvent) => any) | null; + onGroupLabelDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onHeaderChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelDisplayChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelHalignChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onLabelValignChanged: ((event: JetElementCustomEvent) => any) | null; + onPatternChanged: ((event: JetElementCustomEvent) => any) | null; + onSelectableChanged: ((event: JetElementCustomEvent) => any) | null; + onShortDescChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgClassNameChanged: ((event: JetElementCustomEvent) => any) | null; + onSvgStyleChanged: ((event: JetElementCustomEvent) => any) | null; + onValueChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojTreemapNodeEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojTreemapNode[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojTreemapNodeSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojTreemapNodeSettablePropertiesLenient): void; +} +export interface ojTreemapNodeEventMap extends HTMLElementEventMap { + 'categoriesChanged': JetElementCustomEvent; + 'colorChanged': JetElementCustomEvent; + 'drillingChanged': JetElementCustomEvent; + 'groupLabelDisplayChanged': JetElementCustomEvent; + 'headerChanged': JetElementCustomEvent; + 'labelChanged': JetElementCustomEvent; + 'labelDisplayChanged': JetElementCustomEvent; + 'labelHalignChanged': JetElementCustomEvent; + 'labelStyleChanged': JetElementCustomEvent; + 'labelValignChanged': JetElementCustomEvent; + 'patternChanged': JetElementCustomEvent; + 'selectableChanged': JetElementCustomEvent; + 'shortDescChanged': JetElementCustomEvent; + 'svgClassNameChanged': JetElementCustomEvent; + 'svgStyleChanged': JetElementCustomEvent; + 'valueChanged': JetElementCustomEvent; +} +export interface ojTreemapNodeSettableProperties extends JetSettableProperties { + categories?: string[]; + color?: string; + drilling?: 'on' | 'off' | 'inherit'; + groupLabelDisplay?: 'node' | 'off' | 'header'; + header?: { + isolate?: 'off' | 'on'; + labelHalign?: 'center' | 'end' | 'start'; + labelStyle?: object; + useNodeColor?: 'on' | 'off'; + }; + label?: string; + labelDisplay?: 'off' | 'node'; + labelHalign?: 'start' | 'end' | 'center'; + labelStyle?: object; + labelValign?: 'top' | 'bottom' | 'center'; + pattern?: 'smallChecker' | 'smallCrosshatch' | 'smallDiagonalLeft' | 'smallDiagonalRight' | 'smallDiamond' | 'smallTriangle' | 'largeChecker' | 'largeCrosshatch' | 'largeDiagonalLeft' | + 'largeDiagonalRight' | 'largeDiamond' | 'largeTriangle' | 'none'; + selectable?: 'off' | 'auto'; + shortDesc?: string; + svgClassName?: string; + svgStyle?: object; + value: number; +} +export interface ojTreemapNodeSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/ojvalidation-base/index.d.ts b/types/oracle__oraclejet/ojvalidation-base/index.d.ts new file mode 100644 index 0000000000..83a20555db --- /dev/null +++ b/types/oracle__oraclejet/ojvalidation-base/index.d.ts @@ -0,0 +1,144 @@ +import Message = require('../ojmessaging'); +import Color = require('../ojcolor'); +export interface AsyncValidator { + hint: Promise; + validate(value: V): Promise; +} +export class ColorConverter implements Converter { + constructor(options?: ColorConverter.ConverterOptions); + format(color: Color): string | null; + getHint(): string; + parse(value: string): Color; + resolvedOptions(): ColorConverter.ConverterOptions; +} +export namespace ColorConverter { + // tslint:disable-next-line interface-over-type-literal + type ConverterOptions = { + format?: 'rgb' | 'hsl' | 'hsv' | 'hex' | 'hex3'; + }; +} +export interface ColorConverterFactory { + createConverter(options?: ColorConverter.ConverterOptions): ColorConverter; +} +export interface Converter { + format(value: V): string | null; + getHint?(): string | null; + getOptions?(): object; + parse(value: string): V | null; + resolvedOptions?(): object; +} +export interface ConverterError { + // constructor(summary: string, detail: string); + getMessage(): Message; +} +export interface ConverterFactory { + // static CONVERTER_TYPE_COLOR: string; + // static CONVERTER_TYPE_DATETIME: string; + // static CONVERTER_TYPE_NUMBER: string; + createConverter(options: object | null): Converter; +} +export namespace IntlConverterUtils { + function dateToLocalIso(date: Date): string; + function getConverterInstance(converterOption: string | Validation.RegisteredConverter | Converter): Converter | null; + function getInitials(firstName?: string, lastName?: string): string | undefined; + function getLocalTimeZoneOffset(): string; + function isoToDate(isoString: string): Date; + function isoToLocalDate(isoString: string): Date; +} +export class LengthValidator implements Validator { + static defaults: { + countBy: string; + }; + constructor(options?: LengthValidator.ValidatorOptions); + getHint(): string | null; + validate(value: string | number): void; +} +export namespace LengthValidator { + // tslint:disable-next-line interface-over-type-literal + type ValidatorOptions = { + countBy?: 'codeUnit' | 'codePoint'; + min?: number; + max?: number; + hint?: { + max?: string; + min?: string; + inRange?: string; + exact?: string; + }; + messageDetail?: { + tooLong?: string; + tooShort?: string; + }; + messageSummary?: { + tooLong?: string; + tooShort?: string; + }; + }; +} +export interface LengthValidatorFactory { + createValidator(options?: LengthValidator.ValidatorOptions): LengthValidator; +} +export class RegExpValidator implements Validator { + constructor(options?: RegExpValidator.ValidatorOptions); + getHint(): string | null; + validate(value: string | number): void; +} +export namespace RegExpValidator { + // tslint:disable-next-line interface-over-type-literal + type ValidatorOptions = { + pattern?: string; + hint?: string; + messageSummary?: string; + messageDetail?: string; + }; +} +export interface RegExpValidatorFactory { + createValidator(options: RegExpValidator.ValidatorOptions): RegExpValidator; +} +export class RequiredValidator implements Validator { + constructor(options?: RequiredValidator.ValidatorOptions); + getHint(): string | null; + validate(value: object | string | number): void; +} +export namespace RequiredValidator { + // tslint:disable-next-line interface-over-type-literal + type ValidatorOptions = { + hint?: string; + messageSummary?: string; + messageDetail?: string; + }; +} +export interface RequiredValidatorFactory { + createValidator(options?: RequiredValidator.ValidatorOptions): RequiredValidator; +} +export namespace Validation { + function converterFactory>(type: 'number' | 'color' | 'datetime' | string, instance?: CF): CF | null; + function validatorFactory>(type: 'required' | 'regexp' | 'numberRange' | 'length' | 'dateTimeRange' | 'dateRestriction' | string, instance?: VF): VF | null; + // tslint:disable-next-line interface-over-type-literal + type RegisteredConverter = { + type: string; + options?: object; + }; + // tslint:disable-next-line interface-over-type-literal + type RegisteredValidator = { + type: string; + options?: object; + }; +} +export interface Validator { + getHint?(): string | null; + validate(value: V): void; +} +export interface ValidatorError { + // constructor(summary: string, detail: string); + getMessage(): Message; +} +export interface ValidatorFactory { + // static VALIDATOR_TYPE_DATERESTRICTION: string; + // static VALIDATOR_TYPE_DATETIMERANGE: string; + // static VALIDATOR_TYPE_LENGTH: string; + // static VALIDATOR_TYPE_NUMBERRANGE: string; + // static VALIDATOR_TYPE_REGEXP: string; + // static VALIDATOR_TYPE_REQUIRED: string; + createValidator(options: object | null): Validator; +} diff --git a/types/oracle__oraclejet/ojvalidation-datetime/index.d.ts b/types/oracle__oraclejet/ojvalidation-datetime/index.d.ts new file mode 100644 index 0000000000..976969a002 --- /dev/null +++ b/types/oracle__oraclejet/ojvalidation-datetime/index.d.ts @@ -0,0 +1,130 @@ +import { Converter, Validator, Validation } from '../ojvalidation-base'; +export class DateRestrictionValidator implements Validator { + constructor(options?: DateRestrictionValidator.ValidatorOptions); + getHint(): string | null; + validate(value: string): void; +} +export namespace DateRestrictionValidator { + // tslint:disable-next-line interface-over-type-literal + type DayFormatterInput = { + fullYear: number; + month: number; + date: number; + }; + // tslint:disable-next-line interface-over-type-literal + type DayFormatterOutput = { + disabled?: boolean; + className?: string; + tooltip?: string; + }; + // tslint:disable-next-line interface-over-type-literal + type ValidatorOptions = { + dayFormatter?: ((param0: DayFormatterInput) => DayFormatterOutput | null | 'all'); + messageSummary?: string; + messageDetail?: string; + }; +} +export interface DateRestrictionValidatorFactory { + createValidator(options?: DateRestrictionValidator.ValidatorOptions): DateRestrictionValidator; +} +export abstract class DateTimeConverter implements Converter { + abstract calculateWeek(value: string): number | undefined; + compareISODates(isoStr: string, isoStr2: string): number; + format(value: string): string | null; + getAvailableTimeZones(): any[]; + abstract isDayNameSet(): boolean; + abstract isDaySet(): boolean; + abstract isHourInAMPMSet(): boolean; + abstract isHourInDaySet(): boolean; + abstract isMilliSecondSet(): boolean; + abstract isMinuteSet(): boolean; + abstract isMonthSet(): boolean; + abstract isSecondSet(): boolean; + abstract isYearSet(): boolean; + parse(value: string): string | null; +} +export interface DateTimeConverterFactory { + createConverter(options?: IntlDateTimeConverter.ConverterOptions): IntlDateTimeConverter; +} +export class DateTimeRangeValidator implements Validator { + constructor(options?: DateTimeRangeValidator.ValidatorOptions); + getHint(): string | null; + validate(value: string): void; +} +export namespace DateTimeRangeValidator { + // tslint:disable-next-line interface-over-type-literal + type ValidatorOptions = { + converter: DateTimeConverter; + min?: string; + max?: string; + hint?: { + max?: string; + min?: string; + inRange?: string; + }; + translationKey?: string; + messageDetail?: { + rangeUnderflow?: string; + rangeOverflow?: string; + }; + messageSummary?: { + rangeUnderflow?: string; + rangeOverflow?: string; + }; + }; +} +export interface DateTimeRangeValidatorFactory { + createValidator(options?: DateTimeRangeValidator.ValidatorOptions): DateTimeRangeValidator; +} +export class IntlDateTimeConverter extends DateTimeConverter { + constructor(options?: IntlDateTimeConverter.ConverterOptions); + calculateWeek(value: string): number; + compareISODates(isoStr: string, isoStr2: string): number; + format(value: string): string | null; + formatRelative(value: string, relativeOptions?: { + formatUsing?: string; + dateField?: string; + relativeTime?: string; + dateOnly?: boolean; + timeZone?: string; + }): string | null; + getAvailableTimeZones(): any[]; + getHint(): null; + getOptions(): IntlDateTimeConverter.ConverterOptions; + isDayNameSet(): boolean; + isDaySet(): boolean; + isHourInAMPMSet(): boolean; + isHourInDaySet(): boolean; + isMilliSecondSet(): boolean; + isMinuteSet(): boolean; + isMonthSet(): boolean; + isSecondSet(): boolean; + isYearSet(): boolean; + parse(value: string): string | null; + resolvedOptions(): IntlDateTimeConverter.ConverterOptions; +} +export namespace IntlDateTimeConverter { + // tslint:disable-next-line interface-over-type-literal + type ConverterOptions = { + year?: '2-digit' | 'numeric'; + 'two-digit-year-start'?: number; + month?: '2-digit' | 'numeric' | 'narrow' | 'short' | 'long'; + day?: '2-digit' | 'numeric'; + hour?: '2-digit' | 'numeric'; + minute?: '2-digit' | 'numeric'; + second?: '2-digit' | 'numeric'; + millisecond?: 'numeric'; + weekday?: 'narrow' | 'short' | 'long'; + era?: 'narrow' | 'short' | 'long'; + timeZoneName?: 'short' | 'long'; + timeZone?: string; + isoStrFormat?: 'offset' | 'zulu' | 'local' | 'auto'; + dst?: boolean; + hour12?: boolean; + pattern?: string; + formatType?: 'date' | 'time' | 'datetime'; + dateFormat?: 'short' | 'medium' | 'long' | 'full'; + timeFormat?: 'short' | 'medium' | 'long' | 'full'; + lenientParse?: 'full' | 'none'; + }; +} diff --git a/types/oracle__oraclejet/ojvalidation-number/index.d.ts b/types/oracle__oraclejet/ojvalidation-number/index.d.ts new file mode 100644 index 0000000000..09addc6522 --- /dev/null +++ b/types/oracle__oraclejet/ojvalidation-number/index.d.ts @@ -0,0 +1,67 @@ +import { Converter, Validator, Validation } from '../ojvalidation-base'; +export class IntlNumberConverter extends NumberConverter { + constructor(options?: IntlNumberConverter.ConverterOptions); + format(value: number): string; + getHint(): null; + getOptions(): IntlNumberConverter.ConverterOptions; + parse(value: string): number | null; + resolvedOptions(): IntlNumberConverter.ConverterOptions; +} +export namespace IntlNumberConverter { + // tslint:disable-next-line interface-over-type-literal + type ConverterOptions = { + style?: 'decimal' | 'currency' | 'percent' | 'unit'; + currency?: string; + unit?: 'byte' | 'bit'; + currencyDisplay?: 'code' | 'symbol' | 'name'; + decimalFormat?: 'standard' | 'short' | 'long'; + currencyFormat?: 'standard' | 'short' | 'long'; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + useGrouping?: boolean; + pattern?: string; + roundingMode?: 'HALF_UP' | 'HALF_DOWN' | 'HALF_EVEN'; + roundDuringParse?: boolean; + separators?: object; + lenientParse?: 'full' | 'none'; + }; +} +export class NumberConverter implements Converter { + format(value: number): string | null; + parse(value: string): number | null; +} +export interface NumberConverterFactory { + createConverter(options?: IntlNumberConverter.ConverterOptions): IntlNumberConverter; +} +export class NumberRangeValidator implements Validator { + constructor(options?: NumberRangeValidator.ValidatorOptions); + getHint(): string | null; + validate(value: string | number): void; +} +export namespace NumberRangeValidator { + // tslint:disable-next-line interface-over-type-literal + type ValidatorOptions = { + converter?: NumberConverter; + min?: number; + max?: number; + hint?: { + max?: string; + min?: string; + inRange?: string; + exact?: string; + }; + messageDetail?: { + rangeUnderflow?: string; + rangeOverflow?: string; + exact?: string; + }; + messageSummary?: { + rangeUnderflow?: string; + rangeOverflow?: string; + }; + }; +} +export interface NumberRangeValidatorFactory { + createValidator(options?: NumberRangeValidator.ValidatorOptions): NumberRangeValidator; +} diff --git a/types/oracle__oraclejet/ojvalidationgroup/index.d.ts b/types/oracle__oraclejet/ojvalidationgroup/index.d.ts new file mode 100644 index 0000000000..e5dceb249a --- /dev/null +++ b/types/oracle__oraclejet/ojvalidationgroup/index.d.ts @@ -0,0 +1,23 @@ +import { JetElement, JetSettableProperties, JetElementCustomEvent, JetSetPropertyType } from '..'; +export interface ojValidationGroup extends JetElement { + readonly valid: 'valid' | 'pending' | 'invalidHidden' | 'invalidShown'; + onValidChanged: ((event: JetElementCustomEvent) => any) | null; + addEventListener(type: T, listener: (this: HTMLElement, ev: ojValidationGroupEventMap[T]) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + getProperty(property: T): ojValidationGroup[T]; + getProperty(property: string): any; + setProperty(property: T, value: ojValidationGroupSettableProperties[T]): void; + setProperty(property: T, value: JetSetPropertyType): void; + setProperties(properties: ojValidationGroupSettablePropertiesLenient): void; + focusOn(key?: '@firstInvalidShown'): void; + showMessages(): void; +} +export interface ojValidationGroupEventMap extends HTMLElementEventMap { + 'validChanged': JetElementCustomEvent; +} +export interface ojValidationGroupSettableProperties extends JetSettableProperties { + readonly valid: 'valid' | 'pending' | 'invalidHidden' | 'invalidShown'; +} +export interface ojValidationGroupSettablePropertiesLenient extends Partial { + [key: string]: any; +} diff --git a/types/oracle__oraclejet/oracle__oraclejet-tests.ts b/types/oracle__oraclejet/oracle__oraclejet-tests.ts new file mode 100644 index 0000000000..41c645e679 --- /dev/null +++ b/types/oracle__oraclejet/oracle__oraclejet-tests.ts @@ -0,0 +1,113 @@ +// Since all the definitions are auto generated from jsdoc doclets and internally tested through application, +// add some basic tests here. +import { ojAccordion } from "@oracle/oraclejet/ojaccordion"; +import AnimationUtils = require("@oracle/oraclejet/ojanimation"); +import ArrayDataProvider = require("@oracle/oraclejet/ojarraydataprovider"); +import ArrayTreeDataProvider = require("@oracle/oraclejet/ojarraytreedataprovider"); +import { AttributeGroupHandler, ColorAttributeGroupHandler, ShapeAttributeGroupHandler } from '@oracle/oraclejet/ojattributegrouphandler'; +import { ojAvatar } from "@oracle/oraclejet/ojavatar"; +import { ojButton, ojButtonsetMany, ojButtonsetOne } from "@oracle/oraclejet/ojbutton"; +import { ojChart, ojChartGroup, ojChartItem, ojChartSeries, ojSparkChart, ojSparkChartItem } from "@oracle/oraclejet/ojchart"; +import { ojCheckboxset } from "@oracle/oraclejet/ojcheckboxset"; +import { ojCollapsible } from "@oracle/oraclejet/ojcollapsible"; +import CollectionDataprovider = require("@oracle/oraclejet/ojcollectiondataprovider"); +import Color = require("@oracle/oraclejet/ojcolor"); +import { ojColorPalette } from "@oracle/oraclejet/ojcolorpalette"; +import { ojColorSpectrum } from "@oracle/oraclejet/ojcolorspectrum"; +import Components = require("@oracle/oraclejet/ojcomponentcore"); +import Composite = require("@oracle/oraclejet/ojcomposite"); +import Config = require('@oracle/oraclejet/ojconfig'); +import Context = require("@oracle/oraclejet/ojcontext"); +import { ojConveyorBelt } from "@oracle/oraclejet/ojconveyorbelt"; +import { ojDataGrid } from "@oracle/oraclejet/ojdatagrid"; +import { DataMapping, DataProvider, DataProviderAddOperationEventDetail, DataProviderMutationEventDetail, DataProviderOperationEventDetail } from "@oracle/oraclejet/ojdataprovider"; +import { ojDatePicker, ojDateTimePicker, ojInputDate, ojInputDateTime, ojInputTime } from "@oracle/oraclejet/ojdatetimepicker"; +import { ojDefer } from "@oracle/oraclejet/ojdefer"; +import DeferredDataprovider = require("@oracle/oraclejet/ojdeferreddataprovider"); +import { ojDiagram, ojDiagramLink, ojDiagramNode } from "@oracle/oraclejet/ojdiagram"; +import { ojDialog } from "@oracle/oraclejet/ojdialog"; +import { dvtBaseComponent } from "@oracle/oraclejet/ojdvt-base"; +import { editableValue } from "@oracle/oraclejet/ojeditablevalue"; +import ExpressionUtils = require('@oracle/oraclejet/ojexpressionutils'); +import { ojFilePicker, FileUploadTransport } from "@oracle/oraclejet/ojfilepicker"; +import { ojFilmStrip } from "@oracle/oraclejet/ojfilmstrip"; +import { ojFormLayout } from "@oracle/oraclejet/ojformlayout"; +import { ojGantt, ojGanttRow, ojGanttTask, ojGanttDependency } from "@oracle/oraclejet/ojgantt"; +import GanttUtils = require ('@oracle/oraclejet/ojganttutils'); +import { ojLedGauge, ojRatingGauge, ojStatusMeterGauge } from "@oracle/oraclejet/ojgauge"; +import { ojInputNumber } from "@oracle/oraclejet/ojinputnumber"; +import { ojInputPassword, ojInputText, ojTextArea } from "@oracle/oraclejet/ojinputtext"; +import { KeySet, ExpandAllKeySet, ExpandedKeySet } from "@oracle/oraclejet/ojkeyset"; +import { ObservableExpandedKeySet } from "@oracle/oraclejet/ojknockout-keyset"; +import KnockoutUtils = require("@oracle/oraclejet/ojknockout-model"); +import KnockoutTemplateUtils = require('@oracle/oraclejet/ojknockouttemplateutils'); +import { ojLabel } from "@oracle/oraclejet/ojlabel"; +import { ojLabelValue } from "@oracle/oraclejet/ojlabelvalue"; +import { ojLegend } from "@oracle/oraclejet/ojlegend"; +import ListDataProviderView = require("@oracle/oraclejet/ojlistdataproviderview"); +import { ojListView } from "@oracle/oraclejet/ojlistview"; +import LocaleData = require('@oracle/oraclejet/ojlocaledata'); +import Logger = require('@oracle/oraclejet/ojlogger'); +import { ojMasonryLayout } from "@oracle/oraclejet/ojmasonrylayout"; +import { ojMenu } from "@oracle/oraclejet/ojmenu"; +import { ojMenuSelectMany } from "@oracle/oraclejet/ojmenuselectmany"; +import { ojMessages } from "@oracle/oraclejet/ojmessages"; +import { ojMessage } from "@oracle/oraclejet/ojmessage"; +import Message = require("@oracle/oraclejet/ojmessaging"); +import { Collection, Model, URLError, OAuth } from "@oracle/oraclejet/ojmodel"; +import { ojModule } from "@oracle/oraclejet/ojmodule-element"; +import ModuleElementUtils = require("@oracle/oraclejet/ojmodule-element-utils"); +import ModuleAnimations = require("@oracle/oraclejet/ojmoduleanimations") ; +import { ojNavigationList, ojTabBar } from "@oracle/oraclejet/ojnavigationlist"; +import { ojNBox } from "@oracle/oraclejet/ojnbox"; +import { ojOptgroup } from "@oracle/oraclejet/ojoptgroup"; +import { ojOption } from "@oracle/oraclejet/ojoption"; +import { ojPictoChart, ojPictoChartItem } from "@oracle/oraclejet/ojpictochart"; +import { ojPopup } from "@oracle/oraclejet/ojpopup"; +import { ojProgress } from "@oracle/oraclejet/ojprogress"; +import { ojProgressList, ProgressItem } from "@oracle/oraclejet/ojprogresslist"; +import PullToRefreshUtils = require("@oracle/oraclejet/ojpulltorefresh"); +import { ojRadioset } from "@oracle/oraclejet/ojradioset"; +import { ojRefresher } from "@oracle/oraclejet/ojrefresher"; +import ResponsiveKnockoutUtils = require('@oracle/oraclejet/ojresponsiveknockoututils'); +import ResponsiveUtils = require('@oracle/oraclejet/ojresponsiveutils'); +import Router = require("@oracle/oraclejet/ojrouter"); +import { ojComboboxOne, ojComboboxMany, ojSelectOne, ojSelectMany } from "@oracle/oraclejet/ojselectcombobox"; +import { ojSlider } from "@oracle/oraclejet/ojslider"; +import { ojSunburst } from "@oracle/oraclejet/ojsunburst"; +import { ojSwipeActions } from "@oracle/oraclejet/ojswipeactions"; +import SwipeToRevealUtils = require("@oracle/oraclejet/ojswipetoreveal"); +import { ojSwitch } from "@oracle/oraclejet/ojswitch"; +import { ojSwitcher } from "@oracle/oraclejet/ojswitcher"; +import { ojTable } from "@oracle/oraclejet/ojtable"; +import { ojTagCloud } from "@oracle/oraclejet/ojtagcloud"; +import { ojThematicMap } from "@oracle/oraclejet/ojthematicmap"; +import ThemeUtils = require('@oracle/oraclejet/ojthemeutils'); +import { dvtTimeComponent } from "@oracle/oraclejet/ojtime-base"; +import { ojTimeAxis } from "@oracle/oraclejet/ojtimeaxis"; +import TimeUtils = require("@oracle/oraclejet/ojtimeutils"); +import { ojToolbar } from "@oracle/oraclejet/ojtoolbar"; +import { ojTrain } from "@oracle/oraclejet/ojtrain"; +import Translations = require("@oracle/oraclejet/ojtranslation"); +import TreeDataProvider = require("@oracle/oraclejet/ojtreedataprovider"); +import { ojTreemap } from "@oracle/oraclejet/ojtreemap"; +import { Validation, Validator, ValidatorError, ValidatorFactory, + AsyncValidator, LengthValidator, LengthValidatorFactory, RegExpValidator, RegExpValidatorFactory, RequiredValidator, RequiredValidatorFactory } from "@oracle/oraclejet/ojvalidation-base"; +import { DateRestrictionValidator, DateRestrictionValidatorFactory, DateTimeRangeValidator, DateTimeRangeValidatorFactory } from "@oracle/oraclejet/ojvalidation-datetime"; +import { NumberRangeValidator, NumberRangeValidatorFactory } from "@oracle/oraclejet/ojvalidation-number"; +import { ojValidationGroup } from "@oracle/oraclejet/ojvalidationgroup"; + +const onChangedCallback = (event: CustomEvent) => { +}; +const myHTMLElement = document.getElementById('myelement'); +const accordionElement = myHTMLElement as ojAccordion; +accordionElement.multiple = true; +accordionElement.onMultipleChanged = onChangedCallback; + +const avatarElement = myHTMLElement as ojAvatar; +avatarElement.size = "xxs"; +avatarElement.set("initials", "I"); +avatarElement.unset("src"); + +const button = myHTMLElement as ojButtonsetOne; +button.chroming = 'half'; diff --git a/types/oracle__oraclejet/tsconfig.json b/types/oracle__oraclejet/tsconfig.json new file mode 100644 index 0000000000..5f529007f8 --- /dev/null +++ b/types/oracle__oraclejet/tsconfig.json @@ -0,0 +1,126 @@ +{ + "compileOnSave": true, + "compilerOptions": { + "module": "commonjs", + "lib": ["dom","es5","scripthost", "es2015.core","es2015.collection","es2015","esnext.asynciterable"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "types": [], + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "target": "es5", + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "@oracle/oraclejet": [ + "oracle__oraclejet" + ], + "@oracle/oraclejet/*": [ + "oracle__oraclejet/*" + ] + } + }, + "files": [ + "oracle__oraclejet-tests.ts", + "index.d.ts", + "ojaccordion/index.d.ts", + "ojanimation/index.d.ts", + "ojarraydataprovider/index.d.ts", + "ojarraytreedataprovider/index.d.ts", + "ojattributegrouphandler/index.d.ts", + "ojavatar/index.d.ts", + "ojbutton/index.d.ts", + "ojchart/index.d.ts", + "ojcheckboxset/index.d.ts", + "ojcollapsible/index.d.ts", + "ojcollectiondataprovider/index.d.ts", + "ojcolor/index.d.ts", + "ojcolorpalette/index.d.ts", + "ojcolorspectrum/index.d.ts", + "ojcomponentcore/index.d.ts", + "ojcomposite/index.d.ts", + "ojconfig/index.d.ts", + "ojcontext/index.d.ts", + "ojconveyorbelt/index.d.ts", + "ojdatagrid/index.d.ts", + "ojdataprovider/index.d.ts", + "ojdatetimepicker/index.d.ts", + "ojdefer/index.d.ts", + "ojdeferreddataprovider/index.d.ts", + "ojdiagram/index.d.ts", + "ojdialog/index.d.ts", + "ojdvt-base/index.d.ts", + "ojeditablevalue/index.d.ts", + "ojexpressionutils/index.d.ts", + "ojfilepicker/index.d.ts", + "ojfilmstrip/index.d.ts", + "ojformlayout/index.d.ts", + "ojgantt/index.d.ts", + "ojganttutils/index.d.ts", + "ojgauge/index.d.ts", + "ojinputnumber/index.d.ts", + "ojinputtext/index.d.ts", + "ojkeyset/index.d.ts", + "ojknockout-keyset/index.d.ts", + "ojknockout-model/index.d.ts", + "ojknockouttemplateutils/index.d.ts", + "ojlabel/index.d.ts", + "ojlabelvalue/index.d.ts", + "ojlegend/index.d.ts", + "ojlistdataproviderview/index.d.ts", + "ojlistview/index.d.ts", + "ojlocaledata/index.d.ts", + "ojlogger/index.d.ts", + "ojmasonrylayout/index.d.ts", + "ojmenu/index.d.ts", + "ojmenuselectmany/index.d.ts", + "ojmessage/index.d.ts", + "ojmessages/index.d.ts", + "ojmessaging/index.d.ts", + "ojmodel/index.d.ts", + "ojmodule-element/index.d.ts", + "ojmodule-element-utils/index.d.ts", + "ojmoduleanimations/index.d.ts", + "ojnavigationlist/index.d.ts", + "ojnbox/index.d.ts", + "ojoptgroup/index.d.ts", + "ojoption/index.d.ts", + "ojpictochart/index.d.ts", + "ojpopup/index.d.ts", + "ojprogress/index.d.ts", + "ojprogresslist/index.d.ts", + "ojpulltorefresh/index.d.ts", + "ojradioset/index.d.ts", + "ojrefresher/index.d.ts", + "ojresponsiveknockoututils/index.d.ts", + "ojresponsiveutils/index.d.ts", + "ojrouter/index.d.ts", + "ojselectcombobox/index.d.ts", + "ojslider/index.d.ts", + "ojsunburst/index.d.ts", + "ojswipeactions/index.d.ts", + "ojswipetoreveal/index.d.ts", + "ojswitch/index.d.ts", + "ojswitcher/index.d.ts", + "ojtable/index.d.ts", + "ojtagcloud/index.d.ts", + "ojthematicmap/index.d.ts", + "ojthemeutils/index.d.ts", + "ojtime-base/index.d.ts", + "ojtimeaxis/index.d.ts", + "ojtimeutils/index.d.ts", + "ojtoolbar/index.d.ts", + "ojtrain/index.d.ts", + "ojtranslation/index.d.ts", + "ojtreedataprovider/index.d.ts", + "ojtreemap/index.d.ts", + "ojvalidation-base/index.d.ts", + "ojvalidation-datetime/index.d.ts", + "ojvalidation-number/index.d.ts", + "ojvalidationgroup/index.d.ts" + ] +} \ No newline at end of file diff --git a/types/oracle__oraclejet/tslint.json b/types/oracle__oraclejet/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/oracle__oraclejet/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/osmosis/index.d.ts b/types/osmosis/index.d.ts index 4c03388047..8d9f640f8b 100644 --- a/types/osmosis/index.d.ts +++ b/types/osmosis/index.d.ts @@ -56,8 +56,33 @@ interface Osmosis { * result data, osmosis finished */ data(callback: (param: any) => any): Osmosis; - } - declare const osmosis: Osmosis; + /** + * Set configuration options for the **preceeding** command on down the chain. + */ + config(option: string | { [key: string]: any }, value?: any): Osmosis; - export = osmosis; + /** + * Set a cookie. Short for `.config({ cookies: ... })`. Note: Setting a cookie to `null` will delete the cookie. + */ + cookie(name: string, value: string | null): Osmosis; + + /** + * Set an HTTP header. Short for `.config({ headers: ... })` + */ + header(name: string, value: string): Osmosis; + + /** + * Set multiple HTTP headers. Short for `.config({ headers: ... })`. + */ + headers(headers: { [key: string]: string }): Osmosis; + + /** + * Call a callback when the Osmosis instance has completely finished. + */ + done(callback: () => any): Osmosis; +} + +declare const osmosis: Osmosis; + +export = osmosis; diff --git a/types/osmosis/osmosis-tests.ts b/types/osmosis/osmosis-tests.ts index f0c39d4312..94f08db15e 100644 --- a/types/osmosis/osmosis-tests.ts +++ b/types/osmosis/osmosis-tests.ts @@ -12,9 +12,15 @@ const errorFunction = (error: string) => { const myError = error; }; -// example is from https://github.com/rchipka/node-osmosis#example +const doneFunction = () => {}; + +// modified example from https://github.com/rchipka/node-osmosis#example osmosis + .config({ headers: { 'test-header-name': 'test-header-value' } }) + .headers({ 'test-header-name': 'test-header-value' }) + .header('test-header-name', 'test-header-value') + .cookie('test-cookie-name', 'test-cookie-value') .get('www.craigslist.org/about/sites') .find('h1 + div a') .set('location') @@ -39,4 +45,5 @@ osmosis }) .log(logFunction) .error(errorFunction) - .debug(debugFunction); + .debug(debugFunction) + .done(doneFunction); diff --git a/types/p-loading/tsconfig.json b/types/p-loading/tsconfig.json index 09fd52fdda..6f45b638aa 100644 --- a/types/p-loading/tsconfig.json +++ b/types/p-loading/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/p-queue/index.d.ts b/types/p-queue/index.d.ts index 568de0ca1d..10c1179815 100644 --- a/types/p-queue/index.d.ts +++ b/types/p-queue/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for p-queue 2.3 +// Type definitions for p-queue 3.0 // Project: https://github.com/sindresorhus/p-queue#readme // Definitions by: BendingBender // Evan Shortiss @@ -93,6 +93,9 @@ declare namespace PQueue { concurrency?: number; autoStart?: boolean; queueClass?: QueueClassConstructor; + intervalCap?: number; + interval?: number; + carryoverConcurrencyCount?: boolean; } interface DefaultAddOptions { diff --git a/types/p-queue/v2/index.d.ts b/types/p-queue/v2/index.d.ts new file mode 100644 index 0000000000..568de0ca1d --- /dev/null +++ b/types/p-queue/v2/index.d.ts @@ -0,0 +1,103 @@ +// Type definitions for p-queue 2.3 +// Project: https://github.com/sindresorhus/p-queue#readme +// Definitions by: BendingBender +// Evan Shortiss +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export = PQueue; + +declare class PQueue { + /** + * Size of the queue. + */ + size: number; + + /** + * Number of pending promises. + */ + pending: number; + + /** + * Whether the queue is currently paused. + */ + isPaused: boolean; + + constructor(opts?: PQueue.Options); + + /** + * Returns the promise returned by calling fn. + * @param fn Promise-returning/async function. + */ + add(fn: PQueue.Task, opts?: O): Promise; + + /** + * Same as .add(), but accepts an array of async functions and + * returns a promise that resolves when all async functions are resolved. + * @param fn Array of Promise-returning/async functions. + */ + addAll(fns: Array>, opts?: O): Promise; + + /** + * Returns a promise that settles when the queue becomes empty. + * Can be called multiple times. Useful if you for example add + * additional items at a later time. + */ + onEmpty(): Promise; + + /** + * Returns a promise that settles when the queue becomes empty, and all + * promises have completed; queue.size === 0 && queue.pending === 0. + * The difference with .onEmpty is that .onIdle guarantees that all work + * from the queue has finished. .onEmpty merely signals that the queue is + * empty, but it could mean that some promises haven't completed yet. + */ + onIdle(): Promise; + + /** + * Start (or resume) executing enqueued tasks within concurrency limit. + * No need to call this if queue is not paused (via options.autoStart = false + * or by .pause() method.) + */ + start(): void; + + /** + * Clear the queue. + */ + clear(): void; + + /** + * Put queue execution on hold. + */ + pause(): void; +} + +declare namespace PQueue { + interface QueueAddOptions { + [key: string]: any; + } + + interface QueueClassConstructor { + new(): QueueClass; + } + + interface QueueClass { + size: number; + + enqueue(run: () => void, options?: O): void; + + dequeue(): (() => void) | undefined; + } + + interface Options { + concurrency?: number; + autoStart?: boolean; + queueClass?: QueueClassConstructor; + } + + interface DefaultAddOptions { + priority?: number; + } + + type Task = () => Promise; +} diff --git a/types/p-queue/v2/p-queue-tests.ts b/types/p-queue/v2/p-queue-tests.ts new file mode 100644 index 0000000000..fcd48c852d --- /dev/null +++ b/types/p-queue/v2/p-queue-tests.ts @@ -0,0 +1,51 @@ +import PQueue = require("p-queue"); + +const queue = new PQueue({ concurrency: 1 }); + +queue + .add(() => Promise.resolve("sindresorhus.com")) + .then(sindre => { + const str: string = sindre; + }); + +queue.addAll([() => Promise.resolve("oh"), () => Promise.resolve("hi")]).then(r => { + r.indexOf("h"); +}); + +Promise.resolve((): Promise => Promise.resolve("unicorn")) + .then(task => queue.add(task, { priority: 5 })) + .then(unicorn => { + const str: string = unicorn; + }); + +queue.onEmpty().then(() => {}); +queue.onIdle().then(() => {}); +queue.start(); +queue.pause(); +queue.clear(); + +let num: number; +num = queue.size; +num = queue.pending; +const paused = queue.isPaused; + +class QueueClass implements PQueue.QueueClass<{ any: string }> { + private readonly queue: Array<() => void>; + + size = 0; + + constructor() { + this.queue = []; + } + + enqueue(run: () => void, options: { any: string }) { + this.queue.push(run); + } + + dequeue() { + return this.queue.shift(); + } +} + +const queue2 = new PQueue({ queueClass: QueueClass }); +queue2.add(() => Promise.resolve(), { any: "hi" }); diff --git a/types/p-queue/v2/tsconfig.json b/types/p-queue/v2/tsconfig.json new file mode 100644 index 0000000000..49d979aa06 --- /dev/null +++ b/types/p-queue/v2/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "p-queue": [ "p-queue/v2" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "p-queue-tests.ts" + ] +} diff --git a/types/p-queue/v2/tslint.json b/types/p-queue/v2/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/p-queue/v2/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/p-wait-for/index.d.ts b/types/p-wait-for/index.d.ts index 5e8f88d413..d7fa76e016 100644 --- a/types/p-wait-for/index.d.ts +++ b/types/p-wait-for/index.d.ts @@ -1,8 +1,15 @@ -// Type definitions for p-wait-for 1.0 +// Type definitions for p-wait-for 2.0 // Project: https://github.com/sindresorhus/p-wait-for#readme // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = pWaitFor; -declare function pWaitFor(condition: () => PromiseLike | boolean, interval?: number): Promise; +declare function pWaitFor(condition: () => PromiseLike | boolean, options?: pWaitFor.Options): Promise; + +declare namespace pWaitFor { + interface Options { + interval?: number; + timeout?: number; + } +} diff --git a/types/p-wait-for/p-wait-for-tests.ts b/types/p-wait-for/p-wait-for-tests.ts index 587d08d5a5..ef23ef6526 100644 --- a/types/p-wait-for/p-wait-for-tests.ts +++ b/types/p-wait-for/p-wait-for-tests.ts @@ -1,6 +1,8 @@ import pWaitFor = require('p-wait-for'); pWaitFor(() => Promise.resolve(false)).then(() => {}); -pWaitFor(() => Promise.resolve(true), 1).then(() => {}); +pWaitFor(() => Promise.resolve(true), { interval: 1 }).then(() => {}); +pWaitFor(() => Promise.resolve(true), { timeout: 1 }).then(() => {}); pWaitFor(() => false).then(() => {}); -pWaitFor(() => true, 1).then(() => {}); +pWaitFor(() => true, { interval: 1 }).then(() => {}); +pWaitFor(() => true, { timeout: 1 }).then(() => {}); diff --git a/types/p-wait-for/v1/index.d.ts b/types/p-wait-for/v1/index.d.ts new file mode 100644 index 0000000000..5e8f88d413 --- /dev/null +++ b/types/p-wait-for/v1/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for p-wait-for 1.0 +// Project: https://github.com/sindresorhus/p-wait-for#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = pWaitFor; + +declare function pWaitFor(condition: () => PromiseLike | boolean, interval?: number): Promise; diff --git a/types/p-wait-for/v1/p-wait-for-tests.ts b/types/p-wait-for/v1/p-wait-for-tests.ts new file mode 100644 index 0000000000..587d08d5a5 --- /dev/null +++ b/types/p-wait-for/v1/p-wait-for-tests.ts @@ -0,0 +1,6 @@ +import pWaitFor = require('p-wait-for'); + +pWaitFor(() => Promise.resolve(false)).then(() => {}); +pWaitFor(() => Promise.resolve(true), 1).then(() => {}); +pWaitFor(() => false).then(() => {}); +pWaitFor(() => true, 1).then(() => {}); diff --git a/types/p-wait-for/v1/tsconfig.json b/types/p-wait-for/v1/tsconfig.json new file mode 100644 index 0000000000..2d81275cae --- /dev/null +++ b/types/p-wait-for/v1/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "p-wait-for": [ "p-wait-for/v1" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "p-wait-for-tests.ts" + ] +} diff --git a/types/p-wait-for/v1/tslint.json b/types/p-wait-for/v1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/p-wait-for/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/p5/constants.d.ts b/types/p5/constants.d.ts new file mode 100644 index 0000000000..808e55b72e --- /dev/null +++ b/types/p5/constants.d.ts @@ -0,0 +1,127 @@ +import * as p5 from "./index"; + +declare module "./index" { + type ANGLE_MODE = + | RADIANS + | DEGREES; + + type ARC_MODE = + | CHORD + | PIE + | OPEN; + + type BEGIN_KIND = + | POINTS + | LINES + | TRIANGLES + | TRIANGLE_FAN + | TRIANGLE_STRIP + | QUADS + | QUAD_STRIP; + + type BLEND_MODE = + | BLEND + | DARKEST + | LIGHTEST + | DIFFERENCE + | MULTIPLY + | EXCLUSION + | SCREEN + | REPLACE + | OVERLAY + | HARD_LIGHT + | SOFT_LIGHT + | DODGE + | BURN + | ADD + | NORMAL; + + type COLOR_MODE = + | RGB + | HSB + | HSL; + + type CURSOR_TYPE = + | ARROW + | CROSS + | HAND + | MOVE + | TEXT + | WAIT; + + type DEBUG_MODE = + | GRID + | AXES; + + type ELLIPSE_MODE = + | CENTER + | RADIUS + | CORNER + | CORNERS; + + type END_MODE = CLOSE; + + type FILTER_TYPE = + | THRESHOLD + | GRAY + | OPAQUE + | INVERT + | POSTERIZE + | BLUR + | ERODE + | DILATE + | BLUR; + + type GRAPHICS_RENDERER = + | P2D + | WEBGL; + + type HORIZ_ALIGN = + | LEFT + | CENTER + | RIGHT; + + type IMAGE_MODE = + | CORNER + | CORNERS + | CENTER; + + type RECT_MODE = + | CORNER + | CORNERS + | CENTER + | RADIUS; + + type RENDERER = + | P2D + | WEBGL; + + type SIZE_H = AUTO; + + type SIZE_W = AUTO; + + type STROKE_CAP = + | SQUARE + | PROJECT + | ROUND; + + type STROKE_JOIN = + | MITER + | BEVEL + | ROUND; + + type THE_STYLE = + | NORMAL + | ITALIC + | BOLD; + + type TYPE = + | VIDEO + | AUDIO; + + type VERT_ALIGN = + | TOP + | BOTTOM + | CENTER + | BASELINE; +} diff --git a/types/p5/global.d.ts b/types/p5/global.d.ts new file mode 100644 index 0000000000..6dd593e282 --- /dev/null +++ b/types/p5/global.d.ts @@ -0,0 +1,7874 @@ +// Global mode type definitions for p5 + +// This file was auto-generated. Please do not edit it. + +/// +/// +import * as p5 from "./index"; +declare global { + /** + * Extracts the alpha value from a color or pixel + * array. + * @param color p5.Color object, color components, or + * CSS color + * @return the alpha value + */ + function alpha( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * Extracts the blue value from a color or pixel + * array. + * @param color p5.Color object, color components, or + * CSS color + * @return the blue value + */ + function blue( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * Extracts the HSB brightness value from a color or + * pixel array. + * @param color p5.Color object, color components, or + * CSS color + * @return the brightness value + */ + function brightness( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * Creates colors for storing in variables of the + * color datatype. The parameters are interpreted as + * RGB or HSB values depending on the current + * colorMode(). The default mode is RGB values from 0 + * to 255 and, therefore, the function call + * color(255, 204, 0) will return a bright yellow + * color. Note that if only one value is provided to + * color(), it will be interpreted as a grayscale + * value. Add a second value, and it will be used for + * alpha transparency. When three values are + * specified, they are interpreted as either RGB or + * HSB values. Adding a fourth value applies alpha + * transparency. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * @param gray number specifying value between white + * and black. + * @param [alpha] alpha value relative to current + * color range (default is 0-255) + * @return resulting color + */ + function color( + gray: number, + alpha?: number + ): p5.Color; + + /** + * Creates colors for storing in variables of the + * color datatype. The parameters are interpreted as + * RGB or HSB values depending on the current + * colorMode(). The default mode is RGB values from 0 + * to 255 and, therefore, the function call + * color(255, 204, 0) will return a bright yellow + * color. Note that if only one value is provided to + * color(), it will be interpreted as a grayscale + * value. Add a second value, and it will be used for + * alpha transparency. When three values are + * specified, they are interpreted as either RGB or + * HSB values. Adding a fourth value applies alpha + * transparency. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * @param v1 red or hue value relative to the current + * color range + * @param v2 green or saturation value relative to + * the current color range + * @param v3 blue or brightness value relative to the + * current color range + * @param [alpha] alpha value relative to current + * color range (default is 0-255) + */ + function color( + v1: number, + v2: number, + v3: number, + alpha?: number + ): p5.Color; + + /** + * Creates colors for storing in variables of the + * color datatype. The parameters are interpreted as + * RGB or HSB values depending on the current + * colorMode(). The default mode is RGB values from 0 + * to 255 and, therefore, the function call + * color(255, 204, 0) will return a bright yellow + * color. Note that if only one value is provided to + * color(), it will be interpreted as a grayscale + * value. Add a second value, and it will be used for + * alpha transparency. When three values are + * specified, they are interpreted as either RGB or + * HSB values. Adding a fourth value applies alpha + * transparency. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * @param value a color string + */ + function color( + value: string + ): p5.Color; + + /** + * Creates colors for storing in variables of the + * color datatype. The parameters are interpreted as + * RGB or HSB values depending on the current + * colorMode(). The default mode is RGB values from 0 + * to 255 and, therefore, the function call + * color(255, 204, 0) will return a bright yellow + * color. Note that if only one value is provided to + * color(), it will be interpreted as a grayscale + * value. Add a second value, and it will be used for + * alpha transparency. When three values are + * specified, they are interpreted as either RGB or + * HSB values. Adding a fourth value applies alpha + * transparency. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * @param values an array containing the + * red,green,blue & and alpha components of the color + */ + function color( + values: number[] + ): p5.Color; + + /** + * Creates colors for storing in variables of the + * color datatype. The parameters are interpreted as + * RGB or HSB values depending on the current + * colorMode(). The default mode is RGB values from 0 + * to 255 and, therefore, the function call + * color(255, 204, 0) will return a bright yellow + * color. Note that if only one value is provided to + * color(), it will be interpreted as a grayscale + * value. Add a second value, and it will be used for + * alpha transparency. When three values are + * specified, they are interpreted as either RGB or + * HSB values. Adding a fourth value applies alpha + * transparency. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + */ + function color( + color: p5.Color + ): p5.Color; + + /** + * Extracts the green value from a color or pixel + * array. + * @param color p5.Color object, color components, or + * CSS color + * @return the green value + */ + function green( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * Extracts the hue value from a color or pixel + * array. Hue exists in both HSB and HSL. This + * function will return the HSB-normalized hue when + * supplied with an HSB color object (or when + * supplied with a pixel array while the color mode + * is HSB), but will default to the HSL-normalized + * hue otherwise. (The values will only be different + * if the maximum hue setting for each system is + * different.) + * @param color p5.Color object, color components, or + * CSS color + * @return the hue + */ + function hue( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * Blends two colors to find a third color somewhere + * between them. The amt parameter is the amount to + * interpolate between the two values where 0.0 equal + * to the first color, 0.1 is very near the first + * color, 0.5 is halfway in between, etc. An amount + * below 0 will be treated as 0. Likewise, amounts + * above 1 will be capped at 1. This is different + * from the behavior of lerp(), but necessary because + * otherwise numbers outside the range will produce + * strange and unexpected colors. The way that + * colours are interpolated depends on the current + * color mode. + * @param c1 interpolate from this color + * @param c2 interpolate to this color + * @param amt number between 0 and 1 + * @return interpolated color + */ + function lerpColor( + c1: p5.Color, + c2: p5.Color, + amt: number + ): p5.Color; + + /** + * Extracts the HSL lightness value from a color or + * pixel array. + * @param color p5.Color object, color components, or + * CSS color + * @return the lightness + */ + function lightness( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * Extracts the red value from a color or pixel + * array. + * @param color p5.Color object, color components, or + * CSS color + * @return the red value + */ + function red( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * Extracts the saturation value from a color or + * pixel array. Saturation is scaled differently in + * HSB and HSL. This function will return the HSB + * saturation when supplied with an HSB color object + * (or when supplied with a pixel array while the + * color mode is HSB), but will default to the HSL + * saturation otherwise. + * @param color p5.Color object, color components, or + * CSS color + * @return the saturation value + */ + function saturation( + color: + | p5.Color + | number[] + | string + ): number; + + /** + * The background() function sets the color used for + * the background of the p5.js canvas. The default + * background is light gray. This function is + * typically used within draw() to clear the display + * window at the beginning of each frame, but it can + * be used inside setup() to set the background on + * the first frame of animation or if the background + * need only be set once. The color is either + * specified in terms of the RGB, HSB, or HSL color + * depending on the current colorMode. (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * + * + * A p5.Color object can also be provided to set the + * background color. + * + * + * A p5.Image can also be provided to set the + * background image. + * @param color any value created by the color() + * function + * @chainable + */ + function background( + color: p5.Color + ): p5; + + /** + * The background() function sets the color used for + * the background of the p5.js canvas. The default + * background is light gray. This function is + * typically used within draw() to clear the display + * window at the beginning of each frame, but it can + * be used inside setup() to set the background on + * the first frame of animation or if the background + * need only be set once. The color is either + * specified in terms of the RGB, HSB, or HSL color + * depending on the current colorMode. (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * + * + * A p5.Color object can also be provided to set the + * background color. + * + * + * A p5.Image can also be provided to set the + * background image. + * @param colorstring color string, possible formats + * include: integer rgb() or rgba(), percentage rgb() + * or rgba(), 3-digit hex, 6-digit hex + * @param [a] opacity of the background relative to + * current color range (default is 0-255) + * @chainable + */ + function background( + colorstring: string, + a?: number + ): p5; + + /** + * The background() function sets the color used for + * the background of the p5.js canvas. The default + * background is light gray. This function is + * typically used within draw() to clear the display + * window at the beginning of each frame, but it can + * be used inside setup() to set the background on + * the first frame of animation or if the background + * need only be set once. The color is either + * specified in terms of the RGB, HSB, or HSL color + * depending on the current colorMode. (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * + * + * A p5.Color object can also be provided to set the + * background color. + * + * + * A p5.Image can also be provided to set the + * background image. + * @param gray specifies a value between white and + * black + * @param [a] opacity of the background relative to + * current color range (default is 0-255) + * @chainable + */ + function background( + gray: number, + a?: number + ): p5; + + /** + * The background() function sets the color used for + * the background of the p5.js canvas. The default + * background is light gray. This function is + * typically used within draw() to clear the display + * window at the beginning of each frame, but it can + * be used inside setup() to set the background on + * the first frame of animation or if the background + * need only be set once. The color is either + * specified in terms of the RGB, HSB, or HSL color + * depending on the current colorMode. (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * + * + * A p5.Color object can also be provided to set the + * background color. + * + * + * A p5.Image can also be provided to set the + * background image. + * @param v1 red or hue value (depending on the + * current color mode) + * @param v2 green or saturation value (depending on + * the current color mode) + * @param v3 blue or brightness value (depending on + * the current color mode) + * @param [a] opacity of the background relative to + * current color range (default is 0-255) + * @chainable + */ + function background( + v1: number, + v2: number, + v3: number, + a?: number + ): p5; + + /** + * The background() function sets the color used for + * the background of the p5.js canvas. The default + * background is light gray. This function is + * typically used within draw() to clear the display + * window at the beginning of each frame, but it can + * be used inside setup() to set the background on + * the first frame of animation or if the background + * need only be set once. The color is either + * specified in terms of the RGB, HSB, or HSL color + * depending on the current colorMode. (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * + * + * A p5.Color object can also be provided to set the + * background color. + * + * + * A p5.Image can also be provided to set the + * background image. + * @param values an array containing the + * red,green,blue & and alpha components of the color + * @chainable + */ + function background( + values: number[] + ): p5; + + /** + * The background() function sets the color used for + * the background of the p5.js canvas. The default + * background is light gray. This function is + * typically used within draw() to clear the display + * window at the beginning of each frame, but it can + * be used inside setup() to set the background on + * the first frame of animation or if the background + * need only be set once. The color is either + * specified in terms of the RGB, HSB, or HSL color + * depending on the current colorMode. (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. + * + * + * If a single string argument is provided, RGB, RGBA + * and Hex CSS color strings and all named color + * strings are supported. In this case, an alpha + * number value as a second argument is not + * supported, the RGBA form should be used. + * + * + * A p5.Color object can also be provided to set the + * background color. + * + * + * A p5.Image can also be provided to set the + * background image. + * @param image image created with loadImage() or + * createImage(), to set as background (must be same + * size as the sketch window) + * @param [a] opacity of the background relative to + * current color range (default is 0-255) + * @chainable + */ + function background( + image: p5.Image, + a?: number + ): p5; + + /** + * Clears the pixels within a buffer. This function + * only works on p5.Canvas objects created with the + * createCanvas() function; it won't work with the + * main display window. Unlike the main graphics + * context, pixels in additional graphics areas + * created with createGraphics() can be entirely or + * partially transparent. This function clears + * everything to make all of the pixels 100% + * transparent. + * @chainable + */ + function clear(): p5; + + /** + * colorMode() changes the way p5.js interprets color + * data. By default, the parameters for fill(), + * stroke(), background(), and color() are defined by + * values between 0 and 255 using the RGB color + * model. This is equivalent to setting + * colorMode(RGB, 255). Setting colorMode(HSB) lets + * you use the HSB system instead. By default, this + * is colorMode(HSB, 360, 100, 100, 1). You can also + * use HSL. Note: existing color objects remember + * the mode that they were created in, so you can + * change modes as you like without affecting their + * appearance. + * @param mode either RGB, HSB or HSL, corresponding + * to Red/Green/Blue and Hue/Saturation/Brightness + * (or Lightness) + * @param [max] range for all values + * @chainable + */ + function colorMode( + mode: p5.COLOR_MODE, + max?: number + ): p5; + + /** + * colorMode() changes the way p5.js interprets color + * data. By default, the parameters for fill(), + * stroke(), background(), and color() are defined by + * values between 0 and 255 using the RGB color + * model. This is equivalent to setting + * colorMode(RGB, 255). Setting colorMode(HSB) lets + * you use the HSB system instead. By default, this + * is colorMode(HSB, 360, 100, 100, 1). You can also + * use HSL. Note: existing color objects remember + * the mode that they were created in, so you can + * change modes as you like without affecting their + * appearance. + * @param mode either RGB, HSB or HSL, corresponding + * to Red/Green/Blue and Hue/Saturation/Brightness + * (or Lightness) + * @param max1 range for the red or hue depending on + * the current color mode + * @param max2 range for the green or saturation + * depending on the current color mode + * @param max3 range for the blue or + * brightness/lighntess depending on the current + * color mode + * @param [maxA] range for the alpha + * @chainable + */ + function colorMode( + mode: p5.UNKNOWN_P5_CONSTANT, + max1: number, + max2: number, + max3: number, + maxA?: number + ): p5; + + /** + * Sets the color used to fill shapes. For example, + * if you run fill(204, 102, 0), all subsequent + * shapes will be filled with orange. This color is + * either specified in terms of the RGB or HSB color + * depending on the current colorMode(). (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. If a single string argument is + * provided, RGB, RGBA and Hex CSS color strings and + * all named color strings are supported. In this + * case, an alpha number value as a second argument + * is not supported, the RGBA form should be used. + * + * + * A p5 Color object can also be provided to set the + * fill color. + * @param v1 red or hue value relative to the current + * color range + * @param v2 green or saturation value relative to + * the current color range + * @param v3 blue or brightness value relative to the + * current color range + * @chainable + */ + function fill( + v1: number, + v2: number, + v3: number, + alpha?: number + ): p5; + + /** + * Sets the color used to fill shapes. For example, + * if you run fill(204, 102, 0), all subsequent + * shapes will be filled with orange. This color is + * either specified in terms of the RGB or HSB color + * depending on the current colorMode(). (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. If a single string argument is + * provided, RGB, RGBA and Hex CSS color strings and + * all named color strings are supported. In this + * case, an alpha number value as a second argument + * is not supported, the RGBA form should be used. + * + * + * A p5 Color object can also be provided to set the + * fill color. + * @param value a color string + * @chainable + */ + function fill( + value: string + ): p5; + + /** + * Sets the color used to fill shapes. For example, + * if you run fill(204, 102, 0), all subsequent + * shapes will be filled with orange. This color is + * either specified in terms of the RGB or HSB color + * depending on the current colorMode(). (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. If a single string argument is + * provided, RGB, RGBA and Hex CSS color strings and + * all named color strings are supported. In this + * case, an alpha number value as a second argument + * is not supported, the RGBA form should be used. + * + * + * A p5 Color object can also be provided to set the + * fill color. + * @param gray a gray value + * @chainable + */ + function fill( + gray: number, + alpha?: number + ): p5; + + /** + * Sets the color used to fill shapes. For example, + * if you run fill(204, 102, 0), all subsequent + * shapes will be filled with orange. This color is + * either specified in terms of the RGB or HSB color + * depending on the current colorMode(). (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. If a single string argument is + * provided, RGB, RGBA and Hex CSS color strings and + * all named color strings are supported. In this + * case, an alpha number value as a second argument + * is not supported, the RGBA form should be used. + * + * + * A p5 Color object can also be provided to set the + * fill color. + * @param values an array containing the + * red,green,blue & and alpha components of the color + * @chainable + */ + function fill( + values: number[] + ): p5; + + /** + * Sets the color used to fill shapes. For example, + * if you run fill(204, 102, 0), all subsequent + * shapes will be filled with orange. This color is + * either specified in terms of the RGB or HSB color + * depending on the current colorMode(). (The default + * color space is RGB, with each value in the range + * from 0 to 255). The alpha range by default is also + * 0 to 255. If a single string argument is + * provided, RGB, RGBA and Hex CSS color strings and + * all named color strings are supported. In this + * case, an alpha number value as a second argument + * is not supported, the RGBA form should be used. + * + * + * A p5 Color object can also be provided to set the + * fill color. + * @param color the fill color + * @chainable + */ + function fill( + color: p5.Color + ): p5; + + /** + * Disables filling geometry. If both noStroke() and + * noFill() are called, nothing will be drawn to the + * screen. + * @chainable + */ + function noFill(): p5; + + /** + * Disables drawing the stroke (outline). If both + * noStroke() and noFill() are called, nothing will + * be drawn to the screen. + * @chainable + */ + function noStroke(): p5; + + /** + * Sets the color used to draw lines and borders + * around shapes. This color is either specified in + * terms of the RGB or HSB color depending on the + * current colorMode() (the default color space is + * RGB, with each value in the range from 0 to 255). + * The alpha range by default is also 0 to 255. If a + * single string argument is provided, RGB, RGBA and + * Hex CSS color strings and all named color strings + * are supported. In this case, an alpha number value + * as a second argument is not supported, the RGBA + * form should be used. + * + * + * A p5 Color object can also be provided to set the + * stroke color. + * @param v1 red or hue value relative to the current + * color range + * @param v2 green or saturation value relative to + * the current color range + * @param v3 blue or brightness value relative to the + * current color range + * @chainable + */ + function stroke( + v1: number, + v2: number, + v3: number, + alpha?: number + ): p5; + + /** + * Sets the color used to draw lines and borders + * around shapes. This color is either specified in + * terms of the RGB or HSB color depending on the + * current colorMode() (the default color space is + * RGB, with each value in the range from 0 to 255). + * The alpha range by default is also 0 to 255. If a + * single string argument is provided, RGB, RGBA and + * Hex CSS color strings and all named color strings + * are supported. In this case, an alpha number value + * as a second argument is not supported, the RGBA + * form should be used. + * + * + * A p5 Color object can also be provided to set the + * stroke color. + * @param value a color string + * @chainable + */ + function stroke( + value: string + ): p5; + + /** + * Sets the color used to draw lines and borders + * around shapes. This color is either specified in + * terms of the RGB or HSB color depending on the + * current colorMode() (the default color space is + * RGB, with each value in the range from 0 to 255). + * The alpha range by default is also 0 to 255. If a + * single string argument is provided, RGB, RGBA and + * Hex CSS color strings and all named color strings + * are supported. In this case, an alpha number value + * as a second argument is not supported, the RGBA + * form should be used. + * + * + * A p5 Color object can also be provided to set the + * stroke color. + * @param gray a gray value + * @chainable + */ + function stroke( + gray: number, + alpha?: number + ): p5; + + /** + * Sets the color used to draw lines and borders + * around shapes. This color is either specified in + * terms of the RGB or HSB color depending on the + * current colorMode() (the default color space is + * RGB, with each value in the range from 0 to 255). + * The alpha range by default is also 0 to 255. If a + * single string argument is provided, RGB, RGBA and + * Hex CSS color strings and all named color strings + * are supported. In this case, an alpha number value + * as a second argument is not supported, the RGBA + * form should be used. + * + * + * A p5 Color object can also be provided to set the + * stroke color. + * @param values an array containing the + * red,green,blue & and alpha components of the color + * @chainable + */ + function stroke( + values: number[] + ): p5; + + /** + * Sets the color used to draw lines and borders + * around shapes. This color is either specified in + * terms of the RGB or HSB color depending on the + * current colorMode() (the default color space is + * RGB, with each value in the range from 0 to 255). + * The alpha range by default is also 0 to 255. If a + * single string argument is provided, RGB, RGBA and + * Hex CSS color strings and all named color strings + * are supported. In this case, an alpha number value + * as a second argument is not supported, the RGBA + * form should be used. + * + * + * A p5 Color object can also be provided to set the + * stroke color. + * @param color the stroke color + * @chainable + */ + function stroke( + color: p5.Color + ): p5; + + /** + * Draw an arc to the screen. If called with only x, + * y, w, h, start, and stop, the arc will be drawn + * and filled as an open pie segment. If a mode + * parameter is provided, the arc will be filled like + * an open semi-circle (OPEN) , a closed semi-circle + * (CHORD), or as a closed pie segment (PIE). The + * origin may be changed with the ellipseMode() + * function. Note that drawing a full circle (ex: 0 + * to TWO_PI) will appear blank because 0 and TWO_PI + * are the same position on the unit circle. The best + * way to handle this is by using the ellipse() + * function instead to create a closed ellipse, and + * to use the arc() function only to draw parts of an + * ellipse. + * @param x x-coordinate of the arc's ellipse + * @param y y-coordinate of the arc's ellipse + * @param w width of the arc's ellipse by default + * @param h height of the arc's ellipse by default + * @param start angle to start the arc, specified in + * radians + * @param stop angle to stop the arc, specified in + * radians + * @param [mode] optional parameter to determine the + * way of drawing the arc. either CHORD, PIE or OPEN + * @param [detail] optional parameter for WebGL mode + * only. This is to specify the number of vertices + * that makes up the perimeter of the arc. Default + * value is 25. + * @chainable + */ + function arc( + x: number, + y: number, + w: number, + h: number, + start: number, + stop: number, + mode?: p5.ARC_MODE, + detail?: number + ): p5; + + /** + * Draws an ellipse (oval) to the screen. An ellipse + * with equal width and height is a circle. By + * default, the first two parameters set the + * location, and the third and fourth parameters set + * the shape's width and height. If no height is + * specified, the value of width is used for both the + * width and height. If a negative height or width is + * specified, the absolute value is taken. The origin + * may be changed with the ellipseMode() function. + * @param x x-coordinate of the ellipse. + * @param y y-coordinate of the ellipse. + * @param w width of the ellipse. + * @param [h] height of the ellipse. + * @chainable + */ + function ellipse( + x: number, + y: number, + w: number, + h?: number + ): p5; + + /** + * Draws an ellipse (oval) to the screen. An ellipse + * with equal width and height is a circle. By + * default, the first two parameters set the + * location, and the third and fourth parameters set + * the shape's width and height. If no height is + * specified, the value of width is used for both the + * width and height. If a negative height or width is + * specified, the absolute value is taken. The origin + * may be changed with the ellipseMode() function. + * @param x x-coordinate of the ellipse. + * @param y y-coordinate of the ellipse. + * @param w width of the ellipse. + * @param h height of the ellipse. + * @param detail number of radial sectors to draw + */ + function ellipse( + x: number, + y: number, + w: number, + h: number, + detail: number + ): void; + + /** + * Draws a line (a direct path between two points) to + * the screen. The version of line() with four + * parameters draws the line in 2D. To color a line, + * use the stroke() function. A line cannot be + * filled, therefore the fill() function will not + * affect the color of a line. 2D lines are drawn + * with a width of one pixel by default, but this can + * be changed with the strokeWeight() function. + * @param x1 the x-coordinate of the first point + * @param y1 the y-coordinate of the first point + * @param x2 the x-coordinate of the second point + * @param y2 the y-coordinate of the second point + * @chainable + */ + function line( + x1: number, + y1: number, + x2: number, + y2: number + ): p5; + + /** + * Draws a line (a direct path between two points) to + * the screen. The version of line() with four + * parameters draws the line in 2D. To color a line, + * use the stroke() function. A line cannot be + * filled, therefore the fill() function will not + * affect the color of a line. 2D lines are drawn + * with a width of one pixel by default, but this can + * be changed with the strokeWeight() function. + * @param x1 the x-coordinate of the first point + * @param y1 the y-coordinate of the first point + * @param z1 the z-coordinate of the first point + * @param x2 the x-coordinate of the second point + * @param y2 the y-coordinate of the second point + * @param z2 the z-coordinate of the second point + * @chainable + */ + function line( + x1: number, + y1: number, + z1: number, + x2: number, + y2: number, + z2: number + ): p5; + + /** + * Draws a point, a coordinate in space at the + * dimension of one pixel. The first parameter is the + * horizontal value for the point, the second value + * is the vertical value for the point. The color of + * the point is determined by the current stroke. + * @param x the x-coordinate + * @param y the y-coordinate + * @param [z] the z-coordinate (for WEBGL mode) + * @chainable + */ + function point( + x: number, + y: number, + z?: number + ): p5; + + /** + * Draw a quad. A quad is a quadrilateral, a four + * sided polygon. It is similar to a rectangle, but + * the angles between its edges are not constrained + * to ninety degrees. The first pair of parameters + * (x1,y1) sets the first vertex and the subsequent + * pairs should proceed clockwise or + * counter-clockwise around the defined shape. + * @param x1 the x-coordinate of the first point + * @param y1 the y-coordinate of the first point + * @param x2 the x-coordinate of the second point + * @param y2 the y-coordinate of the second point + * @param x3 the x-coordinate of the third point + * @param y3 the y-coordinate of the third point + * @param x4 the x-coordinate of the fourth point + * @param y4 the y-coordinate of the fourth point + * @chainable + */ + function quad( + x1: number, + y1: number, + x2: number, + y2: number, + x3: number, + y3: number, + x4: number, + y4: number + ): p5; + + /** + * Draw a quad. A quad is a quadrilateral, a four + * sided polygon. It is similar to a rectangle, but + * the angles between its edges are not constrained + * to ninety degrees. The first pair of parameters + * (x1,y1) sets the first vertex and the subsequent + * pairs should proceed clockwise or + * counter-clockwise around the defined shape. + * @param x1 the x-coordinate of the first point + * @param y1 the y-coordinate of the first point + * @param z1 the z-coordinate of the first point + * @param x2 the x-coordinate of the second point + * @param y2 the y-coordinate of the second point + * @param z2 the z-coordinate of the second point + * @param x3 the x-coordinate of the third point + * @param y3 the y-coordinate of the third point + * @param z3 the z-coordinate of the third point + * @param x4 the x-coordinate of the fourth point + * @param y4 the y-coordinate of the fourth point + * @param z4 the z-coordinate of the fourth point + * @chainable + */ + function quad( + x1: number, + y1: number, + z1: number, + x2: number, + y2: number, + z2: number, + x3: number, + y3: number, + z3: number, + x4: number, + y4: number, + z4: number + ): p5; + + /** + * Draws a rectangle to the screen. A rectangle is a + * four-sided shape with every angle at ninety + * degrees. By default, the first two parameters set + * the location of the upper-left corner, the third + * sets the width, and the fourth sets the height. + * The way these parameters are interpreted, however, + * may be changed with the rectMode() function. The + * fifth, sixth, seventh and eighth parameters, if + * specified, determine corner radius for the + * top-left, top-right, lower-right and lower-left + * corners, respectively. An omitted corner radius + * parameter is set to the value of the previously + * specified radius value in the parameter list. + * @param x x-coordinate of the rectangle. + * @param y y-coordinate of the rectangle. + * @param w width of the rectangle. + * @param h height of the rectangle. + * @param [tl] optional radius of top-left corner. + * @param [tr] optional radius of top-right corner. + * @param [br] optional radius of bottom-right + * corner. + * @param [bl] optional radius of bottom-left corner. + * @chainable + */ + function rect( + x: number, + y: number, + w: number, + h: number, + tl?: number, + tr?: number, + br?: number, + bl?: number + ): p5; + + /** + * Draws a rectangle to the screen. A rectangle is a + * four-sided shape with every angle at ninety + * degrees. By default, the first two parameters set + * the location of the upper-left corner, the third + * sets the width, and the fourth sets the height. + * The way these parameters are interpreted, however, + * may be changed with the rectMode() function. The + * fifth, sixth, seventh and eighth parameters, if + * specified, determine corner radius for the + * top-left, top-right, lower-right and lower-left + * corners, respectively. An omitted corner radius + * parameter is set to the value of the previously + * specified radius value in the parameter list. + * @param x x-coordinate of the rectangle. + * @param y y-coordinate of the rectangle. + * @param w width of the rectangle. + * @param h height of the rectangle. + * @param [detailX] number of segments in the + * x-direction + * @param [detailY] number of segments in the + * y-direction + * @chainable + */ + function rect( + x: number, + y: number, + w: number, + h: number, + detailX?: number, + detailY?: number + ): p5; + + /** + * A triangle is a plane created by connecting three + * points. The first two arguments specify the first + * point, the middle two arguments specify the second + * point, and the last two arguments specify the + * third point. + * @param x1 x-coordinate of the first point + * @param y1 y-coordinate of the first point + * @param x2 x-coordinate of the second point + * @param y2 y-coordinate of the second point + * @param x3 x-coordinate of the third point + * @param y3 y-coordinate of the third point + * @chainable + */ + function triangle( + x1: number, + y1: number, + x2: number, + y2: number, + x3: number, + y3: number + ): p5; + + /** + * Modifies the location from which ellipses are + * drawn by changing the way in which parameters + * given to ellipse() are interpreted. The default + * mode is ellipseMode(CENTER), which interprets the + * first two parameters of ellipse() as the shape's + * center point, while the third and fourth + * parameters are its width and height. + * + * + * ellipseMode(RADIUS) also uses the first two + * parameters of ellipse() as the shape's center + * point, but uses the third and fourth parameters to + * specify half of the shapes's width and height. + * + * + * ellipseMode(CORNER) interprets the first two + * parameters of ellipse() as the upper-left corner + * of the shape, while the third and fourth + * parameters are its width and height. + * + * + * ellipseMode(CORNERS) interprets the first two + * parameters of ellipse() as the location of one + * corner of the ellipse's bounding box, and the + * third and fourth parameters as the location of the + * opposite corner. + * + * + * The parameter must be written in ALL CAPS because + * Javascript is a case-sensitive language. + * @param mode either CENTER, RADIUS, CORNER, or + * CORNERS + * @chainable + */ + function ellipseMode( + mode: p5.ELLIPSE_MODE + ): p5; + + /** + * Draws all geometry with jagged (aliased) edges. + * Note that smooth() is active by default in 2D + * mode, so it is necessary to call noSmooth() to + * disable smoothing of geometry, images, and fonts. + * In 3D mode, noSmooth() is enabled by default, so + * it is necessary to call smooth() if you would like + * smooth (antialiased) edges on your geometry. + * @chainable + */ + function noSmooth(): p5; + + /** + * Modifies the location from which rectangles are + * drawn by changing the way in which parameters + * given to rect() are interpreted. The default mode + * is rectMode(CORNER), which interprets the first + * two parameters of rect() as the upper-left corner + * of the shape, while the third and fourth + * parameters are its width and height. + * + * + * rectMode(CORNERS) interprets the first two + * parameters of rect() as the location of one + * corner, and the third and fourth parameters as the + * location of the opposite corner. + * + * + * rectMode(CENTER) interprets the first two + * parameters of rect() as the shape's center point, + * while the third and fourth parameters are its + * width and height. + * + * + * rectMode(RADIUS) also uses the first two + * parameters of rect() as the shape's center point, + * but uses the third and fourth parameters to + * specify half of the shapes's width and height. + * + * + * The parameter must be written in ALL CAPS because + * Javascript is a case-sensitive language. + * @param mode either CORNER, CORNERS, CENTER, or + * RADIUS + * @chainable + */ + function rectMode( + mode: p5.RECT_MODE + ): p5; + + /** + * Draws all geometry with smooth (anti-aliased) + * edges. smooth() will also improve image quality of + * resized images. Note that smooth() is active by + * default in 2D mode; noSmooth() can be used to + * disable smoothing of geometry, images, and fonts. + * In 3D mode, noSmooth() is enabled by default, so + * it is necessary to call smooth() if you would like + * smooth (antialiased) edges on your geometry. + * @chainable + */ + function smooth(): p5; + + /** + * Sets the style for rendering line endings. These + * ends are either squared, extended, or rounded, + * each of which specified with the corresponding + * parameters: SQUARE, PROJECT, and ROUND. The + * default cap is ROUND. + * @param cap either SQUARE, PROJECT, or ROUND + * @chainable + */ + function strokeCap( + cap: p5.STROKE_CAP + ): p5; + + /** + * Sets the style of the joints which connect line + * segments. These joints are either mitered, + * beveled, or rounded and specified with the + * corresponding parameters MITER, BEVEL, and ROUND. + * The default joint is MITER. + * @param join either MITER, BEVEL, ROUND + * @chainable + */ + function strokeJoin( + join: p5.STROKE_JOIN + ): p5; + + /** + * Sets the width of the stroke used for lines, + * points, and the border around shapes. All widths + * are set in units of pixels. + * @param weight the weight (in pixels) of the stroke + * @chainable + */ + function strokeWeight( + weight: number + ): p5; + + /** + * Draws a cubic Bezier curve on the screen. These + * curves are defined by a series of anchor and + * control points. The first two parameters specify + * the first anchor point and the last two parameters + * specify the other anchor point, which become the + * first and last points on the curve. The middle + * parameters specify the two control points which + * define the shape of the curve. Approximately + * speaking, control points "pull" the curve towards + * them.Bezier curves were developed by French + * automotive engineer Pierre Bezier, and are + * commonly used in computer graphics to define + * gently sloping curves. See also curve(). + * @param x1 x-coordinate for the first anchor point + * @param y1 y-coordinate for the first anchor point + * @param x2 x-coordinate for the first control point + * @param y2 y-coordinate for the first control point + * @param x3 x-coordinate for the second control + * point + * @param y3 y-coordinate for the second control + * point + * @param x4 x-coordinate for the second anchor point + * @param y4 y-coordinate for the second anchor point + * @chainable + */ + function bezier( + x1: number, + y1: number, + x2: number, + y2: number, + x3: number, + y3: number, + x4: number, + y4: number + ): p5; + + /** + * Draws a cubic Bezier curve on the screen. These + * curves are defined by a series of anchor and + * control points. The first two parameters specify + * the first anchor point and the last two parameters + * specify the other anchor point, which become the + * first and last points on the curve. The middle + * parameters specify the two control points which + * define the shape of the curve. Approximately + * speaking, control points "pull" the curve towards + * them.Bezier curves were developed by French + * automotive engineer Pierre Bezier, and are + * commonly used in computer graphics to define + * gently sloping curves. See also curve(). + * @param x1 x-coordinate for the first anchor point + * @param y1 y-coordinate for the first anchor point + * @param z1 z-coordinate for the first anchor point + * @param x2 x-coordinate for the first control point + * @param y2 y-coordinate for the first control point + * @param z2 z-coordinate for the first control point + * @param x3 x-coordinate for the second control + * point + * @param y3 y-coordinate for the second control + * point + * @param z3 z-coordinate for the second control + * point + * @param x4 x-coordinate for the second anchor point + * @param y4 y-coordinate for the second anchor point + * @param z4 z-coordinate for the second anchor point + * @chainable + */ + function bezier( + x1: number, + y1: number, + z1: number, + x2: number, + y2: number, + z2: number, + x3: number, + y3: number, + z3: number, + x4: number, + y4: number, + z4: number + ): p5; + + /** + * Sets the resolution at which Beziers display. The + * default value is 20. + * + * This function is only useful when using the WEBGL + * renderer as the default canvas renderer does not + * use this information. + * @param detail resolution of the curves + * @chainable + */ + function bezierDetail( + detail: number + ): p5; + + /** + * Evaluates the Bezier at position t for points a, + * b, c, d. The parameters a and d are the first and + * last points on the curve, and b and c are the + * control points. The final parameter t varies + * between 0 and 1. This can be done once with the x + * coordinates and a second time with the y + * coordinates to get the location of a bezier curve + * at t. + * @param a coordinate of first point on the curve + * @param b coordinate of first control point + * @param c coordinate of second control point + * @param d coordinate of second point on the curve + * @param t value between 0 and 1 + * @return the value of the Bezier at position t + */ + function bezierPoint( + a: number, + b: number, + c: number, + d: number, + t: number + ): number; + + /** + * Evaluates the tangent to the Bezier at position t + * for points a, b, c, d. The parameters a and d are + * the first and last points on the curve, and b and + * c are the control points. The final parameter t + * varies between 0 and 1. + * @param a coordinate of first point on the curve + * @param b coordinate of first control point + * @param c coordinate of second control point + * @param d coordinate of second point on the curve + * @param t value between 0 and 1 + * @return the tangent at position t + */ + function bezierTangent( + a: number, + b: number, + c: number, + d: number, + t: number + ): number; + + /** + * Draws a curved line on the screen between two + * points, given as the middle four parameters. The + * first two parameters are a control point, as if + * the curve came from this point even though it's + * not drawn. The last two parameters similarly + * describe the other control point. Longer curves + * can be created by putting a series of curve() + * functions together or using curveVertex(). An + * additional function called curveTightness() + * provides control for the visual quality of the + * curve. The curve() function is an implementation + * of Catmull-Rom splines. + * @param x1 x-coordinate for the beginning control + * point + * @param y1 y-coordinate for the beginning control + * point + * @param x2 x-coordinate for the first point + * @param y2 y-coordinate for the first point + * @param x3 x-coordinate for the second point + * @param y3 y-coordinate for the second point + * @param x4 x-coordinate for the ending control + * point + * @param y4 y-coordinate for the ending control + * point + * @chainable + */ + function curve( + x1: number, + y1: number, + x2: number, + y2: number, + x3: number, + y3: number, + x4: number, + y4: number + ): p5; + + /** + * Draws a curved line on the screen between two + * points, given as the middle four parameters. The + * first two parameters are a control point, as if + * the curve came from this point even though it's + * not drawn. The last two parameters similarly + * describe the other control point. Longer curves + * can be created by putting a series of curve() + * functions together or using curveVertex(). An + * additional function called curveTightness() + * provides control for the visual quality of the + * curve. The curve() function is an implementation + * of Catmull-Rom splines. + * @param x1 x-coordinate for the beginning control + * point + * @param y1 y-coordinate for the beginning control + * point + * @param z1 z-coordinate for the beginning control + * point + * @param x2 x-coordinate for the first point + * @param y2 y-coordinate for the first point + * @param z2 z-coordinate for the first point + * @param x3 x-coordinate for the second point + * @param y3 y-coordinate for the second point + * @param z3 z-coordinate for the second point + * @param x4 x-coordinate for the ending control + * point + * @param y4 y-coordinate for the ending control + * point + * @param z4 z-coordinate for the ending control + * point + * @chainable + */ + function curve( + x1: number, + y1: number, + z1: number, + x2: number, + y2: number, + z2: number, + x3: number, + y3: number, + z3: number, + x4: number, + y4: number, + z4: number + ): p5; + + /** + * Sets the resolution at which curves display. The + * default value is 20 while the minimum value is 3. + * + * This function is only useful when using the WEBGL + * renderer as the default canvas renderer does not + * use this information. + * @param resolution resolution of the curves + * @chainable + */ + function curveDetail( + resolution: number + ): p5; + + /** + * Modifies the quality of forms created with curve() + * and curveVertex(). The parameter tightness + * determines how the curve fits to the vertex + * points. The value 0.0 is the default value for + * tightness (this value defines the curves to be + * Catmull-Rom splines) and the value 1.0 connects + * all the points with straight lines. Values within + * the range -5.0 and 5.0 will deform the curves but + * will leave them recognizable and as values + * increase in magnitude, they will continue to + * deform. + * @param amount amount of deformation from the + * original vertices + * @chainable + */ + function curveTightness( + amount: number + ): p5; + + /** + * Evaluates the curve at position t for points a, b, + * c, d. The parameter t varies between 0 and 1, a + * and d are control points of the curve, and b and c + * are the start and end points of the curve. This + * can be done once with the x coordinates and a + * second time with the y coordinates to get the + * location of a curve at t. + * @param a coordinate of first control point of the + * curve + * @param b coordinate of first point + * @param c coordinate of second point + * @param d coordinate of second control point + * @param t value between 0 and 1 + * @return bezier value at position t + */ + function curvePoint( + a: number, + b: number, + c: number, + d: number, + t: number + ): number; + + /** + * Evaluates the tangent to the curve at position t + * for points a, b, c, d. The parameter t varies + * between 0 and 1, a and d are points on the curve, + * and b and c are the control points. + * @param a coordinate of first point on the curve + * @param b coordinate of first control point + * @param c coordinate of second control point + * @param d coordinate of second point on the curve + * @param t value between 0 and 1 + * @return the tangent at position t + */ + function curveTangent( + a: number, + b: number, + c: number, + d: number, + t: number + ): number; + + /** + * Use the beginContour() and endContour() functions + * to create negative shapes within shapes such as + * the center of the letter 'O'. beginContour() + * begins recording vertices for the shape and + * endContour() stops recording. The vertices that + * define a negative shape must "wind" in the + * opposite direction from the exterior shape. First + * draw vertices for the exterior clockwise order, + * then for internal shapes, draw vertices shape in + * counter-clockwise. These functions can only be + * used within a beginShape()/endShape() pair and + * transformations such as translate(), rotate(), and + * scale() do not work within a + * beginContour()/endContour() pair. It is also not + * possible to use other shapes, such as ellipse() or + * rect() within. + * @chainable + */ + function beginContour(): p5; + + /** + * Using the beginShape() and endShape() functions + * allow creating more complex forms. beginShape() + * begins recording vertices for a shape and + * endShape() stops recording. The value of the kind + * parameter tells it which types of shapes to create + * from the provided vertices. With no mode + * specified, the shape can be any irregular polygon. + * The parameters available for beginShape() are + * POINTS, LINES, TRIANGLES, TRIANGLE_FAN, + * TRIANGLE_STRIP, QUADS, and QUAD_STRIP. After + * calling the beginShape() function, a series of + * vertex() commands must follow. To stop drawing the + * shape, call endShape(). Each shape will be + * outlined with the current stroke color and filled + * with the fill color. + * + * + * Transformations such as translate(), rotate(), and + * scale() do not work within beginShape(). It is + * also not possible to use other shapes, such as + * ellipse() or rect() within beginShape(). + * @param [kind] either POINTS, LINES, TRIANGLES, + * TRIANGLE_FAN TRIANGLE_STRIP, QUADS, or QUAD_STRIP + * @chainable + */ + function beginShape( + kind?: p5.BEGIN_KIND + ): p5; + + /** + * Specifies vertex coordinates for Bezier curves. + * Each call to bezierVertex() defines the position + * of two control points and one anchor point of a + * Bezier curve, adding a new segment to a line or + * shape. For WebGL mode bezierVertex() can be used + * in 2D as well as 3D mode. 2D mode expects 6 + * parameters, while 3D mode expects 9 parameters + * (including z coordinates). The first time + * bezierVertex() is used within a beginShape() call, + * it must be prefaced with a call to vertex() to set + * the first anchor point. This function must be used + * between beginShape() and endShape() and only when + * there is no MODE or POINTS parameter specified to + * beginShape(). + * @param x2 x-coordinate for the first control point + * @param y2 y-coordinate for the first control point + * @param x3 x-coordinate for the second control + * point + * @param y3 y-coordinate for the second control + * point + * @param x4 x-coordinate for the anchor point + * @param y4 y-coordinate for the anchor point + * @chainable + */ + function bezierVertex( + x2: number, + y2: number, + x3: number, + y3: number, + x4: number, + y4: number + ): p5; + + /** + * Specifies vertex coordinates for Bezier curves. + * Each call to bezierVertex() defines the position + * of two control points and one anchor point of a + * Bezier curve, adding a new segment to a line or + * shape. For WebGL mode bezierVertex() can be used + * in 2D as well as 3D mode. 2D mode expects 6 + * parameters, while 3D mode expects 9 parameters + * (including z coordinates). The first time + * bezierVertex() is used within a beginShape() call, + * it must be prefaced with a call to vertex() to set + * the first anchor point. This function must be used + * between beginShape() and endShape() and only when + * there is no MODE or POINTS parameter specified to + * beginShape(). + * @param x2 x-coordinate for the first control point + * @param y2 y-coordinate for the first control point + * @param z2 z-coordinate for the first control point + * (for WebGL mode) + * @param x3 x-coordinate for the second control + * point + * @param y3 y-coordinate for the second control + * point + * @param z3 z-coordinate for the second control + * point (for WebGL mode) + * @param x4 x-coordinate for the anchor point + * @param y4 y-coordinate for the anchor point + * @param z4 z-coordinate for the anchor point (for + * WebGL mode) + * @chainable + */ + function bezierVertex( + x2: number, + y2: number, + z2: number, + x3: number, + y3: number, + z3: number, + x4: number, + y4: number, + z4: number + ): p5; + + /** + * Specifies vertex coordinates for curves. This + * function may only be used between beginShape() and + * endShape() and only when there is no MODE + * parameter specified to beginShape(). For WebGL + * mode curveVertex() can be used in 2D as well as 3D + * mode. 2D mode expects 2 parameters, while 3D mode + * expects 3 parameters. The first and last points + * in a series of curveVertex() lines will be used to + * guide the beginning and end of a the curve. A + * minimum of four points is required to draw a tiny + * curve between the second and third points. Adding + * a fifth point with curveVertex() will draw the + * curve between the second, third, and fourth + * points. The curveVertex() function is an + * implementation of Catmull-Rom splines. + * @param x x-coordinate of the vertex + * @param y y-coordinate of the vertex + * @chainable + */ + function curveVertex( + x: number, + y: number + ): p5; + + /** + * Specifies vertex coordinates for curves. This + * function may only be used between beginShape() and + * endShape() and only when there is no MODE + * parameter specified to beginShape(). For WebGL + * mode curveVertex() can be used in 2D as well as 3D + * mode. 2D mode expects 2 parameters, while 3D mode + * expects 3 parameters. The first and last points + * in a series of curveVertex() lines will be used to + * guide the beginning and end of a the curve. A + * minimum of four points is required to draw a tiny + * curve between the second and third points. Adding + * a fifth point with curveVertex() will draw the + * curve between the second, third, and fourth + * points. The curveVertex() function is an + * implementation of Catmull-Rom splines. + * @param x x-coordinate of the vertex + * @param y y-coordinate of the vertex + * @param [z] z-coordinate of the vertex (for WebGL + * mode) + * @chainable + */ + function curveVertex( + x: number, + y: number, + z?: number + ): p5; + + /** + * Use the beginContour() and endContour() functions + * to create negative shapes within shapes such as + * the center of the letter 'O'. beginContour() + * begins recording vertices for the shape and + * endContour() stops recording. The vertices that + * define a negative shape must "wind" in the + * opposite direction from the exterior shape. First + * draw vertices for the exterior clockwise order, + * then for internal shapes, draw vertices shape in + * counter-clockwise. These functions can only be + * used within a beginShape()/endShape() pair and + * transformations such as translate(), rotate(), and + * scale() do not work within a + * beginContour()/endContour() pair. It is also not + * possible to use other shapes, such as ellipse() or + * rect() within. + * @chainable + */ + function endContour(): p5; + + /** + * The endShape() function is the companion to + * beginShape() and may only be called after + * beginShape(). When endshape() is called, all of + * image data defined since the previous call to + * beginShape() is written into the image buffer. The + * constant CLOSE as the value for the MODE parameter + * to close the shape (to connect the beginning and + * the end). + * @param [mode] use CLOSE to close the shape + * @chainable + */ + function endShape( + mode?: p5.END_MODE + ): p5; + + /** + * Specifies vertex coordinates for quadratic Bezier + * curves. Each call to quadraticVertex() defines the + * position of one control points and one anchor + * point of a Bezier curve, adding a new segment to a + * line or shape. The first time quadraticVertex() is + * used within a beginShape() call, it must be + * prefaced with a call to vertex() to set the first + * anchor point. For WebGL mode quadraticVertex() can + * be used in 2D as well as 3D mode. 2D mode expects + * 4 parameters, while 3D mode expects 6 parameters + * (including z coordinates). This function must be + * used between beginShape() and endShape() and only + * when there is no MODE or POINTS parameter + * specified to beginShape(). + * @param cx x-coordinate for the control point + * @param cy y-coordinate for the control point + * @param x3 x-coordinate for the anchor point + * @param y3 y-coordinate for the anchor point + * @chainable + */ + function quadraticVertex( + cx: number, + cy: number, + x3: number, + y3: number + ): p5; + + /** + * Specifies vertex coordinates for quadratic Bezier + * curves. Each call to quadraticVertex() defines the + * position of one control points and one anchor + * point of a Bezier curve, adding a new segment to a + * line or shape. The first time quadraticVertex() is + * used within a beginShape() call, it must be + * prefaced with a call to vertex() to set the first + * anchor point. For WebGL mode quadraticVertex() can + * be used in 2D as well as 3D mode. 2D mode expects + * 4 parameters, while 3D mode expects 6 parameters + * (including z coordinates). This function must be + * used between beginShape() and endShape() and only + * when there is no MODE or POINTS parameter + * specified to beginShape(). + * @param cx x-coordinate for the control point + * @param cy y-coordinate for the control point + * @param cz z-coordinate for the control point (for + * WebGL mode) + * @param x3 x-coordinate for the anchor point + * @param y3 y-coordinate for the anchor point + * @param z3 z-coordinate for the anchor point (for + * WebGL mode) + * @chainable + */ + function quadraticVertex( + cx: number, + cy: number, + cz: number, + x3: number, + y3: number, + z3: number + ): p5; + + /** + * All shapes are constructed by connecting a series + * of vertices. vertex() is used to specify the + * vertex coordinates for points, lines, triangles, + * quads, and polygons. It is used exclusively within + * the beginShape() and endShape() functions. + * @param x x-coordinate of the vertex + * @param y y-coordinate of the vertex + * @chainable + */ + function vertex( + x: number, + y: number + ): p5; + + /** + * All shapes are constructed by connecting a series + * of vertices. vertex() is used to specify the + * vertex coordinates for points, lines, triangles, + * quads, and polygons. It is used exclusively within + * the beginShape() and endShape() functions. + * @param x x-coordinate of the vertex + * @param y y-coordinate of the vertex + * @param z z-coordinate of the vertex + * @param [u] the vertex's texture u-coordinate + * @param [v] the vertex's texture v-coordinate + * @chainable + */ + function vertex( + x: number, + y: number, + z: number, + u?: number, + v?: number + ): p5; + const P2D: p5.P2D; + const WEBGL: p5.WEBGL; + const ARROW: p5.ARROW; + const CROSS: p5.CROSS; + const HAND: p5.HAND; + const MOVE: p5.MOVE; + const TEXT: p5.TEXT; + const WAIT: p5.WAIT; + + /** + * HALF_PI is a mathematical constant with the value + * 1.57079632679489661923. It is half the ratio of + * the circumference of a circle to its diameter. It + * is useful in combination with the trigonometric + * functions sin() and cos(). + */ + const HALF_PI: number; + + /** + * PI is a mathematical constant with the value + * 3.14159265358979323846. It is the ratio of the + * circumference of a circle to its diameter. It is + * useful in combination with the trigonometric + * functions sin() and cos(). + */ + const PI: number; + + /** + * QUARTER_PI is a mathematical constant with the + * value 0.7853982. It is one quarter the ratio of + * the circumference of a circle to its diameter. It + * is useful in combination with the trigonometric + * functions sin() and cos(). + */ + const QUARTER_PI: number; + + /** + * TAU is an alias for TWO_PI, a mathematical + * constant with the value 6.28318530717958647693. It + * is twice the ratio of the circumference of a + * circle to its diameter. It is useful in + * combination with the trigonometric functions sin() + * and cos(). + */ + const TAU: number; + + /** + * TWO_PI is a mathematical constant with the value + * 6.28318530717958647693. It is twice the ratio of + * the circumference of a circle to its diameter. It + * is useful in combination with the trigonometric + * functions sin() and cos(). + */ + const TWO_PI: number; + + /** + * Constant to be used with angleMode() function, to + * set the mode which p5.js interprates and + * calculates angles (either DEGREES or RADIANS). + */ + const DEGREES: p5.DEGREES; + + /** + * Constant to be used with angleMode() function, to + * set the mode which p5.js interprates and + * calculates angles (either RADIANS or DEGREES). + */ + const RADIANS: p5.RADIANS; + const CORNER: p5.CORNER; + const CORNERS: p5.CORNERS; + const RADIUS: p5.RADIUS; + const RIGHT: p5.RIGHT; + const LEFT: p5.LEFT; + const CENTER: p5.CENTER; + const TOP: p5.TOP; + const BOTTOM: p5.BOTTOM; + const BASELINE: p5.BASELINE; + const POINTS: p5.POINTS; + const LINES: p5.LINES; + const LINE_STRIP: p5.LINE_STRIP; + const LINE_LOOP: p5.LINE_LOOP; + const TRIANGLES: p5.TRIANGLES; + const TRIANGLE_FAN: p5.TRIANGLE_FAN; + const TRIANGLE_STRIP: p5.TRIANGLE_STRIP; + const QUADS: p5.QUADS; + const QUAD_STRIP: p5.QUAD_STRIP; + const CLOSE: p5.CLOSE; + const OPEN: p5.OPEN; + const CHORD: p5.CHORD; + const PIE: p5.PIE; + const PROJECT: p5.PROJECT; + const SQUARE: p5.SQUARE; + const ROUND: p5.ROUND; + const BEVEL: p5.BEVEL; + const MITER: p5.MITER; + const RGB: p5.RGB; + const HSB: p5.HSB; + const HSL: p5.HSL; + const AUTO: p5.AUTO; + const BLEND: p5.BLEND; + const ADD: p5.ADD; + const DARKEST: p5.DARKEST; + const LIGHTEST: p5.LIGHTEST; + const DIFFERENCE: p5.DIFFERENCE; + const EXCLUSION: p5.EXCLUSION; + const MULTIPLY: p5.MULTIPLY; + const SCREEN: p5.SCREEN; + const REPLACE: p5.REPLACE; + const OVERLAY: p5.OVERLAY; + const HARD_LIGHT: p5.HARD_LIGHT; + const SOFT_LIGHT: p5.SOFT_LIGHT; + const DODGE: p5.DODGE; + const BURN: p5.BURN; + const THRESHOLD: p5.THRESHOLD; + const GRAY: p5.GRAY; + const OPAQUE: p5.OPAQUE; + const INVERT: p5.INVERT; + const POSTERIZE: p5.POSTERIZE; + const DILATE: p5.DILATE; + const ERODE: p5.ERODE; + const BLUR: p5.BLUR; + const NORMAL: p5.NORMAL; + const ITALIC: p5.ITALIC; + const BOLD: p5.BOLD; + const LANDSCAPE: p5.LANDSCAPE; + const PORTRAIT: p5.PORTRAIT; + const GRID: p5.GRID; + const AXES: p5.AXES; + + /** + * The print() function writes to the console area of + * your browser. This function is often helpful for + * looking at the data a program is producing. This + * function creates a new line of text for each call + * to the function. Individual elements can be + * separated with quotes ("") and joined with the + * addition operator (+). Note that calling print() + * without any arguments invokes the window.print() + * function which opens the browser's print dialog. + * To print a blank line to console you can write + * print('\n'). + * @param contents any combination of Number, String, + * Object, Boolean, Array to print + */ + function print( + contents: any + ): void; + + /** + * Sets the cursor to a predefined symbol or an + * image, or makes it visible if already hidden. If + * you are trying to set an image as the cursor, the + * recommended size is 16x16 or 32x32 pixels. The + * values for parameters x and y must be less than + * the dimensions of the image. + * @param type either ARROW, CROSS, HAND, MOVE, TEXT, + * or WAIT, or path for image + * @param [x] the horizontal active spot of the + * cursor + * @param [y] the vertical active spot of the cursor + */ + function cursor( + type: + | string + | p5.CURSOR_TYPE, + x?: number, + y?: number + ): void; + + /** + * Specifies the number of frames to be displayed + * every second. For example, the function call + * frameRate(30) will attempt to refresh 30 times a + * second. If the processor is not fast enough to + * maintain the specified rate, the frame rate will + * not be achieved. Setting the frame rate within + * setup() is recommended. The default frame rate is + * based on the frame rate of the display (here also + * called "refresh rate"), which is set to 60 frames + * per second on most computers. A frame rate of 24 + * frames per second (usual for movies) or above will + * be enough for smooth animations This is the same + * as setFrameRate(val). Calling frameRate() with no + * arguments returns the current framerate. The draw + * function must run at least once before it will + * return a value. This is the same as + * getFrameRate(). + * + * + * Calling frameRate() with arguments that are not of + * the type numbers or are non positive also returns + * current framerate. + * @param fps number of frames to be displayed every + * second + * @chainable + */ + function frameRate( + fps: number + ): p5; + + /** + * Specifies the number of frames to be displayed + * every second. For example, the function call + * frameRate(30) will attempt to refresh 30 times a + * second. If the processor is not fast enough to + * maintain the specified rate, the frame rate will + * not be achieved. Setting the frame rate within + * setup() is recommended. The default frame rate is + * based on the frame rate of the display (here also + * called "refresh rate"), which is set to 60 frames + * per second on most computers. A frame rate of 24 + * frames per second (usual for movies) or above will + * be enough for smooth animations This is the same + * as setFrameRate(val). Calling frameRate() with no + * arguments returns the current framerate. The draw + * function must run at least once before it will + * return a value. This is the same as + * getFrameRate(). + * + * + * Calling frameRate() with arguments that are not of + * the type numbers or are non positive also returns + * current framerate. + * @return current frameRate + */ + function frameRate(): number; + + /** + * Hides the cursor from view. + */ + function noCursor(): void; + + /** + * The windowResized() function is called once every + * time the browser window is resized. This is a good + * place to resize the canvas or do any other + * adjustments to accommodate the new window size. + */ + function windowResized(): void; + + /** + * If argument is given, sets the sketch to + * fullscreen or not based on the value of the + * argument. If no argument is given, returns the + * current fullscreen state. Note that due to browser + * restrictions this can only be called on user + * input, for example, on mouse press like the + * example below. + * @param [val] whether the sketch should be in + * fullscreen mode or not + * @return current fullscreen state + */ + function fullscreen( + val?: boolean + ): boolean; + + /** + * Sets the pixel scaling for high pixel density + * displays. By default pixel density is set to match + * display density, call pixelDensity(1) to turn this + * off. Calling pixelDensity() with no arguments + * returns the current pixel density of the sketch. + * @param val whether or how much the sketch should + * scale + * @chainable + */ + function pixelDensity( + val: number + ): p5; + + /** + * Sets the pixel scaling for high pixel density + * displays. By default pixel density is set to match + * display density, call pixelDensity(1) to turn this + * off. Calling pixelDensity() with no arguments + * returns the current pixel density of the sketch. + * @return current pixel density of the sketch + */ + function pixelDensity(): number; + + /** + * Returns the pixel density of the current display + * the sketch is running on. + * @return current pixel density of the display + */ + function displayDensity(): number; + + /** + * Gets the current URL. + * @return url + */ + function getURL(): string; + + /** + * Gets the current URL path as an array. + * @return path components + */ + function getURLPath(): string[]; + + /** + * Gets the current URL params as an Object. + * @return URL params + */ + function getURLParams(): object; + + /** + * The system variable frameCount contains the number + * of frames that have been displayed since the + * program started. Inside setup() the value is 0, + * after the first iteration of draw it is 1, etc. + */ + let frameCount: number; + + /** + * Confirms if the window a p5.js program is in is + * "focused," meaning that the sketch will accept + * mouse or keyboard input. This variable is "true" + * if the window is focused and "false" if not. + */ + let focused: boolean; + + /** + * System variable that stores the width of the + * screen display according to The default + * pixelDensity. This is used to run a full-screen + * program on any display size. To return actual + * screen size, multiply this by pixelDensity. + */ + let displayWidth: number; + + /** + * System variable that stores the height of the + * screen display according to The default + * pixelDensity. This is used to run a full-screen + * program on any display size. To return actual + * screen size, multiply this by pixelDensity. + */ + let displayHeight: number; + + /** + * System variable that stores the width of the inner + * window, it maps to window.innerWidth. + */ + let windowWidth: number; + + /** + * System variable that stores the height of the + * inner window, it maps to window.innerHeight. + */ + let windowHeight: number; + + /** + * System variable that stores the width of the + * drawing canvas. This value is set by the first + * parameter of the createCanvas() function. For + * example, the function call createCanvas(320, 240) + * sets the width variable to the value 320. The + * value of width defaults to 100 if createCanvas() + * is not used in a program. + */ + let width: number; + + /** + * System variable that stores the height of the + * drawing canvas. This value is set by the second + * parameter of the createCanvas() function. For + * example, the function call createCanvas(320, 240) + * sets the height variable to the value 240. The + * value of height defaults to 100 if createCanvas() + * is not used in a program. + */ + let height: number; + + /** + * Creates a canvas element in the document, and sets + * the dimensions of it in pixels. This method should + * be called only once at the start of setup. Calling + * createCanvas more than once in a sketch will + * result in very unpredictable behavior. If you want + * more than one drawing canvas you could use + * createGraphics (hidden by default but it can be + * shown). The system variables width and height are + * set by the parameters passed to this function. If + * createCanvas() is not used, the window will be + * given a default size of 100x100 pixels. + * + * + * For more ways to position the canvas, see the + * positioning the canvas wiki page. + * @param w width of the canvas + * @param h height of the canvas + * @param [renderer] either P2D or WEBGL + */ + function createCanvas( + w: number, + h: number, + renderer?: p5.RENDERER + ): p5.Renderer; + + /** + * Resizes the canvas to given width and height. The + * canvas will be cleared and draw will be called + * immediately, allowing the sketch to re-render + * itself in the resized canvas. + * @param w width of the canvas + * @param h height of the canvas + * @param [noRedraw] don't redraw the canvas + * immediately + */ + function resizeCanvas( + w: number, + h: number, + noRedraw?: boolean + ): void; + + /** + * Removes the default canvas for a p5 sketch that + * doesn't require a canvas + */ + function noCanvas(): void; + + /** + * Creates and returns a new p5.Renderer object. Use + * this class if you need to draw into an off-screen + * graphics buffer. The two parameters define the + * width and height in pixels. + * @param w width of the offscreen graphics buffer + * @param h height of the offscreen graphics buffer + * @param [renderer] either P2D or WEBGL undefined + * defaults to p2d + * @return offscreen graphics buffer + */ + function createGraphics( + w: number, + h: number, + renderer?: p5.RENDERER + ): p5.Graphics; + + /** + * Blends the pixels in the display window according + * to the defined mode. There is a choice of the + * following modes to blend the source pixels (A) + * with the ones of pixels already in the display + * window (B): - BLEND - linear interpolation of + * colours: C = A*factor + B. This is the default + * blending mode. + * - ADD - sum of A and B + * - DARKEST - only the darkest colour succeeds: C = + * min(A*factor, B). + * - LIGHTEST - only the lightest colour succeeds: C + * = max(A*factor, B). + * - DIFFERENCE - subtract colors from underlying + * image. + * - EXCLUSION - similar to DIFFERENCE, but less + * extreme. + * - MULTIPLY - multiply the colors, result will + * always be darker. + * - SCREEN - opposite multiply, uses inverse values + * of the colors. + * - REPLACE - the pixels entirely replace the others + * and don't utilize alpha (transparency) values. + * - OVERLAY - mix of MULTIPLY and SCREEN . + * Multiplies dark values, and screens light values. + * - HARD_LIGHT - SCREEN when greater than 50% gray, + * MULTIPLY when lower. + * - SOFT_LIGHT - mix of DARKEST and LIGHTEST. Works + * like OVERLAY, but not as harsh. + * - DODGE - lightens light tones and increases + * contrast, ignores darks. + * - BURN - darker areas are applied, increasing + * contrast, ignores lights. + * @param mode blend mode to set for canvas. either + * BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY, + * EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, + * SOFT_LIGHT, DODGE, BURN, ADD or NORMAL + */ + function blendMode( + mode: p5.BLEND_MODE + ): void; + + /** + * Stops p5.js from continuously executing the code + * within draw(). If loop() is called, the code in + * draw() begins to run continuously again. If using + * noLoop() in setup(), it should be the last line + * inside the block. When noLoop() is used, it's not + * possible to manipulate or access the screen inside + * event handling functions such as mousePressed() or + * keyPressed(). Instead, use those functions to call + * redraw() or loop(), which will run draw(), which + * can update the screen properly. This means that + * when noLoop() has been called, no drawing can + * happen, and functions like saveFrame() or + * loadPixels() may not be used. + * + * + * Note that if the sketch is resized, redraw() will + * be called to update the sketch, even after + * noLoop() has been specified. Otherwise, the sketch + * would enter an odd state until loop() was called. + */ + function noLoop(): void; + + /** + * By default, p5.js loops through draw() + * continuously, executing the code within it. + * However, the draw() loop may be stopped by calling + * noLoop(). In that case, the draw() loop can be + * resumed with loop(). + */ + function loop(): void; + + /** + * The push() function saves the current drawing + * style settings and transformations, while pop() + * restores these settings. Note that these functions + * are always used together. They allow you to change + * the style and transformation settings and later + * return to what you had. When a new state is + * started with push(), it builds on the current + * style and transform information. The push() and + * pop() functions can be embedded to provide more + * control. (See the second example for a + * demonstration.) push() stores information related + * to the current transformation state and style + * settings controlled by the following functions: + * fill(), stroke(), tint(), strokeWeight(), + * strokeCap(), strokeJoin(), imageMode(), + * rectMode(), ellipseMode(), colorMode(), + * textAlign(), textFont(), textMode(), textSize(), + * textLeading(). + */ + function push(): void; + + /** + * The push() function saves the current drawing + * style settings and transformations, while pop() + * restores these settings. Note that these functions + * are always used together. They allow you to change + * the style and transformation settings and later + * return to what you had. When a new state is + * started with push(), it builds on the current + * style and transform information. The push() and + * pop() functions can be embedded to provide more + * control. (See the second example for a + * demonstration.) push() stores information related + * to the current transformation state and style + * settings controlled by the following functions: + * fill(), stroke(), tint(), strokeWeight(), + * strokeCap(), strokeJoin(), imageMode(), + * rectMode(), ellipseMode(), colorMode(), + * textAlign(), textFont(), textMode(), textSize(), + * textLeading(). + */ + function pop(): void; + + /** + * Executes the code within draw() one time. This + * functions allows the program to update the display + * window only when necessary, for example when an + * event registered by mousePressed() or keyPressed() + * occurs. In structuring a program, it only makes + * sense to call redraw() within events such as + * mousePressed(). This is because redraw() does not + * run draw() immediately (it only sets a flag that + * indicates an update is needed). + * + * + * The redraw() function does not work properly when + * called inside draw(). To enable/disable + * animations, use loop() and noLoop(). + * + * + * In addition you can set the number of redraws per + * method call. Just add an integer as single + * parameter for the number of redraws. + * @param [n] Redraw for n-times. The default value + * is 1. + */ + function redraw( + n?: number + ): void; + + /** + * Multiplies the current matrix by the one specified + * through the parameters. This is a powerful + * operation that can perform the equivalent of + * translate, scale, shear and rotate all at once. + * You can learn more about transformation matrices + * on Wikipedia. The naming of the arguments here + * follows the naming of the WHATWG specification + * and corresponds to a transformation matrix of the + * form: + * @param a numbers which define the 2x3 matrix to be + * multiplied + * @param b numbers which define the 2x3 matrix to be + * multiplied + * @param c numbers which define the 2x3 matrix to be + * multiplied + * @param d numbers which define the 2x3 matrix to be + * multiplied + * @param e numbers which define the 2x3 matrix to be + * multiplied + * @param f numbers which define the 2x3 matrix to be + * multiplied + * @chainable + */ + function applyMatrix( + a: number, + b: number, + c: number, + d: number, + e: number, + f: number + ): p5; + + /** + * Replaces the current matrix with the identity + * matrix. + * @chainable + */ + function resetMatrix(): p5; + + /** + * Rotates a shape the amount specified by the angle + * parameter. This function accounts for angleMode, + * so angles can be entered in either RADIANS or + * DEGREES. Objects are always rotated around their + * relative position to the origin and positive + * numbers rotate objects in a clockwise direction. + * Transformations apply to everything that happens + * after and subsequent calls to the function + * accumulates the effect. For example, calling + * rotate(HALF_PI) and then rotate(HALF_PI) is the + * same as rotate(PI). All tranformations are reset + * when draw() begins again. + * + * + * Technically, rotate() multiplies the current + * transformation matrix by a rotation matrix. This + * function can be further controlled by the push() + * and pop(). + * @param angle the angle of rotation, specified in + * radians or degrees, depending on current angleMode + * @param [axis] (in 3d) the axis to rotate around + * @chainable + */ + function rotate( + angle: number, + axis?: + | p5.Vector + | number[] + ): p5; + + /** + * Rotates around X axis. + * @param angle the angle of rotation, specified in + * radians or degrees, depending on current angleMode + * @chainable + */ + function rotateX( + angle: number + ): p5; + + /** + * Rotates around Y axis. + * @param angle the angle of rotation, specified in + * radians or degrees, depending on current angleMode + * @chainable + */ + function rotateY( + angle: number + ): p5; + + /** + * Rotates around Z axis. Webgl mode only. + * @param angle the angle of rotation, specified in + * radians or degrees, depending on current angleMode + * @chainable + */ + function rotateZ( + angle: number + ): p5; + + /** + * Increases or decreases the size of a shape by + * expanding and contracting vertices. Objects always + * scale from their relative origin to the coordinate + * system. Scale values are specified as decimal + * percentages. For example, the function call + * scale(2.0) increases the dimension of a shape by + * 200%. Transformations apply to everything that + * happens after and subsequent calls to the function + * multiply the effect. For example, calling + * scale(2.0) and then scale(1.5) is the same as + * scale(3.0). If scale() is called within draw(), + * the transformation is reset when the loop begins + * again. + * + * + * Using this function with the z parameter is only + * available in WEBGL mode. This function can be + * further controlled with push() and pop(). + * @param s percent to scale the object, or + * percentage to scale the object in the x-axis if + * multiple arguments are given + * @param [y] percent to scale the object in the + * y-axis + * @param [z] percent to scale the object in the + * z-axis (webgl only) + * @chainable + */ + function scale( + s: + | number + | p5.Vector + | number[], + y?: number, + z?: number + ): p5; + + /** + * Increases or decreases the size of a shape by + * expanding and contracting vertices. Objects always + * scale from their relative origin to the coordinate + * system. Scale values are specified as decimal + * percentages. For example, the function call + * scale(2.0) increases the dimension of a shape by + * 200%. Transformations apply to everything that + * happens after and subsequent calls to the function + * multiply the effect. For example, calling + * scale(2.0) and then scale(1.5) is the same as + * scale(3.0). If scale() is called within draw(), + * the transformation is reset when the loop begins + * again. + * + * + * Using this function with the z parameter is only + * available in WEBGL mode. This function can be + * further controlled with push() and pop(). + * @param scales per-axis percents to scale the + * object + * @chainable + */ + function scale( + scales: + | p5.Vector + | number[] + ): p5; + + /** + * Shears a shape around the x-axis the amount + * specified by the angle parameter. Angles should be + * specified in the current angleMode. Objects are + * always sheared around their relative position to + * the origin and positive numbers shear objects in a + * clockwise direction. Transformations apply to + * everything that happens after and subsequent calls + * to the function accumulates the effect. For + * example, calling shearX(PI/2) and then + * shearX(PI/2) is the same as shearX(PI). If + * shearX() is called within the draw(), the + * transformation is reset when the loop begins + * again. + * + * + * Technically, shearX() multiplies the current + * transformation matrix by a rotation matrix. This + * function can be further controlled by the push() + * and pop() functions. + * @param angle angle of shear specified in radians + * or degrees, depending on current angleMode + * @chainable + */ + function shearX( + angle: number + ): p5; + + /** + * Shears a shape around the y-axis the amount + * specified by the angle parameter. Angles should be + * specified in the current angleMode. Objects are + * always sheared around their relative position to + * the origin and positive numbers shear objects in a + * clockwise direction. Transformations apply to + * everything that happens after and subsequent calls + * to the function accumulates the effect. For + * example, calling shearY(PI/2) and then + * shearY(PI/2) is the same as shearY(PI). If + * shearY() is called within the draw(), the + * transformation is reset when the loop begins + * again. + * + * + * Technically, shearY() multiplies the current + * transformation matrix by a rotation matrix. This + * function can be further controlled by the push() + * and pop() functions. + * @param angle angle of shear specified in radians + * or degrees, depending on current angleMode + * @chainable + */ + function shearY( + angle: number + ): p5; + + /** + * Specifies an amount to displace objects within the + * display window. The x parameter specifies + * left/right translation, the y parameter specifies + * up/down translation. Transformations are + * cumulative and apply to everything that happens + * after and subsequent calls to the function + * accumulates the effect. For example, calling + * translate(50, 0) and then translate(20, 0) is the + * same as translate(70, 0). If translate() is called + * within draw(), the transformation is reset when + * the loop begins again. This function can be + * further controlled by using push() and pop(). + * @param x left/right translation + * @param y up/down translation + * @param [z] forward/backward translation (webgl + * only) + * @chainable + */ + function translate( + x: number, + y: number, + z?: number + ): p5; + + /** + * Specifies an amount to displace objects within the + * display window. The x parameter specifies + * left/right translation, the y parameter specifies + * up/down translation. Transformations are + * cumulative and apply to everything that happens + * after and subsequent calls to the function + * accumulates the effect. For example, calling + * translate(50, 0) and then translate(20, 0) is the + * same as translate(70, 0). If translate() is called + * within draw(), the transformation is reset when + * the loop begins again. This function can be + * further controlled by using push() and pop(). + * @param vector the vector to translate by + * @chainable + */ + function translate( + vector: p5.Vector + ): p5; + + /** + * Creates a new instance of p5.StringDict using the + * key-value pair or the object you provide. + */ + function createStringDict( + key: string, + value: string + ): p5.StringDict; + + /** + * Creates a new instance of p5.StringDict using the + * key-value pair or the object you provide. + * @param object object + */ + function createStringDict( + object: object + ): p5.StringDict; + + /** + * Creates a new instance of p5.NumberDict using the + * key-value pair or object you provide. + */ + function createNumberDict( + key: number, + value: number + ): p5.NumberDict; + + /** + * Creates a new instance of p5.NumberDict using the + * key-value pair or object you provide. + * @param object object + */ + function createNumberDict( + object: object + ): p5.NumberDict; + + /** + * The setMoveThreshold() function is used to set the + * movement threshold for the deviceMoved() function. + * The default threshold is set to 0.5. + * @param value The threshold value + */ + function setMoveThreshold( + value: number + ): void; + + /** + * The setShakeThreshold() function is used to set + * the movement threshold for the deviceShaken() + * function. The default threshold is set to 30. + * @param value The threshold value + */ + function setShakeThreshold( + value: number + ): void; + + /** + * The deviceMoved() function is called when the + * device is moved by more than the threshold value + * along X, Y or Z axis. The default threshold is set + * to 0.5. + */ + function deviceMoved(): void; + + /** + * The deviceTurned() function is called when the + * device rotates by more than 90 degrees + * continuously. The axis that triggers the + * deviceTurned() method is stored in the turnAxis + * variable. The deviceTurned() method can be locked + * to trigger on any axis: X, Y or Z by comparing the + * turnAxis variable to 'X', 'Y' or 'Z'. + */ + function deviceTurned(): void; + + /** + * The deviceShaken() function is called when the + * device total acceleration changes of accelerationX + * and accelerationY values is more than the + * threshold value. The default threshold is set to + * 30. + */ + function deviceShaken(): void; + + /** + * The system variable deviceOrientation always + * contains the orientation of the device. The value + * of this variable will either be set 'landscape' or + * 'portrait'. If no data is available it will be set + * to 'undefined'. either LANDSCAPE or PORTRAIT. + */ + let deviceOrientation: p5.UNKNOWN_P5_CONSTANT; + + /** + * The system variable accelerationX always contains + * the acceleration of the device along the x axis. + * Value is represented as meters per second squared. + */ + let accelerationX: number; + + /** + * The system variable accelerationY always contains + * the acceleration of the device along the y axis. + * Value is represented as meters per second squared. + */ + let accelerationY: number; + + /** + * The system variable accelerationZ always contains + * the acceleration of the device along the z axis. + * Value is represented as meters per second squared. + */ + let accelerationZ: number; + + /** + * The system variable pAccelerationX always contains + * the acceleration of the device along the x axis in + * the frame previous to the current frame. Value is + * represented as meters per second squared. + */ + let pAccelerationX: number; + + /** + * The system variable pAccelerationY always contains + * the acceleration of the device along the y axis in + * the frame previous to the current frame. Value is + * represented as meters per second squared. + */ + let pAccelerationY: number; + + /** + * The system variable pAccelerationZ always contains + * the acceleration of the device along the z axis in + * the frame previous to the current frame. Value is + * represented as meters per second squared. + */ + let pAccelerationZ: number; + + /** + * The system variable rotationX always contains the + * rotation of the device along the x axis. Value is + * represented as 0 to +/-180 degrees. Note: The + * order the rotations are called is important, ie. + * if used together, it must be called in the order + * Z-X-Y or there might be unexpected behaviour. + */ + let rotationX: number; + + /** + * The system variable rotationY always contains the + * rotation of the device along the y axis. Value is + * represented as 0 to +/-90 degrees. Note: The + * order the rotations are called is important, ie. + * if used together, it must be called in the order + * Z-X-Y or there might be unexpected behaviour. + */ + let rotationY: number; + + /** + * The system variable rotationZ always contains the + * rotation of the device along the z axis. Value is + * represented as 0 to 359 degrees. Unlike rotationX + * and rotationY, this variable is available for + * devices with a built-in compass only. + * + * + * Note: The order the rotations are called is + * important, ie. if used together, it must be called + * in the order Z-X-Y or there might be unexpected + * behaviour. + */ + let rotationZ: number; + + /** + * The system variable pRotationX always contains the + * rotation of the device along the x axis in the + * frame previous to the current frame. Value is + * represented as 0 to +/-180 degrees. pRotationX + * can also be used with rotationX to determine the + * rotate direction of the device along the X-axis. + */ + let pRotationX: number; + + /** + * The system variable pRotationY always contains the + * rotation of the device along the y axis in the + * frame previous to the current frame. Value is + * represented as 0 to +/-90 degrees. pRotationY can + * also be used with rotationY to determine the + * rotate direction of the device along the Y-axis. + */ + let pRotationY: number; + + /** + * The system variable pRotationZ always contains the + * rotation of the device along the z axis in the + * frame previous to the current frame. Value is + * represented as 0 to 359 degrees. pRotationZ can + * also be used with rotationZ to determine the + * rotate direction of the device along the Z-axis. + */ + let pRotationZ: number; + let turnAxis: string; + + /** + * The keyPressed() function is called once every + * time a key is pressed. The keyCode for the key + * that was pressed is stored in the keyCode + * variable. For non-ASCII keys, use the keyCode + * variable. You can check if the keyCode equals + * BACKSPACE, DELETE, ENTER, RETURN, TAB, ESCAPE, + * SHIFT, CONTROL, OPTION, ALT, UP_ARROW, DOWN_ARROW, + * LEFT_ARROW, RIGHT_ARROW. + * + * + * For ASCII keys that was pressed is stored in the + * key variable. However, it does not distinguish + * between uppercase and lowercase. For this reason, + * it is recommended to use keyTyped() to read the + * key variable, in which the case of the variable + * will be distinguished. + * + * + * Because of how operating systems handle key + * repeats, holding down a key may cause multiple + * calls to keyTyped() (and keyReleased() as well). + * The rate of repeat is set by the operating system + * and how each computer is configured. + * + * + * Browsers may have different default behaviors + * attached to various key events. To prevent any + * default behavior for this event, add "return + * false" to the end of the method. + */ + function keyPressed(): void; + + /** + * The keyReleased() function is called once every + * time a key is released. See key and keyCode for + * more information. Browsers may have different + * default behaviors attached to various key events. + * To prevent any default behavior for this event, + * add "return false" to the end of the method. + */ + function keyReleased(): void; + + /** + * The keyTyped() function is called once every time + * a key is pressed, but action keys such as Ctrl, + * Shift, and Alt are ignored. The most recent key + * pressed will be stored in the key variable. + * Because of how operating systems handle key + * repeats, holding down a key will cause multiple + * calls to keyTyped() (and keyReleased() as well). + * The rate of repeat is set by the operating system + * and how each computer is configured. + * + * + * Browsers may have different default behaviors + * attached to various key events. To prevent any + * default behavior for this event, add "return + * false" to the end of the method. + */ + function keyTyped(): void; + + /** + * The keyIsDown() function checks if the key is + * currently down, i.e. pressed. It can be used if + * you have an object that moves, and you want + * several keys to be able to affect its behaviour + * simultaneously, such as moving a sprite + * diagonally. You can put in any number representing + * the keyCode of the key, or use any of the variable + * keyCode names listed here. + * @param code The key to check for. + * @return whether key is down or not + */ + function keyIsDown( + code: number + ): boolean; + + /** + * The boolean system variable keyIsPressed is true + * if any key is pressed and false if no keys are + * pressed. + */ + let keyIsPressed: boolean; + + /** + * The system variable key always contains the value + * of the most recent key on the keyboard that was + * typed. To get the proper capitalization, it is + * best to use it within keyTyped(). For non-ASCII + * keys, use the keyCode variable. + */ + let key: string; + + /** + * The variable keyCode is used to detect special + * keys such as BACKSPACE, DELETE, ENTER, RETURN, + * TAB, ESCAPE, SHIFT, CONTROL, OPTION, ALT, + * UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW. You + * can also check for custom keys by looking up the + * keyCode of any key on a site like this: + * keycode.info. + */ + let keyCode: number; + + /** + * The mouseMoved() function is called every time the + * mouse moves and a mouse button is not pressed. + * Browsers may have different default behaviors + * attached to various mouse events. To prevent any + * default behavior for this event, add "return + * false" to the end of the method. + * @param [event] optional MouseEvent callback + * argument. + */ + function mouseMoved( + event?: object + ): void; + + /** + * The mouseDragged() function is called once every + * time the mouse moves and a mouse button is + * pressed. If no mouseDragged() function is defined, + * the touchMoved() function will be called instead + * if it is defined. Browsers may have different + * default behaviors attached to various mouse + * events. To prevent any default behavior for this + * event, add "return false" to the end of the + * method. + * @param [event] optional MouseEvent callback + * argument. + */ + function mouseDragged( + event?: object + ): void; + + /** + * The mousePressed() function is called once after + * every time a mouse button is pressed. The + * mouseButton variable (see the related reference + * entry) can be used to determine which button has + * been pressed. If no mousePressed() function is + * defined, the touchStarted() function will be + * called instead if it is defined. Browsers may have + * different default behaviors attached to various + * mouse events. To prevent any default behavior for + * this event, add "return false" to the end of the + * method. + * @param [event] optional MouseEvent callback + * argument. + */ + function mousePressed( + event?: object + ): void; + + /** + * The mouseReleased() function is called every time + * a mouse button is released. If no mouseReleased() + * function is defined, the touchEnded() function + * will be called instead if it is defined. Browsers + * may have different default behaviors attached to + * various mouse events. To prevent any default + * behavior for this event, add "return false" to the + * end of the method. + * @param [event] optional MouseEvent callback + * argument. + */ + function mouseReleased( + event?: object + ): void; + + /** + * The mouseClicked() function is called once after a + * mouse button has been pressed and then released. + * Browsers handle clicks differently, so this + * function is only guaranteed to be run when the + * left mouse button is clicked. To handle other + * mouse buttons being pressed or released, see + * mousePressed() or mouseReleased(). + * + * + * Browsers may have different default behaviors + * attached to various mouse events. To prevent any + * default behavior for this event, add "return + * false" to the end of the method. + * @param [event] optional MouseEvent callback + * argument. + */ + function mouseClicked( + event?: object + ): void; + + /** + * The doubleClicked() function is executed every + * time a event listener has detected a dblclick + * event which is a part of the DOM L3 specification. + * The doubleClicked event is fired when a pointing + * device button (usually a mouse's primary button) + * is clicked twice on a single element. For more + * info on the dblclick event refer to mozilla's + * documentation here: + * https://developer.mozilla.org/en-US/docs/Web/Events/dblclick + * @param [event] optional MouseEvent callback + * argument. + */ + function doubleClicked( + event?: object + ): void; + + /** + * The function mouseWheel() is executed every time a + * vertical mouse wheel event is detected either + * triggered by an actual mouse wheel or by a + * touchpad. The event.delta property returns the + * amount the mouse wheel have scrolled. The values + * can be positive or negative depending on the + * scroll direction (on OS X with "natural" scrolling + * enabled, the signs are inverted). + * + * + * Browsers may have different default behaviors + * attached to various mouse events. To prevent any + * default behavior for this event, add "return + * false" to the end of the method. + * + * + * Due to the current support of the "wheel" event on + * Safari, the function may only work as expected if + * "return false" is included while using Safari. + * @param [event] optional WheelEvent callback + * argument. + */ + function mouseWheel( + event?: object + ): void; + + /** + * The system variable mouseX always contains the + * current horizontal position of the mouse, relative + * to (0, 0) of the canvas. If touch is used instead + * of mouse input, mouseX will hold the x value of + * the most recent touch point. + */ + let mouseX: number; + + /** + * The system variable mouseY always contains the + * current vertical position of the mouse, relative + * to (0, 0) of the canvas. If touch is used instead + * of mouse input, mouseY will hold the y value of + * the most recent touch point. + */ + let mouseY: number; + + /** + * The system variable pmouseX always contains the + * horizontal position of the mouse or finger in the + * frame previous to the current frame, relative to + * (0, 0) of the canvas. Note: pmouseX will be reset + * to the current mouseX value at the start of each + * touch event. + */ + let pmouseX: number; + + /** + * The system variable pmouseY always contains the + * vertical position of the mouse or finger in the + * frame previous to the current frame, relative to + * (0, 0) of the canvas. Note: pmouseY will be reset + * to the current mouseY value at the start of each + * touch event. + */ + let pmouseY: number; + + /** + * The system variable winMouseX always contains the + * current horizontal position of the mouse, relative + * to (0, 0) of the window. + */ + let winMouseX: number; + + /** + * The system variable winMouseY always contains the + * current vertical position of the mouse, relative + * to (0, 0) of the window. + */ + let winMouseY: number; + + /** + * The system variable pwinMouseX always contains the + * horizontal position of the mouse in the frame + * previous to the current frame, relative to (0, 0) + * of the window. Note: pwinMouseX will be reset to + * the current winMouseX value at the start of each + * touch event. + */ + let pwinMouseX: number; + + /** + * The system variable pwinMouseY always contains the + * vertical position of the mouse in the frame + * previous to the current frame, relative to (0, 0) + * of the window. Note: pwinMouseY will be reset to + * the current winMouseY value at the start of each + * touch event. + */ + let pwinMouseY: number; + + /** + * Processing automatically tracks if the mouse + * button is pressed and which button is pressed. The + * value of the system variable mouseButton is either + * LEFT, RIGHT, or CENTER depending on which button + * was pressed last. Warning: different browsers may + * track mouseButton differently. + */ + let mouseButton: p5.UNKNOWN_P5_CONSTANT; + + /** + * The boolean system variable mouseIsPressed is true + * if the mouse is pressed and false if not. + */ + let mouseIsPressed: boolean; + + /** + * The touchStarted() function is called once after + * every time a touch is registered. If no + * touchStarted() function is defined, the + * mousePressed() function will be called instead if + * it is defined. Browsers may have different default + * behaviors attached to various touch events. To + * prevent any default behavior for this event, add + * "return false" to the end of the method. + * @param [event] optional TouchEvent callback + * argument. + */ + function touchStarted( + event?: object + ): void; + + /** + * The touchMoved() function is called every time a + * touch move is registered. If no touchMoved() + * function is defined, the mouseDragged() function + * will be called instead if it is defined. Browsers + * may have different default behaviors attached to + * various touch events. To prevent any default + * behavior for this event, add "return false" to the + * end of the method. + * @param [event] optional TouchEvent callback + * argument. + */ + function touchMoved( + event?: object + ): void; + + /** + * The touchEnded() function is called every time a + * touch ends. If no touchEnded() function is + * defined, the mouseReleased() function will be + * called instead if it is defined. Browsers may have + * different default behaviors attached to various + * touch events. To prevent any default behavior for + * this event, add "return false" to the end of the + * method. + * @param [event] optional TouchEvent callback + * argument. + */ + function touchEnded( + event?: object + ): void; + + /** + * The system variable touches[] contains an array of + * the positions of all current touch points, + * relative to (0, 0) of the canvas, and IDs + * identifying a unique touch as it moves. Each + * element in the array is an object with x, y, and + * id properties. The touches[] array is not + * supported on Safari and IE on touch-based desktops + * (laptops). + */ + let touches: object[]; + + /** + * Creates a new p5.Image (the datatype for storing + * images). This provides a fresh buffer of pixels to + * play with. Set the size of the buffer with the + * width and height parameters. .pixels gives access + * to an array containing the values for all the + * pixels in the display window. These values are + * numbers. This array is the size (including an + * appropriate factor for the pixelDensity) of the + * display window x4, representing the R, G, B, A + * values in order for each pixel, moving from left + * to right across each row, then down each column. + * See .pixels for more info. It may also be simpler + * to use set() or get(). + * + * + * Before accessing the pixels of an image, the data + * must loaded with the loadPixels() function. After + * the array data has been modified, the + * updatePixels() function must be run to update the + * changes. + * @param width width in pixels + * @param height height in pixels + * @return the p5.Image object + */ + function createImage( + width: number, + height: number + ): p5.Image; + + /** + * Save the current canvas as an image. The browser + * will either save the file immediately, or prompt + * the user with a dialogue window. + * @param selectedCanvas a variable representing a + * specific html5 canvas (optional) + * @param [extension] 'jpg' or 'png' + */ + function saveCanvas( + selectedCanvas: + | p5.Element + | HTMLCanvasElement, + filename?: string, + extension?: string + ): void; + + /** + * Save the current canvas as an image. The browser + * will either save the file immediately, or prompt + * the user with a dialogue window. + * @param [extension] 'jpg' or 'png' + */ + function saveCanvas( + filename?: string, + extension?: string + ): void; + + /** + * Capture a sequence of frames that can be used to + * create a movie. Accepts a callback. For example, + * you may wish to send the frames to a server where + * they can be stored or converted into a movie. If + * no callback is provided, the browser will pop up + * save dialogues in an attempt to download all of + * the images that have just been created. With the + * callback provided the image data isn't saved by + * default but instead passed as an argument to the + * callback function as an array of objects, with the + * size of array equal to the total number of frames. + * Note that saveFrames() will only save the first 15 + * frames of an animation. To export longer + * animations, you might look into a library like + * ccapture.js. + * @param extension 'jpg' or 'png' + * @param duration Duration in seconds to save the + * frames for. + * @param framerate Framerate to save the frames in. + * @param [callback] A callback function that will be + * executed to handle the image data. This function + * should accept an array as argument. The array will + * contain the specified number of frames of objects. + * Each object has three properties: imageData - an + * image/octet-stream, filename and extension. + */ + function saveFrames( + filename: string, + extension: string, + duration: number, + framerate: number, + callback?: ( + p1: any[] + ) => any + ): void; + + /** + * Loads an image from a path and creates a p5.Image + * from it. The image may not be immediately + * available for rendering If you want to ensure that + * the image is ready before doing anything with it, + * place the loadImage() call in preload(). You may + * also supply a callback function to handle the + * image when it's ready. + * + * + * The path to the image should be relative to the + * HTML file that links in your sketch. Loading an + * image from a URL or other remote location may be + * blocked due to your browser's built-in security. + * @param path Path of the image to be loaded + * @param [successCallback] Function to be called + * once the image is loaded. Will be passed the + * p5.Image. + * @param [failureCallback] called with event error + * if the image fails to load. + * @return the p5.Image object + */ + function loadImage( + path: string, + successCallback?: ( + p1: p5.Image + ) => any, + failureCallback?: ( + p1: Event + ) => any + ): p5.Image; + + /** + * Draw an image to the p5.js canvas. This function + * can be used with different numbers of parameters. + * The simplest use requires only three parameters: + * img, x, and y—where (x, y) is the position of the + * image. Two more parameters can optionally be added + * to specify the width and height of the image. + * + * This function can also be used with all eight + * Number parameters. To differentiate between all + * these parameters, p5.js uses the language of + * "destination rectangle" (which corresponds to + * "dx", "dy", etc.) and "source image" (which + * corresponds to "sx", "sy", etc.) below. Specifying + * the "source image" dimensions can be useful when + * you want to display a subsection of the source + * image instead of the whole thing. Here's a diagram + * to explain further: + * @param img the image to display + * @param x the x-coordinate of the top-left corner + * of the image + * @param y the y-coordinate of the top-left corner + * of the image + * @param [width] the width to draw the image + * @param [height] the height to draw the image + */ + function image( + img: + | p5.Image + | p5.Element, + x: number, + y: number, + width?: number, + height?: number + ): void; + + /** + * Draw an image to the p5.js canvas. This function + * can be used with different numbers of parameters. + * The simplest use requires only three parameters: + * img, x, and y—where (x, y) is the position of the + * image. Two more parameters can optionally be added + * to specify the width and height of the image. + * + * This function can also be used with all eight + * Number parameters. To differentiate between all + * these parameters, p5.js uses the language of + * "destination rectangle" (which corresponds to + * "dx", "dy", etc.) and "source image" (which + * corresponds to "sx", "sy", etc.) below. Specifying + * the "source image" dimensions can be useful when + * you want to display a subsection of the source + * image instead of the whole thing. Here's a diagram + * to explain further: + * @param img the image to display + * @param dx the x-coordinate of the destination + * rectangle in which to draw the source image + * @param dy the y-coordinate of the destination + * rectangle in which to draw the source image + * @param dWidth the width of the destination + * rectangle + * @param dHeight the height of the destination + * rectangle + * @param sx the x-coordinate of the subsection of + * the source image to draw into the destination + * rectangle + * @param sy the y-coordinate of the subsection of + * the source image to draw into the destination + * rectangle + * @param [sWidth] the width of the subsection of the + * source image to draw into the destination + * rectangle + * @param [sHeight] the height of the subsection of + * the source image to draw into the destination + * rectangle + */ + function image( + img: + | p5.Image + | p5.Element, + dx: number, + dy: number, + dWidth: number, + dHeight: number, + sx: number, + sy: number, + sWidth?: number, + sHeight?: number + ): void; + + /** + * Sets the fill value for displaying images. Images + * can be tinted to specified colors or made + * transparent by including an alpha value. To apply + * transparency to an image without affecting its + * color, use white as the tint color and specify an + * alpha value. For instance, tint(255, 128) will + * make an image 50% transparent (assuming the + * default alpha range of 0-255, which can be changed + * with colorMode()). + * + * + * The value for the gray parameter must be less than + * or equal to the current maximum value as specified + * by colorMode(). The default maximum value is 255. + * @param v1 red or hue value relative to the current + * color range + * @param v2 green or saturation value relative to + * the current color range + * @param v3 blue or brightness value relative to the + * current color range + */ + function tint( + v1: number, + v2: number, + v3: number, + alpha?: number + ): void; + + /** + * Sets the fill value for displaying images. Images + * can be tinted to specified colors or made + * transparent by including an alpha value. To apply + * transparency to an image without affecting its + * color, use white as the tint color and specify an + * alpha value. For instance, tint(255, 128) will + * make an image 50% transparent (assuming the + * default alpha range of 0-255, which can be changed + * with colorMode()). + * + * + * The value for the gray parameter must be less than + * or equal to the current maximum value as specified + * by colorMode(). The default maximum value is 255. + * @param value a color string + */ + function tint( + value: string + ): void; + + /** + * Sets the fill value for displaying images. Images + * can be tinted to specified colors or made + * transparent by including an alpha value. To apply + * transparency to an image without affecting its + * color, use white as the tint color and specify an + * alpha value. For instance, tint(255, 128) will + * make an image 50% transparent (assuming the + * default alpha range of 0-255, which can be changed + * with colorMode()). + * + * + * The value for the gray parameter must be less than + * or equal to the current maximum value as specified + * by colorMode(). The default maximum value is 255. + * @param gray a gray value + */ + function tint( + gray: number, + alpha?: number + ): void; + + /** + * Sets the fill value for displaying images. Images + * can be tinted to specified colors or made + * transparent by including an alpha value. To apply + * transparency to an image without affecting its + * color, use white as the tint color and specify an + * alpha value. For instance, tint(255, 128) will + * make an image 50% transparent (assuming the + * default alpha range of 0-255, which can be changed + * with colorMode()). + * + * + * The value for the gray parameter must be less than + * or equal to the current maximum value as specified + * by colorMode(). The default maximum value is 255. + * @param values an array containing the + * red,green,blue & and alpha components of the color + */ + function tint( + values: number[] + ): void; + + /** + * Sets the fill value for displaying images. Images + * can be tinted to specified colors or made + * transparent by including an alpha value. To apply + * transparency to an image without affecting its + * color, use white as the tint color and specify an + * alpha value. For instance, tint(255, 128) will + * make an image 50% transparent (assuming the + * default alpha range of 0-255, which can be changed + * with colorMode()). + * + * + * The value for the gray parameter must be less than + * or equal to the current maximum value as specified + * by colorMode(). The default maximum value is 255. + * @param color the tint color + */ + function tint( + color: p5.Color + ): void; + + /** + * Removes the current fill value for displaying + * images and reverts to displaying images with their + * original hues. + */ + function noTint(): void; + + /** + * Set image mode. Modifies the location from which + * images are drawn by changing the way in which + * parameters given to image() are interpreted. The + * default mode is imageMode(CORNER), which + * interprets the second and third parameters of + * image() as the upper-left corner of the image. If + * two additional parameters are specified, they are + * used to set the image's width and height. + * imageMode(CORNERS) interprets the second and third + * parameters of image() as the location of one + * corner, and the fourth and fifth parameters as the + * opposite corner. + * + * + * imageMode(CENTER) interprets the second and third + * parameters of image() as the image's center point. + * If two additional parameters are specified, they + * are used to set the image's width and height. + * @param mode either CORNER, CORNERS, or CENTER + */ + function imageMode( + mode: p5.IMAGE_MODE + ): void; + + /** + * Copies a region of pixels from one image to + * another, using a specified blend mode to do the + * operation. + * @param srcImage source image + * @param sx X coordinate of the source's upper left + * corner + * @param sy Y coordinate of the source's upper left + * corner + * @param sw source image width + * @param sh source image height + * @param dx X coordinate of the destination's upper + * left corner + * @param dy Y coordinate of the destination's upper + * left corner + * @param dw destination image width + * @param dh destination image height + * @param blendMode the blend mode. either BLEND, + * DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY, + * EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, + * SOFT_LIGHT, DODGE, BURN, ADD or NORMAL. + */ + function blend( + srcImage: p5.Image, + sx: number, + sy: number, + sw: number, + sh: number, + dx: number, + dy: number, + dw: number, + dh: number, + blendMode: p5.BLEND_MODE + ): void; + + /** + * Copies a region of pixels from one image to + * another, using a specified blend mode to do the + * operation. + * @param sx X coordinate of the source's upper left + * corner + * @param sy Y coordinate of the source's upper left + * corner + * @param sw source image width + * @param sh source image height + * @param dx X coordinate of the destination's upper + * left corner + * @param dy Y coordinate of the destination's upper + * left corner + * @param dw destination image width + * @param dh destination image height + * @param blendMode the blend mode. either BLEND, + * DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY, + * EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, + * SOFT_LIGHT, DODGE, BURN, ADD or NORMAL. + */ + function blend( + sx: number, + sy: number, + sw: number, + sh: number, + dx: number, + dy: number, + dw: number, + dh: number, + blendMode: p5.UNKNOWN_P5_CONSTANT + ): void; + + /** + * Copies a region of the canvas to another region of + * the canvas and copies a region of pixels from an + * image used as the srcImg parameter into the canvas + * srcImage is specified this is used as the source. + * If the source and destination regions aren't the + * same size, it will automatically resize source + * pixels to fit the specified target region. + * @param srcImage source image + * @param sx X coordinate of the source's upper left + * corner + * @param sy Y coordinate of the source's upper left + * corner + * @param sw source image width + * @param sh source image height + * @param dx X coordinate of the destination's upper + * left corner + * @param dy Y coordinate of the destination's upper + * left corner + * @param dw destination image width + * @param dh destination image height + */ + function copy( + srcImage: + | p5.Image + | p5.Element, + sx: number, + sy: number, + sw: number, + sh: number, + dx: number, + dy: number, + dw: number, + dh: number + ): void; + + /** + * Copies a region of the canvas to another region of + * the canvas and copies a region of pixels from an + * image used as the srcImg parameter into the canvas + * srcImage is specified this is used as the source. + * If the source and destination regions aren't the + * same size, it will automatically resize source + * pixels to fit the specified target region. + * @param sx X coordinate of the source's upper left + * corner + * @param sy Y coordinate of the source's upper left + * corner + * @param sw source image width + * @param sh source image height + * @param dx X coordinate of the destination's upper + * left corner + * @param dy Y coordinate of the destination's upper + * left corner + * @param dw destination image width + * @param dh destination image height + */ + function copy( + sx: number, + sy: number, + sw: number, + sh: number, + dx: number, + dy: number, + dw: number, + dh: number + ): void; + + /** + * Applies a filter to the canvas. + * + * The presets options are: + * + * + * + * THRESHOLD Converts the image to black and white + * pixels depending if they are above or below the + * threshold defined by the level parameter. The + * parameter must be between 0.0 (black) and 1.0 + * (white). If no level is specified, 0.5 is used. + * + * + * + * GRAY Converts any colors in the image to grayscale + * equivalents. No parameter is used. + * + * + * + * OPAQUE Sets the alpha channel to entirely opaque. + * No parameter is used. + * + * + * + * INVERT Sets each pixel to its inverse value. No + * parameter is used. + * + * + * + * POSTERIZE Limits each channel of the image to the + * number of colors specified as the parameter. The + * parameter can be set to values between 2 and 255, + * but results are most noticeable in the lower + * ranges. + * + * + * + * BLUR Executes a Gaussian blur with the level + * parameter specifying the extent of the blurring. + * If no parameter is used, the blur is equivalent to + * Gaussian blur of radius 1. Larger values increase + * the blur. + * + * + * + * ERODE Reduces the light areas. No parameter is + * used. + * + * + * + * DILATE Increases the light areas. No parameter is + * used. + * @param filterType either THRESHOLD, GRAY, OPAQUE, + * INVERT, POSTERIZE, BLUR, ERODE, DILATE or BLUR. + * See Filters.js for docs on each available filter + * @param [filterParam] an optional parameter unique + * to each filter, see above + */ + function filter( + filterType: p5.FILTER_TYPE, + filterParam?: number + ): void; + + /** + * Returns an array of [R,G,B,A] values for any pixel + * or grabs a section of an image. If no parameters + * are specified, the entire image is returned. Use + * the x and y parameters to get the value of one + * pixel. Get a section of the display window by + * specifying additional w and h parameters. When + * getting an image, the x and y parameters define + * the coordinates for the upper-left corner of the + * image, regardless of the current imageMode(). If + * the pixel requested is outside of the image + * window, [0,0,0,255] is returned. To get the + * numbers scaled according to the current color + * ranges and taking into account colorMode, use + * getColor instead of get. + * + * + * Getting the color of a single pixel with get(x, y) + * is easy, but not as fast as grabbing the data + * directly from pixels[]. The equivalent statement + * to get(x, y) using pixels[] with pixel density d + * is var x, y, d; // set these to the coordinates + * var off = (y width + x) d * 4; var components = + * [ pixels[off], pixels[off + 1], pixels[off + 2], + * pixels[off + 3] ]; print(components); + * + * + * See the reference for pixels[] for more + * information. + * + * If you want to extract an array of colors or a + * subimage from an p5.Image object, take a look at + * p5.Image.get() + * @param [x] x-coordinate of the pixel + * @param [y] y-coordinate of the pixel + * @param [w] width + * @param [h] height + * @return values of pixel at x,y in array format [R, + * G, B, A] or p5.Image + */ + function get( + x?: number, + y?: number, + w?: number, + h?: number + ): + | number[] + | p5.Image; + + /** + * Loads the pixel data for the display window into + * the pixels[] array. This function must always be + * called before reading from or writing to pixels[]. + * Note that only changes made with set() or direct + * manipulation of pixels[] will occur. + */ + function loadPixels(): void; + + /** + * Changes the color of any pixel, or writes an image + * directly to the display window. The x and y + * parameters specify the pixel to change and the c + * parameter specifies the color value. This can be a + * p5.Color object, or [R, G, B, A] pixel array. It + * can also be a single grayscale value. When setting + * an image, the x and y parameters define the + * coordinates for the upper-left corner of the + * image, regardless of the current imageMode(). + * + * + * After using set(), you must call updatePixels() + * for your changes to appear. This should be called + * once all pixels have been set, and must be called + * before calling .get() or drawing the image. + * + * Setting the color of a single pixel with set(x, y) + * is easy, but not as fast as putting the data + * directly into pixels[]. Setting the pixels[] + * values directly may be complicated when working + * with a retina display, but will perform better + * when lots of pixels need to be set directly on + * every loop. + * + * See the reference for pixels[] for more + * information. + * @param x x-coordinate of the pixel + * @param y y-coordinate of the pixel + * @param c insert a grayscale value | a pixel array + * | a p5.Color object | a p5.Image to copy + */ + function set( + x: number, + y: number, + c: + | number + | number[] + | object + ): void; + + /** + * Updates the display window with the data in the + * pixels[] array. Use in conjunction with + * loadPixels(). If you're only reading pixels from + * the array, there's no need to call updatePixels() + * — updating is only necessary to apply changes. + * updatePixels() should be called anytime the pixels + * array is manipulated or set() is called, and only + * changes made with set() or direct changes to + * pixels[] will occur. + * @param [x] x-coordinate of the upper-left corner + * of region to update + * @param [y] y-coordinate of the upper-left corner + * of region to update + * @param [w] width of region to update + * @param [h] height of region to update + */ + function updatePixels( + x?: number, + y?: number, + w?: number, + h?: number + ): void; + + /** + * Uint8ClampedArray containing the values for all + * the pixels in the display window. These values are + * numbers. This array is the size (include an + * appropriate factor for pixelDensity) of the + * display window x4, representing the R, G, B, A + * values in order for each pixel, moving from left + * to right across each row, then down each column. + * Retina and other high density displays will have + * more pixels[] (by a factor of pixelDensity^2). For + * example, if the image is 100x100 pixels, there + * will be 40,000. On a retina display, there will be + * 160,000. The first four values (indices 0-3) in + * the array will be the R, G, B, A values of the + * pixel at (0, 0). The second four values (indices + * 4-7) will contain the R, G, B, A values of the + * pixel at (1, 0). More generally, to set values for + * a pixel at (x, y): + * + * var d = pixelDensity(); for (var i = 0; i < d; + * i++) { for (var j = 0; j < d; j++) { // loop over + * idx = 4 * ((y * d + j) * width * d + (x * d + i)); + * pixels[idx] = r; pixels[idx+1] = g; pixels[idx+2] + * = b; pixels[idx+3] = a; } } + * + * While the above method is complex, it is flexible + * enough to work with any pixelDensity. Note that + * set() will automatically take care of setting all + * the appropriate values in pixels[] for a given (x, + * y) at any pixelDensity, but the performance may + * not be as fast when lots of modifications are made + * to the pixel array. + * + * + * Before accessing this array, the data must loaded + * with the loadPixels() function. After the array + * data has been modified, the updatePixels() + * function must be run to update the changes. + * + * + * Note that this is not a standard javascript array. + * This means that standard javascript functions such + * as slice() or arrayCopy() do not work. + */ + let pixels: number[]; + + /** + * Loads a JSON file from a file or a URL, and + * returns an Object. Note that even if the JSON file + * contains an Array, an Object will be returned with + * index numbers as keys. This method is + * asynchronous, meaning it may not finish before the + * next line in your sketch is executed. JSONP is + * supported via a polyfill and you can pass in as + * the second argument an object with definitions of + * the json callback following the syntax specified + * here. + * + * This method is suitable for fetching files up to + * size of 64MB. + * @param path name of the file or url to load + * @param [jsonpOptions] options object for jsonp + * related settings + * @param [datatype] "json" or "jsonp" + * @param [callback] function to be executed after + * loadJSON() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + * @return JSON data + */ + function loadJSON( + path: string, + jsonpOptions?: object, + datatype?: string, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): + | object + | any[]; + + /** + * Loads a JSON file from a file or a URL, and + * returns an Object. Note that even if the JSON file + * contains an Array, an Object will be returned with + * index numbers as keys. This method is + * asynchronous, meaning it may not finish before the + * next line in your sketch is executed. JSONP is + * supported via a polyfill and you can pass in as + * the second argument an object with definitions of + * the json callback following the syntax specified + * here. + * + * This method is suitable for fetching files up to + * size of 64MB. + * @param path name of the file or url to load + * @param datatype "json" or "jsonp" + * @param [callback] function to be executed after + * loadJSON() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function loadJSON( + path: string, + datatype: string, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): + | object + | any[]; + + /** + * Loads a JSON file from a file or a URL, and + * returns an Object. Note that even if the JSON file + * contains an Array, an Object will be returned with + * index numbers as keys. This method is + * asynchronous, meaning it may not finish before the + * next line in your sketch is executed. JSONP is + * supported via a polyfill and you can pass in as + * the second argument an object with definitions of + * the json callback following the syntax specified + * here. + * + * This method is suitable for fetching files up to + * size of 64MB. + * @param path name of the file or url to load + * @param callback function to be executed after + * loadJSON() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function loadJSON( + path: string, + callback: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): + | object + | any[]; + + /** + * Reads the contents of a file and creates a String + * array of its individual lines. If the name of the + * file is used as the parameter, as in the above + * example, the file must be located in the sketch + * directory/folder. Alternatively, the file maybe + * be loaded from anywhere on the local computer + * using an absolute path (something that starts with + * / on Unix and Linux, or a drive letter on + * Windows), or the filename parameter can be a URL + * for a file found on a network. + * + * + * This method is asynchronous, meaning it may not + * finish before the next line in your sketch is + * executed. + * + * This method is suitable for fetching files up to + * size of 64MB. + * @param filename name of the file or url to load + * @param [callback] function to be executed after + * loadStrings() completes, Array is passed in as + * first argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + * @return Array of Strings + */ + function loadStrings( + filename: string, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): string[]; + + /** + * Reads the contents of a file or URL and creates a + * p5.Table object with its values. If a file is + * specified, it must be located in the sketch's + * "data" folder. The filename parameter can also be + * a URL to a file found online. By default, the file + * is assumed to be comma-separated (in CSV format). + * Table only looks for a header row if the 'header' + * option is included. Possible options include: + * + * - csv - parse the table as comma-separated values + * - tsv - parse the table as tab-separated values + * - header - this table has a header (title) row + * + * When passing in multiple options, pass them in as + * separate parameters, seperated by commas. For + * example: + * + * + * loadTable('my_csv_file.csv', 'csv', 'header'); + * + * + * All files loaded and saved use UTF-8 encoding. + * + * This method is asynchronous, meaning it may not + * finish before the next line in your sketch is + * executed. Calling loadTable() inside preload() + * guarantees to complete the operation before + * setup() and draw() are called. + * + * Outside of preload(), you may supply a callback + * function to handle the object: + * + * + * + * This method is suitable for fetching files up to + * size of 64MB. + * @param filename name of the file or URL to load + * @param options "header" "csv" "tsv" + * @param [callback] function to be executed after + * loadTable() completes. On success, the Table + * object is passed in as the first argument. + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + * @return Table object containing data + */ + function loadTable( + filename: string, + options: string, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): object; + + /** + * Reads the contents of a file or URL and creates a + * p5.Table object with its values. If a file is + * specified, it must be located in the sketch's + * "data" folder. The filename parameter can also be + * a URL to a file found online. By default, the file + * is assumed to be comma-separated (in CSV format). + * Table only looks for a header row if the 'header' + * option is included. Possible options include: + * + * - csv - parse the table as comma-separated values + * - tsv - parse the table as tab-separated values + * - header - this table has a header (title) row + * + * When passing in multiple options, pass them in as + * separate parameters, seperated by commas. For + * example: + * + * + * loadTable('my_csv_file.csv', 'csv', 'header'); + * + * + * All files loaded and saved use UTF-8 encoding. + * + * This method is asynchronous, meaning it may not + * finish before the next line in your sketch is + * executed. Calling loadTable() inside preload() + * guarantees to complete the operation before + * setup() and draw() are called. + * + * Outside of preload(), you may supply a callback + * function to handle the object: + * + * + * + * This method is suitable for fetching files up to + * size of 64MB. + * @param filename name of the file or URL to load + * @param [callback] function to be executed after + * loadTable() completes. On success, the Table + * object is passed in as the first argument. + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function loadTable( + filename: string, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): object; + + /** + * Reads the contents of a file and creates an XML + * object with its values. If the name of the file is + * used as the parameter, as in the above example, + * the file must be located in the sketch + * directory/folder. Alternatively, the file maybe be + * loaded from anywhere on the local computer using + * an absolute path (something that starts with / on + * Unix and Linux, or a drive letter on Windows), or + * the filename parameter can be a URL for a file + * found on a network. + * + * This method is asynchronous, meaning it may not + * finish before the next line in your sketch is + * executed. Calling loadXML() inside preload() + * guarantees to complete the operation before + * setup() and draw() are called. + * + * Outside of preload(), you may supply a callback + * function to handle the object. + * + * This method is suitable for fetching files up to + * size of 64MB. + * @param filename name of the file or URL to load + * @param [callback] function to be executed after + * loadXML() completes, XML object is passed in as + * first argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + * @return XML object containing data + */ + function loadXML( + filename: string, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): object; + + /** + * This method is suitable for fetching files up to + * size of 64MB. + * @param file name of the file or URL to load + * @param [callback] function to be executed after + * loadBytes() completes + * @param [errorCallback] function to be executed if + * there is an error + * @return an object whose 'bytes' property will be + * the loaded buffer + */ + function loadBytes( + file: string, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): object; + + /** + * Method for executing an HTTP GET request. If data + * type is not specified, p5 will try to guess based + * on the URL, defaulting to text. This is equivalent + * to calling httpDo(path, 'GET'). The 'binary' + * datatype will return a Blob object, and the + * 'arrayBuffer' datatype will return an ArrayBuffer + * which can be used to initialize typed arrays (such + * as Uint8Array). + * @param path name of the file or url to load + * @param [datatype] "json", "jsonp", "binary", + * "arrayBuffer", "xml", or "text" + * @param [data] param data passed sent with request + * @param [callback] function to be executed after + * httpGet() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + * @return A promise that resolves with the data when + * the operation completes successfully or rejects + * with the error after one occurs. + */ + function httpGet( + path: string, + datatype?: string, + data?: + | object + | boolean, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + + /** + * Method for executing an HTTP GET request. If data + * type is not specified, p5 will try to guess based + * on the URL, defaulting to text. This is equivalent + * to calling httpDo(path, 'GET'). The 'binary' + * datatype will return a Blob object, and the + * 'arrayBuffer' datatype will return an ArrayBuffer + * which can be used to initialize typed arrays (such + * as Uint8Array). + * @param path name of the file or url to load + * @param data param data passed sent with request + * @param [callback] function to be executed after + * httpGet() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function httpGet( + path: string, + data: + | object + | boolean, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + + /** + * Method for executing an HTTP GET request. If data + * type is not specified, p5 will try to guess based + * on the URL, defaulting to text. This is equivalent + * to calling httpDo(path, 'GET'). The 'binary' + * datatype will return a Blob object, and the + * 'arrayBuffer' datatype will return an ArrayBuffer + * which can be used to initialize typed arrays (such + * as Uint8Array). + * @param path name of the file or url to load + * @param callback function to be executed after + * httpGet() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function httpGet( + path: string, + callback: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + + /** + * Method for executing an HTTP POST request. If data + * type is not specified, p5 will try to guess based + * on the URL, defaulting to text. This is equivalent + * to calling httpDo(path, 'POST'). + * @param path name of the file or url to load + * @param [datatype] "json", "jsonp", "xml", or + * "text". If omitted, httpPost() will guess. + * @param [data] param data passed sent with request + * @param [callback] function to be executed after + * httpPost() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + * @return A promise that resolves with the data when + * the operation completes successfully or rejects + * with the error after one occurs. + */ + function httpPost( + path: string, + datatype?: string, + data?: + | object + | boolean, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + + /** + * Method for executing an HTTP POST request. If data + * type is not specified, p5 will try to guess based + * on the URL, defaulting to text. This is equivalent + * to calling httpDo(path, 'POST'). + * @param path name of the file or url to load + * @param data param data passed sent with request + * @param [callback] function to be executed after + * httpPost() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function httpPost( + path: string, + data: + | object + | boolean, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + + /** + * Method for executing an HTTP POST request. If data + * type is not specified, p5 will try to guess based + * on the URL, defaulting to text. This is equivalent + * to calling httpDo(path, 'POST'). + * @param path name of the file or url to load + * @param callback function to be executed after + * httpPost() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function httpPost( + path: string, + callback: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + + /** + * Method for executing an HTTP request. If data type + * is not specified, p5 will try to guess based on + * the URL, defaulting to text. For more advanced + * use, you may also pass in the path as the first + * argument and a object as the second argument, the + * signature follows the one specified in the Fetch + * API specification. This method is suitable for + * fetching files up to size of 64MB when "GET" is + * used. + * @param path name of the file or url to load + * @param [method] either "GET", "POST", or "PUT", + * defaults to "GET" + * @param [datatype] "json", "jsonp", "xml", or + * "text" + * @param [data] param data passed sent with request + * @param [callback] function to be executed after + * httpGet() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + * @return A promise that resolves with the data when + * the operation completes successfully or rejects + * with the error after one occurs. + */ + function httpDo( + path: string, + method?: string, + datatype?: string, + data?: object, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + + /** + * Method for executing an HTTP request. If data type + * is not specified, p5 will try to guess based on + * the URL, defaulting to text. For more advanced + * use, you may also pass in the path as the first + * argument and a object as the second argument, the + * signature follows the one specified in the Fetch + * API specification. This method is suitable for + * fetching files up to size of 64MB when "GET" is + * used. + * @param path name of the file or url to load + * @param options Request object options as + * documented in the "fetch" API reference + * @param [callback] function to be executed after + * httpGet() completes, data is passed in as first + * argument + * @param [errorCallback] function to be executed if + * there is an error, response is passed in as first + * argument + */ + function httpDo( + path: string, + options: object, + callback?: ( + ...args: any[] + ) => any, + errorCallback?: ( + ...args: any[] + ) => any + ): Promise< + any + >; + function createWriter( + name: string, + extension?: string + ): p5.PrintWriter; + + /** + * Save an image, text, json, csv, wav, or html. + * Prompts download to the client's computer. Note + * that it is not recommended to call save() within + * draw if it's looping, as the save() function will + * open a new save dialog every frame. The default + * behavior is to save the canvas as an image. You + * can optionally specify a filename. For example: + * + * + * save(); save('myCanvas.jpg'); // save a specific + * canvas with a filename + * + * Alternately, the first parameter can be a pointer + * to a canvas p5.Element, an Array of Strings, an + * Array of JSON, a JSON object, a p5.Table, a + * p5.Image, or a p5.SoundFile (requires p5.sound). + * The second parameter is a filename (including + * extension). The third parameter is for options + * specific to this type of object. This method will + * save a file that fits the given parameters. For + * example: + * + * + * // Saves canvas as an image save('myCanvas.jpg'); + * // Saves pImage as a png image var img = + * createImage(10, 10); save(img, 'my.png'); // Saves + * canvas as an image var cnv = createCanvas(100, + * 100); save(cnv, 'myCanvas.jpg'); // Saves + * p5.Renderer object as an image var gb = + * createGraphics(100, 100); save(gb, + * 'myGraphics.jpg'); var myTable = new p5.Table(); + * // Saves table as html file save(myTable, + * 'myTable.html'); // Comma Separated Values + * save(myTable, 'myTable.csv'); // Tab Separated + * Values save(myTable, 'myTable.tsv'); var myJSON = + * { a: 1, b: true }; // Saves pretty JSON + * save(myJSON, 'my.json'); // Optimizes JSON + * filesize save(myJSON, 'my.json', true); // Saves + * array of strings to a text file with line breaks + * after each item var arrayOfStrings = ['a', 'b']; + * save(arrayOfStrings, 'my.txt'); + * @param [objectOrFilename] If filename is provided, + * will save canvas as an image with either png or + * jpg extension depending on the filename. If object + * is provided, will save depending on the object and + * filename (see examples above). + * @param [filename] If an object is provided as the + * first parameter, then the second parameter + * indicates the filename, and should include an + * appropriate file extension (see examples above). + * @param [options] Additional options depend on + * filetype. For example, when saving JSON, true + * indicates that the output will be optimized for + * filesize, rather than readability. + */ + function save( + objectOrFilename?: + | object + | string, + filename?: string, + options?: + | boolean + | string + ): void; + + /** + * Writes the contents of an Array or a JSON object + * to a .json file. The file saving process and + * location of the saved file will vary between web + * browsers. + * @param [optimize] If true, removes line breaks and + * spaces from the output file to optimize filesize + * (but not readability). + */ + function saveJSON( + json: + | any[] + | object, + filename: string, + optimize?: boolean + ): void; + + /** + * Writes an array of Strings to a text file, one + * line per String. The file saving process and + * location of the saved file will vary between web + * browsers. + * @param list string array to be written + * @param filename filename for output + * @param [extension] the filename's extension + */ + function saveStrings( + list: string[], + filename: string, + extension?: string + ): void; + + /** + * Writes the contents of a Table object to a file. + * Defaults to a text file with + * comma-separated-values ('csv') but can also use + * tab separation ('tsv'), or generate an HTML table + * ('html'). The file saving process and location of + * the saved file will vary between web browsers. + * @param Table the Table object to save to a file + * @param filename the filename to which the Table + * should be saved + * @param [options] can be one of "tsv", "csv", or + * "html" + */ + function saveTable( + Table: p5.Table, + filename: string, + options?: string + ): void; + + /** + * Calculates the absolute value (magnitude) of a + * number. Maps to Math.abs(). The absolute value of + * a number is always positive. + * @param n number to compute + * @return absolute value of given number + */ + function abs( + n: number + ): number; + + /** + * Calculates the closest int value that is greater + * than or equal to the value of the parameter. Maps + * to Math.ceil(). For example, ceil(9.03) returns + * the value 10. + * @param n number to round up + * @return rounded up number + */ + function ceil( + n: number + ): number; + + /** + * Constrains a value between a minimum and maximum + * value. + * @param n number to constrain + * @param low minimum limit + * @param high maximum limit + * @return constrained number + */ + function constrain( + n: number, + low: number, + high: number + ): number; + + /** + * Calculates the distance between two points. + * @param x1 x-coordinate of the first point + * @param y1 y-coordinate of the first point + * @param x2 x-coordinate of the second point + * @param y2 y-coordinate of the second point + * @return distance between the two points + */ + function dist( + x1: number, + y1: number, + x2: number, + y2: number + ): number; + + /** + * Calculates the distance between two points. + * @param x1 x-coordinate of the first point + * @param y1 y-coordinate of the first point + * @param z1 z-coordinate of the first point + * @param x2 x-coordinate of the second point + * @param y2 y-coordinate of the second point + * @param z2 z-coordinate of the second point + * @return distance between the two points + */ + function dist( + x1: number, + y1: number, + z1: number, + x2: number, + y2: number, + z2: number + ): number; + + /** + * Returns Euler's number e (2.71828...) raised to + * the power of the n parameter. Maps to Math.exp(). + * @param n exponent to raise + * @return e^n + */ + function exp( + n: number + ): number; + + /** + * Calculates the closest int value that is less than + * or equal to the value of the parameter. Maps to + * Math.floor(). + * @param n number to round down + * @return rounded down number + */ + function floor( + n: number + ): number; + + /** + * Calculates a number between two numbers at a + * specific increment. The amt parameter is the + * amount to interpolate between the two values where + * 0.0 equal to the first point, 0.1 is very near the + * first point, 0.5 is half-way in between, etc. The + * lerp function is convenient for creating motion + * along a straight path and for drawing dotted + * lines. + * @param start first value + * @param stop second value + * @param amt number between 0.0 and 1.0 + * @return lerped value + */ + function lerp( + start: number, + stop: number, + amt: number + ): number; + + /** + * Calculates the natural logarithm (the base-e + * logarithm) of a number. This function expects the + * n parameter to be a value greater than 0.0. Maps + * to Math.log(). + * @param n number greater than 0 + * @return natural logarithm of n + */ + function log( + n: number + ): number; + + /** + * Calculates the magnitude (or length) of a vector. + * A vector is a direction in space commonly used in + * computer graphics and linear algebra. Because it + * has no "start" position, the magnitude of a vector + * can be thought of as the distance from the + * coordinate 0,0 to its x,y value. Therefore, mag() + * is a shortcut for writing dist(0, 0, x, y). + * @param a first value + * @param b second value + * @return magnitude of vector from (0,0) to (a,b) + */ + function mag( + a: number, + b: number + ): number; + + /** + * Re-maps a number from one range to another. In + * the first example above, the number 25 is + * converted from a value in the range of 0 to 100 + * into a value that ranges from the left edge of the + * window (0) to the right edge (width). + * @param value the incoming value to be converted + * @param start1 lower bound of the value's current + * range + * @param stop1 upper bound of the value's current + * range + * @param start2 lower bound of the value's target + * range + * @param stop2 upper bound of the value's target + * range + * @param [withinBounds] constrain the value to the + * newly mapped range + * @return remapped number + */ + function map( + value: number, + start1: number, + stop1: number, + start2: number, + stop2: number, + withinBounds?: boolean + ): number; + + /** + * Determines the largest value in a sequence of + * numbers, and then returns that value. max() + * accepts any number of Number parameters, or an + * Array of any length. + * @param n0 Number to compare + * @param n1 Number to compare + * @return maximum Number + */ + function max( + n0: number, + n1: number + ): number; + + /** + * Determines the largest value in a sequence of + * numbers, and then returns that value. max() + * accepts any number of Number parameters, or an + * Array of any length. + * @param nums Numbers to compare + */ + function max( + nums: number[] + ): number; + + /** + * Determines the smallest value in a sequence of + * numbers, and then returns that value. min() + * accepts any number of Number parameters, or an + * Array of any length. + * @param n0 Number to compare + * @param n1 Number to compare + * @return minimum Number + */ + function min( + n0: number, + n1: number + ): number; + + /** + * Determines the smallest value in a sequence of + * numbers, and then returns that value. min() + * accepts any number of Number parameters, or an + * Array of any length. + * @param nums Numbers to compare + */ + function min( + nums: number[] + ): number; + + /** + * Normalizes a number from another range into a + * value between 0 and 1. Identical to map(value, + * low, high, 0, 1). Numbers outside of the range are + * not clamped to 0 and 1, because out-of-range + * values are often intentional and useful. (See the + * second example above.) + * @param value incoming value to be normalized + * @param start lower bound of the value's current + * range + * @param stop upper bound of the value's current + * range + * @return normalized number + */ + function norm( + value: number, + start: number, + stop: number + ): number; + + /** + * Facilitates exponential expressions. The pow() + * function is an efficient way of multiplying + * numbers by themselves (or their reciprocals) in + * large quantities. For example, pow(3, 5) is + * equivalent to the expression 33333 and pow(3, -5) + * is equivalent to 1 / 33333. Maps to Math.pow(). + * @param n base of the exponential expression + * @param e power by which to raise the base + * @return n^e + */ + function pow( + n: number, + e: number + ): number; + + /** + * Calculates the integer closest to the n parameter. + * For example, round(133.8) returns the value 134. + * Maps to Math.round(). + * @param n number to round + * @return rounded number + */ + function round( + n: number + ): number; + + /** + * Squares a number (multiplies a number by itself). + * The result is always a positive number, as + * multiplying two negative numbers always yields a + * positive result. For example, -1 * -1 = 1. + * @param n number to square + * @return squared number + */ + function sq( + n: number + ): number; + + /** + * Calculates the square root of a number. The square + * root of a number is always positive, even though + * there may be a valid negative root. The square + * root s of number a is such that s*s = a. It is the + * opposite of squaring. Maps to Math.sqrt(). + * @param n non-negative number to square root + * @return square root of number + */ + function sqrt( + n: number + ): number; + + /** + * Creates a new p5.Vector (the datatype for storing + * vectors). This provides a two or three dimensional + * vector, specifically a Euclidean (also known as + * geometric) vector. A vector is an entity that has + * both magnitude and direction. + * @param [x] x component of the vector + * @param [y] y component of the vector + * @param [z] z component of the vector + */ + function createVector( + x?: number, + y?: number, + z?: number + ): p5.Vector; + + /** + * Returns the Perlin noise value at specified + * coordinates. Perlin noise is a random sequence + * generator producing a more natural ordered, + * harmonic succession of numbers compared to the + * standard random() function. It was invented by Ken + * Perlin in the 1980s and been used since in + * graphical applications to produce procedural + * textures, natural motion, shapes, terrains etc. + * The main difference to the random() function is + * that Perlin noise is defined in an infinite + * n-dimensional space where each pair of coordinates + * corresponds to a fixed semi-random value (fixed + * only for the lifespan of the program; see the + * noiseSeed() function). p5.js can compute 1D, 2D + * and 3D noise, depending on the number of + * coordinates given. The resulting value will always + * be between 0.0 and 1.0. The noise value can be + * animated by moving through the noise space as + * demonstrated in the example above. The 2nd and 3rd + * dimension can also be interpreted as time. + * + * The actual noise is structured similar to an audio + * signal, in respect to the function's use of + * frequencies. Similar to the concept of harmonics + * in physics, perlin noise is computed over several + * octaves which are added together for the final + * result. + * + * Another way to adjust the character of the + * resulting sequence is the scale of the input + * coordinates. As the function works within an + * infinite space the value of the coordinates + * doesn't matter as such, only the distance between + * successive coordinates does (eg. when using + * noise() within a loop). As a general rule the + * smaller the difference between coordinates, the + * smoother the resulting noise sequence will be. + * Steps of 0.005-0.03 work best for most + * applications, but this will differ depending on + * use. + * @param x x-coordinate in noise space + * @param [y] y-coordinate in noise space + * @param [z] z-coordinate in noise space + * @return Perlin noise value (between 0 and 1) at + * specified coordinates + */ + function noise( + x: number, + y?: number, + z?: number + ): number; + + /** + * Adjusts the character and level of detail produced + * by the Perlin noise function. Similar to harmonics + * in physics, noise is computed over several + * octaves. Lower octaves contribute more to the + * output signal and as such define the overall + * intensity of the noise, whereas higher octaves + * create finer grained details in the noise + * sequence. By default, noise is computed over 4 + * octaves with each octave contributing exactly half + * than its predecessor, starting at 50% strength for + * the 1st octave. This falloff amount can be changed + * by adding an additional function parameter. Eg. a + * falloff factor of 0.75 means each octave will now + * have 75% impact (25% less) of the previous lower + * octave. Any value between 0.0 and 1.0 is valid, + * however note that values greater than 0.5 might + * result in greater than 1.0 values returned by + * noise(). + * + * + * By changing these parameters, the signal created + * by the noise() function can be adapted to fit very + * specific needs and characteristics. + * @param lod number of octaves to be used by the + * noise + * @param falloff falloff factor for each octave + */ + function noiseDetail( + lod: number, + falloff: number + ): void; + + /** + * Sets the seed value for noise(). By default, + * noise() produces different results each time the + * program is run. Set the value parameter to a + * constant to return the same pseudo-random numbers + * each time the software is run. + * @param seed the seed value + */ + function noiseSeed( + seed: number + ): void; + + /** + * Sets the seed value for random(). By default, + * random() produces different results each time the + * program is run. Set the seed parameter to a + * constant to return the same pseudo-random numbers + * each time the software is run. + * @param seed the seed value + */ + function randomSeed( + seed: number + ): void; + + /** + * Return a random floating-point number. Takes + * either 0, 1 or 2 arguments. + * + * If no argument is given, returns a random number + * from 0 up to (but not including) 1. + * + * If one argument is given and it is a number, + * returns a random number from 0 up to (but not + * including) the number. + * + * If one argument is given and it is an array, + * returns a random element from that array. + * + * If two arguments are given, returns a random + * number from the first argument up to (but not + * including) the second argument. + * @param [min] the lower bound (inclusive) + * @param [max] the upper bound (exclusive) + * @return the random number + */ + function random( + min?: number, + max?: number + ): number; + + /** + * Return a random floating-point number. Takes + * either 0, 1 or 2 arguments. + * + * If no argument is given, returns a random number + * from 0 up to (but not including) 1. + * + * If one argument is given and it is a number, + * returns a random number from 0 up to (but not + * including) the number. + * + * If one argument is given and it is an array, + * returns a random element from that array. + * + * If two arguments are given, returns a random + * number from the first argument up to (but not + * including) the second argument. + * @param choices the array to choose from + * @return the random element from the array + */ + function random( + choices: any[] + ): any; + + /** + * Returns a random number fitting a Gaussian, or + * normal, distribution. There is theoretically no + * minimum or maximum value that randomGaussian() + * might return. Rather, there is just a very low + * probability that values far from the mean will be + * returned; and a higher probability that numbers + * near the mean will be returned. Takes either 0, 1 + * or 2 arguments. + * + * If no args, returns a mean of 0 and standard + * deviation of 1. + * + * If one arg, that arg is the mean (standard + * deviation is 1). + * + * If two args, first is mean, second is standard + * deviation. + * @param mean the mean + * @param sd the standard deviation + * @return the random number + */ + function randomGaussian( + mean: number, + sd: number + ): number; + + /** + * The inverse of cos(), returns the arc cosine of a + * value. This function expects the values in the + * range of -1 to 1 and values are returned in the + * range 0 to PI (3.1415927). + * @param value the value whose arc cosine is to be + * returned + * @return the arc cosine of the given value + */ + function acos( + value: number + ): number; + + /** + * The inverse of sin(), returns the arc sine of a + * value. This function expects the values in the + * range of -1 to 1 and values are returned in the + * range -PI/2 to PI/2. + * @param value the value whose arc sine is to be + * returned + * @return the arc sine of the given value + */ + function asin( + value: number + ): number; + + /** + * The inverse of tan(), returns the arc tangent of a + * value. This function expects the values in the + * range of -Infinity to Infinity (exclusive) and + * values are returned in the range -PI/2 to PI/2. + * @param value the value whose arc tangent is to be + * returned + * @return the arc tangent of the given value + */ + function atan( + value: number + ): number; + + /** + * Calculates the angle (in radians) from a specified + * point to the coordinate origin as measured from + * the positive x-axis. Values are returned as a + * float in the range from PI to -PI. The atan2() + * function is most often used for orienting geometry + * to the position of the cursor. Note: The + * y-coordinate of the point is the first parameter, + * and the x-coordinate is the second parameter, due + * the the structure of calculating the tangent. + * @param y y-coordinate of the point + * @param x x-coordinate of the point + * @return the arc tangent of the given point + */ + function atan2( + y: number, + x: number + ): number; + + /** + * Calculates the cosine of an angle. This function + * takes into account the current angleMode. Values + * are returned in the range -1 to 1. + * @param angle the angle + * @return the cosine of the angle + */ + function cos( + angle: number + ): number; + + /** + * Calculates the sine of an angle. This function + * takes into account the current angleMode. Values + * are returned in the range -1 to 1. + * @param angle the angle + * @return the sine of the angle + */ + function sin( + angle: number + ): number; + + /** + * Calculates the tangent of an angle. This function + * takes into account the current angleMode. Values + * are returned in the range -1 to 1. + * @param angle the angle + * @return the tangent of the angle + */ + function tan( + angle: number + ): number; + + /** + * Converts a radian measurement to its corresponding + * value in degrees. Radians and degrees are two ways + * of measuring the same thing. There are 360 degrees + * in a circle and 2*PI radians in a circle. For + * example, 90° = PI/2 = 1.5707964. This function + * does not take into account the current angleMode. + * @param radians the radians value to convert to + * degrees + * @return the converted angle + */ + function degrees( + radians: number + ): number; + + /** + * Converts a degree measurement to its corresponding + * value in radians. Radians and degrees are two ways + * of measuring the same thing. There are 360 degrees + * in a circle and 2*PI radians in a circle. For + * example, 90° = PI/2 = 1.5707964. This function + * does not take into account the current angleMode. + * @param degrees the degree value to convert to + * radians + * @return the converted angle + */ + function radians( + degrees: number + ): number; + + /** + * Sets the current mode of p5 to given mode. Default + * mode is RADIANS. + * @param mode either RADIANS or DEGREES + */ + function angleMode( + mode: p5.ANGLE_MODE + ): void; + + /** + * Sets the current alignment for drawing text. + * Accepts two arguments: horizAlign (LEFT, CENTER, + * or RIGHT) and vertAlign (TOP, BOTTOM, CENTER, or + * BASELINE). The horizAlign parameter is in + * reference to the x value of the text() function, + * while the vertAlign parameter is in reference to + * the y value. + * + * So if you write textAlign(LEFT), you are aligning + * the left edge of your text to the x value you give + * in text(). If you write textAlign(RIGHT, TOP), you + * are aligning the right edge of your text to the x + * value and the top of edge of the text to the y + * value. + * @param horizAlign horizontal alignment, either + * LEFT, CENTER, or RIGHT + * @param [vertAlign] vertical alignment, either TOP, + * BOTTOM, CENTER, or BASELINE + * @chainable + */ + function textAlign( + horizAlign: p5.HORIZ_ALIGN, + vertAlign?: p5.VERT_ALIGN + ): p5; + + /** + * Sets the current alignment for drawing text. + * Accepts two arguments: horizAlign (LEFT, CENTER, + * or RIGHT) and vertAlign (TOP, BOTTOM, CENTER, or + * BASELINE). The horizAlign parameter is in + * reference to the x value of the text() function, + * while the vertAlign parameter is in reference to + * the y value. + * + * So if you write textAlign(LEFT), you are aligning + * the left edge of your text to the x value you give + * in text(). If you write textAlign(RIGHT, TOP), you + * are aligning the right edge of your text to the x + * value and the top of edge of the text to the y + * value. + */ + function textAlign(): object; + + /** + * Sets/gets the spacing, in pixels, between lines of + * text. This setting will be used in all subsequent + * calls to the text() function. + * @param leading the size in pixels for spacing + * between lines + * @chainable + */ + function textLeading( + leading: number + ): p5; + + /** + * Sets/gets the spacing, in pixels, between lines of + * text. This setting will be used in all subsequent + * calls to the text() function. + */ + function textLeading(): number; + + /** + * Sets/gets the current font size. This size will be + * used in all subsequent calls to the text() + * function. Font size is measured in pixels. + * @param theSize the size of the letters in units of + * pixels + * @chainable + */ + function textSize( + theSize: number + ): p5; + + /** + * Sets/gets the current font size. This size will be + * used in all subsequent calls to the text() + * function. Font size is measured in pixels. + */ + function textSize(): number; + + /** + * Sets/gets the style of the text for system fonts + * to NORMAL, ITALIC, or BOLD. Note: this may be is + * overridden by CSS styling. For non-system fonts + * (opentype, truetype, etc.) please load styled + * fonts instead. + * @param theStyle styling for text, either NORMAL, + * ITALIC, or BOLD + * @chainable + */ + function textStyle( + theStyle: p5.THE_STYLE + ): p5; + + /** + * Sets/gets the style of the text for system fonts + * to NORMAL, ITALIC, or BOLD. Note: this may be is + * overridden by CSS styling. For non-system fonts + * (opentype, truetype, etc.) please load styled + * fonts instead. + */ + function textStyle(): string; + + /** + * Calculates and returns the width of any character + * or text string. + * @param theText the String of characters to measure + */ + function textWidth( + theText: string + ): number; + + /** + * Returns the ascent of the current font at its + * current size. The ascent represents the distance, + * in pixels, of the tallest character above the + * baseline. + */ + function textAscent(): number; + + /** + * Returns the descent of the current font at its + * current size. The descent represents the distance, + * in pixels, of the character with the longest + * descender below the baseline. + */ + function textDescent(): number; + + /** + * Loads an opentype font file (.otf, .ttf) from a + * file or a URL, and returns a PFont Object. This + * method is asynchronous, meaning it may not finish + * before the next line in your sketch is executed. + * The path to the font should be relative to the + * HTML file that links in your sketch. Loading an + * from a URL or other remote location may be blocked + * due to your browser's built-in security. + * @param path name of the file or url to load + * @param [callback] function to be executed after + * loadFont() completes + * @param [onError] function to be executed if an + * error occurs + * @return p5.Font object + */ + function loadFont( + path: string, + callback?: ( + ...args: any[] + ) => any, + onError?: ( + ...args: any[] + ) => any + ): p5.Font; + + /** + * Draws text to the screen. Displays the information + * specified in the first parameter on the screen in + * the position specified by the additional + * parameters. A default font will be used unless a + * font is set with the textFont() function and a + * default size will be used unless a font is set + * with textSize(). Change the color of the text with + * the fill() function. Change the outline of the + * text with the stroke() and strokeWeight() + * functions. The text displays in relation to the + * textAlign() function, which gives the option to + * draw to the left, right, and center of the + * coordinates. + * + * + * The x2 and y2 parameters define a rectangular area + * to display within and may only be used with string + * data. When these parameters are specified, they + * are interpreted based on the current rectMode() + * setting. Text that does not fit completely within + * the rectangle specified will not be drawn to the + * screen. If x2 and y2 are not specified, the + * baseline alignment is the default, which means + * that the text will be drawn upwards from x and y. + * + * + * WEBGL: Only opentype/truetype fonts are supported. + * You must load a font using the loadFont() method + * (see the example above). stroke() currently has no + * effect in webgl mode. + * @param str the alphanumeric symbols to be + * displayed + * @param x x-coordinate of text + * @param y y-coordinate of text + * @param [x2] by default, the width of the text box, + * see rectMode() for more info + * @param [y2] by default, the height of the text + * box, see rectMode() for more info + * @chainable + */ + function text( + str: + | string + | object + | any[] + | number + | boolean, + x: number, + y: number, + x2?: number, + y2?: number + ): p5; + + /** + * Sets the current font that will be drawn with the + * text() function. WEBGL: Only fonts loaded via + * loadFont() are supported. + * @return the current font + */ + function textFont(): object; + + /** + * Sets the current font that will be drawn with the + * text() function. WEBGL: Only fonts loaded via + * loadFont() are supported. + * @param font a font loaded via loadFont(), or a + * String representing a web safe font (a font that + * is generally available across all systems) + * @param [size] the font size to use + * @chainable + */ + function textFont( + font: + | object + | string, + size?: number + ): p5; + + /** + * Adds a value to the end of an array. Extends the + * length of the array by one. Maps to Array.push(). + * @param array Array to append + * @param value to be added to the Array + * @return the array that was appended to + */ + function append( + array: any[], + value: any + ): any[]; + + /** + * Copies an array (or part of an array) to another + * array. The src array is copied to the dst array, + * beginning at the position specified by srcPosition + * and into the position specified by dstPosition. + * The number of elements to copy is determined by + * length. Note that copying values overwrites + * existing values in the destination array. To + * append values instead of overwriting them, use + * concat(). The simplified version with only two + * arguments, arrayCopy(src, dst), copies an entire + * array to another of the same size. It is + * equivalent to arrayCopy(src, 0, dst, 0, + * src.length). + * + * + * Using this function is far more efficient for + * copying array data than iterating through a for() + * loop and copying each element individually. + * @param src the source Array + * @param srcPosition starting position in the source + * Array + * @param dst the destination Array + * @param dstPosition starting position in the + * destination Array + * @param length number of Array elements to be + * copied + */ + function arrayCopy( + src: any[], + srcPosition: number, + dst: any[], + dstPosition: number, + length: number + ): void; + + /** + * Copies an array (or part of an array) to another + * array. The src array is copied to the dst array, + * beginning at the position specified by srcPosition + * and into the position specified by dstPosition. + * The number of elements to copy is determined by + * length. Note that copying values overwrites + * existing values in the destination array. To + * append values instead of overwriting them, use + * concat(). The simplified version with only two + * arguments, arrayCopy(src, dst), copies an entire + * array to another of the same size. It is + * equivalent to arrayCopy(src, 0, dst, 0, + * src.length). + * + * + * Using this function is far more efficient for + * copying array data than iterating through a for() + * loop and copying each element individually. + * @param src the source Array + * @param dst the destination Array + * @param [length] number of Array elements to be + * copied + */ + function arrayCopy( + src: any[], + dst: any[], + length?: number + ): void; + + /** + * Concatenates two arrays, maps to Array.concat(). + * Does not modify the input arrays. + * @param a first Array to concatenate + * @param b second Array to concatenate + * @return concatenated array + */ + function concat( + a: any[], + b: any[] + ): any[]; + + /** + * Reverses the order of an array, maps to + * Array.reverse() + * @param list Array to reverse + * @return the reversed list + */ + function reverse( + list: any[] + ): any[]; + + /** + * Decreases an array by one element and returns the + * shortened array, maps to Array.pop(). + * @param list Array to shorten + * @return shortened Array + */ + function shorten( + list: any[] + ): any[]; + + /** + * Randomizes the order of the elements of an array. + * Implements Fisher-Yates Shuffle Algorithm. + * @param array Array to shuffle + * @param [bool] modify passed array + * @return shuffled Array + */ + function shuffle( + array: any[], + bool?: boolean + ): any[]; + + /** + * Sorts an array of numbers from smallest to + * largest, or puts an array of words in alphabetical + * order. The original array is not modified; a + * re-ordered array is returned. The count parameter + * states the number of elements to sort. For + * example, if there are 12 elements in an array and + * count is set to 5, only the first 5 elements in + * the array will be sorted. + * @param list Array to sort + * @param [count] number of elements to sort, + * starting from 0 + * @return the sorted list + */ + function sort( + list: any[], + count?: number + ): any[]; + + /** + * Inserts a value or an array of values into an + * existing array. The first parameter specifies the + * initial array to be modified, and the second + * parameter defines the data to be inserted. The + * third parameter is an index value which specifies + * the array position from which to insert data. + * (Remember that array index numbering starts at + * zero, so the first position is 0, the second + * position is 1, and so on.) + * @param list Array to splice into + * @param value value to be spliced in + * @param position in the array from which to insert + * data + * @return the list + */ + function splice( + list: any[], + value: any, + position: number + ): any[]; + + /** + * Extracts an array of elements from an existing + * array. The list parameter defines the array from + * which the elements will be copied, and the start + * and count parameters specify which elements to + * extract. If no count is given, elements will be + * extracted from the start to the end of the array. + * When specifying the start, remember that the first + * array element is 0. This function does not change + * the source array. + * @param list Array to extract from + * @param start position to begin + * @param [count] number of values to extract + * @return Array of extracted elements + */ + function subset( + list: any[], + start: number, + count?: number + ): any[]; + + /** + * Converts a string to its floating point + * representation. The contents of a string must + * resemble a number, or NaN (not a number) will be + * returned. For example, float("1234.56") evaluates + * to 1234.56, but float("giraffe") will return NaN. + * When an array of values is passed in, then an + * array of floats of the same length is returned. + * @param str float string to parse + * @return floating point representation of string + */ + function float( + str: string + ): number; + + /** + * Converts a boolean, string, or float to its + * integer representation. When an array of values is + * passed in, then an int array of the same length is + * returned. + * @param n value to parse + * @param [radix] the radix to convert to (default: + * 10) + * @return integer representation of value + */ + function int( + n: + | string + | boolean + | number, + radix?: number + ): number; + + /** + * Converts a boolean, string, or float to its + * integer representation. When an array of values is + * passed in, then an int array of the same length is + * returned. + * @param ns values to parse + * @return integer representation of values + */ + function int( + ns: any[] + ): number[]; + + /** + * Converts a boolean, string or number to its string + * representation. When an array of values is passed + * in, then an array of strings of the same length is + * returned. + * @param n value to parse + * @return string representation of value + */ + function str( + n: + | string + | boolean + | number + | any[] + ): string; + + /** + * Converts a number or string to its boolean + * representation. For a number, any non-zero value + * (positive or negative) evaluates to true, while + * zero evaluates to false. For a string, the value + * "true" evaluates to true, while any other value + * evaluates to false. When an array of number or + * string values is passed in, then a array of + * booleans of the same length is returned. + * @param n value to parse + * @return boolean representation of value + */ + function boolean( + n: + | string + | boolean + | number + | any[] + ): boolean; + + /** + * Converts a number, string representation of a + * number, or boolean to its byte representation. A + * byte can be only a whole number between -128 and + * 127, so when a value outside of this range is + * converted, it wraps around to the corresponding + * byte representation. When an array of number, + * string or boolean values is passed in, then an + * array of bytes the same length is returned. + * @param n value to parse + * @return byte representation of value + */ + function byte( + n: + | string + | boolean + | number + ): number; + + /** + * Converts a number, string representation of a + * number, or boolean to its byte representation. A + * byte can be only a whole number between -128 and + * 127, so when a value outside of this range is + * converted, it wraps around to the corresponding + * byte representation. When an array of number, + * string or boolean values is passed in, then an + * array of bytes the same length is returned. + * @param ns values to parse + * @return array of byte representation of values + */ + function byte( + ns: any[] + ): number[]; + + /** + * Converts a number or string to its corresponding + * single-character string representation. If a + * string parameter is provided, it is first parsed + * as an integer and then translated into a + * single-character string. When an array of number + * or string values is passed in, then an array of + * single-character strings of the same length is + * returned. + * @param n value to parse + * @return string representation of value + */ + function char( + n: + | string + | number + ): string; + + /** + * Converts a number or string to its corresponding + * single-character string representation. If a + * string parameter is provided, it is first parsed + * as an integer and then translated into a + * single-character string. When an array of number + * or string values is passed in, then an array of + * single-character strings of the same length is + * returned. + * @param ns values to parse + * @return array of string representation of values + */ + function char( + ns: any[] + ): string[]; + + /** + * Converts a single-character string to its + * corresponding integer representation. When an + * array of single-character string values is passed + * in, then an array of integers of the same length + * is returned. + * @param n value to parse + * @return integer representation of value + */ + function unchar( + n: string + ): number; + + /** + * Converts a single-character string to its + * corresponding integer representation. When an + * array of single-character string values is passed + * in, then an array of integers of the same length + * is returned. + * @param ns values to parse + * @return integer representation of values + */ + function unchar( + ns: any[] + ): number[]; + + /** + * Converts a number to a string in its equivalent + * hexadecimal notation. If a second parameter is + * passed, it is used to set the number of characters + * to generate in the hexadecimal notation. When an + * array is passed in, an array of strings in + * hexadecimal notation of the same length is + * returned. + * @param n value to parse + * @return hexadecimal string representation of value + */ + function hex( + n: number, + digits?: number + ): string; + + /** + * Converts a number to a string in its equivalent + * hexadecimal notation. If a second parameter is + * passed, it is used to set the number of characters + * to generate in the hexadecimal notation. When an + * array is passed in, an array of strings in + * hexadecimal notation of the same length is + * returned. + * @param ns array of values to parse + * @return hexadecimal string representation of + * values + */ + function hex( + ns: number[], + digits?: number + ): string[]; + + /** + * Converts a string representation of a hexadecimal + * number to its equivalent integer value. When an + * array of strings in hexadecimal notation is passed + * in, an array of integers of the same length is + * returned. + * @param n value to parse + * @return integer representation of hexadecimal + * value + */ + function unhex( + n: string + ): number; + + /** + * Converts a string representation of a hexadecimal + * number to its equivalent integer value. When an + * array of strings in hexadecimal notation is passed + * in, an array of integers of the same length is + * returned. + * @param ns values to parse + * @return integer representations of hexadecimal + * value + */ + function unhex( + ns: any[] + ): number[]; + + /** + * Combines an array of Strings into one String, each + * separated by the character(s) used for the + * separator parameter. To join arrays of ints or + * floats, it's necessary to first convert them to + * Strings using nf() or nfs(). + * @param list array of Strings to be joined + * @param separator String to be placed between each + * item + * @return joined String + */ + function join( + list: any[], + separator: string + ): string; + + /** + * This function is used to apply a regular + * expression to a piece of text, and return matching + * groups (elements found inside parentheses) as a + * String array. If there are no matches, a null + * value will be returned. If no groups are specified + * in the regular expression, but the sequence + * matches, an array of length 1 (with the matched + * text as the first element of the array) will be + * returned. To use the function, first check to see + * if the result is null. If the result is null, then + * the sequence did not match at all. If the sequence + * did match, an array is returned. + * + * + * If there are groups (specified by sets of + * parentheses) in the regular expression, then the + * contents of each will be returned in the array. + * Element [0] of a regular expression match returns + * the entire matching string, and the match groups + * start at element [1] (the first group is [1], the + * second [2], and so on). + * @param str the String to be searched + * @param regexp the regexp to be used for matching + * @return Array of Strings found + */ + function match( + str: string, + regexp: string + ): string[]; + + /** + * This function is used to apply a regular + * expression to a piece of text, and return a list + * of matching groups (elements found inside + * parentheses) as a two-dimensional String array. If + * there are no matches, a null value will be + * returned. If no groups are specified in the + * regular expression, but the sequence matches, a + * two dimensional array is still returned, but the + * second dimension is only of length one. To use + * the function, first check to see if the result is + * null. If the result is null, then the sequence did + * not match at all. If the sequence did match, a 2D + * array is returned. + * + * + * If there are groups (specified by sets of + * parentheses) in the regular expression, then the + * contents of each will be returned in the array. + * Assuming a loop with counter variable i, element + * [i][0] of a regular expression match returns the + * entire matching string, and the match groups start + * at element [i][1] (the first group is [i][1], the + * second [i][2], and so on). + * @param str the String to be searched + * @param regexp the regexp to be used for matching + * @return 2d Array of Strings found + */ + function matchAll( + str: string, + regexp: string + ): string[]; + + /** + * Utility function for formatting numbers into + * strings. There are two versions: one for + * formatting floats, and one for formatting ints. + * The values for the digits, left, and right + * parameters should always be positive integers. + * @param num the Number to format + * @param [left] number of digits to the left of the + * decimal point + * @param [right] number of digits to the right of + * the decimal point + * @return formatted String + */ + function nf( + num: + | number + | string, + left?: + | number + | string, + right?: + | number + | string + ): string; + + /** + * Utility function for formatting numbers into + * strings. There are two versions: one for + * formatting floats, and one for formatting ints. + * The values for the digits, left, and right + * parameters should always be positive integers. + * @param nums the Numbers to format + * @param [left] number of digits to the left of the + * decimal point + * @param [right] number of digits to the right of + * the decimal point + * @return formatted Strings + */ + function nf( + nums: any[], + left?: + | number + | string, + right?: + | number + | string + ): string[]; + + /** + * Utility function for formatting numbers into + * strings and placing appropriate commas to mark + * units of 1000. There are two versions: one for + * formatting ints, and one for formatting an array + * of ints. The value for the right parameter should + * always be a positive integer. + * @param num the Number to format + * @param [right] number of digits to the right of + * the decimal point + * @return formatted String + */ + function nfc( + num: + | number + | string, + right?: + | number + | string + ): string; + + /** + * Utility function for formatting numbers into + * strings and placing appropriate commas to mark + * units of 1000. There are two versions: one for + * formatting ints, and one for formatting an array + * of ints. The value for the right parameter should + * always be a positive integer. + * @param nums the Numbers to format + * @param [right] number of digits to the right of + * the decimal point + * @return formatted Strings + */ + function nfc( + nums: any[], + right?: + | number + | string + ): string[]; + + /** + * Utility function for formatting numbers into + * strings. Similar to nf() but puts a "+" in front + * of positive numbers and a "-" in front of negative + * numbers. There are two versions: one for + * formatting floats, and one for formatting ints. + * The values for left, and right parameters should + * always be positive integers. + * @param num the Number to format + * @param [left] number of digits to the left of the + * decimal point + * @param [right] number of digits to the right of + * the decimal point + * @return formatted String + */ + function nfp( + num: number, + left?: number, + right?: number + ): string; + + /** + * Utility function for formatting numbers into + * strings. Similar to nf() but puts a "+" in front + * of positive numbers and a "-" in front of negative + * numbers. There are two versions: one for + * formatting floats, and one for formatting ints. + * The values for left, and right parameters should + * always be positive integers. + * @param nums the Numbers to format + * @param [left] number of digits to the left of the + * decimal point + * @param [right] number of digits to the right of + * the decimal point + * @return formatted Strings + */ + function nfp( + nums: number[], + left?: number, + right?: number + ): string[]; + + /** + * Utility function for formatting numbers into + * strings. Similar to nf() but puts a " " (space) in + * front of positive numbers and a "-" in front of + * negative numbers. There are two versions: one for + * formatting floats, and one for formatting ints. + * The values for the digits, left, and right + * parameters should always be positive integers. + * @param num the Number to format + * @param [left] number of digits to the left of the + * decimal point + * @param [right] number of digits to the right of + * the decimal point + * @return formatted String + */ + function nfs( + num: number, + left?: number, + right?: number + ): string; + + /** + * Utility function for formatting numbers into + * strings. Similar to nf() but puts a " " (space) in + * front of positive numbers and a "-" in front of + * negative numbers. There are two versions: one for + * formatting floats, and one for formatting ints. + * The values for the digits, left, and right + * parameters should always be positive integers. + * @param nums the Numbers to format + * @param [left] number of digits to the left of the + * decimal point + * @param [right] number of digits to the right of + * the decimal point + * @return formatted Strings + */ + function nfs( + nums: any[], + left?: number, + right?: number + ): string[]; + + /** + * The split() function maps to String.split(), it + * breaks a String into pieces using a character or + * string as the delimiter. The delim parameter + * specifies the character or characters that mark + * the boundaries between each piece. A String[] + * array is returned that contains each of the + * pieces. The splitTokens() function works in a + * similar fashion, except that it splits using a + * range of characters instead of a specific + * character or sequence. + * @param value the String to be split + * @param delim the String used to separate the data + * @return Array of Strings + */ + function split( + value: string, + delim: string + ): string[]; + + /** + * The splitTokens() function splits a String at one + * or many character delimiters or "tokens." The + * delim parameter specifies the character or + * characters to be used as a boundary. If no delim + * characters are specified, any whitespace character + * is used to split. Whitespace characters include + * tab (\t), line feed (\n), carriage return (\r), + * form feed (\f), and space. + * @param value the String to be split + * @param [delim] list of individual Strings that + * will be used as separators + * @return Array of Strings + */ + function splitTokens( + value: string, + delim?: string + ): string[]; + + /** + * Removes whitespace characters from the beginning + * and end of a String. In addition to standard + * whitespace characters such as space, carriage + * return, and tab, this function also removes the + * Unicode "nbsp" character. + * @param str a String to be trimmed + * @return a trimmed String + */ + function trim( + str: string + ): string; + + /** + * Removes whitespace characters from the beginning + * and end of a String. In addition to standard + * whitespace characters such as space, carriage + * return, and tab, this function also removes the + * Unicode "nbsp" character. + * @param strs an Array of Strings to be trimmed + * @return an Array of trimmed Strings + */ + function trim( + strs: any[] + ): string[]; + + /** + * p5.js communicates with the clock on your + * computer. The day() function returns the current + * day as a value from 1 - 31. + * @return the current day + */ + function day(): number; + + /** + * p5.js communicates with the clock on your + * computer. The hour() function returns the current + * hour as a value from 0 - 23. + * @return the current hour + */ + function hour(): number; + + /** + * p5.js communicates with the clock on your + * computer. The minute() function returns the + * current minute as a value from 0 - 59. + * @return the current minute + */ + function minute(): number; + + /** + * Returns the number of milliseconds (thousandths of + * a second) since starting the program. This + * information is often used for timing events and + * animation sequences. + * @return the number of milliseconds since starting + * the program + */ + function millis(): number; + + /** + * p5.js communicates with the clock on your + * computer. The month() function returns the current + * month as a value from 1 - 12. + * @return the current month + */ + function month(): number; + + /** + * p5.js communicates with the clock on your + * computer. The second() function returns the + * current second as a value from 0 - 59. + * @return the current second + */ + function second(): number; + + /** + * p5.js communicates with the clock on your + * computer. The year() function returns the current + * year as an integer (2014, 2015, 2016, etc). + * @return the current year + */ + function year(): number; + + /** + * Draw a plane with given a width and height + * @param [width] width of the plane + * @param [height] height of the plane + * @param [detailX] Optional number of triangle + * subdivisions in x-dimension + * @param [detailY] Optional number of triangle + * subdivisions in y-dimension + * @chainable + */ + function plane( + width?: number, + height?: number, + detailX?: number, + detailY?: number + ): p5; + + /** + * Draw a box with given width, height and depth + * @param [width] width of the box + * @param [Height] height of the box + * @param [depth] depth of the box + * @param [detailX] Optional number of triangle + * subdivisions in x-dimension + * @param [detailY] Optional number of triangle + * subdivisions in y-dimension + * @chainable + */ + function box( + width?: number, + Height?: number, + depth?: number, + detailX?: number, + detailY?: number + ): p5; + + /** + * Draw a sphere with given radius + * @param [radius] radius of circle + * @param [detailX] number of segments, the more + * segments the smoother geometry default is 24 + * @param [detailY] number of segments, the more + * segments the smoother geometry default is 16 + * @chainable + */ + function sphere( + radius?: number, + detailX?: number, + detailY?: number + ): p5; + + /** + * Draw a cylinder with given radius and height + * @param [radius] radius of the surface + * @param [height] height of the cylinder + * @param [detailX] number of segments, the more + * segments the smoother geometry default is 24 + * @param [detailY] number of segments in + * y-dimension, the more segments the smoother + * geometry default is 1 + * @param [bottomCap] whether to draw the bottom of + * the cylinder + * @param [topCap] whether to draw the top of the + * cylinder + * @chainable + */ + function cylinder( + radius?: number, + height?: number, + detailX?: number, + detailY?: number, + bottomCap?: boolean, + topCap?: boolean + ): p5; + + /** + * Draw a cone with given radius and height + * @param [radius] radius of the bottom surface + * @param [height] height of the cone + * @param [detailX] number of segments, the more + * segments the smoother geometry default is 24 + * @param [detailY] number of segments, the more + * segments the smoother geometry default is 1 + * @param [cap] whether to draw the base of the cone + * @chainable + */ + function cone( + radius?: number, + height?: number, + detailX?: number, + detailY?: number, + cap?: boolean + ): p5; + + /** + * Draw an ellipsoid with given radius + * @param [radiusx] xradius of circle + * @param [radiusy] yradius of circle + * @param [radiusz] zradius of circle + * @param [detailX] number of segments, the more + * segments the smoother geometry default is 24. + * Avoid detail number above 150, it may crash the + * browser. + * @param [detailY] number of segments, the more + * segments the smoother geometry default is 16. + * Avoid detail number above 150, it may crash the + * browser. + * @chainable + */ + function ellipsoid( + radiusx?: number, + radiusy?: number, + radiusz?: number, + detailX?: number, + detailY?: number + ): p5; + + /** + * Draw a torus with given radius and tube radius + * @param [radius] radius of the whole ring + * @param [tubeRadius] radius of the tube + * @param [detailX] number of segments in + * x-dimension, the more segments the smoother + * geometry default is 24 + * @param [detailY] number of segments in + * y-dimension, the more segments the smoother + * geometry default is 16 + * @chainable + */ + function torus( + radius?: number, + tubeRadius?: number, + detailX?: number, + detailY?: number + ): p5; + + /** + * Allows movement around a 3D sketch using a mouse + * or trackpad. Left-clicking and dragging will + * rotate the camera position about the center of the + * sketch, right-clicking and dragging will pan the + * camera position without rotation, and using the + * mouse wheel (scrolling) will move the camera + * closer or further from the center of the sketch. + * This function can be called with parameters + * dictating sensitivity to mouse movement along the + * X and Y axes. Calling this function without + * parameters is equivalent to calling + * orbitControl(1,1). To reverse direction of + * movement in either axis, enter a negative number + * for sensitivity. + * @param [sensitivityX] sensitivity to mouse + * movement along X axis + * @param [sensitivityY] sensitivity to mouse + * movement along Y axis + * @chainable + */ + function orbitControl( + sensitivityX?: number, + sensitivityY?: number + ): p5; + + /** + * debugMode() helps visualize 3D space by adding a + * grid to indicate where the ‘ground’ is in a sketch + * and an axes icon which indicates the +X, +Y, and + * +Z directions. This function can be called without + * parameters to create a default grid and axes icon, + * or it can be called according to the examples + * above to customize the size and position of the + * grid and/or axes icon. The grid is drawn using the + * most recently set stroke color and weight. To + * specify these parameters, add a call to stroke() + * and strokeWeight() just before the end of the + * draw() loop. By default, the grid will run through + * the origin (0,0,0) of the sketch along the XZ + * plane and the axes icon will be offset from the + * origin. Both the grid and axes icon will be sized + * according to the current canvas size. Note that + * because the grid runs parallel to the default + * camera view, it is often helpful to use debugMode + * along with orbitControl to allow full view of the + * grid. + */ + function debugMode(): void; + + /** + * debugMode() helps visualize 3D space by adding a + * grid to indicate where the ‘ground’ is in a sketch + * and an axes icon which indicates the +X, +Y, and + * +Z directions. This function can be called without + * parameters to create a default grid and axes icon, + * or it can be called according to the examples + * above to customize the size and position of the + * grid and/or axes icon. The grid is drawn using the + * most recently set stroke color and weight. To + * specify these parameters, add a call to stroke() + * and strokeWeight() just before the end of the + * draw() loop. By default, the grid will run through + * the origin (0,0,0) of the sketch along the XZ + * plane and the axes icon will be offset from the + * origin. Both the grid and axes icon will be sized + * according to the current canvas size. Note that + * because the grid runs parallel to the default + * camera view, it is often helpful to use debugMode + * along with orbitControl to allow full view of the + * grid. + * @param mode either GRID or AXES + */ + function debugMode( + mode: p5.DEBUG_MODE + ): void; + + /** + * debugMode() helps visualize 3D space by adding a + * grid to indicate where the ‘ground’ is in a sketch + * and an axes icon which indicates the +X, +Y, and + * +Z directions. This function can be called without + * parameters to create a default grid and axes icon, + * or it can be called according to the examples + * above to customize the size and position of the + * grid and/or axes icon. The grid is drawn using the + * most recently set stroke color and weight. To + * specify these parameters, add a call to stroke() + * and strokeWeight() just before the end of the + * draw() loop. By default, the grid will run through + * the origin (0,0,0) of the sketch along the XZ + * plane and the axes icon will be offset from the + * origin. Both the grid and axes icon will be sized + * according to the current canvas size. Note that + * because the grid runs parallel to the default + * camera view, it is often helpful to use debugMode + * along with orbitControl to allow full view of the + * grid. + * @param mode either GRID or AXES + * @param [gridSize] size of one side of the grid + * @param [gridDivisions] number of divisions in the + * grid + * @param [xOff] X axis offset from origin (0,0,0) + * @param [yOff] Y axis offset from origin (0,0,0) + * @param [zOff] Z axis offset from origin (0,0,0) + */ + function debugMode( + mode: p5.UNKNOWN_P5_CONSTANT, + gridSize?: number, + gridDivisions?: number, + xOff?: number, + yOff?: number, + zOff?: number + ): void; + + /** + * debugMode() helps visualize 3D space by adding a + * grid to indicate where the ‘ground’ is in a sketch + * and an axes icon which indicates the +X, +Y, and + * +Z directions. This function can be called without + * parameters to create a default grid and axes icon, + * or it can be called according to the examples + * above to customize the size and position of the + * grid and/or axes icon. The grid is drawn using the + * most recently set stroke color and weight. To + * specify these parameters, add a call to stroke() + * and strokeWeight() just before the end of the + * draw() loop. By default, the grid will run through + * the origin (0,0,0) of the sketch along the XZ + * plane and the axes icon will be offset from the + * origin. Both the grid and axes icon will be sized + * according to the current canvas size. Note that + * because the grid runs parallel to the default + * camera view, it is often helpful to use debugMode + * along with orbitControl to allow full view of the + * grid. + * @param mode either GRID or AXES + * @param [axesSize] size of axes icon + * @param [xOff] X axis offset from origin (0,0,0) + * @param [yOff] Y axis offset from origin (0,0,0) + * @param [zOff] Z axis offset from origin (0,0,0) + */ + function debugMode( + mode: p5.UNKNOWN_P5_CONSTANT, + axesSize?: number, + xOff?: number, + yOff?: number, + zOff?: number + ): void; + + /** + * debugMode() helps visualize 3D space by adding a + * grid to indicate where the ‘ground’ is in a sketch + * and an axes icon which indicates the +X, +Y, and + * +Z directions. This function can be called without + * parameters to create a default grid and axes icon, + * or it can be called according to the examples + * above to customize the size and position of the + * grid and/or axes icon. The grid is drawn using the + * most recently set stroke color and weight. To + * specify these parameters, add a call to stroke() + * and strokeWeight() just before the end of the + * draw() loop. By default, the grid will run through + * the origin (0,0,0) of the sketch along the XZ + * plane and the axes icon will be offset from the + * origin. Both the grid and axes icon will be sized + * according to the current canvas size. Note that + * because the grid runs parallel to the default + * camera view, it is often helpful to use debugMode + * along with orbitControl to allow full view of the + * grid. + * @param [gridSize] size of one side of the grid + * @param [gridDivisions] number of divisions in the + * grid + * @param [axesSize] size of axes icon + */ + function debugMode( + gridSize?: number, + gridDivisions?: number, + gridXOff?: number, + gridYOff?: number, + gridZOff?: number, + axesSize?: number, + axesXOff?: number, + axesYOff?: number, + axesZOff?: number + ): void; + + /** + * Turns off debugMode() in a 3D sketch. + */ + function noDebugMode(): void; + + /** + * Creates an ambient light with a color + * @param v1 red or hue value relative to the current + * color range + * @param v2 green or saturation value relative to + * the current color range + * @param v3 blue or brightness value relative to the + * current color range + * @param [alpha] the alpha value + * @chainable + */ + function ambientLight( + v1: number, + v2: number, + v3: number, + alpha?: number + ): p5; + + /** + * Creates an ambient light with a color + * @param value a color string + * @chainable + */ + function ambientLight( + value: string + ): p5; + + /** + * Creates an ambient light with a color + * @param gray a gray value + * @param [alpha] the alpha value + * @chainable + */ + function ambientLight( + gray: number, + alpha?: number + ): p5; + + /** + * Creates an ambient light with a color + * @param values an array containing the + * red,green,blue & and alpha components of the color + * @chainable + */ + function ambientLight( + values: number[] + ): p5; + + /** + * Creates an ambient light with a color + * @param color the ambient light color + * @chainable + */ + function ambientLight( + color: p5.Color + ): p5; + + /** + * Creates a directional light with a color and a + * direction + * @param v1 red or hue value (depending on the + * current color mode), + * @param v2 green or saturation value + * @param v3 blue or brightness value + * @param position the direction of the light + * @chainable + */ + function directionalLight( + v1: number, + v2: number, + v3: number, + position: p5.Vector + ): p5; + + /** + * Creates a directional light with a color and a + * direction + * @param color color Array, CSS color string, or + * p5.Color value + * @param x x axis direction + * @param y y axis direction + * @param z z axis direction + * @chainable + */ + function directionalLight( + color: + | number[] + | string + | p5.Color, + x: number, + y: number, + z: number + ): p5; + + /** + * Creates a directional light with a color and a + * direction + * @param color color Array, CSS color string, or + * p5.Color value + * @param position the direction of the light + * @chainable + */ + function directionalLight( + color: + | number[] + | string + | p5.Color, + position: p5.Vector + ): p5; + + /** + * Creates a directional light with a color and a + * direction + * @param v1 red or hue value (depending on the + * current color mode), + * @param v2 green or saturation value + * @param v3 blue or brightness value + * @param x x axis direction + * @param y y axis direction + * @param z z axis direction + * @chainable + */ + function directionalLight( + v1: number, + v2: number, + v3: number, + x: number, + y: number, + z: number + ): p5; + + /** + * Creates a point light with a color and a light + * position + * @param v1 red or hue value (depending on the + * current color mode), + * @param v2 green or saturation value + * @param v3 blue or brightness value + * @param x x axis position + * @param y y axis position + * @param z z axis position + * @chainable + */ + function pointLight( + v1: number, + v2: number, + v3: number, + x: number, + y: number, + z: number + ): p5; + + /** + * Creates a point light with a color and a light + * position + * @param v1 red or hue value (depending on the + * current color mode), + * @param v2 green or saturation value + * @param v3 blue or brightness value + * @param position the position of the light + * @chainable + */ + function pointLight( + v1: number, + v2: number, + v3: number, + position: p5.Vector + ): p5; + + /** + * Creates a point light with a color and a light + * position + * @param color color Array, CSS color string, or + * p5.Color value + * @param x x axis position + * @param y y axis position + * @param z z axis position + * @chainable + */ + function pointLight( + color: + | number[] + | string + | p5.Color, + x: number, + y: number, + z: number + ): p5; + + /** + * Creates a point light with a color and a light + * position + * @param color color Array, CSS color string, or + * p5.Color value + * @param position the position of the light + * @chainable + */ + function pointLight( + color: + | number[] + | string + | p5.Color, + position: p5.Vector + ): p5; + + /** + * Load a 3d model from an OBJ file. One of the + * limitations of the OBJ format is that it doesn't + * have a built-in sense of scale. This means that + * models exported from different programs might be + * very different sizes. If your model isn't + * displaying, try calling loadModel() with the + * normalized parameter set to true. This will resize + * the model to a scale appropriate for p5. You can + * also make additional changes to the final size of + * your model with the scale() function. + * @param path Path of the model to be loaded + * @param normalize If true, scale the model to a + * standardized size when loading + * @param [successCallback] Function to be called + * once the model is loaded. Will be passed the 3D + * model object. + * @param [failureCallback] called with event error + * if the image fails to load. + * @return the p5.Geometry object + */ + function loadModel( + path: string, + normalize: boolean, + successCallback?: ( + p1: p5.Geometry + ) => any, + failureCallback?: ( + p1: Event + ) => any + ): p5.Geometry; + + /** + * Load a 3d model from an OBJ file. One of the + * limitations of the OBJ format is that it doesn't + * have a built-in sense of scale. This means that + * models exported from different programs might be + * very different sizes. If your model isn't + * displaying, try calling loadModel() with the + * normalized parameter set to true. This will resize + * the model to a scale appropriate for p5. You can + * also make additional changes to the final size of + * your model with the scale() function. + * @param path Path of the model to be loaded + * @param [successCallback] Function to be called + * once the model is loaded. Will be passed the 3D + * model object. + * @param [failureCallback] called with event error + * if the image fails to load. + * @return the p5.Geometry object + */ + function loadModel( + path: string, + successCallback?: ( + p1: p5.Geometry + ) => any, + failureCallback?: ( + p1: Event + ) => any + ): p5.Geometry; + + /** + * Render a 3d model to the screen. + * @param model Loaded 3d model to be rendered + */ + function model( + model: p5.Geometry + ): void; + + /** + * Loads a custom shader from the provided vertex and + * fragment shader paths. The shader files are loaded + * asynchronously in the background, so this method + * should be used in preload(). For now, there are + * three main types of shaders. p5 will automatically + * supply appropriate vertices, normals, colors, and + * lighting attributes if the parameters defined in + * the shader match the names. + * @param [vertFilename] path to file containing + * vertex shader source code + * @param [fragFilename] path to file containing + * fragment shader source code + * @return a shader object created from the provided + * vertex and fragment shader files. + */ + function loadShader( + vertFilename?: string, + fragFilename?: string + ): p5.Shader; + function createShader( + vertSrc: string, + fragSrc: string + ): p5.Shader; + + /** + * The shader() function lets the user provide a + * custom shader to fill in shapes in WEBGL mode. + * Users can create their own shaders by loading + * vertex and fragment shaders with loadShader(). + * @param [s] the desired p5.Shader to use for + * rendering shapes. + * @chainable + */ + function shader( + s?: p5.Shader + ): p5; + + /** + * Normal material for geometry. You can view all + * possible materials in this example. + * @chainable + */ + function normalMaterial(): p5; + + /** + * Texture for geometry. You can view other possible + * materials in this example. + * @param tex 2-dimensional graphics to render as + * texture + * @chainable + */ + function texture( + tex: + | p5.Image + | p5.MediaElement + | p5.Graphics + ): p5; + + /** + * Ambient material for geometry with a given color. + * You can view all possible materials in this + * example. + * @param v1 gray value, red or hue value (depending + * on the current color mode), + * @param [v2] green or saturation value + * @param [v3] blue or brightness value + * @param [a] opacity + * @chainable + */ + function ambientMaterial( + v1: number, + v2?: number, + v3?: number, + a?: number + ): p5; + + /** + * Ambient material for geometry with a given color. + * You can view all possible materials in this + * example. + * @param color color, color Array, or CSS color + * string + * @chainable + */ + function ambientMaterial( + color: + | number[] + | string + | p5.Color + ): p5; + + /** + * Specular material for geometry with a given color. + * You can view all possible materials in this + * example. + * @param v1 gray value, red or hue value (depending + * on the current color mode), + * @param [v2] green or saturation value + * @param [v3] blue or brightness value + * @param [a] opacity + * @chainable + */ + function specularMaterial( + v1: number, + v2?: number, + v3?: number, + a?: number + ): p5; + + /** + * Specular material for geometry with a given color. + * You can view all possible materials in this + * example. + * @param color color Array, or CSS color string + * @chainable + */ + function specularMaterial( + color: + | number[] + | string + | p5.Color + ): p5; + + /** + * Sets the camera position for a 3D sketch. + * Parameters for this function define the position + * for the camera, the center of the sketch (where + * the camera is pointing), and an up direction (the + * orientation of the camera). When called with no + * arguments, this function creates a default camera + * equivalent to camera(0, 0, (height/2.0) / + * tan(PI*30.0 / 180.0), 0, 0, 0, 0, 1, 0); + * @param [x] camera position value on x axis + * @param [y] camera position value on y axis + * @param [z] camera position value on z axis + * @param [centerX] x coordinate representing center + * of the sketch + * @param [centerY] y coordinate representing center + * of the sketch + * @param [centerZ] z coordinate representing center + * of the sketch + * @param [upX] x component of direction 'up' from + * camera + * @param [upY] y component of direction 'up' from + * camera + * @param [upZ] z component of direction 'up' from + * camera + * @chainable + */ + function camera( + x?: number, + y?: number, + z?: number, + centerX?: number, + centerY?: number, + centerZ?: number, + upX?: number, + upY?: number, + upZ?: number + ): p5; + + /** + * Sets a perspective projection for the camera in a + * 3D sketch. This projection represents depth + * through foreshortening: objects that are close to + * the camera appear their actual size while those + * that are further away from the camera appear + * smaller. The parameters to this function define + * the viewing frustum (the truncated pyramid within + * which objects are seen by the camera) through + * vertical field of view, aspect ratio (usually + * width/height), and near and far clipping planes. + * When called with no arguments, the defaults + * provided are equivalent to perspective(PI/3.0, + * width/height, eyeZ/10.0, eyeZ10.0), where eyeZ is + * equal to ((height/2.0) / tan(PI60.0/360.0)); + * @param [fovy] camera frustum vertical field of + * view, from bottom to top of view, in angleMode + * units + * @param [aspect] camera frustum aspect ratio + * @param [near] frustum near plane length + * @param [far] frustum far plane length + * @chainable + */ + function perspective( + fovy?: number, + aspect?: number, + near?: number, + far?: number + ): p5; + + /** + * Sets an orthographic projection for the camera in + * a 3D sketch and defines a box-shaped viewing + * frustum within which objects are seen. In this + * projection, all objects with the same dimension + * appear the same size, regardless of whether they + * are near or far from the camera. The parameters to + * this function specify the viewing frustum where + * left and right are the minimum and maximum x + * values, top and bottom are the minimum and maximum + * y values, and near and far are the minimum and + * maximum z values. If no parameters are given, the + * default is used: ortho(-width/2, width/2, + * -height/2, height/2). + * @param [left] camera frustum left plane + * @param [right] camera frustum right plane + * @param [bottom] camera frustum bottom plane + * @param [top] camera frustum top plane + * @param [near] camera frustum near plane + * @param [far] camera frustum far plane + * @chainable + */ + function ortho( + left?: number, + right?: number, + bottom?: number, + top?: number, + near?: number, + far?: number + ): p5; + + /** + * Creates a new p5.Camera object and tells the + * renderer to use that camera. Returns the p5.Camera + * object. + * @return The newly created camera object. + */ + function createCamera(): p5.Camera; + + /** + * Sets rendererGL's current camera to a p5.Camera + * object. Allows switching between multiple cameras. + * @param cam p5.Camera object + */ + function setCamera( + cam: p5.Camera + ): void; + + /** + * Set attributes for the WebGL Drawing context. This + * is a way of adjusting ways that the WebGL renderer + * works to fine-tune the display and performance. + * This should be put in setup(). The available + * attributes are: alpha - indicates if the canvas + * contains an alpha buffer default is true + * + * + * depth - indicates whether the drawing buffer has a + * depth buffer of at least 16 bits - default is true + * + * + * stencil - indicates whether the drawing buffer has + * a stencil buffer of at least 8 bits + * + * + * antialias - indicates whether or not to perform + * anti-aliasing default is false + * + * + * premultipliedAlpha - indicates that the page + * compositor will assume the drawing buffer contains + * colors with pre-multiplied alpha default is false + * + * + * preserveDrawingBuffer - if true the buffers will + * not be cleared and and will preserve their values + * until cleared or overwritten by author (note that + * p5 clears automatically on draw loop) default is + * true + * + * + * perPixelLighting - if true, per-pixel lighting + * will be used in the lighting shader. default is + * false + * @param key Name of attribute + * @param value New value of named attribute + */ + function setAttributes( + key: string, + value: boolean + ): void; + + /** + * Set attributes for the WebGL Drawing context. This + * is a way of adjusting ways that the WebGL renderer + * works to fine-tune the display and performance. + * This should be put in setup(). The available + * attributes are: alpha - indicates if the canvas + * contains an alpha buffer default is true + * + * + * depth - indicates whether the drawing buffer has a + * depth buffer of at least 16 bits - default is true + * + * + * stencil - indicates whether the drawing buffer has + * a stencil buffer of at least 8 bits + * + * + * antialias - indicates whether or not to perform + * anti-aliasing default is false + * + * + * premultipliedAlpha - indicates that the page + * compositor will assume the drawing buffer contains + * colors with pre-multiplied alpha default is false + * + * + * preserveDrawingBuffer - if true the buffers will + * not be cleared and and will preserve their values + * until cleared or overwritten by author (note that + * p5 clears automatically on draw loop) default is + * true + * + * + * perPixelLighting - if true, per-pixel lighting + * will be used in the lighting shader. default is + * false + * @param obj object with key-value pairs + */ + function setAttributes( + obj: object + ): void; + + /** + * Searches the page for an element with the given + * ID, class, or tag name (using the '#' or '.' + * prefixes to specify an ID or class respectively, + * and none for a tag) and returns it as a + * p5.Element. If a class or tag name is given with + * more than 1 element, only the first element will + * be returned. The DOM node itself can be accessed + * with .elt. Returns null if none found. You can + * also specify a container to search within. + * @param name id, class, or tag name of element to + * search for + * @param [container] id, p5.Element, or HTML element + * to search within + * @return p5.Element containing node found + */ + function select( + name: string, + container?: + | string + | p5.Element + | HTMLElement + ): p5.Element | null; + + /** + * Searches the page for elements with the given + * class or tag name (using the '.' prefix to specify + * a class and no prefix for a tag) and returns them + * as p5.Elements in an array. The DOM node itself + * can be accessed with .elt. Returns an empty array + * if none found. You can also specify a container to + * search within. + * @param name class or tag name of elements to + * search for + * @param [container] id, p5.Element, or HTML element + * to search within + * @return Array of p5.Elements containing nodes + * found + */ + function selectAll( + name: string, + container?: string + ): p5.Element[]; + + /** + * Removes all elements created by p5, except any + * canvas / graphics elements created by createCanvas + * or createGraphics. Event handlers are removed, and + * element is removed from the DOM. + */ + function removeElements(): void; + + /** + * Creates a
      element in the DOM with + * given inner HTML. Appends to the container node if + * one is specified, otherwise appends to body. + * @param [html] inner HTML for element created + * @return pointer to p5.Element holding created node + */ + function createDiv( + html?: string + ): p5.Element; + + /** + * Creates a

      element in the DOM with given + * inner HTML. Used for paragraph length text. + * Appends to the container node if one is specified, + * otherwise appends to body. + * @param [html] inner HTML for element created + * @return pointer to p5.Element holding created node + */ + function createP( + html?: string + ): p5.Element; + + /** + * Creates a element in the DOM with + * given inner HTML. Appends to the container node if + * one is specified, otherwise appends to body. + * @param [html] inner HTML for element created + * @return pointer to p5.Element holding created node + */ + function createSpan( + html?: string + ): p5.Element; + + /** + * Creates an element in the DOM with given src + * and alternate text. Appends to the container node + * if one is specified, otherwise appends to body. + * @param src src path or url for image + * @param [alt] alternate text to be used if image + * does not load + * @param [successCallback] callback to be called + * once image data is loaded + * @return pointer to p5.Element holding created node + */ + function createImg( + src: string, + alt?: string, + successCallback?: ( + ...args: any[] + ) => any + ): p5.Element; + + /** + * Creates an element in the DOM with given src + * and alternate text. Appends to the container node + * if one is specified, otherwise appends to body. + * @param src src path or url for image + * @param successCallback callback to be called once + * image data is loaded + */ + function createImg( + src: string, + successCallback: ( + ...args: any[] + ) => any + ): + | object + | p5.Element; + + /** + * Creates an element in the DOM for + * including a hyperlink. Appends to the container + * node if one is specified, otherwise appends to + * body. + * @param href url of page to link to + * @param html inner html of link element to display + * @param [target] target where new link should open, + * could be _blank, _self, _parent, _top. + * @return pointer to p5.Element holding created node + */ + function createA( + href: string, + html: string, + target?: string + ): p5.Element; + + /** + * Creates a slider element in the + * DOM. Use .size() to set the display length of the + * slider. Appends to the container node if one is + * specified, otherwise appends to body. + * @param min minimum value of the slider + * @param max maximum value of the slider + * @param [value] default value of the slider + * @param [step] step size for each tick of the + * slider (if step is set to 0, the slider will move + * continuously from the minimum to the maximum + * value) + * @return pointer to p5.Element holding created node + */ + function createSlider( + min: number, + max: number, + value?: number, + step?: number + ): p5.Element; + + /** + * Creates a element in the DOM. + * Use .size() to set the display size of the button. + * Use .mousePressed() to specify behavior on press. + * Appends to the container node if one is specified, + * otherwise appends to body. + * @param label label displayed on the button + * @param [value] value of the button + * @return pointer to p5.Element holding created node + */ + function createButton( + label: string, + value?: string + ): p5.Element; + + /** + * Creates a checkbox element in the + * DOM. Calling .checked() on a checkbox returns if + * it is checked or not + * @param [label] label displayed after checkbox + * @param [value] value of the checkbox; checked is + * true, unchecked is false + * @return pointer to p5.Element holding created node + */ + function createCheckbox( + label?: string, + value?: boolean + ): p5.Element; + + /** + * Creates a dropdown menu element + * in the DOM. It also helps to assign select-box + * methods to p5.Element when selecting existing + * select box + * @param [multiple] true if dropdown should support + * multiple selections + */ + function createSelect( + multiple?: boolean + ): p5.Element; + + /** + * Creates a dropdown menu element + * in the DOM. It also helps to assign select-box + * methods to p5.Element when selecting existing + * select box + * @param existing DOM select element + */ + function createSelect( + existing: object + ): p5.Element; + + /** + * Creates a radio button element in + * the DOM. The .option() method can be used to set + * options for the radio after it is created. The + * .value() method will return the currently selected + * option. + * @param [divId] the id and name of the created div + * and input field respectively + * @return pointer to p5.Element holding created node + */ + function createRadio( + divId?: string + ): p5.Element; + + /** + * Creates a colorPicker element in the DOM for color + * input. The .value() method will return a hex + * string (#rrggbb) of the color. The .color() method + * will return a p5.Color object with the current + * chosen color. + * @param [value] default color of element + * @return pointer to p5.Element holding created node + */ + function createColorPicker( + value?: + | string + | p5.Color + ): p5.Element; + + /** + * Creates an element in the DOM for + * text input. Use .size() to set the display length + * of the box. Appends to the container node if one + * is specified, otherwise appends to body. + * @param [value] default value of the input box + * @param [type] type of text, ie text, password etc. + * Defaults to text + * @return pointer to p5.Element holding created node + */ + function createInput( + value?: string, + type?: string + ): p5.Element; + + /** + * Creates an element in the DOM of + * type 'file'. This allows users to select local + * files for use in a sketch. + * @param [callback] callback function for when a + * file loaded + * @param [multiple] optional to allow multiple files + * selected + * @return pointer to p5.Element holding created DOM + * element + */ + function createFileInput( + callback?: ( + ...args: any[] + ) => any, + multiple?: string + ): p5.Element; + + /** + * Creates an HTML5