diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6477b03f07..54d80df8e5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -49,7 +49,7 @@ /types/adal-angular/ @unindented @aciccarello /types/add-zero/ @Roaders /types/adlib/ @Esri @MikeTschudi -/types/adm-zip/ @jvilk @abner +/types/adm-zip/ @jvilk @abner @BendingBender /types/adone/ @s0m3on3 @maxveres /types/aes-js/ @federicobond /types/aframe/ @devpaul @bertoritger @twastvedt @@ -59,12 +59,14 @@ /types/agora-rtc-sdk/ @menthays /types/airbnb-prop-types/ @milesj /types/ajv-errors/ @afshawnlotfi +/types/ajv-merge-patch/ @littlepiggy03 /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 @keichinger +/types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss @keichinger @neryortez @antoinerousseau +/types/algoliasearch-helper/ @gburgett @haroenv @samouss /types/ali-app/ @taoqf /types/ali-oss/ @ptrdu /types/all-keys/ @BendingBender @@ -72,6 +74,7 @@ /types/allure-js-commons/ @zaqqaz /types/almost-equal/ @cmaddalozzo /types/alt/ @Shearerbeard +/types/amap-js-api/ @breeze9527 /types/amap-js-sdk/ @agasbzj /types/amazon-cognito-auth-js/ @scottescue /types/amazon-product-api/ @MattiLehtinen @alien35 @@ -160,7 +163,7 @@ /types/angularlocalstorage/ @horiuchi /types/angulartics/ @bateast2 /types/animation-frame/ @qinfchen -/types/animejs/ @A-Babin +/types/animejs/ @A-Babin @supaiku0 /types/annyang/ @hisham @theluk /types/ansi/ @Gustavo6046 /types/ansi-colors/ @rogierschouten @BendingBender @@ -204,7 +207,7 @@ /types/archy/ @vvakame /types/are-we-there-yet/ @brianloveswords /types/argon2-browser/ @ivangabriele -/types/argparse/ @arcticwaters @tlaziuk @eps1lon +/types/argparse/ @arcticwaters @tlaziuk @eps1lon @cakoose /types/args/ @Slessi /types/argv/ @hookclaw /types/arr-diff/ @BendingBender @@ -273,7 +276,8 @@ /types/await-timeout/ @szhu /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 @trevor-leach @jagregory @dalen +/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 @dalen @loikg @skyzenr @richardcornelissen +/types/aws-param-store/ @jasonthomasgray /types/aws-serverless-express/ @threesquared @jcaffey @mattmeye @albertovasquez /types/aws4/ @ajcrites /types/axe-webdriverjs/ @JoshuaKGoldberg @@ -295,7 +299,7 @@ /types/babel-types/ @yortus @baxtersa @marvinhagemeister @bcherny /types/babel-webpack-plugin/ @j-f1 /types/babel__code-frame/ @mohsen1 @ForbesLindesay -/types/babel__core/ @yortus @marvinhagemeister @mgroenhoff +/types/babel__core/ @yortus @marvinhagemeister @mgroenhoff @Jessidhia /types/babel__generator/ @yortus @johnnyestilles @mgroenhoff /types/babel__template/ @yortus @marvinhagemeister @mgroenhoff /types/babel__traverse/ @yortus @marvinhagemeister @rpetrich @mgroenhoff @@ -303,15 +307,15 @@ /types/babylon/ @yortus @marvinhagemeister /types/babylon-walk/ @czbuchi /types/babyparse/ @cdiddy77 -/types/backbone/ @borisyankov @nvivo @kenjiru @jjoekoullas +/types/backbone/ @borisyankov @nvivo @kenjiru @jjoekoullas @jgonggrijp /types/backbone-associations/ @craigbrett17 /types/backbone-fetch-cache/ @delphinus35 -/types/backbone-relational/ @eirikhm +/types/backbone-relational/ @eirikhm @jgonggrijp /types/backbone.layoutmanager/ @hejiang2000 /types/backbone.localstorage/ @lgrignon -/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs @jjoekoullas +/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs @jjoekoullas @jgonggrijp /types/backbone.paginator/ @Nyamazing -/types/backbone.radio/ @alphaleonis +/types/backbone.radio/ @alphaleonis @jgonggrijp /types/backgrid/ @jlujan /types/backlog-js/ @vvatanabe /types/backo2/ @Retsam @@ -375,6 +379,7 @@ /types/bip38/ @micksatana /types/bip39/ @micksatana /types/bit-array/ @mudkipme +/types/bit-twiddle/ @adamzerella /types/bitcoinjs-lib/ @mhegazy @dlebrecht @rbuckton @micksatana @youssefgh @kento1218 /types/bitcore-lib/ @lautarodragan /types/bittorrent-protocol/ @feross @tlaziuk @@ -414,6 +419,7 @@ /types/bootstrap/ @denisname /types/bootstrap/v3/ @borisyankov @denisname /types/bootstrap-3-typeahead/ @AndersonFriaca +/types/bootstrap-colorpicker/ @aleksandar-manukov /types/bootstrap-datepicker/ @borisyankov /types/bootstrap-fileinput/ @CheCoxshall /types/bootstrap-growl-ifightcrime/ @AndersonFriaca @@ -457,7 +463,7 @@ /types/browserslist-useragent/ @nju33 /types/bs58/ @chrootsu @BendingBender /types/bs58/v3/ @chrootsu -/types/bson/ @horiuchi @CaselIT +/types/bson/ @horiuchi @CaselIT @justingrant /types/btoa/ @johngeorgewright @bricka /types/buble/ @Kocal /types/bucks/ @zaneli @@ -469,6 +475,7 @@ /types/buffer-xor/ @danwbyrne /types/buffers/ @rhencke /types/bufferstream/ @Bartvds +/types/build-output-script/ @BendingBender /types/builtin-modules/ @ajafff /types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana @kjellmorten @pc-jedi /types/bull/v2/ @bgrieder @JProgrammer @@ -480,11 +487,13 @@ /types/bunyan-config/ @cyrilschumacher /types/bunyan-format/ @dex4er /types/bunyan-prettystream/ @jasonswearingen @enlight +/types/bunyan-seq/ @raybooysen /types/bunyan-winston-adapter/ @stevehipwell /types/busboy/ @jacobbaskin /types/business-rules-engine/ @rsamec /types/bwip-js/ @MugeSo /types/byline/ @reppners +/types/byte-range/ @BendingBender /types/bytebuffer/ @cappellin /types/bytes/ @danny8002 @believer /types/bytewise/ @danwbyrne @@ -499,8 +508,8 @@ /types/callsites/ @BendingBender /types/calq/ @eirikhm /types/camaro/ @tuananh -/types/camelcase/ @samverschueren /types/camelcase-keys/ @mhegazy +/types/camljs/ @andrei-markeev /types/camo/ @lucasmciruzzi /types/cancan/ @Vincent-Pang /types/caniuse-api/ @davecardwell @@ -511,16 +520,23 @@ /types/canvasjs/ @brutalimp /types/capitalize/ @frederickfogerty /types/capture-console/ @AustonZ +/types/carbon__colors/ @vpicone +/types/carbon__layout/ @vpicone +/types/carbon__motion/ @vpicone +/types/carbon__themes/ @vpicone +/types/carbon__type/ @vpicone /types/card-validator/ @ChanceM /types/case-sensitive-paths-webpack-plugin/ @r3nya /types/caseless/ @downace @mastermatt /types/cash/ @akvlko /types/casperjs/ @jedmao @urielch -/types/cassandra-driver/ @Svjard @pc-jedi +/types/cassandra-driver/ @Svjard @pc-jedi @michal-b-kaminski +/types/cassanknex/ @bioball /types/catbox/ @jasonswearingen @AJamesPhillips @saboya /types/catbox/v7/ @jasonswearingen @AJamesPhillips /types/catbox-memory/ @SimonSchick /types/catbox-redis/ @SimonSchick +/types/cavy/ @tyler-hoffman /types/cbor/ @pushplay /types/ccap/ @taoqf /types/cesium/ @Zuzon @hnipps @szechyjs @golyalpha @@ -561,11 +577,10 @@ /types/check-types/ @idchlife /types/checkstyle-formatter/ @mhegazy /types/checksum/ @rogierschouten -/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz +/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz @nwtgck /types/chess.js/ @JacobFischer /types/chessboardjs/ @sliverb @davidmpaz /types/chmodr/ @BendingBender -/types/chokidar/ @reppners @felixfbecker @bayssmekanique /types/chordsheetjs/ @adamsbloom /types/chosen-js/ @borisyankov @denisname /types/chownr/ @BendingBender @@ -576,6 +591,7 @@ /types/chromecast-caf-receiver/ @craigrbruce /types/chromecast-caf-sender/ @samuelmaddock /types/chromedriver/ @pe8ter +/types/cipher-base/ @adamzerella /types/circuit-breaker-js/ @DeTeam /types/circular-json/ @jpevarnek /types/ckeditor/ @wittwert @stuartlong @viktorpegy @@ -627,6 +643,7 @@ /types/cls-hooked/ @aleung /types/clusterize.js/ @Pr1st0n /types/cmd-shim/ @cspotcode +/types/co/ @doniyor2109 /types/co-body/ @geoffreak /types/co-views/ @devlee @geoffreak /types/code/ @prashaantt @@ -637,6 +654,7 @@ /types/coinlist/ @BendingBender /types/coinstring/ @mhegazy /types/collections/ @scarabedore +/types/collectionsjs/ @jaymeh /types/color/ @Airlun @jameswlane /types/color/v2/ @Airlun /types/color/v1/ @LKay @@ -646,6 +664,7 @@ /types/color-name/ @Ailrun /types/color-namer/ @in19farkt /types/color-string/ @BendingBender @danmarshall +/types/color-support/ @Yavanosta /types/colorbrewer/ @mtraynham /types/colornames/ @manuth /types/colresizable/ @gilleswaeber @@ -654,7 +673,7 @@ /types/combine-source-map/ @TeamworkGuy2 /types/combined-stream/ @felixge @tlaziuk @konpikwastaken /types/combokeys/ @iclanton -/types/cometd/ @derekcicerone @unindented @alxHenry +/types/cometd/ @derekcicerone @unindented @alxHenry @hagl /types/command-exists/ @BendingBender /types/command-line-args/ @75lb /types/command-line-args/v4/ @CzBuCHi @75lb @@ -672,6 +691,7 @@ /types/compare-version/ @jpevarnek /types/compare-versions/ @LogvinovLeon /types/complex/ @AyaMorisawa @pavasich +/types/complex.js/ @adamzerella /types/component-emitter/ @psnider /types/compose-function/ @denis-sokolov /types/compressible/ @BendingBender @@ -681,9 +701,7 @@ /types/compute-stdev/ @mrmlnc /types/concat-stream/ @jmarianer /types/concaveman/ @DenisCarriere -/types/conf/ @SamVerschueren @BendingBender -/types/conf/v1/ @SamVerschueren @BendingBender -/types/conf/v0/ @SamVerschueren +/types/condense-whitespace/ @djcsdy /types/confidence/ @jppellerin /types/config/ @RWander @forrestbice @jndonald3 @albertovasquez /types/config-yaml/ @me @@ -692,16 +710,17 @@ /types/confit/ @ethanresnick /types/connect/ @SomaticIT @EvanHahn /types/connect-busboy/ @pinguet62 -/types/connect-datadog/ @moshegood +/types/connect-datadog/ @moshegood @xzyfer /types/connect-ensure-login/ @0x6368656174 /types/connect-flash/ @AndreasGassmann /types/connect-history-api-fallback/ @douglasduteil +/types/connect-history-api-fallback-exclusions/ @tonystonee /types/connect-livereload/ @SomaticIT /types/connect-modrewrite/ @tinganho /types/connect-mongo/ @Syati /types/connect-mongodb-session/ @NattapongSiri /types/connect-pg-simple/ @pasieronen -/types/connect-redis/ @xstoudi +/types/connect-redis/ @xstoudi @sbutler2901 /types/connect-slashes/ @samherrmann /types/connect-timeout/ @cyrilschumacher /types/consola/ @Jungwoo-An @@ -785,6 +804,7 @@ /types/create-html-element/ @BendingBender /types/create-react-class/ @jgoz /types/create-subscription/ @Asana @vsiao +/types/create-xpub/ @BendingBender /types/createjs/ @evilangelist @gyohk /types/createjs-lib/ @evilangelist @gyohk /types/credential/ @phuvo @@ -814,6 +834,7 @@ /types/css-to-style/ @bengry /types/css-tree/ @erik-kallen /types/cssbeautify/ @rictic +/types/cssesc/ @djcsdy /types/cssnano/ @odnamrataizem /types/csso/ @screendriver @erik-kallen /types/csurf/ @horiuchi @@ -845,7 +866,7 @@ /types/d3-box/ @lk-chen /types/d3-brush/ @tomwanzek @gustavderdrache @borisyankov /types/d3-chord/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-cloud/ @hansrwindhoff +/types/d3-cloud/ @hansrwindhoff @locknono /types/d3-collection/ @tomwanzek @gustavderdrache @borisyankov /types/d3-color/ @tomwanzek @gustavderdrache @borisyankov @denisname @ledragon /types/d3-contour/ @tomwanzek @Ledragon @@ -855,7 +876,7 @@ /types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-ease/ @tomwanzek @gustavderdrache @borisyankov /types/d3-fetch/ @ledragon @denisname -/types/d3-force/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-force/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-format/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-geo/ @ledragon @tomwanzek @gustavderdrache @borisyankov /types/d3-graphviz/ @DomParfitt @@ -894,6 +915,7 @@ /types/dat.gui/ @gyohk @sonic3d @rroylance @singuerinc /types/data-driven/ @mrhen /types/datadog-metrics/ @pushplay +/types/datadog-statsd-metrics-collector/ @xzyfer /types/datadog-tracer/ @dineshsaravanan /types/datatables.net/ @Silver-Connection @omidkrad @pragmatrix @CNBoland /types/datatables.net-autofill/ @andy-maca @@ -904,7 +926,9 @@ /types/datatables.net-rowreorder/ @baywet /types/datatables.net-scroller/ @RohdeK /types/datatables.net-select/ @szechyjs +/types/date-and-time/ @danplisetsky /types/date-arithmetic/ @HeeL +/types/date-now/ @adamzerella /types/date.format.js/ @balrob /types/dateformat/ @aicest @BendingBender /types/dateformat/v1/ @aicest @@ -916,13 +940,12 @@ /types/db-migrate-pg/ @nickiannone /types/db.js/ @cgwrench /types/dc/ @hansrwindhoff @mtraynham @MatthiasJobst -/types/dd-trace/ @ColinBradley @alloy /types/deasync/ @Sicilica /types/debessmann/ @vkorehov /types/debounce/ @denis-sokolov @joshuakgoldberg @wcarson /types/debounce-fn/ @BendingBender /types/debounce-promise/ @whtsky -/types/debug/ @swook @galtalmor @zamb3zi @brasten +/types/debug/ @swook @galtalmor @zamb3zi @brasten @npenin /types/decamelize/ @samverschueren /types/decay/ @enaeseth /types/decode-entities/ @waspothegreat @@ -934,6 +957,7 @@ /types/deep-assign/ @souldreamer /types/deep-diff/ @ZauberNerd /types/deep-equal/ @remojansen @janslow +/types/deep-equal-in-any-order/ @bcaudan /types/deep-extend/ @rhysd /types/deep-freeze/ @Bartvds @aluanhaddad /types/deep-freeze-es6/ @mattbishop @@ -946,8 +970,6 @@ /types/defined/ @BendingBender /types/deglob/ @saadq /types/deku/ @pocka -/types/del/ @AyaMorisawa @BendingBender @bitjson -/types/del/v2/ @AyaMorisawa /types/delaunator/ @DenisCarriere @BTOdell /types/delete-empty/ @Alorel /types/deline/ @iarroyo5 @@ -963,7 +985,6 @@ /types/derhuerst__cli-on-key/ @jacobbubu /types/destroy/ @BendingBender /types/destroy-on-hwm/ @BendingBender -/types/detect-browser/ @rogierschouten @carusology /types/detect-character-encoding/ @BendingBender /types/detect-hover/ @thomastilkema /types/detect-indent/ @Bartvds @BendingBender @@ -997,7 +1018,7 @@ /types/dir-resolve/ @andy-ms /types/dirname-regex/ @BendingBender /types/discontinuous-range/ @OiCMudkips -/types/discord-rpc/ @jasonhaxstuff +/types/discord-rpc/ @jasonhaxstuff @lolPants /types/discourse-sso/ @championswimmer /types/dispatchr/ @Ragg- /types/disposable-email-domains/ @geoffreak @@ -1049,8 +1070,10 @@ /types/draft-js/ @dmitryrogozhny @eelco @ghotiphud @schwers @michael-yx-wu @willisplummer @smvilar @sulf @pablopunk @claudiopro /types/drag-timetable/ @chinkan /types/draggabilly/ @jaydubu +/types/dragscroll/ @spkellydev /types/dragster/ @zskovacs /types/dragula/ @pwelter34 @abruzzihraig +/types/driftless/ @dandelany /types/drivelist/ @WholeMilk /types/dropbox-chooser/ @quas94 /types/dropboxjs/ @Steve-Fenton @xperiments @@ -1064,6 +1087,7 @@ /types/duplicate-package-checker-webpack-plugin/ @mtraynham /types/durandal/ @BlueSpire /types/dustjs-linkedin/ @mdezem +/types/dv/ @taoqf /types/dvtng-jss/ @Ptival /types/dw-bxslider-4/ @namerci /types/dwt/ @yushulx @jbh @lincoln2018 @Tom-Dynamsoft @@ -1083,7 +1107,7 @@ /types/easy-xapi/ @DeadAlready /types/easy-xapi-utils/ @DeadAlready /types/ebongarde-root/ @Ebongarde -/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 +/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 @bilalucar /types/ecma-proposal-math-extensions/ @ksm2 /types/ecurve/ @mhegazy /types/ed25519/ @erikma @@ -1151,7 +1175,7 @@ /types/ember__object/ @mike-north /types/ember__polyfills/ @mike-north /types/ember__routing/ @mike-north -/types/ember__runloop/ @mike-north +/types/ember__runloop/ @mike-north @scalvert /types/ember__service/ @mike-north /types/ember__string/ @mike-north /types/ember__test/ @mike-north @@ -1179,10 +1203,9 @@ /types/entities/ @aliceklipper /types/env-ci/ @BendingBender /types/env-editor/ @BendingBender -/types/env-paths/ @danwbyrne /types/env-to-object/ @MugeSo /types/envify/ @tkQubo -/types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden @hotell +/types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden @hotell @screendriver /types/enzyme-adapter-react-15/ @tkrotoff /types/enzyme-adapter-react-15.4/ @nali /types/enzyme-adapter-react-16/ @tkrotoff @@ -1221,12 +1244,13 @@ /types/estree/ @RReverser /types/etag/ @BendingBender /types/eth-lightwallet/ @LogvinovLeon +/types/eth-sig-util/ @quezak /types/ethereum-protocol/ @LogvinovLeon -/types/ethereumjs-abi/ @LogvinovLeon +/types/ethereumjs-abi/ @LogvinovLeon @quezak /types/ethereumjs-tx/ @LogvinovLeon @dmihal /types/ethereumjs-util/ @cortopy /types/ethjs-signer/ @doppio -/types/eureka-js-client/ @Schnillz @karl-run @tombarton +/types/eureka-js-client/ @Schnillz @karl-run @tombarton @jpsullivan /types/evaporate/ @kookster @chrisrhoden @ailrun /types/event-emitter/ @LKay /types/event-emitter-es6/ @ahstro @@ -1253,9 +1277,11 @@ /types/expect-puppeteer/ @JoshuaKGoldberg @tkrotoff /types/expect.js/ @teppeis /types/expectations/ @vvakame +/types/expired/ @BendingBender /types/expired-storage/ @intolerance /types/expirymanager/ @DanielRose -/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 @vinitsood +/types/expo/v31/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 /types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v26/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @tinaroh @@ -1263,6 +1289,7 @@ /types/expo/v24/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger /types/expo/v23/ @KonstantinKai /types/expo-localization/ @burtek +/types/expo-mixpanel-analytics/ @martintreurnicht /types/expo__status-bar-height/ @dawnmist /types/expo__vector-icons/ @incleaf @robertying /types/express/ @borisyankov @@ -1313,7 +1340,8 @@ /types/express-slow-down/ @jdforsythe /types/express-socket.io-session/ @AylaJK /types/express-to-koa/ @xiaohanzhang -/types/express-unless/ @wokim +/types/express-unless/ @wokim @joaovieira @michal-b-kaminski +/types/express-urlrewrite/ @mgroenhoff /types/express-version-request/ @weffe /types/express-version-route/ @weffe /types/express-wechat-access/ @simmons8616 @@ -1332,7 +1360,7 @@ /types/eyes/ @brynbellomy /types/ez-plus/ @AndersonFriaca /types/f1/ @neolwc -/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods @bmartinson @RogerioTeixeira @BradleyHill +/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods @bmartinson @RogerioTeixeira @BradleyHill @bmkrol823 @glenngartner /types/facebook-instant-games/ @menushka @oyvindjam /types/facebook-js-sdk/ @amritk @mahmoudzohdi @fluidsonic /types/facebook-pixel/ @noctishsu @@ -1346,7 +1374,7 @@ /types/falcor-router/ @Quramy @cdhgee /types/famous/ @borisvasilenko /types/fancy-log/ @pine -/types/fancybox/ @borisyankov +/types/fancybox/ @borisyankov @SPWizard01 /types/farbtastic/ @EnableSoftware /types/fast-json-stable-stringify/ @BendingBender /types/fast-levenshtein/ @mizunashi-mana @@ -1355,12 +1383,8 @@ /types/fast64/ @rarmatei /types/fastclick/ @shinnn /types/fastify-accepts/ @leomelzer -/types/fastify-cors/ @jannikkeye /types/fastify-favicon/ @tuelsch -/types/fastify-jwt/ @jannikkeye -/types/fastify-multipart/ @jannikkeye /types/fastify-rate-limit/ @pc-jedi -/types/fastify-static/ @leomelzer /types/favico.js/ @drowse314-dev-ymat /types/favicons/ @mohsen1 @metsawyr /types/fb/ @JoshStrobl @@ -1375,7 +1399,7 @@ /types/feathersjs__authentication-oauth1/ @j2L4e /types/feathersjs__authentication-oauth2/ @j2L4e @NickBolles /types/feathersjs__configuration/ @j2L4e -/types/feathersjs__errors/ @j2L4e +/types/feathersjs__errors/ @j2L4e @RazzM13 /types/feathersjs__express/ @j2L4e @DadUndead /types/feathersjs__feathers/ @j2L4e @AbraaoAlves @TimMensch /types/feathersjs__primus/ @j2L4e @@ -1405,7 +1429,7 @@ /types/file-url/ @coderslagoon /types/filenamify/ @rokt33r /types/filenamify-url/ @cprecioso -/types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk +/types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk @ffxsam /types/fill-pdf/ @westy92 /types/filter-console/ @BendingBender /types/filter-invalid-dom-props/ @icopp @@ -1467,11 +1491,12 @@ /types/focus-within/ @eramdam /types/fontfaceobserver/ @RandScullard /types/fontoxml/ @rolandzwaga +/types/force-graph/ @p-kimberley /types/forever-agent/ @yavanosta /types/forever-monitor/ @shuntksh @wrboyce /types/forge-apis/ @Autodesk-Forge /types/forge-di/ @adamcarr -/types/forge-viewer/ @Autodesk-Forge +/types/forge-viewer/ @Autodesk-Forge @alansmithnbs /types/form-data/ @soywiz @leonyu @BendingBender /types/form-serialize/ @tyler-johnson /types/form-serializer/ @flqw @@ -1685,7 +1710,7 @@ /types/geolite2/ @ffflorian /types/geometry-dom/ @nakakura /types/geopattern/ @Gaelan -/types/gestalt/ @serranoarevalo +/types/gestalt/ @serranoarevalo @joshgachnang /types/get-caller-file/ @ajafff /types/get-certain/ @BendingBender /types/get-emails/ @BendingBender @@ -1708,7 +1733,8 @@ /types/ghauth/ @Leko /types/gifffer/ @gatimus /types/gijgo/ @atatanasov -/types/giraffe/ @darthapo +/types/giphy-api/ @screendriver +/types/giraffe/ @darthapo @jgonggrijp /types/git/ @vvakame /types/git-add-remote/ @BendingBender /types/git-branch/ @rynclark @@ -1735,6 +1761,9 @@ /types/gl-react-native/ @jussikinnula /types/gl-shader/ @MathiasPaumgarten /types/gl-texture2d/ @MathiasPaumgarten +/types/gl-vec2/ @adamzerella +/types/gl-vec3/ @adamzerella +/types/gl-vec4/ @adamzerella /types/gldatepicker/ @qcz /types/glidejs/ @milanjaros /types/glob/ @vvakame @voy @ajafff @@ -1751,7 +1780,6 @@ /types/global-tunnel-ng/ @BendingBender /types/globalize/ @gcastre @afromogli @bryanforbes /types/globalize-compiler/ @iclanton -/types/globby/ @douglasduteil @ikatyang /types/globule/ @durad /types/glue/ @garfty /types/glue/v4/ @gjednaszewski @@ -1780,7 +1808,7 @@ /types/google.script.client-side/ @clomie /types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm @shrujalshah28 /types/google__maps/ @indrimuska -/types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm +/types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm @captain-igloo /types/googlemaps.infobubble/ @Dashue /types/googlepay/ @Fluccioni @Radu-Raicea @fstanis /types/got/ @BendingBender @LinusU @ikokostya @stijnvn @@ -1792,7 +1820,7 @@ /types/gramps__rest-helpers/ @claude /types/graphite-udp/ @EricByers /types/graphlib-dot/ @DomParfitt -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel @mc0 /types/graphql-date/ @enaeseth /types/graphql-deduplicator/ @lfades /types/graphql-depth-limit/ @eritikass @@ -1817,7 +1845,7 @@ /types/gridstack/ @PascalSenn @ZoolWay @Sl1MBoy /types/grpc-error/ @danwbyrne /types/grunt/ @jeffmay @basarat -/types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp +/types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp @AdemHodzic /types/gtin/ @RafaelKr /types/guardian__prosemirror-invisibles/ @dddotsev /types/guid/ @maroy1986 @@ -1845,6 +1873,7 @@ /types/gulp-file-include/ @DanielRosenwasser /types/gulp-filter/ @tkrotoff /types/gulp-flatten/ @k-kagurazaka +/types/gulp-gh-pages/ @ntnyq /types/gulp-gzip/ @tkQubo /types/gulp-help/ @tkQubo /types/gulp-help-doc/ @Mikhus @@ -1898,6 +1927,8 @@ /types/gulp-util/ @jedmao /types/gulp-watch/ @tkrotoff /types/gulp-zip/ @dudeofawesome +/types/gun/ @Jack-Works +/types/gyronorm/ @evanshortiss /types/gzip-js/ @rhysd /types/gzip-size/ @plantain-00 @jimivdw @andrewiggins /types/gzip-size/v3/ @plantain-00 @@ -1905,7 +1936,6 @@ /types/halfred/ @dherges /types/halogen/ @steller /types/hammerjs/ @milkisevil @codler -/types/handlebars/ @borisyankov @evil-shrike /types/handlebars-helpers/ @Toilal /types/hapi/ @rafaelsouzaf @jhsimms @SimonSchick @saboya /types/hapi/v17/ @rafaelsouzaf @jhsimms @SimonSchick @saboya @@ -1948,12 +1978,13 @@ /types/hedron/ @dborysov /types/hellojs/ @PavelPZ @vuorinem @baywet /types/hellosign-embedded/ @xt0rted -/types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit +/types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit @chdanielmueller /types/heredatalens/ @denyo /types/heremaps/ @Josh-ES @denyo @fx88 /types/heroku-logger/ @kylevogt /types/hex-rgb/ @BendingBender /types/hex-rgba/ @r3nya +/types/hexo/ @kentarouTakeda /types/hexo-bunyan/ @segayuu /types/hexo-fs/ @segayuu /types/hexo-log/ @segayuu @@ -1969,15 +2000,15 @@ /types/history.js/ @borisyankov @gjunge /types/historykana/ @h-shiratsuki /types/hjson/ @crunchie84 -/types/hls.js/ @jgainfort @brookback @adripanico +/types/hls.js/ @jgainfort @brookback @adripanico @beraliv /types/hoek/ @prashaantt -/types/hoist-non-react-statics/ @JounQin +/types/hoist-non-react-statics/ @JounQin @jamesreggio /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/howler/ @xperiments @alien35 @nicholashza @cjurango /types/hpp/ @kryops /types/html-entities/ @xstoudi /types/html-minifier/ @tkrotoff @rikuayanokozy @@ -1986,10 +2017,13 @@ /types/html-tag-names/ @sandersn /types/html-tags/ @BendingBender /types/html-to-text/ @erykwarren +/types/html-truncate/ @adamzerella /types/html-void-elements/ @rhysd /types/html-webpack-plugin/ @deevus @bumbleblym @tlaziuk /types/html-webpack-template/ @bumbleblym /types/html2canvas/ @rwhepburn @tan9 @sschocke @Ristaaf +/types/html5-history/ @akashishu777 +/types/html5plus/ @dcloudio /types/htmlbars-inline-precompile/ @chriskrycho /types/htmlparser2/ @staticfunction @LinusU /types/htmltojsx/ @basarat @@ -2001,7 +2035,7 @@ /types/http-errors/ @tkrotoff @BendingBender /types/http-graceful-shutdown/ @dlee-nvisia /types/http-link-header/ @screendriver -/types/http-proxy/ @SomaticIT @Raigen @DanielMSchmidt +/types/http-proxy/ @SomaticIT @Raigen @DanielMSchmidt @jabreu610 /types/http-proxy-agent/ @mrmlnc @steprescott /types/http-proxy-middleware/ @zebMcCorkle @BendingBender /types/http-rx/ @L2jLiga @@ -2009,9 +2043,10 @@ /types/http-status/ @misak113 /types/http-string-parser/ @pine613 /types/httperr/ @yortus -/types/hubot/ @dirk @KeesCBakker +/types/hubot/ @dirk @KeesCBakker @eeemil /types/hubspot-pace/ @borislavjivkov /types/humane/ @jmvrbanac +/types/humanize-ms/ @adamzerella /types/humanize-plus/ @DenisCarriere /types/humanize-string/ @ragnarok56 /types/humanize-url/ @BendingBender @@ -2028,13 +2063,10 @@ /types/i18next/ @mxl @deerawan @GiedriusGrabauskas @lenovouser @qqilihq @butchyyyy /types/i18next/v8/ @mxl @deerawan @GiedriusGrabauskas /types/i18next/v2/ @mxl @deerawan @GiedriusGrabauskas -/types/i18next-browser-languagedetector/ @cyrilschumacher @GiedriusGrabauskas -/types/i18next-browser-languagedetector/v0/ @cyrilschumacher @GiedriusGrabauskas /types/i18next-express-middleware/ @cyrilschumacher /types/i18next-ko/ @dwaxweiler /types/i18next-node-fs-backend/ @cyrilschumacher @lenovouser /types/i18next-sprintf-postprocessor/ @cyrilschumacher -/types/i18next-xhr-backend/ @jamuhl @GiedriusGrabauskas /types/i2c-bus/ @101100 /types/iarna__toml/ @ajafff /types/iban/ @cyrilschumacher @@ -2075,6 +2107,7 @@ /types/in-range/ @DanielRosenwasser /types/inboxsdk/ @rdoursenaud @amiram /types/incremental-dom/ @basarat @lanthaler @vvakame +/types/indefinite/ @omaishr /types/indent-string/ @mhegazy @BendingBender /types/inert/ @nycdotnet @AJamesPhillips @lenovouser /types/inert/v4/ @nycdotnet @AJamesPhillips @@ -2085,8 +2118,12 @@ /types/iniparser/ @chrootsu /types/init-package-json/ @kfarnung /types/ink/ @cprecioso +/types/ink-spinner/ @lukostry +/types/ink-table/ @lukostry +/types/ink-text-input/ @lukostry /types/inline-css/ @philipisapain /types/inline-style-prefixer/ @ahz @dpetrezselyova @franklixuefei +/types/inputmask/ @dmester /types/inquirer/ @tkQubo @ppathan @jouderianjr @bang88 @bitjson @synarque @jrockwood @kwkelly @Ailrun /types/inquirer-npm-name/ @manuth /types/insert-css/ @hvoecking @@ -2097,8 +2134,6 @@ /types/intercom-client/ @jineshshah36 @peping /types/intercom-web/ @fongandrew @salbahra @onatm /types/intercomjs/ @spencerwi -/types/internal-ip/ @BendingBender -/types/internal-ip/v2/ @BendingBender /types/interpret/ @BendingBender /types/intl/ @RagibHasin /types/intl-locales-supported/ @Slessi @@ -2135,6 +2170,7 @@ /types/is-array/ @pine /types/is-array-sorted/ @BendingBender /types/is-binary-path/ @DanielRosenwasser +/types/is-blank/ @heygambo /types/is-buffer/ @rokt33r /types/is-callable/ @nieltg /types/is-charging/ @BendingBender @@ -2153,14 +2189,16 @@ /types/is-glob/ @mrmlnc /types/is-hotkey/ @petester42 @kalley /types/is-installed-globally/ @BendingBender +/types/is-integer/ @djcsdy /types/is-ip/ @coderslagoon /types/is-mobile/ @LogvinovLeon /types/is-my-json-valid/ @kruncher +/types/is-natural-number/ @adamzerella /types/is-negated-glob/ @ajafff /types/is-number/ @harryshipton /types/is-obj/ @forivall /types/is-object/ @wbhob -/types/is-online/ @BendingBender +/types/is-odd/ @adamzerella /types/is-path-cwd/ @DanielRosenwasser /types/is-path-in-cwd/ @mhegazy /types/is-plain-obj/ @BendingBender @@ -2196,7 +2234,7 @@ /types/iso-3166-2/ @sicilica /types/iso8601-localizer/ @avielfedida /types/isomorphic-fetch/ @toddlucas -/types/isotope-layout/ @avidenic @malinushj +/types/isotope-layout/ @avidenic @malinushj @SPWizard01 /types/issue-parser/ @Leko /types/issue-regex/ @BendingBender /types/istanbul/ @tkrotoff @@ -2240,14 +2278,14 @@ /types/jcanvas/ @rogierschouten /types/jdataview/ @RReverser /types/jdenticon/ @mtr -/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald @andys8 +/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald @andys8 @antoinebrault /types/jest/v16/ @NoHomey @jwbay /types/jest-axe/ @JoshuaKGoldberg /types/jest-cli/ @lifeiscontent /types/jest-diff/ @myabc /types/jest-docblock/ @ikatyang /types/jest-each/ @theutz @nickmccurdy -/types/jest-environment-puppeteer/ @joshuakgoldberg +/types/jest-environment-puppeteer/ @joshuakgoldberg @ifiokjr /types/jest-get-type/ @myabc /types/jest-image-snapshot/ @dawnmist /types/jest-in-case/ @geovanisouza92 @@ -2267,7 +2305,7 @@ /types/jjve/ @Nemo157 /types/jmespath/ @pushplay /types/johnny-five/ @nakakura @ujvzolee @workshop2 @xtrimsystems @marcinobiedz -/types/joi/ @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 @afharo /types/joi/v13/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @aconanlai /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @@ -2423,8 +2461,10 @@ /types/js.spec/ @mattbishop /types/jsbn/ @Evgenus @al2xed /types/jschannel/ @yitzchok @McFlat +/types/jscodeshift/ @brieb /types/jscrollpane/ @qcz /types/jsdeferred/ @minodisk +/types/jsdoc-to-markdown/ @adamzerella /types/jsdom/ @leonard-thieu @palmfjord /types/jsen/ @vladeck /types/jsend/ @CaselIT @@ -2452,13 +2492,14 @@ /types/json-stringify-safe/ @BendingBender /types/json2csv/ @juanjoDiaz /types/json2md/ @MartynasZilinskas +/types/json2mq/ @ZhangYiJiang /types/json3/ @NN--- /types/json5/ @Esemesek /types/json_ml/ @pluma /types/jsonabc/ @ffflorian /types/jsonapi-serializer/ @chiangf /types/jsonata/ @nick121212 -/types/jsoneditor/ @alejo90 @errietta +/types/jsoneditor/ @alejo90 @errietta @adamvig /types/jsoneditor-for-react/ @joshuakgoldberg /types/jsoneditoronline/ @vbortone /types/jsonfile/ @dbowring @BendingBender @@ -2472,7 +2513,7 @@ /types/jsonrpc-serializer/ @Akim95 @many20 /types/jsonstream/ @Bartvds /types/jsontoxml/ @benstevens48 -/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod +/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod @kettil /types/jsonwebtoken-promisified/ @SomaticIT @danielheim @brikou @aneilbaboo /types/jspath/ @dex4er /types/jspdf/ @amberjs @lleios @jemerald @@ -2515,7 +2556,8 @@ /types/jwt-simple/ @kenfdev @GaelMagnan /types/jwt-then/ @phenomax /types/k6/ @MajorBreakfast -/types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram +/types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram @insanehong +/types/kafkajs/ @michal-b-kaminski /types/karma/ @tkrotoff @43081j @devoto13 /types/karma/v1/ @tkrotoff @43081j /types/karma-chai/ @JayAndCatchFire @@ -2525,7 +2567,7 @@ /types/karma-jasmine/ @michelsalib /types/karma-viewport/ @karak /types/karma-webpack/ @mtraynham -/types/katex/ @mrand01 @knguyen0125 +/types/katex/ @mrand01 @knguyen0125 @dreamerblue /types/kcors/ @Xstoudi @izayoiko /types/kdbush/ @DenisCarriere @chrfrasco /types/kdbxweb/ @Roang-zero1 @@ -2540,7 +2582,7 @@ /types/keymirror/ @jfahrenkrug /types/keypress.js/ @rcchen /types/keysym/ @harryshipton -/types/keytar/ @miniak @shiftkey @juturu +/types/keytar/ @miniak @shiftkey @juturu @queeniema /types/keyv/ @Arylo @BendingBender /types/keyv__mongo/ @BendingBender /types/keyv__mysql/ @BendingBender @@ -2548,7 +2590,8 @@ /types/keyv__redis/ @BendingBender /types/keyv__sqlite/ @BendingBender /types/kik-browser/ @joelday -/types/klaw/ @mceachen +/types/kissfft-js/ @racerhere +/types/klaw/ @mceachen @p4sca1 /types/klaw/v1/ @mceachen /types/klaw-sync/ @shiftkey /types/kms-json/ @sunnyone @@ -2579,7 +2622,7 @@ /types/koa-better-body/ @danwbyrne /types/koa-bodyparser/ @hellopao @anup-2s @hirochachacha /types/koa-bouncer/ @maruware -/types/koa-bunyan-logger/ @sjmcdowall +/types/koa-bunyan-logger/ @sjmcdowall @jankdc /types/koa-cache-control/ @pe8ter /types/koa-compose/ @jkeylu /types/koa-compress/ @hellopao @@ -2593,10 +2636,11 @@ /types/koa-hbs/ @jcbmln @mudkipme /types/koa-helmet/ @me /types/koa-html-minifier/ @romain-faust -/types/koa-joi-router/ @wingsbob @move-zig @hirochachacha +/types/koa-joi-router/ @wingsbob @move-zig @hirochachacha @NotWoods /types/koa-json/ @brooklyndev /types/koa-json-error/ @mudkipme /types/koa-log/ @havenchyk +/types/koa-log4/ @a631807682 /types/koa-logger/ @geoffreak @tlaziuk /types/koa-logger-winston/ @stevehipwell /types/koa-morgan/ @vesse @@ -2618,7 +2662,7 @@ /types/koa-send/ @pe8ter @tlaziuk /types/koa-session/ @kerol2r20 @tlaziuk @hirochachacha /types/koa-session-minimal/ @longztian -/types/koa-sslify/ @wingsbob +/types/koa-sslify/ @wingsbob @msokk /types/koa-static/ @hellopao @tlaziuk /types/koa-static-cache/ @JounQin /types/koa-static-server/ @wulunyi @@ -2657,7 +2701,7 @@ /types/ldap-filters/ @pluma /types/ldapjs/ @cvillemure @peterkooijmans /types/leadfoot/ @theintern -/types/leaflet/ @alejo90 @atd-schubert @mcauer +/types/leaflet/ @alejo90 @atd-schubert @mcauer @ronikar /types/leaflet/v0/ @rgripper /types/leaflet-areaselect/ @awallat /types/leaflet-curve/ @onikiienko @@ -2711,6 +2755,7 @@ /types/libxslt/ @alejo90 /types/license-checker/ @rogierschouten @unindented /types/liftoff/ @BendingBender +/types/lil-uri/ @wcarson /types/lil-uuid/ @Pr1st0n /types/lime-js/ @arthur-xavier /types/line-by-line/ @etomsen @@ -2726,6 +2771,7 @@ /types/linkifyjs/ @szhu @ovidiubute /types/list-git-remotes/ @BendingBender /types/list-stream/ @IanStorm +/types/list.js/ @jeffreymeng /types/listr/ @durad /types/lls/ @borislavjivkov /types/load-google-maps-api/ @oBusk @@ -3037,7 +3083,6 @@ /types/lodash.zipobjectdeep/ @bczengel @chrootsu @stepancar /types/lodash.zipwith/ @bczengel @chrootsu @stepancar /types/log-symbols/ @BendingBender -/types/log-update/ @BendingBender /types/logat/ @krvikash35 /types/logform/ @DABH /types/logg/ @blittle @@ -3045,7 +3090,7 @@ /types/loglevel/ @Pro @szmeti @screendriver /types/logrotate-stream/ @rogierschouten /types/lokijs/ @TeamworkGuy2 @thomasconner -/types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten +/types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten @zyishai /types/long/ @peterkooijmans /types/looks-same/ @xcatliu /types/loopback/ @kattsushi @enko @sequoia @drmikecrowe @karimsa @@ -3059,6 +3104,7 @@ /types/lowlight/ @NoHomey /types/lozad/ @plantain-00 /types/lru-cache/ @Bartvds @BendingBender +/types/lru-cache/v4/ @Bartvds @BendingBender /types/lscache/ @Chris-Martinezz /types/ltx/ @PJakcson @BendingBender /types/luaparse/ @stpettersens @@ -3077,9 +3123,8 @@ /types/maildev/ @cyrilschumacher @zbarbuto /types/mailgen/ @vothanhkiet @jordanfarrer /types/mailgun-js/ @sampsonjoliver @andipaetzold -/types/mailparser/ @psnider +/types/mailparser/ @psnider @Avol-V /types/main-bower-files/ @k-kagurazaka -/types/make-dir/ @ikatyang @BendingBender /types/maker.js/ @danmarshall /types/makeup-expander/ @darkwebdev /types/makeup-floating-label/ @darkwebdev @@ -3092,13 +3137,14 @@ /types/mangopay2-nodejs-sdk/ @ifiokjr /types/map-obj/ @BendingBender /types/mapbox/ @anahkiasen @Fluccioni -/types/mapbox-gl/ @dobrud @patrickr +/types/mapbox-gl/ @dobrud @patrickr @macobo /types/mapbox-gl-leaflet/ @agorshkov23 /types/mapbox__geo-viewport/ @fnberta /types/mapbox__geojson-area/ @n0nick /types/mapbox__polyline/ @Kern0 @mklopets /types/mapbox__s3urls/ @sebastianvera /types/mapbox__shelf-pack/ @Perlmint +/types/mapbox__sphericalmercator/ @nhusher /types/mapnik/ @ipv4sec /types/mapsjs/ @davismj /types/mariasql/ @bennett000 @@ -3109,7 +3155,7 @@ /types/markdown-it-lazy-headers/ @knom /types/markdown-pdf/ @MonsieurMan /types/markdownlint/ @ark120202 -/types/marked/ @worr @BendingBender @CrossR @mwickett +/types/marked/ @worr @BendingBender @CrossR @mwickett @htkzhtm /types/marked-terminal/ @bkendall /types/marker-animate-unobtrusive/ @viskin /types/markerclustererplus/ @enanox @mxl @@ -3177,7 +3223,7 @@ /types/mem-fs-editor/ @MyFoodBag /types/memcached/ @KentarouTakeda /types/memdown/ @MeirionHughes @danwbyrne -/types/memjs/ @leizongmin +/types/memjs/ @leizongmin @BendingBender /types/memoize-one/ @karol-majewski @franklixuefei /types/memoize-one/v3/ @karol-majewski @franklixuefei /types/memoizee/ @juanpicado @@ -3217,6 +3263,7 @@ /types/micro-events/ @AlexanderSychev /types/micromatch/ @glen-84 @vemoo /types/micromatch/v2/ @glen-84 +/types/micromodal/ @wcarson /types/microrouter/ @mathieudutour /types/microservice-utilities/ @runebaas /types/microsoft-ajax/ @pjmagee @@ -3279,18 +3326,19 @@ /types/moment-duration-format/ @SwintDC @TwoStone @leonard-thieu @bendykowski /types/moment-holiday/ @rwdalpe /types/moment-jalaali/ @alitaheri +/types/moment-precise-range-plugin/ @gricey432 /types/moment-range/ @Burgov @wilgert @franjuan @MartynasZilinskas @chemass /types/moment-round/ @jacobbaskin /types/moment-shortformat/ @whatasoda /types/moment-strftime2/ @dex4er -/types/moment-timezone/ @michelsalib @alanblins @asermax +/types/moment-timezone/ @michelsalib @alanblins @asermax @borys-kupar /types/money-math/ @taoqf /types/mongo-sanitize/ @CedricCazin -/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 @erikc5000 +/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 @erikc5000 @Manc /types/mongodb/v2/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi /types/mongodb-memory-server/ @dmitryrogozhny /types/mongodb-uri/ @mernxl -/types/mongoose/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier @frontendmonster @mingchen +/types/mongoose/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier @frontendmonster @mingchen @penumbra1 /types/mongoose/v4/ @simonxca @horiuchi @lukasz-zak /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa @@ -3315,8 +3363,7 @@ /types/motor-hat/ @muntyan /types/mousetrap/ @qcz @alanhchoi /types/move-concurrently/ @mgroenhoff -/types/move-file/ @BendingBender -/types/moveto/ @shermendev +/types/moveto/ @shermendev @pea3nut /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka /types/mozilla-readability/ @charlesvdv @@ -3344,6 +3391,7 @@ /types/multiplexjs/ @KamyarNazeri /types/multisort/ @CzBuCHi /types/multistream/ @mrmlnc @kenzierocks +/types/mumath/ @adamzerella /types/muri/ @jloveridge /types/murmurhash/ @atd-schubert /types/murmurhash-js/ @cvle @@ -3369,6 +3417,8 @@ /types/nats-hemera/ @vforv /types/natsort/ @mgroenhoff /types/natural/ @dmoonfire +/types/natural-compare/ @doniyor2109 +/types/natural-compare-lite/ @doniyor2109 /types/natural-sort/ @a-morales @fluggo /types/navermaps/ @ckboyjiy /types/navigation/ @grahammendick @@ -3437,14 +3487,16 @@ /types/nightwatch/ @rkavalap @schlesiger @ClaytonAstrom /types/nise/ @a-tarasyuk /types/nivo-slider/ @AndersonFriaca -/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko +/types/no-scroll/ @ZhangYiJiang +/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko @claytonkucera /types/noble-mac/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour @paambaati /types/nodal/ @charrondev -/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 @samuela @kuehlein -/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/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/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry +/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @btoueg @brunoscheufler @smac89 @tellnes @touffy @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 @samuela @kuehlein @j-oliveras @bhongy +/types/node/v10/ @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 @samuela @kuehlein @j-oliveras @bhongy +/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 @j-oliveras @bhongy +/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 @j-oliveras @bhongy +/types/node/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry @j-oliveras /types/node/v6/ @Microsoft @DefinitelyTyped @WilcoBakker @inlined @eps1lon @Alorel @KSXGitHub @Archcry /types/node/v4/ @Microsoft @DefinitelyTyped @eps1lon @Archcry /types/node/v0/ @Microsoft @DefinitelyTyped @@ -3457,9 +3509,9 @@ /types/node-cron/ @maximelkin @burtek /types/node-dijkstra/ @nokutu /types/node-dir/ @panuhorsmalahti -/types/node-dogstatsd/ @chrisbobo +/types/node-dogstatsd/ @chrisbobo @xzyfer /types/node-emoji/ @jonestristand @styu @rimiti -/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre +/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre @kyranet /types/node-fibers/ @caryhaynie /types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 @supaiku0 @andersk /types/node-gcm/ @horiuchi @@ -3471,6 +3523,7 @@ /types/node-hue-api/ @fjmorel /types/node-int64/ @x3cion @kevin-greene-ck /types/node-ipc/ @arvitaly @gjurgens +/types/node-jose/ @nadunindunil /types/node-jsfl-runner/ @mrand01 /types/node-json-db/ @kuzn-ilya /types/node-localstorage/ @intolerance @@ -3485,6 +3538,7 @@ /types/node-redis-pubsub/ @renekeijzer /types/node-resque/ @gordey4doronin /types/node-rsa/ @alitaheri @xm @ffflorian +/types/node-sass/ @pspeter3 @chriseppstein /types/node-schedule/ @cyrilschumacher @flowpl /types/node-slack/ @tkQubo /types/node-snap7/ @heilingbrunner @@ -3506,7 +3560,7 @@ /types/node-zopfli-es/ @Alorel /types/node_redis/ @borisyankov /types/nodecredstash/ @migstopheles -/types/nodegit/ @dolanmiu @tniessen +/types/nodegit/ @dolanmiu @tniessen @pvigier /types/nodemailer/ @rogierschouten @dex4er @bioball /types/nodemailer/v3/ @rogierschouten /types/nodemailer-direct-transport/ @rogierschouten @@ -3523,7 +3577,6 @@ /types/nopt/ @jbondc /types/normalize-package-data/ @jdxcode /types/normalize-path/ @BendingBender -/types/normalize-url/ @odin3 @BendingBender @mathieumg /types/notie/ @mateusdemboski /types/notify/ @hellochar /types/notifyjs/ @soundTricker @NateScarlet @@ -3537,10 +3590,12 @@ /types/npm-email/ @BendingBender /types/npm-keyword/ @BendingBender /types/npm-license-crawler/ @ffflorian +/types/npm-list-author-packages/ @ffflorian /types/npm-name/ @BendingBender /types/npm-package-arg/ @mgroenhoff @OiYouYeahYou /types/npm-packlist/ @ajafff /types/npm-paths/ @BendingBender +/types/npm-registry-package-info/ @ffflorian /types/npm-run-path/ @BendingBender /types/npm-user/ @BendingBender /types/npm-user-packages/ @BendingBender @@ -3548,6 +3603,7 @@ /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk +/types/nssm/ @hongaar /types/number-is-nan/ @mhegazy /types/number-to-words/ @frederickfogerty /types/numeral/ @vbortone @BehindTheMath @klujanrosas @@ -3560,6 +3616,7 @@ /types/nw.js/ @alirdn /types/nwmatcher/ @woutervh- /types/o.js/ @IceOnFire @bradzacher @janhommes @jcchalte +/types/oakdex-pokedex/ @jalyna /types/oauth/ @nonAlgebraic @EduardoAC /types/oauth-shim/ @BendingBender /types/oauth.js/ @nobuoka @@ -3590,13 +3647,13 @@ /types/office-js-preview/ @OfficeDev @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT /types/office-runtime/ @Zlatkovsky @mscharlock /types/offline-js/ @cgwrench +/types/offscreencanvas/ @kayahr /types/oibackoff/ @geoffreak /types/oidc-token-manager/ @rosieks /types/oja/ @buffcode /types/okta__okta-vue/ @innovation-team /types/ol/ @yairtawil /types/omggif/ @ffflorian -/types/on-change/ @BendingBender /types/on-finished/ @czechboy0 @BendingBender /types/on-headers/ @jjeffery @BendingBender /types/on-wake-up/ @ajafff @@ -3604,14 +3661,18 @@ /types/one-time/ @BendingBender /types/onesignal-cordova-plugin/ @broder /types/onetime/ @BendingBender +/types/onetime/v2/ @BendingBender /types/oniguruma/ @smhxx +/types/onionoo/ @BendingBender /types/onoff/ @marcel-ernst @Kallu609 /types/ontime/ @Hirse /types/open/ @Bartvds /types/open-editor/ @BendingBender +/types/open-graph/ @ffflorian /types/openapi-factory/ @runebaas /types/opener/ @tikurahul /types/openfin/ @chrisbarker @rdepena @whyn07m3 @licui3936 +/types/openfin/v37/ @chrisbarker @rdepena @whyn07m3 @licui3936 /types/openfin/v34/ @chrisbarker @rdepena @whyn07m3 /types/openfin/v29/ @chrisbarker @rdepena /types/openfin/v17/ @chrisbarker @@ -3628,9 +3689,6 @@ /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem -/types/ora/ @basarat @screendriver @BendingBender @azasypkin -/types/ora/v1/ @basarat @screendriver @BendingBender @azasypkin -/types/ora/v0/ @basarat @screendriver /types/oracle__oraclejet/ @nolakara @jingxwu /types/oracledb/ @Bigous /types/orchestrator/ @tkQubo @TeamworkGuy2 @@ -3659,25 +3717,19 @@ /types/p-defer/ @SamVerschueren @BendingBender /types/p-do-whilst/ @BendingBender /types/p-each-series/ @BendingBender -/types/p-event/ @BendingBender /types/p-every/ @BendingBender /types/p-forever/ @BendingBender /types/p-is-promise/ @BendingBender /types/p-lazy/ @BendingBender -/types/p-limit/ @BendingBender @LinusU /types/p-loading/ @renjfk /types/p-locate/ @BendingBender /types/p-log/ @BendingBender -/types/p-map/ @BendingBender /types/p-map-series/ @BendingBender /types/p-memoize/ @forabi /types/p-min-delay/ @BendingBender /types/p-one/ @BendingBender -/types/p-pipe/ @BendingBender /types/p-progress/ @icopp /types/p-props/ @BendingBender -/types/p-queue/ @BendingBender @evanshortiss -/types/p-queue/v2/ @BendingBender @evanshortiss /types/p-reduce/ @BendingBender /types/p-reflect/ @BendingBender /types/p-retry/ @BendingBender @@ -3685,7 +3737,6 @@ /types/p-settle/ @natesilva /types/p-some/ @BendingBender /types/p-tap/ @BendingBender -/types/p-throttle/ @BendingBender /types/p-time/ @BendingBender /types/p-timeout/ @BendingBender /types/p-times/ @BendingBender @@ -3694,7 +3745,7 @@ /types/p-wait-for/v1/ @BendingBender /types/p-waterfall/ @BendingBender /types/p-whilst/ @BendingBender -/types/p2/ @clark-stevenson +/types/p2/ @clark-stevenson @jramstedt /types/p5/ @p5-types /types/package-json/ @jinwoo @BendingBender /types/packery/ @piraveen @hanssens @@ -3716,7 +3767,7 @@ /types/parity-pmr/ @leovujanic /types/parity-poe/ @leovujanic /types/park-miller/ @BendingBender -/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis @AlexandreHetu /types/parse/v1/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas /types/parse-columns/ @BendingBender /types/parse-filepath/ @BendingBender @@ -3795,7 +3846,7 @@ /types/pbf/ @cschwarz /types/pbkdf2/ @timonegk /types/pdf2image/ @taoqf -/types/pdfjs-dist/ @jbaldwin +/types/pdfjs-dist/ @jbaldwin @1999 /types/pdfkit/ @erichillah /types/pdfmake/ @m1llen1um @radziksh @evolkmann /types/pdfobject/ @nielsboogaard @@ -3805,12 +3856,14 @@ /types/pegjs/ @vvakame @SrTobi @siegebell /types/pem/ @tony19 @DethAriel /types/pem-jwk/ @alessiopcc +/types/pendo-io-browser/ @aaronbeall /types/permit/ @jannikkeye /types/persona/ @Nycto /types/pet-finder-api/ @me /types/petit-dom/ @JamesMessinger /types/pg/ @pspeter3 /types/pg/v6/ @pspeter3 +/types/pg-copy-streams/ @fluggo /types/pg-ears/ @bradleyayers /types/pg-escape/ @khell /types/pg-format/ @zopf @@ -3822,7 +3875,7 @@ /types/phantom/ @horiuchi @llRandom /types/phantomcss/ @abauzac /types/phantomjs/ @jedhunsaker @keesey -/types/phoenix/ @mciastek +/types/phoenix/ @mciastek @John-Goff @princemaple /types/phone/ @DxCx /types/phone-formatter/ @westy92 /types/phonegap/ @borisyankov @DickvdBrink @@ -3839,7 +3892,7 @@ /types/pid-from-port/ @BendingBender /types/pidusage/ @cyrilschumacher @mx601595686 /types/pify/ @samverschueren @mad-mike @c7hm4r -/types/pigpio/ @manerfan @erikma +/types/pigpio/ @manerfan @erikma @park012241 /types/pigpio-dht/ @erikma /types/pikaday/ @MidnightDesign @wake42 @mezoistvan /types/pikaday-time/ @Sayan751 @@ -3853,10 +3906,10 @@ /types/piwik-tracker/ @lbguilherme /types/pixelmatch/ @iamolegga /types/pixi.js/ @clark-stevenson -/types/pkg-conf/ @jorgegonzalez /types/pkg-dir/ @NK-WEB-Git /types/pkg-up/ @forivall /types/pkg-versions/ @BendingBender +/types/pkgcloud/ @dantman /types/pkijs/ @microshine /types/platform/ @JakeH /types/playcanvas/ @Neoflash1979 @@ -3864,13 +3917,13 @@ /types/playmusic/ @nickp10 /types/pleasejs/ @nakakura /types/plist/ @higuri -/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart @szechyjs @MercifulCode @soorajpudiyadath @jonfreedman @meganrm +/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart @szechyjs @MercifulCode @soorajpudiyadath @jonfreedman @meganrm @zeroyoichihachi /types/plugapi/ @BNedry /types/plugin-error/ @rogierschouten /types/plupload/ @patrickbussmann /types/plur/ @iRoachie /types/pluralize/ @ukyo @karol-majewski -/types/png-async/ @kanreisa +/types/plurals-cldr/ @ChaosinaCan /types/png.js/ @ffflorian /types/pngjs/ @jason0x43 /types/pngquant-bin/ @hikoma @@ -3899,9 +3952,11 @@ /types/postcss-modules-local-by-default/ @huan086 /types/postcss-modules-resolve-imports/ @huan086 /types/postcss-modules-scope/ @huan086 +/types/postcss-nested/ @VorontsovMaxim /types/postcss-url/ @lenovouser /types/postman-collection/ @kbuzby /types/postmark/ @benbayard @jineshshah36 +/types/postmate/ @wcarson /types/pouch-redux-middleware/ @charrondev /types/pouchdb/ @AGBrown @geppy @fredgalvao /types/pouchdb-adapter-fruitdown/ @spaulg @geppy @fredgalvao @@ -3928,12 +3983,14 @@ /types/preloadjs/ @endel /types/prelude-ls/ @AyaMorisawa /types/prettier/ @ikatyang +/types/pretty/ @adamzerella /types/pretty-bytes/ @plantain-00 @danielasy /types/pretty-bytes/v4/ @plantain-00 /types/pretty-format/ @ikatyang /types/pretty-hrtime/ @BendingBender /types/pretty-ms/ @BendingBender @ocboogie @silh /types/pretty-ms/v3/ @BendingBender @ocboogie +/types/pretty-time/ @adamzerella /types/preval.macro/ @huan086 /types/printf/ @AluisioASG /types/priorityqueuejs/ @geoffreak @@ -3942,6 +3999,7 @@ /types/private-ip/ @coderslagoon /types/procfs-stats/ @cyrilschumacher /types/progress/ @sebastian-lenz +/types/progress-stream/ @mickdekkers /types/progressbar/ @atd-schubert /types/progressjs/ @zaneli /types/proj4/ @DenisCarriere @BendingBender @@ -3969,8 +4027,8 @@ /types/prompt-sync-history/ @MugeSo /types/promptly/ @danrspencer /types/prompts/ @Berkays @danielpa9708 @kamontat -/types/prop-types/ @DovydasNavickas @ferdaber -/types/proper-lockfile/ @qlonik +/types/prop-types/ @DovydasNavickas @ferdaber @eps1lon +/types/proper-lockfile/ @qlonik @LinusU /types/properties-reader/ @Goldsmith42 /types/prosemirror-collab/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-commands/ @bradleyayers @davidka @timjb @patsimm @@ -3986,6 +4044,7 @@ /types/prosemirror-schema-list/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-state/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-tables/ @superchu @eshvedai @patsimm +/types/prosemirror-test-builder/ @ifiokjr /types/prosemirror-transform/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-view/ @bradleyayers @davidka @timjb @patsimm /types/proton-native/ @khanhas @ltetzlaff @@ -4004,7 +4063,7 @@ /types/ptomasroos__react-native-multi-slider/ @Slessi /types/pty.js/ @enlight /types/public-ip/ @BendingBender -/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr @danduh +/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr @danduh @ChristianBoehlke /types/pubsub-js/ @borisyankov /types/pug/ @TonyPythoneer @19majkel94 /types/pulltorefreshjs/ @DanielRosenwasser @humpedli @@ -4035,7 +4094,6 @@ /types/qs/ @RWander @leonyu @tehbelinda @zyml @artursvonda @CarlosBonetti /types/qs-middleware/ @davecardwell /types/qtip2/ @Seltzer @leonard-thieu -/types/query-string/ @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha @shssoichiro @jarrku /types/querystringify/ @ilich /types/quick-lru/ @BendingBender /types/quick-lru/v1/ @BendingBender @@ -4053,7 +4111,7 @@ /types/radius/ @codeanimal /types/radix64/ @huan086 /types/raf/ @BenLorantfy -/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 @jottenlips @minitesh +/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 @jottenlips @minitesh @krantisinh @pirix-gh /types/random-boolean/ @BendingBender /types/random-float/ @BendingBender /types/random-int/ @BendingBender @@ -4091,7 +4149,7 @@ /types/rc/ @DanielRosenwasser @BendingBender /types/rc-progress/ @jussikinnula /types/rc-select/ @DenisTirilis -/types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 +/types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 @nicholasmaddren @nulladdict /types/rc-switch/ @karol-majewski /types/rc-time-picker/ @Hoff97 /types/rc-tooltip/ @rhysd @ahstro @vsaarinen @@ -4102,7 +4160,7 @@ /types/rdflib/ @cenotelie /types/re-base/ @jordandrako /types/reach__router/ @kingdaro -/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Jessidhia @pshrmn @threepointone +/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Jessidhia @pshrmn @threepointone @saranshkataria /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz /types/react-adal/ @dkorolev1 /types/react-albus/ @sseppola @conradreuter @kuirak @@ -4116,10 +4174,10 @@ /types/react-aria-modal/ @forabi /types/react-autocomplete/ @lstanden /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch @rosskevin -/types/react-avatar-editor/ @diogocorrea @gabsprates +/types/react-avatar-editor/ @diogocorrea @gabsprates @lsenta @davidspiess /types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen @enricoboccadifuoco @lonyele /types/react-better-password/ @mhuynh1 -/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 +/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 @ldthorne /types/react-blessed/ @me /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall @jrakotoharisoa @r3nya @t49tran @bes @@ -4127,7 +4185,7 @@ /types/react-bootstrap-daterangepicker/ @ianks /types/react-bootstrap-table/ @flaub @alelode @UJosue10 @dawnmist @Ogglas /types/react-bootstrap-table/v2/ @flaub @alelode @UJosue10 -/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson @arichter83 @dalevfenton +/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson @arichter83 @dalevfenton @KngHawkon /types/react-breadcrumbs/ @guoyunhe /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros @@ -4137,7 +4195,7 @@ /types/react-calendar-timeline/ @radziksh @acemac /types/react-cartographer/ @trevonmckay /types/react-circular-progressbar/ @lstanden -/types/react-click-outside/ @screendriver +/types/react-click-outside/ @screendriver @Ky6uk /types/react-close-on-escape/ @JamesAlias /types/react-codemirror/ @velveret @rudi-c /types/react-coinhive/ @sktbcbbs @@ -4149,11 +4207,12 @@ /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-credit-cards/ @vstrimaitis @olefrank @zzanol /types/react-cropper/ @stepancar /types/react-css-collapse/ @dford07 /types/react-css-modules/ @KostyaEsmukov @skirsdeda /types/react-css-transition-replace/ @LKay +/types/react-csv/ @vincentjames501 /types/react-currency-formatter/ @pastushenkoy @Jeka-Vasiliev /types/react-custom-scrollbars/ @David-LeBlanc-git @kittimiyo /types/react-custom-scrollbars/v3/ @David-LeBlanc-git @@ -4166,15 +4225,16 @@ /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-dev-utils/ @ark120202 +/types/react-dnd-multi-backend/ @dawnmist @beeequeue @robcodemonkey /types/react-dnd-touch-backend/ @mleko @dawnmist @beeequeue /types/react-document-meta/ @ulrichb /types/react-document-title/ @cleverguy25 -/types/react-dom/ @MartynasZilinskas @theruther4d +/types/react-dom/ @MartynasZilinskas @theruther4d @Jessidhia /types/react-dom/v15/ @MartynasZilinskas /types/react-dom-factories/ @jgoz /types/react-dotdotdot/ @jczyzewski -/types/react-draft-wysiwyg/ @imechZhangLY @brunoMaurice +/types/react-draft-wysiwyg/ @imechZhangLY @brunoMaurice @ldanet /types/react-dragtastic/ @nscarcella /types/react-dropzone/ @matdube @LynxEyes @goblindegook @benbayard @LKay @codeaid @jurosh @ekilah /types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay @@ -4224,7 +4284,6 @@ /types/react-howler/ @maksimovicdanijel /types/react-hyperscript/ @tock203 /types/react-icon-base/ @apare @LKay -/types/react-icons/ @apare @johnnyreilly @LKay /types/react-image-crop/ @danielasy @chaaya /types/react-image-fallback/ @8enSmith /types/react-image-gallery/ @adamwpc @@ -4240,11 +4299,11 @@ /types/react-input-calendar/ @stepancar /types/react-input-mask/ @apare @dima7a14 /types/react-input-mask/v1/ @apare -/types/react-instantsearch/ @gburgett @jpowell -/types/react-instantsearch-core/ @gburgett @jpowell @davidfurlong -/types/react-instantsearch-dom/ @gburgett @jpowell -/types/react-instantsearch-native/ @gburgett @jpowell -/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 +/types/react-instantsearch/ @gburgett @jpowell @haroenv @samouss +/types/react-instantsearch-core/ @gburgett @jpowell @davidfurlong @haroenv @samouss +/types/react-instantsearch-dom/ @gburgett @jpowell @haroenv @samouss +/types/react-instantsearch-native/ @gburgett @jpowell @haroenv @samouss +/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 @anion155 /types/react-intl/v1/ @bgrieder /types/react-intl-redux/ @LKay /types/react-is/ @AviVahl @christianchown @eps1lon @@ -4256,9 +4315,11 @@ /types/react-json-tree/ @gnestor @zainafzal08 /types/react-jsonschema-form/ @iamdanfox @iplus26 @phbou72 @LucianBuzzo @sthenault @sbusch /types/react-jss/ @eps1lon @jlaw90 +/types/react-kawaii/ @ZhangYiJiang /types/react-lazyload/ @m0a /types/react-lazylog/ @benjaminRomano /types/react-leaflet/ @danzel @davschne @yuit +/types/react-leaflet/v1/ @danzel @davschne @yuit /types/react-leaflet-markercluster/ @Kimahriman /types/react-lifecycle-component/ @pixelshaded /types/react-lifecycles-compat/ @bySabi @@ -4269,6 +4330,7 @@ /types/react-mailchimp-subscribe/ @osdiab /types/react-map-gl/ @rimig @fnberta /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti +/types/react-material-ui-form-validator/ @FrankBrullo /types/react-mce/ @morphologue /types/react-mdl/ @bradzacher /types/react-measure/ @asvetliakov @marcfallows @@ -4276,9 +4338,10 @@ /types/react-mixin/ @tkqubo /types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz @jpowell /types/react-motion/ @stepancar @asvetliakov @dimitarnestorov +/types/react-motion-loop/ @j-em /types/react-motion-slider/ @asvetliakov /types/react-motion-ui-pack/ @jsonunger -/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel @souvik-ghosh +/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel @souvik-ghosh @nossbigg /types/react-native-android-taskdescription/ @christianchown /types/react-native-auth0/ @ascariandrea @marknelissen /types/react-native-autocomplete-input/ @ifiokjr @@ -4318,10 +4381,12 @@ /types/react-native-mauron85-background-geolocation/ @djereg /types/react-native-mixpanel/ @r3nya /types/react-native-modal-dropdown/ @echoulen +/types/react-native-modal-filter-picker/ @ywchang @nossbigg /types/react-native-modalbox/ @iRoachie /types/react-native-multi-slider/ @Slessi /types/react-native-navbar/ @ryokik /types/react-native-orientation/ @MoLow +/types/react-native-percentage-circle/ @hmajid2301 /types/react-native-permissions/ @vincentlanglet /types/react-native-photo-view/ @christianchown /types/react-native-platform-touchable/ @tngranados @@ -4338,6 +4403,7 @@ /types/react-native-sensor-manager/ @SahinVardar /types/react-native-settings-list/ @MrLuje /types/react-native-share/ @marknelissen +/types/react-native-snackbar-component/ @hmajid2301 /types/react-native-snap-carousel/ @jnbt @j-fro @gazaret @GuillaumeAmat @VitorLuizC /types/react-native-sortable-grid/ @j-fro /types/react-native-sortable-list/ @sivolobov @RookY2K @@ -4348,7 +4414,7 @@ /types/react-native-svg-uri/ @iRoachie /types/react-native-swiper/ @CaiHuan @huhuanming @mhcgrq /types/react-native-tab-navigator/ @iRoachie -/types/react-native-tab-view/ @kaoDev @iRoachie @timwangdev +/types/react-native-tab-view/ @kaoDev @iRoachie @timwangdev @geriux /types/react-native-text-input-mask/ @RodrigoAWeber /types/react-native-toast-native/ @bm-software /types/react-native-touch-id/ @huhuanming @gazaret @jinshin1013 @@ -4357,7 +4423,7 @@ /types/react-native-version-number/ @VincentLanglet /types/react-native-video/ @huhuanming /types/react-native-zeroconf/ @mattapet -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway @denissb @skovhus +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway @denissb @skovhus @azrosen92 @hmajid2301 /types/react-navigation/v2/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway /types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi /types/react-navigation-material-bottom-tabs/ @iRoachie @@ -4372,8 +4438,8 @@ /types/react-outside-click-handler/ @zubivan /types/react-overlays/ @aaronbeall @vitosamson @aarondancer /types/react-owl-carousel/ @tbounsiar @igorissen @KennethanCeyer -/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin @SPWizard01 -/types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke +/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin @SPWizard01 @kevinrambaud +/types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @kevinrambaud /types/react-paginate/v4/ @deevus @wouterhardeman @pegel03 @archy-bold /types/react-panelgroup/ @qgolsteyn /types/react-places-autocomplete/ @guilhermehubner @r3nya @ApeNox @azizhk @@ -4391,7 +4457,7 @@ /types/react-rangeslider/ @RichieRock /types/react-recaptcha/ @mhegazy @zzanol /types/react-reconciler/ @Methuselah96 -/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris @soerenbf +/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris @soerenbf /types/react-redux/v6/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris /types/react-redux/v5/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva /types/react-redux-epic/ @forabi @@ -4399,12 +4465,13 @@ /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba /types/react-relay/ @graphcool @voxmatt @alloy @npirotte @ckknight @kastermester @mattkrick /types/react-request/ @dannycochran +/types/react-resizable/ @airhorns /types/react-resize-detector/ @matthew-matvei @aMoniker @rdrgn /types/react-resolver/ @forabi /types/react-responsive/ @asvetliakov @alechill @xaviergonz /types/react-responsive/v1/ @asvetliakov /types/react-rnd/ @Ragg- @fsubal @zyh825 -/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/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith @wezleytsai @eps1lon /types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen @gillchristian @nulladdict /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall @@ -4421,7 +4488,9 @@ /types/react-rte/ @jclyons52 /types/react-s-alert/ @mitsuruog /types/react-scroll/ @sudoplz @GiedriusGrabauskas +/types/react-scroll-into-view-if-needed/ @angusfretwell @allanpope @jonathanly /types/react-scrollbar/ @stephenjelfs +/types/react-scrollspy/ @ZhangYiJiang /types/react-select/ @claasahl @jonfreedman /types/react-select/v1/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 @misantronic @darkartur @eps1lon @endurance @RCGuillaume /types/react-share/ @icopp @@ -4451,19 +4520,19 @@ /types/react-svg-inline/ @kiyopikko /types/react-svg-pan-zoom/ @huy-nguyen /types/react-swf/ @stepancar -/types/react-swipe/ @DeividasBakanas +/types/react-swipe/ @DeividasBakanas @AAlakkad /types/react-swipeable/ @GiedriusGrabauskas @mctep @horiuchi /types/react-swipeable-views/ @mxl @DeividasBakanas /types/react-syntax-highlighter/ @NoHomey @ajgamble-milner /types/react-table/ @royxue @psakalo @Havret @andys8 @Gelio /types/react-table-filter/ @gjsln -/types/react-tabs/ @danez @Equationist +/types/react-tabs/ @yu-i9 @danez @Equationist /types/react-tag-autocomplete/ @jlismore /types/react-tag-input/ @Ogglas @jankarres @matthewberryman /types/react-tagcloud/ @wassname /types/react-tagsinput/ @mykter /types/react-tap-event-plugin/ @mxl -/types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz +/types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz @Jessidhia /types/react-test-renderer/v15/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly /types/react-tether/ @ryprice /types/react-text-mask/ @guilhermehubner @cavarzan @needpower @@ -4491,14 +4560,14 @@ /types/react-visibility-sensor/ @JRasmusBm @gcangussu /types/react-webcam/ @squat /types/react-weui/ @tairan -/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger +/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger @vegtelenseg /types/react-widgets-moment/ @dawnmist -/types/react-window/ @martynaskadisa +/types/react-window/ @martynaskadisa @heyimalex /types/react-window-size/ @jakejrichards /types/react-wow/ @mikepthomas /types/react-youtube/ @kgtkr @salguerooo /types/react-youtube-embed/ @charles-salmon -/types/reactable/ @spielc +/types/reactable/ @spielc @priscila-moneo /types/reactcss/ @chrisgervang @LKay /types/reactstrap/ @alihammad @mfal @danilobjr @FaithForHumans @timc13 @patrickrgaffney @prabodht @georg94 /types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva @@ -4513,11 +4582,11 @@ /types/readline-sync/ @jonestristand /types/readline-transform/ @dex4er /types/reapop/ @Barrokgl -/types/rebass/ @rhysd @ryee-dev @jamesmckenzie +/types/rebass/ @rhysd @ryee-dev @jamesmckenzie @gretzky @angusfretwell /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 @RobertStigsson @kousaku-maron +/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok @RobertStigsson @kousaku-maron @iflp /types/recharts-scale/ @johnnyreilly /types/rechoir/ @BendingBender /types/recluster/ @dex4er @@ -4553,7 +4622,8 @@ /types/redux-first-router-link/ @janb87 /types/redux-first-router-restore-scroll/ @icopp /types/redux-first-routing/ @tlaziuk -/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 +/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik @bwlt +/types/redux-form/v7/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik /types/redux-form/v6/ @carsonf @aikoven @LKay @bancek @mshaaban088 /types/redux-form/v4/ @aikoven /types/redux-immutable/ @oizie @sebald @gavingregory @lukyth @@ -4608,6 +4678,8 @@ /types/remote-redux-devtools/ @ColinEberhardt @unindented @mamodom @colindekker /types/remove-markdown/ @RagibHasin /types/rename/ @Aankhen +/types/repeat-element/ @adamzerella +/types/repeat-string/ @adamzerella /types/replace-ext/ @DeividasBakanas /types/replace-string/ @BendingBender /types/replacestream/ @dex4er @@ -4630,6 +4702,7 @@ /types/resemblejs/ @pimterry /types/reservoir/ @danvk /types/resize-img/ @higuri +/types/resize-observer-browser/ @chivesrs /types/resolve/ @marionebl @ajafff /types/resolve-cwd/ @BendingBender /types/resolve-from/ @unional @BendingBender @@ -4652,8 +4725,9 @@ /types/restler/ @cyrilschumacher /types/restling/ @loghorn /types/restore-cursor/ @BendingBender -/types/resumablejs/ @DanielMcAssey +/types/resumablejs/ @DanielMcAssey @Johns3n /types/rethinkdb/ @alexgorbatchev @AdrianFarmadin @kondi @hoishin +/types/retinajs/ @senjyouhara /types/retry/ @krenor @BendingBender /types/retry-as-promised/ @Raigen /types/rev-hash/ @ikatyang @@ -4684,6 +4758,7 @@ /types/rocksdb/ @MeirionHughes @danwbyrne /types/roll/ @icopp /types/rolling-rate-limiter/ @l-jonas +/types/rollup-plugin-buble/ @Kocal /types/rollup-plugin-commonjs/ @eoin-obrien /types/rollup-plugin-delete/ @vladshcherbin /types/rollup-plugin-json/ @asmockler @hotell @@ -4707,6 +4782,7 @@ /types/rss/ @secondwtq /types/rsvp/ @chriskrycho /types/rsync/ @philippstucki +/types/rtlcss/ @adamzerella /types/rtree/ @oefirouz /types/run-parallel/ @mrmlnc /types/run-parallel-limit/ @mrmlnc @@ -4776,13 +4852,15 @@ /types/schema-registry/ @bonzzy /types/schwifty/ @ozum /types/scoped-http-client/ @mattvperry @rianadon -/types/screenfull/ @icholy @lionelb @joelshepherd +/types/screenfull/ @icholy @lionelb @joelshepherd @BendingBender +/types/screenfull/v3/ @icholy @lionelb @joelshepherd /types/screeps/ @MarkoSulamagi @NhanHo @bryanbecker @resir014 @Arcath @dmarcuse /types/screeps-profiler/ @ramblurr /types/script-ext-html-webpack-plugin/ @davecardwell /types/scriptjs/ @ssttevee /types/scroll-into-view/ @zivni /types/scroller/ @haskellcamargo +/types/scrollparent/ @Sintifo /types/scrollreveal/ @Davidblkx /types/scrolltofixed/ @bmdixon /types/scrypt/ @WhiteAbeLincoln @@ -4798,6 +4876,7 @@ /types/seed-random/ @l-jonas /types/seededshuffle/ @urish /types/seedrandom/ @kernhanda +/types/seen/ @admvx /types/segment-analytics/ @fongandrew /types/select2/ @borisyankov @denisname /types/select2/v3/ @borisyankov @@ -4837,6 +4916,7 @@ /types/semver-truncate/ @BendingBender /types/sencha_touch/ @brian428 /types/send/ @MikeJerred +/types/sendmail/ @saostad /types/seneca/ @psnider @kevynb /types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd @nrschultz @thomas-b @Antoine38660 @smff /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal @@ -4846,7 +4926,7 @@ /types/sequester/ @Strate /types/serialize-error/ @thomasthiebaud /types/serialize-javascript/ @lith-light-g @Pochodaydayup -/types/serialport/ @codefoster @apearson +/types/serialport/ @codefoster @apearson @cinderblock /types/serialport/v6/ @codefoster @apearson /types/serialport/v4/ @codefoster /types/serve-favicon/ @urossmolnik @@ -4854,7 +4934,7 @@ /types/serve-static/ @urossmolnik @LinusU /types/server/ @sant123 @iddan /types/server-destroy/ @gyszalai -/types/serverless/ @hassankhan +/types/serverless/ @hassankhan @JonathanWilbur /types/servicenow/ @bryceg /types/session-file-store/ @blendsdk @rokt33r /types/set-cookie-parser/ @nickp10 @ilyaztsv @@ -4866,7 +4946,7 @@ /types/sha1/ @arcdev1 /types/sha256/ @nhardy /types/shallow-equals/ @rsolomon -/types/shallowequal/ @seansfkelley @BendingBender +/types/shallowequal/ @seansfkelley @BendingBender @arndissler /types/shallowequal/v0/ @seansfkelley /types/shapefile/ @DenisCarriere @Thw0rted /types/sharedb/ @soney @@ -4882,7 +4962,7 @@ /types/shelljs/ @nikeee @voy @gkalpak @pheromonez @aldafu /types/shelljs-exec-proxy/ @qlonik /types/shimmer/ @kjin -/types/shipit/ @cyrilschumacher +/types/shipit-cli/ @cyrilschumacher /types/shipit-utils/ @cyrilschumacher /types/shopify-buy/ @openminder @straiforos @totemika /types/shorten-repo-url/ @BendingBender @@ -4944,7 +5024,7 @@ /types/sizzle/ @leonard-thieu /types/sjcl/ @Evgenus /types/skatejs/ @Hotell -/types/sketchapp/ @manekinekko +/types/sketchapp/ @manekinekko @shikanime /types/ski/ @AyaMorisawa /types/skin-tone/ @BendingBender /types/skyway/ @nakakura @izmhr @@ -4954,18 +5034,19 @@ /types/slackdown/ @nju33 /types/slackify-html/ @hypexr /types/slash/ @BendingBender -/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav +/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav @jackall3n /types/slate-base64-serializer/ @YangusKhan /types/slate-html-serializer/ @YangusKhan /types/slate-irc/ @elisee /types/slate-plain-serializer/ @YangusKhan @mkiefel -/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil +/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil @jackall3n /types/sleep/ @rajarz /types/slice-ansi/ @dwieeb /types/slickgrid/ @jbaldwin /types/slideout/ @ToastHawaii /types/slimerjs/ @alexwall /types/slocket/ @BendingBender +/types/slonik/ @sebald /types/slug/ @mhegazy /types/smart-fox-server/ @ChanceM /types/smart-truncate/ @oyalhi @@ -4982,6 +5063,8 @@ /types/snoowrap/ @vitosamson @TheAppleFreak @willwull /types/snowball-stemmers/ @ryanvolum /types/snowboy/ @dolanmiu +/types/sns-validator/ @kevin68 +/types/sntp/ @adamzerella /types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io/v1/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io-client/ @progre @divillysausages @florentpoujol @@ -4998,7 +5081,7 @@ /types/socketty/ @Nax /types/sockjs/ @pmccloghrylaing /types/sockjs-client/ @vladev @arusakov @BendingBender @renjfk -/types/solidity-parser-antlr/ @LogvinovLeon @albrow +/types/solidity-parser-antlr/ @LogvinovLeon @albrow @yxliang01 /types/solr-client/ @liul85 /types/solution-center-communicator/ @dami-gg /types/sonic-boom/ @alferpal @@ -5008,7 +5091,7 @@ /types/soundmanager2/ @elton2048 /types/soupbintcp/ @jewbre /types/source-list-map/ @e-cloud -/types/source-map-support/ @Bartvds @jason0x43 +/types/source-map-support/ @Bartvds @jason0x43 @natealcedo /types/space-pen/ @vvakame /types/spark-md5/ @bastienmoulia /types/sparkly/ @BendingBender @@ -5024,13 +5107,14 @@ /types/speakingurl/ @Goldsmith42 /types/spected/ @benneq /types/spectrum/ @M-Zuber @Ailrun +/types/spellchecker/ @dalevfenton /types/split/ @marcinporebski /types/split.js/ @icholy /types/split2/ @mugeso /types/splunk-bunyan-logger/ @bricka /types/splunk-logging/ @bricka /types/spotify-api/ @skovmand -/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends +/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends @deini /types/sprintf/ @soywiz @BendingBender /types/sprintf-js/ @jasonswearingen @BendingBender @cdagli /types/sql-bricks/ @adn05 @paleo @@ -5047,6 +5131,7 @@ /types/ssh2-sftp-client/ @igrayson @ascariandrea @kartik2406 @viamuli /types/ssh2-streams/ @rbuckton /types/sshpk/ @mabels +/types/ssri/ @huan086 /types/stack-mapper/ @rogierschouten /types/stack-trace/ @exceptionless /types/stack-utils/ @BendingBender @@ -5084,14 +5169,16 @@ /types/storybook__addon-actions/ @joscha @jicjjang /types/storybook__addon-backgrounds/ @hyunseob @adhrinae /types/storybook__addon-centered/ @kiyopikko -/types/storybook__addon-info/ @mkornblum @fyrkant +/types/storybook__addon-info/ @mkornblum @fyrkant @RunningCoderLee /types/storybook__addon-jest/ @halfmatthalfcat -/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay @MLoughry +/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay @MLoughry @alanhchoi /types/storybook__addon-links/ @joscha @jessepinho /types/storybook__addon-notes/ @joscha @amacleay @MLoughry /types/storybook__addon-options/ @joscha @simonhn @amacleay @gaetanmaisse @adam187 /types/storybook__addon-storyshots/ @bradleyayers /types/storybook__addon-viewport/ @Vinnl +/types/storybook__addons/ @bmatcuk +/types/storybook__channels/ @bmatcuk /types/storybook__react/ @joscha @wapgear @dandean /types/storybook__react-native/ @joscha @wapgear @alechill @iRoachie @ceyhuno /types/storybook__vue/ @pntgupta @@ -5133,7 +5220,7 @@ /types/strip-color/ @BendingBender /types/strip-indent/ @BendingBender /types/strip-json-comments/ @dmoonfire -/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos +/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos @saranshkataria @0xJoKe /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder @@ -5144,11 +5231,11 @@ /types/strophe/ @DavidKDeutsch /types/strophe.js/ @DavidKDeutsch /types/structured-source/ @azu -/types/styled-components/ @Igorbek @Igmat @lavoaster @Jessidhia +/types/styled-components/ @Igorbek @Igmat @lavoaster @Jessidhia @jkillian @eps1lon @flavordaaave /types/styled-components/v3/ @Igorbek @Igmat /types/styled-jsx/ @R1ZZU /types/styled-react-modal/ @Lavoaster -/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 @gretzky +/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 @gretzky @chrislopresto /types/styled-theming/ @ArjanJ /types/stylelint/ @alan-agius4 @filipsalpe /types/stylelint/v7/ @alan-agius4 @@ -5165,12 +5252,13 @@ /types/summernote/ @wstaelens @nusantara-cloud /types/sumo-logger/ @forabi @clementallen /types/suncalc/ @horiuchi -/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer +/types/sunrise-sunset-js/ @hmajid2301 +/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer @theQuazz /types/superagent/v2/ @varju @NicoZelaya @mxl /types/superagent-bunyan/ @bricka /types/superagent-no-cache/ @mxl /types/superagent-prefix/ @mxl -/types/supercluster/ @DenisCarriere +/types/supercluster/ @DenisCarriere @Manc /types/superstruct/ @edwardsnare /types/supertest/ @varju @pietu /types/supertest-as-promised/ @tkrotoff @@ -5225,16 +5313,18 @@ /types/table/ @evanshortiss @mrmlnc /types/tableau/ @protip /types/tableify/ @forivall -/types/tabris-plugin-firebase/ @eclipsesource /types/tabtab/ @vojtechhabarta @kamontat /types/tabulator/ @euginio +/types/tabulator-tables/ @jojoshua /types/tail/ @spacejack /types/tapable/ @e-cloud @johnnyreilly /types/tapable/v0/ @e-cloud /types/tape/ @Bartvds @sodatea @DennisSchwartz @mikehenrty @rostrowski +/types/tape-async/ @ExE-Boss /types/tar/ @SomaticIT @connor4312 /types/tar-fs/ @Umoxfo /types/tar-stream/ @glicht +/types/tarantool-driver/ @zharkov-eu /types/task-graph-runner/ @mgroenhoff /types/task-worklet/ @karol-majewski /types/tcp-ping/ @stegano @@ -5254,7 +5344,6 @@ /types/terminal-link/ @BendingBender /types/terminal-menu/ @aravindarun /types/tern/ @nkappler -/types/terser/ @JordiAnderl /types/terser-webpack-plugin/ @Danscho /types/test-console/ @roberto @guidoux @gbmoretti /types/test-listen/ @stephenmathieson @@ -5274,14 +5363,14 @@ /types/texzilla/ @m93a /types/tgfancy/ @Dabolus /types/theming/ @eps1lon -/types/theo/ @petekp +/types/theo/ @petekp @laitine /types/thepiratebay/ @jsorrell -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim +/types/three/ @gyohk @florentpoujol @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @Pro @efokschaner @PsychoSTS @apurvaojas @NotWoods @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim @saranshkataria @psuter /types/three-tds-loader/ @KonstantinLukaschenko @sschoensee /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston /types/throttle/ @BendingBender -/types/throttle-debounce/ @czbuchi @franklixuefei +/types/throttle-debounce/ @czbuchi @franklixuefei @oddsund /types/through/ @AndrewGaspar /types/through2/ @Bartvds @jedmao @valotas @TeamworkGuy2 @Alorel /types/through2/v0/ @Bartvds @jedmao @@ -5305,13 +5394,14 @@ /types/tiny-secp256k1/ @eduhenke /types/tiny-slider-react/ @screendriver /types/tinycolor2/ @M-Zuber @geertjansen @nvh @Ailrun -/types/tinycon/ @dwaxweiler +/types/tinycon/ @dwaxweiler @jaulz /types/tinycopy/ @vvatanabe /types/tinymce/ @martinduparc @ipoul @nicohartto /types/titanium/ @appcelerator @janvennemann /types/title/ @fa7ad /types/tldjs/ @geoffreak /types/tlds/ @ajshres +/types/tmi.js/ @wpapsco /types/tmp/ @optical @Perlmint /types/to-absolute-glob/ @ajafff /types/to-camel-case/ @j-f1 @@ -5321,6 +5411,7 @@ /types/to-title-case-gouch/ @stpettersens /types/toastr/ @borisyankov /types/tocktimer/ @evanshortiss +/types/tokenizr/ @aNickzz /types/tokgen/ @l-jonas /types/toobusy-js/ @atd-schubert @BendingBender /types/tooltipster/ @stephenlautier @pjmagee @VorobeY1326 @leonard-thieu @janhi @joeskeen @@ -5352,6 +5443,7 @@ /types/trianglify/ @unindented /types/trie-prefix-tree/ @jlismore /types/trim/ @skysteve +/types/trim-newlines/ @djcsdy /types/triple-beam/ @danwbyrne /types/triplesec/ @threesquared /types/trunk8/ @niemyjski @@ -5361,6 +5453,7 @@ /types/tspromise/ @soywiz /types/ttf2woff2/ @ThomasdenH /types/tunnel/ @BendingBender +/types/turndown/ @sergey-zhidkov /types/tus-js-client/ @kevhiggins @Acconut /types/tv4/ @Bartvds @psnider /types/tween.js/ @Amos47 @sunetos @jzarnikov @alexburner @@ -5370,8 +5463,8 @@ /types/twilio/ @nickiannone @ashleybrener /types/twilio-common/ @gatimus /types/twilio-video/ @minddocdev @darioblanco -/types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery -/types/twitch-ext/ @beheh +/types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery @justgoscha +/types/twitch-ext/ @beheh @FedeDR /types/twitter/ @BendingBender /types/twitter-for-web/ @chitoku-k /types/twitter-stream-channels/ @adrianbardan @@ -5427,6 +5520,7 @@ /types/universal-analytics/ @Bartvds @DarkerTV /types/universal-cookie/ @tomi /types/unorm/ @chbrown +/types/unsplash-js/ @markupcode /types/untildify/ @BendingBender /types/unused-filename/ @BendingBender /types/unzip/ @coding2012 @@ -5458,11 +5552,15 @@ /types/urlsafe-base64/ @tkrotoff /types/usage/ @pvomhoff /types/usb/ @underscorebrody @thegecko +/types/use-persisted-state/ @karol-majewski +/types/use-set-interval/ @screendriver +/types/use-set-timeout/ @screendriver /types/user-event/ @whtsky /types/user-home/ @mhegazy /types/useragent/ @geoffreak /types/username/ @kayahr @krivachy /types/utf8/ @zelein +/types/utif/ @smajl @nkprince007 @massic80 /types/util-deprecate/ @BendingBender /types/util.promisify/ @adamvoss /types/utils-merge/ @chrootsu @@ -5496,11 +5594,11 @@ /types/vertx3-eventbus-client/ @oddeirik /types/vex-js/ @gdcohan /types/vexdb/ @MayorMonty -/types/vexflow/ @rquiring @sebastianhaas @bohoffi @sschmidTU +/types/vexflow/ @rquiring @sebastianhaas @bohoffi @sschmidTU @bneumann /types/vfile/ @bizen241 @rokt33r /types/vfile-location/ @ikatyang @rokt33r /types/vfile-message/ @rokt33r -/types/victory/ @asvetliakov @snerks @Havret @alredyExist @jlismore +/types/victory/ @asvetliakov @snerks @Havret @allreadyExisted @jlismore /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus @giofreitas @gjanblaszczyk @sroucheray @AkxeOne @meikidd /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 @@ -5529,7 +5627,9 @@ /types/voronoi-diagram/ @michaelneu /types/vorpal/ @danwbyrne /types/vortex-web-client/ @Pro +/types/voucher-code-generator/ @JWebCoder /types/voximplant-websdk/ @aylarov +/types/vue-chartkick/ @cnsmedia /types/vue-color/ @me /types/vue-markdown/ @neodon /types/vue-resource/ @kaorun343 @@ -5544,8 +5644,8 @@ /types/w3c-image-capture/ @cosium /types/w3c-permissions/ @jberube /types/w3c-screen-orientation/ @kenchris -/types/w3c-web-usb/ @larsgk -/types/wait-for-localhost/ @BendingBender +/types/w3c-web-usb/ @larsgk @thegecko +/types/wait-on/ @ifiokjr /types/waitme/ @totpero /types/wake_on_lan/ @SrTobi /types/walk/ @poppa @@ -5572,7 +5672,7 @@ /types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk @sogasg @donamk @dkent600 @nerddan @alexkvak /types/web3-eth-abi/ @LogvinovLeon /types/web3-provider-engine/ @LogvinovLeon -/types/webappsec-credential-management/ @iainmcgin +/types/webappsec-credential-management/ @iainmcgin @Hartimer /types/webassembly-js-api/ @periklis @chicoxyzzy /types/webassembly-web-api/ @jhenninger /types/webcl/ @NCARalph @@ -5593,7 +5693,7 @@ /types/webpack-config-utils/ @hotell /types/webpack-dev-middleware/ @bumbleblym @reduckted @chrisabrams /types/webpack-dev-middleware/v1/ @bumbleblym @reduckted -/types/webpack-dev-server/ @maestroh @daveparslow @ZheyangSong @alan-agius4 @arturovt +/types/webpack-dev-server/ @maestroh @daveparslow @ZheyangSong @alan-agius4 @arturovt @davecardwell /types/webpack-dotenv-plugin/ @kryops /types/webpack-env/ @use-strict @rhonsby /types/webpack-fail-plugin/ @deevus @@ -5610,6 +5710,7 @@ /types/webpack-stream/ @iclanton @bumbleblym /types/webpack-subresource-integrity/ @huan086 /types/webpack-validator/ @deevus +/types/webpack-watched-glob-entries-plugin/ @ChaosinaCan /types/webpackbar/ @rynclark /types/webpagetest/ @ksm2 /types/webprogbase-console-view/ @veetaha @@ -5660,10 +5761,12 @@ /types/wiring-pi/ @NoHomey /types/wnumb/ @acoreyj /types/wonder.js/ @yyc-git +/types/word-extractor/ @saboya /types/word-list-json/ @dovidm /types/word2vector/ @renekeijzer /types/wordcloud/ @joeskeen /types/words-to-numbers/ @James-Frowen +/types/wordwrap/ @ark120202 /types/workbox-sw/ @wessberg /types/workbox-webpack-plugin/ @kgroat /types/worker-threads-pool/ @BendingBender @@ -5724,7 +5827,7 @@ /types/ydn-db/ @yathit @gabrielmaldi /types/year-days/ @BendingBender /types/yeoman-assert/ @Toilal -/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 +/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 @haggen /types/yeoman-test/ @ikatyang /types/yesql/ @Sumolari /types/yn/ @BendingBender @@ -5736,6 +5839,7 @@ /types/yosay/ @armorik83 /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 @terrymun @paulhobbel /types/youtube-dl/ @bsurai @moshfeu +/types/youtube-player/ @jurca /types/yui/ @giabao /types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray @vincentjames501 @robertbullen @sat0yu @dancrumb /types/z-schema/ @pgonzal diff --git a/.travis.yml b/.travis.yml index 9bd31bda14..6ea69355da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,9 @@ language: node_js node_js: - 8 -sudo: false - notifications: email: false + +script: + - npm run test + - if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate 1; fi \ No newline at end of file diff --git a/notNeededPackages.json b/notNeededPackages.json index 4289393363..24f1f0e0e0 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -216,6 +216,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/camel-case", "asOfVersion": "1.2.1" }, + { + "libraryName": "camelcase", + "typingsPackageName": "camelcase", + "sourceRepoURL": "https://github.com/sindresorhus/camelcase", + "asOfVersion": "5.2.0" + }, { "libraryName": "catalog", "typingsPackageName": "catalog", @@ -240,6 +246,12 @@ "sourceRepoURL": "https://github.com/mapbox/cheap-ruler", "asOfVersion": "2.5.0" }, + { + "libraryName": "chokidar", + "typingsPackageName": "chokidar", + "sourceRepoURL": "https://github.com/paulmillr/chokidar", + "asOfVersion": "2.1.3" + }, { "libraryName": "chunked-dc", "typingsPackageName": "chunked-dc", @@ -258,6 +270,12 @@ "sourceRepoURL": "https://github.com/tj/commander.js", "asOfVersion": "2.12.2" }, + { + "libraryName": "conf", + "typingsPackageName": "conf", + "sourceRepoURL": "https://github.com/sindresorhus/conf", + "asOfVersion": "3.0.0" + }, { "libraryName": "confirmdialog", "typingsPackageName": "confirmdialog", @@ -414,6 +432,12 @@ "sourceRepoURL": "git@github.com:KyleAMathews/deepmerge.git", "asOfVersion": "2.2.0" }, + { + "libraryName": "del", + "typingsPackageName": "del", + "sourceRepoURL": "https://github.com/sindresorhus/del", + "asOfVersion": "4.0.0" + }, { "libraryName": "delay", "typingsPackageName": "delay", @@ -510,6 +534,12 @@ "sourceRepoURL": "https://github.com/Sembiance/email-validator", "asOfVersion": "1.0.6" }, + { + "libraryName": "env-paths", + "typingsPackageName": "env-paths", + "sourceRepoURL": "https://github.com/sindresorhus/env-paths", + "asOfVersion": "2.1.0" + }, { "libraryName": "error-stack-parser", "typingsPackageName": "error-stack-parser", @@ -678,6 +708,12 @@ "sourceRepoURL": "https://github.com/jdalrymple/node-gitlab", "asOfVersion": "2.0.0" }, + { + "libraryName": "globby", + "typingsPackageName": "globby", + "sourceRepoURL": "https://github.com/sindresorhus/globby", + "asOfVersion": "9.1.0" + }, { "libraryName": "Google Cloud Storage", "typingsPackageName": "google-cloud__storage", @@ -714,6 +750,12 @@ "sourceRepoURL": "https://github.com/ivogabe/gulp-typescript", "asOfVersion": "2.13.0" }, + { + "libraryName": "handlebars", + "typingsPackageName": "handlebars", + "sourceRepoURL": "https://github.com/wycats/handlebars.js", + "asOfVersion": "4.1.0" + }, { "libraryName": "handsontable", "typingsPackageName": "handsontable", @@ -834,6 +876,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/is-lower-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "is-online", + "typingsPackageName": "is-online", + "sourceRepoURL": "https://github.com/sindresorhus/is-online", + "asOfVersion": "8.1.0" + }, { "libraryName": "is-plain-object", "typingsPackageName": "is-plain-object", @@ -990,6 +1038,12 @@ "sourceRepoURL": "https://github.com/steelsojka/lodash-decorators", "asOfVersion": "4.0.0" }, + { + "libraryName": "log-update", + "typingsPackageName": "log-update", + "sourceRepoURL": "https://github.com/sindresorhus/log-update", + "asOfVersion": "3.1.0" + }, { "libraryName": "log4javascript", "typingsPackageName": "log4javascript", @@ -1014,6 +1068,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/lower-case-first", "asOfVersion": "1.0.1" }, + { + "libraryName": "make-dir", + "typingsPackageName": "make-dir", + "sourceRepoURL": "https://github.com/sindresorhus/make-dir", + "asOfVersion": "2.1.0" + }, { "libraryName": "mali", "typingsPackageName": "mali", @@ -1086,6 +1146,12 @@ "sourceRepoURL": "https://github.com/LearnBoost/monk.git", "asOfVersion": "6.0.0" }, + { + "libraryName": "move-file", + "typingsPackageName": "move-file", + "sourceRepoURL": "https://github.com/sindresorhus/move-file", + "asOfVersion": "1.1.0" + }, { "libraryName": "MQTT", "typingsPackageName": "mqtt", @@ -1110,6 +1176,12 @@ "sourceRepoURL": "https://github.com/theoephraim/node-pg-migrate#readme", "asOfVersion": "2.15.0" }, + { + "libraryName": "png-async", + "typingsPackageName": "png-async", + "sourceRepoURL": "https://github.com/kanreisa/node-png-async", + "asOfVersion": "0.9.4" + }, { "libraryName": "node-waves", "typingsPackageName": "node-waves", @@ -1140,12 +1212,36 @@ "sourceRepoURL": "https://github.com/foretagsplatsen/numbro/", "asOfVersion": "1.9.3" }, + { + "libraryName": "on-change", + "typingsPackageName": "on-change", + "sourceRepoURL": "https://github.com/sindresorhus/on-change", + "asOfVersion": "1.1.0" + }, { "libraryName": "Onsen UI", "typingsPackageName": "onsenui", "sourceRepoURL": "http://onsen.io", "asOfVersion": "2.0.0" }, + { + "libraryName": "ora", + "typingsPackageName": "ora", + "sourceRepoURL": "https://github.com/sindresorhus/ora", + "asOfVersion": "3.2.0" + }, + { + "libraryName": "p-event", + "typingsPackageName": "p-event", + "sourceRepoURL": "https://github.com/sindresorhus/p-event", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "p-limit", + "typingsPackageName": "p-limit", + "sourceRepoURL": "https://github.com/sindresorhus/p-limit", + "asOfVersion": "2.2.0" + }, { "libraryName": "p-map", "typingsPackageName": "p-map", @@ -1158,6 +1254,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/p-pipe", "asOfVersion": "2.0.1" }, + { + "libraryName": "p-queue", + "typingsPackageName": "p-queue", + "sourceRepoURL": "https://github.com/sindresorhus/p-queue", + "asOfVersion": "3.2.1" + }, { "libraryName": "p-throttle", "typingsPackageName": "p-throttle", @@ -1230,6 +1332,12 @@ "sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js", "asOfVersion": "1.0.4" }, + { + "libraryName": "pkg-conf", + "typingsPackageName": "pkg-conf", + "sourceRepoURL": "https://github.com/sindresorhus/pkg-conf", + "asOfVersion": "3.0.0" + }, { "libraryName": "plottable", "typingsPackageName": "plottable", @@ -1278,6 +1386,12 @@ "sourceRepoURL": "https://github.com/kazuhikoarase/qrcode-generator", "asOfVersion": "1.0.6" }, + { + "libraryName": "query-string", + "typingsPackageName": "query-string", + "sourceRepoURL": "https://github.com/sindresorhus/query-string", + "asOfVersion": "6.3.0" + }, { "libraryName": "Raven JS", "typingsPackageName": "raven-js", @@ -1686,6 +1800,12 @@ "sourceRepoURL": "http://tabrisjs.com", "asOfVersion": "1.8.0" }, + { + "libraryName": "tabris-plugin-firebase", + "typingsPackageName": "tabris-plugin-firebase", + "sourceRepoURL": "https://github.com/eclipsesource/tabris-plugin-firebase", + "asOfVersion": "2.1.0" + }, { "libraryName": "tcomb", "typingsPackageName": "tcomb", diff --git a/package.json b/package.json index 1a5124c035..f4c48b1b32 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "scripts": { "compile-scripts": "tsc -p scripts", "not-needed": "node scripts/not-needed.js", + "update-codeowners": "node scripts/update-codeowners.js", "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed", "lint": "dtslint types" }, diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 899f96af64..6e0fd5a58c 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,13 +1,10 @@ { "compilerOptions": { + "allowJs": true, + "checkJs": true, "module": "commonjs", "target": "es6", - "noImplicitAny": true, - "strictNullChecks": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + "strict": true, "baseUrl": "../types", "typeRoots": [ "../types" @@ -15,4 +12,4 @@ "types": [], "forceConsistentCasingInFileNames": true } -} \ No newline at end of file +} diff --git a/scripts/update-codeowners.js b/scripts/update-codeowners.js new file mode 100644 index 0000000000..56eda138c6 --- /dev/null +++ b/scripts/update-codeowners.js @@ -0,0 +1,126 @@ +/// +// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally +const cp = require("child_process"); +const Octokit = require("@octokit/rest"); +const { AllPackages, getDefinitelyTyped, loggerWithErrors, + parseDefinitions, parseNProcesses, clean } = require("types-publisher"); +const { writeFile } = require("fs-extra"); + +async function main() { + const options = { definitelyTypedPath: ".", progress: false, parseInParallel: true }; + const log = loggerWithErrors()[0]; + + clean(); + const dt = await getDefinitelyTyped(options, log); + await parseDefinitions(dt, { nProcesses: parseNProcesses(), definitelyTypedPath: "." }, log); + const allPackages = await AllPackages.read(dt); + const typings = allPackages.allTypings(); + const maxPathLen = Math.max(...typings.map(t => t.subDirectoryPath.length)); + const entries = mapDefined(typings, t => getEntry(t, maxPathLen)); + await writeFile([options.definitelyTypedPath, ".github", "CODEOWNERS"].join("/"), `${header}\n\n${entries.join("\n")}\n`, { encoding: "utf-8" }); +} + +const token = /** @type {string} */(process.env.GH_TOKEN); +const gh = new Octokit(); +const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"] +const now = new Date(); +const branchName = `codeowner-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`; +const remoteUrl = `https://${token}@github.com/DefinitelyTyped/DefinitelyTyped.git`; +runSequence([ + ["git", ["checkout", "."]], // reset any changes +]); + +main().then(() => { + runSequence([ + ["git", ["checkout", "-b", branchName]], // create a branch + ["git", ["add", ".github/CODEOWNERS"]], // Add CODEOWNERS + ["git", ["commit", "-m", `"Update CODEOWNERS"`]], // Commit all changes + ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork + ["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch + ]); + + gh.authenticate({ + type: "token", + token, + }); + return gh.pulls.create({ + owner: "DefinitelyTyped", + repo: "DefinitelyTyped", + maintainer_can_modify: true, + title: `🤖 CODEOWNERS has changed`, + head: `DefinitelyTyped:${branchName}`, + base: "master", + body: + `Please review the diff and merge if no changes are unexpected. + +cc ${reviewers.map(r => "@" + r).join(" ")}`, + }) +}).then(r => { + const num = r.data.number; + console.log(`Pull request ${num} created.`); + return gh.pulls.createReviewRequest({ + owner: "DefinitelyTyped", + repo: "DefinitelyTyped", + number: num, + reviewers, + }); +}).then(() => { + console.log(`Reviewers requested, done.`); +}).catch(e => { + console.error(e); + process.exit(1); +}); + +/** @param {[string, string[]][]} tasks */ +function runSequence(tasks) { + for (const task of tasks) { + console.log(`${task[0]} ${task[1].join(" ")}`); + const result = cp.spawnSync(task[0], task[1], { timeout: 100000, shell: true, stdio: "inherit" }); + if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`); + } +} + +/** @param {number} number */ +function padNum(number) { + const str = "" + number; + return str.length >= 2 ? str : "0" + str; +} + + +const header = +`# This file is generated. +# Add yourself to the "Definitions by:" list instead. +# See https://github.com/DefinitelyTyped/DefinitelyTyped#edit-an-existing-package`; + +/** + * @param { { contributors: ReadonlyArray<{githubUsername?: string }>, subDirectoryPath: string} } pkg + * @param {number} maxPathLen + * @return {string | undefined} + */ +function getEntry(pkg, maxPathLen) { + const users = mapDefined(pkg.contributors, c => c.githubUsername); + if (!users.length) { + return undefined; + } + + const path = `${pkg.subDirectoryPath}/`.padEnd(maxPathLen); + return `/types/${path} ${users.map(u => `@${u}`).join(" ")}`; +} + +/** + * @template T,U + * @param {ReadonlyArray} arr + * @param {(t: T) => U | undefined} mapper + * @return U[] + */ +function mapDefined(arr, mapper) { + const out = []; + for (const a of arr) { + const res = mapper(a); + if (res !== undefined) { + out.push(res); + } + } + return out; +} + diff --git a/types/adone/index.d.ts b/types/adone/index.d.ts index 521bdf6e03..f7249c00b4 100644 --- a/types/adone/index.d.ts +++ b/types/adone/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ciferox/adone // Definitions by: am , Maximus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// /// diff --git a/types/adone/tslint.json b/types/adone/tslint.json index 2a9ae5c804..177bd33372 100644 --- a/types/adone/tslint.json +++ b/types/adone/tslint.json @@ -16,4 +16,4 @@ "await-promise": false, "no-restricted-globals": false } -} \ No newline at end of file +} diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index fdd0f395fe..1d588f2090 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -98,6 +98,7 @@ let _algoliaIndexSettings: IndexSettings = { placeholders: { '': [''] }, camelCaseAttributes: [''], sortFacetValuesBy: 'count', + queryLanguages: ['fr', 'es'], }; let _algoliaQueryParameters: QueryParameters = { diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 8e3ba4c5ab..1dc50603c7 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -6,6 +6,7 @@ // Samuel Vaillant // Kai Eichinger // Nery Ortez +// Antoine Rousseau // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -1778,12 +1779,20 @@ declare namespace algoliasearch { }; /** * List of attributes on which to do a decomposition of camel case words. - * - https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ + * https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ */ camelCaseAttributes?: string[]; - + /** + * Controls how facet values are sorted. + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ sortFacetValuesBy?: 'count' | 'alpha'; + /** + * Sets the languages to be used by language-specific settings and functionalities + * such as ignorePlurals, removeStopWords, and CJK word-detection. + * https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/ + */ + queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>; } interface Response { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 11e22f5ccf..74c4b1bf15 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -7,6 +7,7 @@ // Claas Brüggemann // Kai Eichinger // Nery Ortez +// Antoine Rousseau // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -534,9 +535,16 @@ declare namespace algoliasearch { userData?: string | object; /** + * Controls how facet values are sorted. * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ sortFacetValuesBy?: 'count' | 'alpha'; + /** + * Sets the languages to be used by language-specific settings and functionalities + * such as ignorePlurals, removeStopWords, and CJK word-detection. + * https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/ + */ + queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>; } namespace SearchForFacetValues { diff --git a/types/amap-js-api/amap-js-api-tests.ts b/types/amap-js-api/amap-js-api-tests.ts new file mode 100644 index 0000000000..ee7a2ac583 --- /dev/null +++ b/types/amap-js-api/amap-js-api-tests.ts @@ -0,0 +1,3376 @@ +/** + * preset.ts + */ + +declare const map: AMap.Map; +declare const lnglat: AMap.LngLat; +declare const size: AMap.Size; +declare const lnglatTuple: [number, number]; +declare const pixel: AMap.Pixel; +declare const markerShape: AMap.MarkerShape; +declare const icon: AMap.Icon; +declare const bounds: AMap.Bounds; +declare const div: HTMLDivElement; +declare const lang: AMap.Lang; +declare const domEle: HTMLElement; +declare const canvasEle: HTMLCanvasElement; +declare const imgEle: HTMLImageElement; + +declare const circle: AMap.Circle; +declare const marker: AMap.Marker; +declare const layer: AMap.Layer; +declare const tileLayer: AMap.TileLayer; +declare const massMarksLayer: AMap.MassMarks; + +// declare const videoLayer: AMap.VideoLayer; +// declare const buildings: AMap.Buildings; +// declare const canvasLayer: AMap.CanvasLayer; +// declare const flexible: AMap.TileLayer.Flexible; +// declare const imageLayer: AMap.ImageLayer; +// declare const tileLayerGroup: AMap.LayerGroup; +// declare const layerGroup: AMap.LayerGroup; +// declare const trafficLayer: AMap.TileLayer.Traffic; +// declare const bezierCurve: AMap.BezierCurve; +// declare const contextMenu: AMap.ContextMenu; +// declare const polyline: AMap.Polyline; +// declare const polygon: AMap.Polygon; + +/** + * arryBounds.ts + */ + +// $ExpectType ArrayBounds +const testArrayBounds = new AMap.ArrayBounds([lnglat, lnglat, lnglat]); + +// $ExpectType LngLat[] +testArrayBounds.bounds; + +// $ExpectType boolean +testArrayBounds.contains(lnglat); + +// $ExpectType Bounds +testArrayBounds.toBounds(); + +// $ExpectType LngLat +testArrayBounds.getCenter(); + +/** + * bounds.ts + */ + +// $ExpectType Bounds +const testBounds = new AMap.Bounds(lnglat, lnglat); + +// $ExpectType boolean +testBounds.contains(lnglat); +// $ExpectType boolean +testBounds.contains(lnglatTuple); + +// $ExpectType LngLat +testBounds.getCenter(); + +// $ExpectType LngLat +testBounds.getSouthWest(); + +// $ExpectType LngLat +testBounds.getSouthEast(); + +// $ExpectType LngLat +testBounds.getNorthEast(); + +// $ExpectType LngLat +testBounds.getNorthWest(); + +// $ExpectType string +testBounds.toString(); + +/** + * browser.ts + */ + +const brwoser = AMap.Browser; + +// $ExpectType string +brwoser.ua; + +// $ExpectType boolean +brwoser.mobile; + +const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other' = brwoser.plat; + +// $ExpectType boolean +brwoser.mac; + +// $ExpectType boolean +brwoser.windows; + +// $ExpectType boolean +brwoser.ios; + +// $ExpectType boolean +brwoser.iPad; + +// $ExpectType boolean +brwoser.iPhone; + +// $ExpectType boolean +brwoser.android; + +// $ExpectType boolean +brwoser.android23; + +// $ExpectType boolean +brwoser.chrome; + +// $ExpectType boolean +brwoser.firefox; + +// $ExpectType boolean +brwoser.safari; + +// $ExpectType boolean +brwoser.wechat; + +// $ExpectType boolean +brwoser.uc; + +// $ExpectType boolean +brwoser.qq; + +// $ExpectType boolean +brwoser.ie; + +// $ExpectType boolean +brwoser.ie6; + +// $ExpectType boolean +brwoser.ie7; + +// $ExpectType boolean +brwoser.ie8; + +// $ExpectType boolean +brwoser.ie9; + +// $ExpectType boolean +brwoser.ie10; + +// $ExpectType boolean +brwoser.ie11; + +// $ExpectType boolean +brwoser.edge; + +// $ExpectType boolean +brwoser.ielt9; + +// $ExpectType boolean +brwoser.baidu; + +// $ExpectType boolean +brwoser.isLocalStorage; + +// $ExpectType boolean +brwoser.isGeolocation; + +// $ExpectType boolean +brwoser.mobileWebkit; + +// $ExpectType boolean +brwoser.mobileWebkit3d; + +// $ExpectType boolean +brwoser.mobileOpera; + +// $ExpectType boolean +brwoser.retina; + +// $ExpectType boolean +brwoser.touch; + +// $ExpectType boolean +brwoser.msPointer; + +// $ExpectType boolean +brwoser.pointer; + +// $ExpectType boolean +brwoser.webkit; + +// $ExpectType boolean +brwoser.ie3d; + +// $ExpectType boolean +brwoser.webkit3d; + +// $ExpectType boolean +brwoser.gecko3d; + +// $ExpectType boolean +brwoser.opera3d; + +// $ExpectType boolean +brwoser.any3d; + +// $ExpectType boolean +brwoser.isCanvas; + +// $ExpectType boolean +brwoser.isSvg; + +// $ExpectType boolean +brwoser.isVML; + +// $ExpectType boolean +brwoser.isWorker; + +// $ExpectType boolean +brwoser.isWebsocket; + +// $ExpectType boolean +brwoser.isWebGL(); + +/** + * convert-from.ts + */ + +declare const convertType: 'baidu' | 'mapbar' | 'gps' | null; +// $ExpectType void +AMap.convertFrom(lnglat, convertType, (status, result) => { + const temp: 'complete' | 'error' = status; + if (typeof result !== 'string') { + // $ExpectType string + result.info; + // $ExpectType LngLat[] + result.locations; + } else { + // $ExpectType string + result; + } +}); +// $ExpectType void +AMap.convertFrom([lnglat], null, () => { }); +// $ExpectType void +AMap.convertFrom(lnglatTuple, null, () => { }); +// $ExpectType void +AMap.convertFrom([lnglatTuple], null, () => { }); + +/** + * dom-util.ts + */ + +const domUtil = AMap.DomUtil; + +// $ExpectType Size +domUtil.getViewport(div); + +// $ExpectType Pixel +domUtil.getViewportOffset(div); + +// $ExpectType HTMLDivElement +domUtil.create('div'); +// $ExpectType HTMLAnchorElement +domUtil.create('a'); +// $ExpectType HTMLDivElement +domUtil.create('div', div); +// $ExpectType HTMLDivElement +domUtil.create('div', div, 'className'); + +// $ExpectType void +domUtil.setClass(div); +// $ExpectType void +domUtil.setClass(div, 'className'); + +// $ExpectType boolean +domUtil.hasClass(div, 'className'); + +// $ExpectType void +domUtil.removeClass(div, 'className'); + +// $ExpectType void +domUtil.setOpacity(div, 1); + +// $ExpectType void +domUtil.rotate(div, 10); +// $ExpectType void +domUtil.rotate(div, 10, { x: 10, y: 10 }); + +const util2: typeof AMap.DomUtil = domUtil.setCss(div, { textAlign: 'left' }); +// $ExpectError +domUtil.setCss(div, { textAlign: 10 }); + +// $ExpectType void +domUtil.empty(div); + +// $ExpectType void +domUtil.remove(div); + +/** + * event.ts + */ + +// $ExpectType Map +map.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; +}); + +// $ExpectType EventListener<0> +AMap.event.addDomListener(div, 'click', event => { + // $ExpectType number + event.clientX; +}); + +// $ExpectType EventListener<1> +AMap.event.addListener(map, 'hotspotclick', function(event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); +AMap.event.addListener(map, 'click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); + +// $ExpectType EventListener<1> +const eventListener = AMap.event.addListenerOnce(map, 'hotspotclick', function(event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType void +AMap.event.removeListener(eventListener); + +// $ExpectType void +AMap.event.trigger(map, 'click', { + lnglat, + pixel, + target: map +}); +// $ExpectType void +AMap.event.trigger(map, 'hotspotclick', { + lnglat, + name: 'name', + id: 'id', + isIndoorPOI: true +}); +// $ExpectType void +AMap.event.trigger(map, 'complete'); + +/** + * geometry-util.ts + */ + +{ + const point = lnglat; + const pointTuple = lnglatTuple; + const line = [point]; + const lineTuple = [pointTuple]; + const ring = [point]; + const ringTuple = [pointTuple]; + const polygon = [ring]; + const polygonTuple = [ringTuple]; + const geometryUtil = AMap.GeometryUtil; + + // $ExpectType number + geometryUtil.distance(point, point); + // $ExpectType number + geometryUtil.distance(pointTuple, pointTuple); + // $ExpectType number + geometryUtil.distance(point, line); + // $ExpectType number + geometryUtil.distance(pointTuple, lineTuple); + + // $ExpectType number + geometryUtil.ringArea(ring); + // $ExpectType number + geometryUtil.ringArea(ringTuple); + + // $ExpectType boolean + geometryUtil.isClockwise(ring); + // $ExpectType boolean + geometryUtil.isClockwise(ringTuple); + + // $ExpectType number + geometryUtil.distanceOfLine(line); + // $ExpectType number + geometryUtil.distanceOfLine(lineTuple); + + // $ExpectType [number, number][] + geometryUtil.ringRingClip(ring, ring); + // $ExpectType [number, number][] + geometryUtil.ringRingClip(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesRingRingIntersect(ring, ring); + // $ExpectType boolean + geometryUtil.doesRingRingIntersect(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesLineRingIntersect(line, ring); + // $ExpectType boolean + geometryUtil.doesLineRingIntersect(lineTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesLineLineIntersect(line, line); + // $ExpectType boolean + geometryUtil.doesLineLineIntersect(lineTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentPolygonIntersect(point, point, polygon); + // $ExpectType boolean + geometryUtil.doesSegmentPolygonIntersect(pointTuple, pointTuple, polygonTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentRingIntersect(point, point, ring); + // $ExpectType boolean + geometryUtil.doesSegmentRingIntersect(pointTuple, pointTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentLineIntersect(point, point, line); + // $ExpectType boolean + geometryUtil.doesSegmentLineIntersect(pointTuple, pointTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentsIntersect(point, point, point, point); + // $ExpectType boolean + geometryUtil.doesSegmentsIntersect(pointTuple, pointTuple, pointTuple, pointTuple); + + // $ExpectType boolean + geometryUtil.isPointInRing(point, ring); + // $ExpectType boolean + geometryUtil.isPointInRing(pointTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.isRingInRing(ring, ring); + // $ExpectType boolean + geometryUtil.isRingInRing(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.isPointInPolygon(point, polygon); + // $ExpectType boolean + geometryUtil.isPointInPolygon(pointTuple, polygonTuple); + + // $ExpectType [number, number][] + geometryUtil.makesureClockwise(lineTuple); + + // $ExpectType [number, number][] + geometryUtil.makesureAntiClockwise(lineTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnSegment(point, point, point); + // $ExpectType [number, number] + geometryUtil.closestOnSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnSegment(point, point, point); + // $ExpectType [number, number] + geometryUtil.closestOnSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnLine(point, line); + // $ExpectType [number, number] + geometryUtil.closestOnLine(pointTuple, lineTuple); + + // $ExpectType number + geometryUtil.distanceToSegment(point, point, point); + // $ExpectType number + geometryUtil.distanceToSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType number + geometryUtil.distanceToLine(point, line); + // $ExpectType number + geometryUtil.distanceToLine(pointTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.isPointOnSegment(point, point, point); + // $ExpectType boolean + geometryUtil.isPointOnSegment(point, point, point, 1); + // $ExpectType boolean + geometryUtil.isPointOnSegment(pointTuple, pointTuple, pointTuple); + // $ExpectType boolean + geometryUtil.isPointOnSegment(pointTuple, pointTuple, pointTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnLine(point, line); + // $ExpectType boolean + geometryUtil.isPointOnLine(point, line, 1); + // $ExpectType boolean + geometryUtil.isPointOnLine(pointTuple, lineTuple); + // $ExpectType boolean + geometryUtil.isPointOnLine(pointTuple, lineTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnRing(point, ring); + // $ExpectType boolean + geometryUtil.isPointOnRing(point, ring, 1); + // $ExpectType boolean + geometryUtil.isPointOnRing(pointTuple, ringTuple); + // $ExpectType boolean + geometryUtil.isPointOnRing(pointTuple, ringTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnPolygon(point, polygon); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(point, polygon, 1); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(pointTuple, polygonTuple); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(pointTuple, polygonTuple, 1); +} + +/** + * lnglat.ts + */ + +// $ExpectType LngLat +new AMap.LngLat(114, 22); +// $ExpectType LngLat +const testLnglat = new AMap.LngLat(113, 21); + +// $ExpectType LngLat +testLnglat.offset(1, 2); + +// $ExpectType number +testLnglat.distance(testLnglat); +// $ExpectType number +testLnglat.distance([testLnglat]); + +// $ExpectType number +testLnglat.getLng(); + +// $ExpectType number +testLnglat.getLat(); + +// $ExpectType boolean +testLnglat.equals(testLnglat); + +// $ExpectType string +testLnglat.toString(); + +// $ExpectType LngLat +testLnglat.add(testLnglat); +// $ExpectType LngLat +testLnglat.add(testLnglat, true); + +// $ExpectType LngLat +testLnglat.subtract(testLnglat); +// $ExpectType LngLat +testLnglat.subtract(testLnglat, true); + +// $ExpectType LngLat +testLnglat.divideBy(1); +// $ExpectType LngLat +testLnglat.divideBy(1, true); + +// $ExpectType LngLat +testLnglat.multiplyBy(1); +// $ExpectType LngLat +testLnglat.multiplyBy(1, true); + +/** + * map.ts + */ + +// $ExpectType Map +new AMap.Map('map'); +// $ExpectType Map +new AMap.Map(div); + +// $ExpectType Map +new AMap.Map(div, {}); + +// $ExpectType Map +const testMap = new AMap.Map(div, { + layers: [tileLayer], + zoom: 15, + center: [1, 2], + labelzIndex: 110, + zooms: [5, 15], + lang: 'zh_cn', + defaultCursor: 'default', + crs: 'EPSG4326', + animateEnable: true, + isHotspot: false, + defaultLayer: tileLayer, + rotateEnable: true, + resizeEnable: true, + showIndoorMap: true, + // indoorMap, // TODO + expandZoomRange: true, + dragEnable: true, + zoomEnable: true, + doubleClickZoom: true, + keyboardEnable: true, + jogEnable: true, + scrollWheel: true, + touchZoom: true, + mapStyle: '', + features: ['road'], + showBuildingBlock: true, + skyColor: '#fff', + preloadMode: true, + mask: [[1, 2], [2, 3], [3, 4]] +}); + +// $ExpectType number +testMap.getZoom(); + +// $ExpectType Layer[] +testMap.getLayers(); + +// $ExpectType LngLat +testMap.getCenter(); + +// $ExpectType HTMLElement | null +testMap.getContainer(); + +testMap.getCity(city => { + // $ExpectType string + city.city; + // $ExpectType string + city.citycode; + // $ExpectType string + city.district; + // $ExpectType string | never[] + city.province; +}); + +// $ExpectType Bounds +testMap.getBounds(); + +// $ExpectType number +testMap.getLabelzIndex(); + +// $ExpectType Lang +testMap.getLang(); + +// $ExpectType Size +testMap.getSize(); + +// $ExpectType number +testMap.getRotation(); + +// $ExpectType Status +const mapStatus = testMap.getStatus(); +// $ExpectType boolean +mapStatus.animateEnable; +// $ExpectType boolean +mapStatus.doubleClickZoom; +// $ExpectType boolean +mapStatus.dragEnable; +// $ExpectType boolean +mapStatus.isHotspot; +// $ExpectType boolean +mapStatus.jogEnable; +// $ExpectType boolean +mapStatus.keyboardEnable; +// $ExpectType boolean +mapStatus.pitchEnable; +// $ExpectType boolean +mapStatus.resizeEnable; +// $ExpectType boolean +mapStatus.rotateEnable; +// $ExpectType boolean +mapStatus.scrollWheel; +// $ExpectType boolean +mapStatus.touchZoom; +// $ExpectType boolean +mapStatus.zoomEnable; + +// $ExpectType string +testMap.getDefaultCursor(); + +// $ExpectType number +testMap.getResolution(); + +// $ExpectType number +testMap.getScale(); +// $ExpectType number +testMap.getScale(1); + +// $ExpectType void +testMap.setZoom(1); + +// $ExpectType void +testMap.setLabelzIndex(1); + +// $ExpectType void +testMap.setLayers([tileLayer]); + +// $ExpectType void +testMap.setCenter(lnglat); +// $ExpectType void +testMap.setCenter([1, 2]); + +// $ExpectType void +testMap.setZoomAndCenter(13, lnglat); +// $ExpectType void +testMap.setZoomAndCenter(13, [1, 2]); + +// $ExpectType void +testMap.setCity('city', (coord, zoom) => { + // $ExpectType string + coord[0]; + // $ExpectType string + coord[1]; + // $ExpectType number + zoom; +}); + +// $ExpectType Bounds +testMap.setBounds(bounds); + +// $ExpectType void +testMap.setLimitBounds(bounds); + +// $ExpectType void +testMap.clearLimitBounds(); + +// $ExpectType void +testMap.setLang('zh_cn'); + +// $ExpectType void +testMap.setRotation(1); + +// $ExpectType void +testMap.setStatus({}); +// $ExpectType void +testMap.setStatus({ + animateEnable: true, + doubleClickZoom: true, + dragEnable: true, + isHotspot: true, + jogEnable: true, + keyboardEnable: true, + pitchEnable: false, + resizeEnable: false, + rotateEnable: false, + scrollWheel: true, + touchZoom: true, + zoomEnable: true +}); + +// $ExpectType void +testMap.setDefaultCursor('default'); + +// $ExpectType void +testMap.zoomIn(); + +// $ExpectType void +testMap.zoomOut(); + +// $ExpectType void +testMap.panTo([1, 2]); +// $ExpectType void +testMap.panTo(lnglat); + +// $ExpectType void +testMap.panBy(1, 2); + +// $ExpectType void +testMap.clearMap(); + +// $ExpectType Map +testMap.plugin('plugin name', () => { }); +// $ExpectType Map +testMap.plugin(['plugin name'], () => { }); + +// $ExpectType void +testMap.clearInfoWindow(); + +// $ExpectType LngLat +testMap.pixelToLngLat(pixel); +// $ExpectType LngLat +testMap.pixelToLngLat(pixel, 1); + +// $ExpectType Pixel +testMap.lnglatToPixel(lnglat); +// $ExpectType Pixel +testMap.lnglatToPixel(lnglat, 1); + +// $ExpectType LngLat +testMap.containerToLngLat(pixel); + +// $ExpectType Pixel +testMap.lngLatToContainer(lnglat); +// $ExpectType Pixel +testMap.lnglatTocontainer(lnglat); + +// $ExpectType void +testMap.setMapStyle(''); +// $ExpectType string +testMap.getMapStyle(); + +// $ExpectType void +testMap.setFeatures('all'); +// $ExpectType void +testMap.setFeatures(['bg']); + +const feature: 'all' | 'bg' | 'point' | 'road' | 'building' | AMap.Map.Feature[] = testMap.getFeatures(); + +// $ExpectType void +testMap.setDefaultLayer(tileLayer); + +// $ExpectType void +testMap.setPitch(1); +// $ExpectType number +testMap.getPitch(); + +// $ExpectType ViewMode +testMap.getViewMode_(); + +// $ExpectType Pixel +testMap.lngLatToGeodeticCoord(lnglat); +// $ExpectType Pixel +testMap.lngLatToGeodeticCoord(lnglatTuple); + +// $ExpectType LngLat +testMap.geodeticCoordToLngLat(pixel); + +// $ExpectType void +testMap.destroy(); + +declare function dblClickHandler(this: AMap.Map, event: AMap.Map.EventMap['dblclick']): void; + +// $ExpectType Map +testMap.on('click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Pixel + event.pixel; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); +// $ExpectType Map +testMap.on('dblclick', dblClickHandler); +// $ExpectType Map +testMap.on('complete', (event: AMap.Map.EventMap['complete']) => { + // $ExpectType "complete" + event.type; + // $ExpectError + event.value; +}); +// $ExpectType Map +testMap.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType string + event.name; + // $ExpectType "hotspotclick" + event.type; +}); +// $ExpectType Map +testMap.on('custom', (event: AMap.Event<'custom', { test: string }>) => { + // $ExpectType "custom" + event.type; + // $ExpectType string + event.test; +}); + +// $ExpectType Map +testMap.off('dblclick', dblClickHandler); +// $ExpectType Map +testMap.off('click', 'mv'); + +// $ExpectType Map +testMap.emit('click', { + target: testMap, + lnglat, + pixel +}); + +testMap.emit('complete'); +// $ExpectType Map +testMap.emit('hotspotclick', { + lnglat, + name: '123', + id: '123', + isIndoorPOI: true +}); +// $ExpectType Map +testMap.emit('custom', { + test: 1 +}); +// $ExpectType Map +testMap.emit('custom', undefined); + +/** + * pixel.ts + */ + +// $ExpectType Pixel +new AMap.Pixel(10, 20); +// $ExpectType Pixel +const testPixel = new AMap.Pixel(10, 20); + +// $ExpectType number +testPixel.getX(); + +// $ExpectType number +testPixel.getY(); + +// $ExpectType boolean +testPixel.equals(testPixel); + +// $ExpectType string +testPixel.toString(); + +// $ExpectType Pixel +testPixel.add({ x: 1, y: 2 }); +// $ExpectType Pixel +testPixel.add({ x: 1, y: 2 }, false); + +// $ExpectType Pixel +testPixel.round(); + +// $ExpectType Pixel +testPixel.floor(); + +// $ExpectType number +testPixel.length(); + +// $ExpectType number | null +testPixel.direction(); + +// $ExpectType Pixel +testPixel.toFixed(); +// $ExpectType Pixel +testPixel.toFixed(2); + +/** + * size.ts + */ + +// $ExpectType Size +const testSize = new AMap.Size(10, 20); + +// $ExpectType number +testSize.getHeight(); + +// $ExpectType number +testSize.getWidth(); + +// $ExpectType string +testSize.toString(); + +// $ExpectType boolean +testSize.contains({ x: 10, y: 10 }); + +/** + * util.ts + */ + +const util = AMap.Util; + +// $ExpectType string +util.colorNameToHex('colorName'); + +// $ExpectType string +util.rgbHex2Rgba('rgbHex'); + +// $ExpectType string +util.argbHex2Rgba('argbHex'); + +// $ExpectType boolean +util.isEmpty({}); +// $ExpectError +util.isEmpty(1); + +// $ExpectType number[] +util.deleteItemFromArray([1], 1); + +// $ExpectType number[] +util.deleteItemFromArrayByIndex([1], 1); + +// $ExpectType number +util.indexOf([1], 1); +// $ExpectError +util.indexOf([1], '1'); + +// $ExpectType number +util.format(1); +// $ExpectType number +util.format(1, 1); + +declare const value1: number | number[]; +// $ExpectType boolean +util.isArray(value1); +if (util.isArray(value1)) { + // $ExpectType number[] + value1; +} else { + // $ExpectType number + value1; +} + +declare const value2: number | HTMLElement; +// $ExpectType boolean +util.isDOM(value2); +if (util.isDOM(value2)) { + // $ExpectType HTMLElement + value2; +} else { + // $ExpectType number + value2; +} + +// $ExpectType boolean +util.includes([1], 1); +// $ExpectError +util.includes([1], '1'); + +// $ExpectType number +util.requestIdleCallback(() => { }); +// $ExpectType number +const idleCallbackHandle = util.requestIdleCallback(() => { }, { timeout: 1 }); + +// $ExpectType void +util.cancelIdleCallback(idleCallbackHandle); + +// $ExpectType number +util.requestAnimFrame(() => { }); +// $ExpectType number +const animFrameHandle = util.requestAnimFrame(function() { + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType void +util.cancelAnimFrame(animFrameHandle); + +/** + * view2d.ts + */ + +// $ExpectType View2D +new AMap.View2D(); +// $ExpectType View2D +new AMap.View2D({}); + +// $ExpectType View2D +new AMap.View2D({ + center: [1, 2], + rotation: 1, + zoom: 10, + crs: 'EPGS3395' +}); + +// $ExpectType View2D +const testView2d = new AMap.View2D({ + center: lnglat +}); + +// $ExpectType View2D +testView2d.on('complete', () => { }); + +/** + * layer/buildings.ts + */ + +// $ExpectType Buildings +new AMap.Buildings(); +// $ExpectType Buildings +new AMap.Buildings(); +// $ExpectType Buildings +const testBuildings = new AMap.Buildings({ + zooms: [1, 18], + opacity: 0.8, + heightFactor: 1, + visible: true, + zIndex: 10, + map +}); + +testBuildings.setStyle({ + hideWithoutStyle: false, + areas: [ + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [[1, 2]] + }, + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [lnglat] + }, + { + color1: 'ff99ff00', + path: [lnglat] + }, + ] +}); + +/** + * layer/canvasLayer.ts + */ + +// $ExpectType CanvasLayer +new AMap.CanvasLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType CanvasLayer +new AMap.CanvasLayer(); +// $ExpectType CanvasLayer +new AMap.CanvasLayer({}); +// $ExpectType CanvasLayer +const testCanvasLayer = new AMap.CanvasLayer({ + bounds +}); + +// $ExpectType void +testCanvasLayer.setMap(null); +// $ExpectType void +testCanvasLayer.setMap(map); + +// $ExpectType Map | null | undefined +testCanvasLayer.getMap(); + +// $ExpectType void +testCanvasLayer.show(); + +// $ExpectType void +testCanvasLayer.hide(); + +// $ExpectType number +testCanvasLayer.getzIndex(); + +// $ExpectType void +testCanvasLayer.setzIndex(10); + +// $ExpectType HTMLCanvasElement | null +testCanvasLayer.getElement(); + +// $ExpectType void +testCanvasLayer.setCanvas(canvasEle); + +// $ExpectType HTMLCanvasElement | undefined +testCanvasLayer.getCanvas(); + +/** + * layer/flexible.ts + */ + +// $ExpectType Flexible +new AMap.TileLayer.Flexible(); +// $ExpectType Flexible +new AMap.TileLayer.Flexible({}); +// $ExpectType Flexible +const testFlexible = new AMap.TileLayer.Flexible({ + createTile(x, y, z, success, fail) { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + z; + // $ExpectType void + success(imgEle); + // $ExpectType void + success(canvasEle); + // $ExpectType void + fail(); + }, + cacheSize: 10, + opacity: 1, + visible: true, + map, + zIndex: 1, + zooms: [1, 2] +}); + +// $ExpectType void +testFlexible.setMap(null); +// $ExpectType void +testFlexible.setMap(map); + +// $ExpectType Map | null | undefined +testFlexible.getMap(); + +// $ExpectType void +testFlexible.show(); + +// $ExpectType void +testFlexible.hide(); + +// $ExpectType void +testFlexible.setzIndex(10); + +// $ExpectType number +testFlexible.getzIndex(); + +/** + * layer/imageLayer.ts + */ + +// $ExpectType ImageLayer +new AMap.ImageLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType ImageLayer +new AMap.ImageLayer(); +// $ExpectType ImageLayer +new AMap.ImageLayer({}); +// $ExpectType ImageLayer +const testImageLayer = new AMap.ImageLayer({ + bounds +}); + +// $ExpectType void +testImageLayer.setMap(null); +// $ExpectType void +testImageLayer.setMap(map); + +// $ExpectType Map | null | undefined +testImageLayer.getMap(); + +// $ExpectType void +testImageLayer.show(); + +// $ExpectType void +testImageLayer.hide(); + +// $ExpectType number +testImageLayer.getzIndex(); + +// $ExpectType void +testImageLayer.setzIndex(10); + +// $ExpectType HTMLImageElement | null +testImageLayer.getElement(); + +// $ExpectType void +testImageLayer.setImageUrl('url'); + +// $ExpectType string | undefined +testImageLayer.getImageUrl(); + +/** + * layer/layer.ts + */ + +// $ExpectError +new AMap.Layer(); + +// $ExpectType HTMLDivElement | undefined +layer.getContainer(); + +// $ExpectType [number, number] +layer.getZooms(); + +// $ExpectType void +layer.setOpacity(1); + +// $ExpectType number +layer.getOpacity(); + +// $ExpectType void +layer.show(); + +// $ExpectType void +layer.hide(); + +// $ExpectType void +layer.setMap(); +// $ExpectType void +layer.setMap(map); + +// $ExpectType void +layer.setzIndex(1); + +// $ExpectType number +layer.getzIndex(); + +/** + * layer/layerGroup.ts + */ + +// $ExpectError +new AMap.LayerGroup(); + +// $ExpectType LayerGroup +new AMap.LayerGroup(tileLayer); +// $ExpectType LayerGroup +const testTileLayerGroup = new AMap.LayerGroup([tileLayer]); +// $ExpectType LayerGroup +const testAnyLauerGroup = new AMap.LayerGroup([]); + +// $ExpectType LayerGroup +testTileLayerGroup.addLayer(tileLayer); +// $ExpectType LayerGroup +testTileLayerGroup.addLayer([tileLayer]); +// $ExpectError +testTileLayerGroup.addLayer(massMarksLayer); + +// $ExpectType TileLayer[] +testTileLayerGroup.getLayers(); + +// $ExpectType TileLayer | null +testTileLayerGroup.getLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); + +testTileLayerGroup.hasLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); +testTileLayerGroup.hasLayer(tileLayer); + +// $ExpectType LayerGroup +testTileLayerGroup.removeLayer(tileLayer); +// $ExpectType LayerGroup +testTileLayerGroup.removeLayer([tileLayer]); + +// $ExpectType LayerGroup +testTileLayerGroup.clearLayers(); + +testTileLayerGroup.eachLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType TileLayer + this; +}); +testTileLayerGroup.eachLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType LayerGroup +testTileLayerGroup.setMap(map); + +// $ExpectType LayerGroup +testTileLayerGroup.hide(); + +// $ExpectType LayerGroup +testTileLayerGroup.show(); + +// $ExpectType LayerGroup +testTileLayerGroup.reload(); + +// $ExpectType LayerGroup +testTileLayerGroup.setOptions({}); + +// $ExpectType LayerGroup +testTileLayerGroup.setOptions({ + tileSize: 256 +}); +// layerGruop.setOptions({ +// // $ExpectError +// interval: 1 +// }); + +testAnyLauerGroup.addLayer(tileLayer); + +testAnyLauerGroup.addLayer(massMarksLayer); + +testAnyLauerGroup.setOptions({ + test: 1 +}); + +/** + * layer/massMarks.ts + */ + +const massMarksStyle1 = { + anchor: pixel, + url: '', + size, + rotation: 1 +}; +const massMarksStyle2 = { + anchor: pixel, + url: '', + size +}; +const massMarksData1 = { + lnglat +}; + +interface MassMarksCustomData extends AMap.MassMarks.Data { + name: string; + id: string; +} +const massMarksMassMarksCustomData: MassMarksCustomData = { + lnglat: [1, 2], + style: 1, + name: '', + id: '' +}; + +// $ExpectError +new AMap.MassMarks(); +// $ExpectError +new AMap.MassMarks([], {}); + +new AMap.MassMarks([], { + style: [massMarksStyle1, massMarksStyle2] +}); +new AMap.MassMarks([massMarksData1], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType MassMarks +const testMassMarks = new AMap.MassMarks([massMarksMassMarksCustomData], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType void +testMassMarks.setStyle(massMarksStyle1); +// $ExpectType void +testMassMarks.setStyle([massMarksStyle1]); + +// $ExpectType Style | Style[] +testMassMarks.getStyle(); + +// $ExpectType void +testMassMarks.setData(''); + +// $ExpectError +testMassMarks.setData(massMarksData1); +// $ExpectError +testMassMarks.setData(massMarksMassMarksCustomData); + +const massMarksCustomData = testMassMarks.getData()[0]; +// $ExpectType string +massMarksCustomData.name; +// $ExpectType string +massMarksCustomData.id; +// $ExpectType LngLat +massMarksCustomData.lnglat; + +// $ExpectType void +testMassMarks.clear(); + +testMassMarks.on('click', (event: AMap.MassMarks.EventMap['click']) => { + // $ExpectType "click" + event.type; + + // $ExpectType MassMarksCustomData + event.data; + + // $ExpectType MassMarks + event.target; +}); + +/** + * layer/tileLayer.ts + */ + +// $ExpectType TileLayer +new AMap.TileLayer(); + +// $ExpectType TileLayer +new AMap.TileLayer({}); + +// $ExpectType TileLayer +const testTileLayer = new AMap.TileLayer({ + map, + tileSize: 256, + tileUrl: '', + errorUrl: '', + getTileUrl: (x, y, z) => '', + zIndex: 1, + opacity: 0.1, + zooms: [3, 18], + detectRetina: true +}); + +// $ExpectType string[] +testTileLayer.getTiles(); + +// $ExpectType void +testTileLayer.reload(); + +// $ExpectType void +testTileLayer.setTileUrl(''); +// $ExpectType void +testTileLayer.setTileUrl((x, y, level) => { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + level; + return ''; +}); + +// $ExpectType TileLayer +testTileLayer.on('complete', () => { }); + +testTileLayer.off('complete', () => { }); + +testTileLayer.emit('complete'); + +// $ExpectType Traffic +const testTrafficLayer = new AMap.TileLayer.Traffic({}); +// $ExpectType Traffic +new AMap.TileLayer.Traffic({ + autoRefresh: true, + interval: 180 +}); + +testTrafficLayer.on('complete', () => { }); + +/** + * layer/videoLayer.ts + */ + +// $ExpectType VideoLayer +new AMap.VideoLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType VideoLayer +new AMap.VideoLayer(); +// $ExpectType VideoLayer +new AMap.VideoLayer({}); +// $ExpectType VideoLayer +const testVideoLayer = new AMap.VideoLayer({ + bounds +}); + +// $ExpectType void +testVideoLayer.setMap(null); +// $ExpectType void +testVideoLayer.setMap(map); + +// $ExpectType Map | null | undefined +testVideoLayer.getMap(); + +// $ExpectType void +testVideoLayer.show(); + +// $ExpectType void +testVideoLayer.hide(); + +// $ExpectType number +testVideoLayer.getzIndex(); + +// $ExpectType void +testVideoLayer.setzIndex(10); + +// $ExpectType HTMLVideoElement | null +testVideoLayer.getElement(); + +// $ExpectType void +testVideoLayer.setVideoUrl('url'); + +// $ExpectType string | string[] | undefined +testVideoLayer.getVideoUrl(); + +/** + * layer/wms.ts + */ + +// $ExpectType WMS +new AMap.TileLayer.WMS({ + url: 'url', + params: {} +}); +// $ExpectType WMS +const testWms = new AMap.TileLayer.WMS({ + url: 'url', + blend: true, + params: { + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' + }, + zooms: [1, 2], + tileSize: 256, + opacity: 1, + zIndex: 10, + visible: true +}); + +// $ExpectType void +testWms.setMap(map); +// $ExpectType void +testWms.setMap(null); + +// $ExpectType Map | null | undefined +testWms.getMap(); + +// $ExpectType void +testWms.show(); + +// $ExpectType void +testWms.hide(); + +// $ExpectType void +testWms.setzIndex(10); + +// $ExpectType number +testWms.getzIndex(); + +// $ExpectType void +testWms.setUrl('url'); + +// $ExpectType string +testWms.getUrl(); + +// $ExpectType void +testWms.setParams({ + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' +}); + +{ + const params = testWms.getParams(); + // $ExpectType string | undefined + params.VERSION; + // $ExpectType string | undefined + params.LAYERS; + // $ExpectType string | undefined + params.STYLES; + // $ExpectType string | undefined + params.FORMAT; + // $ExpectType "TRUE" | "FALSE" | undefined + params.TRANSPARENT; + // $ExpectType string | undefined + params.BGCOLOR; + // $ExpectType string | undefined + params.EXCEPTIONS; + // $ExpectType string | undefined + params.TIME; + // $ExpectType string | undefined + params.ELEVATION; +} + +/** + * layer/wmts.ts + */ + +// $ExpectType WMTS +new AMap.TileLayer.WMTS({ + url: 'url', + params: {} +}); +// $ExpectType WMTS +const testWmts = new AMap.TileLayer.WMTS({ + url: 'url', + blend: true, + tileSize: 256, + zooms: [1, 2], + opacity: 1, + zIndex: 10, + visible: true, + params: { + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' + } +}); + +// $ExpectType void +testWmts.setMap(map); +// $ExpectType void +testWmts.setMap(null); + +// $ExpectType Map | null | undefined +testWmts.getMap(); + +// $ExpectType void +testWmts.show(); + +// $ExpectType void +testWmts.hide(); + +// $ExpectType void +testWmts.setzIndex(10); + +// $ExpectType number +testWmts.getzIndex(); + +// $ExpectType void +testWmts.setUrl('url'); + +// $ExpectType string +testWmts.getUrl(); + +// $ExpectType void +testWmts.setParams({ + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' +}); + +{ + const params = testWmts.getParams(); + // $ExpectType string | undefined + params.Version; + // $ExpectType string | undefined + params.Layer; + // $ExpectType string | undefined + params.Style; + // $ExpectType string | undefined + params.Format; +} + +/** + * overlay/bezierCurve.ts + */ + +interface BezierCurveExtraData { + test: number; +} + +const bezierCurvePath = [ + [1, 2, 3, 4], + [1, 2, 3], + [ + [1, 2, 3], + [1, 2] + ], + [1, 2] +]; + +// $ExpectError +new AMap.BezierCurve(); +// $ExpectError +new AMap.BezierCurve({}); +// $ExpectType BezierCurve +const testBezierCurve = new AMap.BezierCurve({ + map, + path: bezierCurvePath, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +// $ExpectType void +testBezierCurve.setPath(bezierCurvePath); + +// $ExpectType void +testBezierCurve.setPath(bezierCurvePath); + +// $ExpectType void +testBezierCurve.setOptions({}); +testBezierCurve.setOptions({ + map, + path: bezierCurvePath, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +{ + const options = testBezierCurve.getOptions(); + + // $ExpectType number | undefined + options.borderWeight; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType string | undefined + options.dirColor; + // $ExpectType string | undefined + options.dirImg; + // $ExpectType {} | BezierCurveExtraData | undefined + options.extData; + // $ExpectType boolean | undefined + options.geodesic; + // $ExpectType boolean | undefined + options.isOutline; + // $ExpectType "round" | "butt" | "square" | undefined + options.lineCap; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType string | undefined + options.outlineColor; + // $ExpectType (LngLat & { controlPoints: LngLat[]; })[] | undefined + options.path; + // $ExpectType boolean | undefined + options.showDir; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType number +testBezierCurve.getLength(); + +// $ExpectType Bounds | null +testBezierCurve.getBounds(); + +// $ExpectType void +testBezierCurve.show(); + +// $ExpectType void +testBezierCurve.hide(); + +// $ExpectType void +testBezierCurve.setMap(null); +testBezierCurve.setMap(map); + +// $ExpectType void +testBezierCurve.setExtData({ test: 1 }); +// $ExpectError +testBezierCurve.setExtData({ test: '123' }); + +// $ExpectType {} | BezierCurveExtraData +testBezierCurve.getExtData(); + +testBezierCurve.on('click', (event: AMap.BezierCurve.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType BezierCurve + event.target; +}); + +testBezierCurve.on('show', (event: AMap.BezierCurve.EventMap['show']) => { + // $ExpectType "show" + event.type; + // $ExpectType BezierCurve + event.target; +}); + +testBezierCurve.on('options', (event: AMap.BezierCurve.EventMap['options']) => { + // $ExpectType "options" + event.type; + // $ExpectError + event.target; +}); + +/** + * overlay/circle.ts + */ + +interface CircleExtraData { + test: number; +} + +// $ExpectType Circle +new AMap.Circle(); +new AMap.Circle({}); +// $ExpectType Circle +const testCircle = new AMap.Circle({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +// $ExpectType void +testCircle.setCenter(lnglat); +// $ExpectType void +testCircle.setCenter(lnglatTuple); + +// $ExpectType LngLat | undefined +testCircle.getCenter(); + +// $ExpectType Bounds | null +testCircle.getBounds(); + +// $ExpectType void +testCircle.setRadius(100); + +// $ExpectType number +testCircle.getRadius(); + +// $ExpectType void +testCircle.setOptions({}); +testCircle.setOptions({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +{ + const options = testCircle.getOptions(); + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType LngLat | undefined + options.center; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | CircleExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType number | undefined + options.radius; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType Bounds | null +testCircle.getBounds(); + +// $ExpectType void +testCircle.hide(); + +// $ExpectType void +testCircle.show(); + +// $ExpectType void +testCircle.setMap(null); +// $ExpectType void +testCircle.setMap(map); + +// $ExpectType void +testCircle.setExtData({ test: 2 }); +// $ExpectError +testCircle.setExtData({ test: '1' }); + +// $ExpectType {} | CircleExtraData +testCircle.getExtData(); + +// $ExpectType boolean +testCircle.contains(lnglat); +// $ExpectType boolean +testCircle.contains(lnglatTuple); + +testCircle.on('click', (event: AMap.Circle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Circle + event.target; +}); + +testCircle.on('setCenter', (event: AMap.Circle.EventMap['setCenter']) => { + // $ExpectType "setCenter" + event.type; + // $ExpectError + event.target; +}); + +testCircle.on('change', (event: AMap.Circle.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType Circle + event.target; +}); + +/** + * overlay/contextMenu.ts + */ + +interface ContextMenuExtraData { + test: number; +} +// $ExpectType ContextMenu +new AMap.ContextMenu(); +// $ExpectType ContextMenu +new AMap.ContextMenu({}); +// $ExpectType ContextMenu +const testContextMenu = new AMap.ContextMenu({ + content: '
content
', +}); + +// $ExpectType void +testContextMenu.addItem('item', function() { + // $ExpectType HTMLLIElement + this; +}); +// $ExpectType void +testContextMenu.addItem('item', () => { }, 1); + +// $ExpectType void +testContextMenu.removeItem('item', () => {}); + +// $ExpectType void +testContextMenu.open(map, lnglatTuple); +// $ExpectType void +testContextMenu.open(map, lnglat); + +// $ExpectType void +testContextMenu.close(); + +testContextMenu.on('items', (event: AMap.ContextMenu.EventMap['items']) => { + // $ExpectType "items" + event.type; +}); + +testContextMenu.on('open', (event: AMap.ContextMenu.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType ContextMenu + event.target; +}); + +/** + * overlay/ellipse.ts + */ + +interface EllipseExtraData { + test: number; +} +// $ExpectType Ellipse +new AMap.Ellipse(); +// $ExpectType Ellipse +new AMap.Ellipse({}); +// $ExpectType Ellipse +const testEllipse = new AMap.Ellipse({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType LngLat | undefined +testEllipse.getCenter(); + +// $ExpectType void +testEllipse.setCenter(lnglat); +// $ExpectType void +testEllipse.setCenter(lnglatTuple); + +// $ExpectType Bounds | null +testEllipse.getBounds(); + +// $ExpectType void +testEllipse.setOptions({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +{ + const options = testEllipse.getOptions(); + + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType LngLat | undefined + options.center; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | EllipseExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType [number, number] | undefined + options.radius; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType void +testEllipse.hide(); + +// $ExpectType void +testEllipse.show(); + +// $ExpectType void +testEllipse.setMap(null); +// $ExpectType void +testEllipse.setMap(map); + +// $ExpectType void +testEllipse.setExtData({ test: 2 }); +// $ExpectType {} | EllipseExtraData +testEllipse.getExtData(); + +// $ExpectType boolean +testEllipse.contains(lnglat); +// $ExpectType boolean +testEllipse.contains(lnglatTuple); + +/** + * overlay/geoJSON.ts + */ + +interface GeoJSONExtraData { + test: number; +} + +const geoJSONObject: AMap.GeoJSON.GeoJSONObject[] = [ + { + type: 'Feature', + properties: {}, + geometry: { + type: 'Point', + coordinates: lnglatTuple + } + }, + { + type: 'Feature', + properties: { test: 1 }, + geometry: { + type: 'LineString', + coordinates: [lnglatTuple, lnglatTuple] + } + } +]; + +// $ExpectType GeoJSON +new AMap.GeoJSON(); +// $ExpectType GeoJSON +new AMap.GeoJSON({}); +// $ExpectType GeoJSON +const testGeoJSON = new AMap.GeoJSON({ + geoJSON: geoJSONObject, + getMarker(obj, lnglat) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat + lnglat; + return marker; + }, + getPolyline(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return testPolyline; + }, + getPolygon(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return testPolygon; + }, + coordsToLatLng(coord) { + // $ExpectType LngLat + coord; + return coord; + } +}); + +// $ExpectType void +testGeoJSON.importData(geoJSONObject); + +// $ExpectType GeoJSON +testGeoJSON.removeOverlay(marker); +// $ExpectType GeoJSON +testGeoJSON.removeOverlay([marker]); + +// $ExpectType boolean +testGeoJSON.hasOverlay(marker); +// $ExpectType boolean +testGeoJSON.hasOverlay(m => m === marker); + +// $ExpectType GeoJSON +testGeoJSON.addOverlay(marker); +// $ExpectType GeoJSON +testGeoJSON.addOverlay([marker]); + +// $ExpectType GeoJSONObject[] +testGeoJSON.toGeoJSON(); + +// $ExpectType GeoJSON +testGeoJSON.setMap(null); +// $ExpectType GeoJSON +testGeoJSON.setMap(map); + +// $ExpectType GeoJSON +testGeoJSON.hide(); + +// $ExpectType GeoJSON +testGeoJSON.show(); + +testGeoJSON.on('click', (event: AMap.MapsEvent<'click', AMap.Overlay>) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); + +/** + * overlay/icon.ts + */ + +// $ExpectType Icon +new AMap.Icon(); +// $ExpectType Icon +new AMap.Icon({}); +// $ExpectType Icon +new AMap.Icon({ + size, + imageOffset: pixel, + image: 'image uri', + imageSize: size +}); +// $ExpectType Icon +const testIcon = new AMap.Icon({ + size: [1, 2], + imageOffset: pixel, + image: 'image uri', + imageSize: [1, 2] +}); + +// $ExpectType Size +testIcon.getImageSize(); + +// $ExpectType void +testIcon.setImageSize(size); +// $ExpectType void +testIcon.setImageSize([1, 2]); + +/** + * overlay/infoWindow.ts + */ + +interface InfoWindowExtraData { + test: number; +} + +// $ExpectType InfoWindow +new AMap.InfoWindow(); +// $ExpectType InfoWindow +new AMap.InfoWindow({}); +// $ExpectType InfoWindow +const testInfoWindow = new AMap.InfoWindow({ + isCustom: false, + autoMove: false, + closeWhenClickMap: false, + content: 'content', + size: [100, 100], + offset: new AMap.Pixel(10, 10), + position: lnglat, + showShadow: true +}); + +// $ExpectType void +testInfoWindow.open(map); +// $ExpectType void +testInfoWindow.open(map, lnglat); +// $ExpectType void +testInfoWindow.open(map, lnglatTuple); + +// $ExpectType void +testInfoWindow.close(); + +// $ExpectType boolean +testInfoWindow.getIsOpen(); + +// $ExpectType void +testInfoWindow.setContent('content'); +// $ExpectType void +testInfoWindow.setContent(div); + +// $ExpectType string | HTMLElement | undefined +testInfoWindow.getContent(); + +// $ExpectType void +testInfoWindow.setPosition(lnglat); +// $ExpectType void +testInfoWindow.setPosition(lnglatTuple); + +// $ExpectType LngLat | undefined +testInfoWindow.getPosition(); + +// $ExpectType Size | undefined +testInfoWindow.getSize(); + +testInfoWindow.on('change', (event: AMap.InfoWindow.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +testInfoWindow.on('close', (event: AMap.InfoWindow.EventMap['close']) => { + // $ExpectType "close" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +testInfoWindow.on('open', (event: AMap.InfoWindow.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +/** + * overlay/marker.ts + */ + +interface MarkerExtraData { + test: number; +} + +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker({}); +// $ExpectType Marker +export const testMarker = new AMap.Marker({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType void +testMarker.markOnAMAP({ + name: '123', + position: [1, 2] +}); +// $ExpectType void +testMarker.markOnAMAP(); +// $ExpectType void +testMarker.markOnAMAP({}); +// $ExpectType void +testMarker.markOnAMAP({ + position: [1, 2], + name: '123' +}); + +// $ExpectType Pixel +testMarker.getOffset(); + +// $ExpectType void +testMarker.setOffset(pixel); + +// $ExpectType void +testMarker.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +testMarker.getAnimation(); + +// $ExpectType void +testMarker.setClickable(true); + +// $ExpectType boolean +testMarker.getClickable(); + +// $ExpectType LngLat | undefined +testMarker.getPosition(); + +// $ExpectType void +testMarker.setPosition(lnglat); + +// $ExpectType void +testMarker.setAngle(0); + +// $ExpectType void +testMarker.setLabel(); +// $ExpectType void +testMarker.setLabel({}); +// $ExpectType void +testMarker.setLabel({ + content: 'label content', + offset: pixel +}); + +// $ExpectType Label | undefined +testMarker.getLabel(); + +// $ExpectType number +testMarker.getAngle(); + +// $ExpectType void +testMarker.setzIndex(100); + +// $ExpectType number +testMarker.getzIndex(); + +// $ExpectType void +testMarker.setIcon('icon uri'); +// $ExpectType void +testMarker.setIcon(icon); + +// $ExpectType string | Icon | undefined +testMarker.getIcon(); + +// $ExpectType void +testMarker.setDraggable(true); + +// $ExpectType boolean +testMarker.getDraggable(); + +// $ExpectType void +testMarker.setCursor('default'); + +// $ExpectType void +testMarker.setContent('content'); +// $ExpectType void +testMarker.setContent(domEle); + +// $ExpectType string | HTMLElement +testMarker.getContent(); + +// $ExpectType void +testMarker.moveAlong([lnglat], 100); +// $ExpectError +testMarker.moveAlong([[1, 2]], 100); +// $ExpectType void +testMarker.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +testMarker.moveTo(lnglat, 100); +// $ExpectType void +testMarker.moveTo([1, 2], 100); +// $ExpectType void +testMarker.moveTo([1, 2], 100, t => t); + +// $ExpectType void +testMarker.stopMove(); + +// $ExpectType boolean +testMarker.pauseMove(); + +// $ExpectType boolean +testMarker.resumeMove(); + +// $ExpectType void +testMarker.setMap(map); + +// $ExpectType void +testMarker.setTitle('title'); +// $ExpectError +testMarker.setTitle(); + +// $ExpectType string | undefined +testMarker.getTitle(); + +// $ExpectType void +testMarker.setTop(true); + +// $ExpectType boolean +testMarker.getTop(); + +// $ExpectType void +testMarker.setShadow(); +// $ExpectType void +testMarker.setShadow(icon); +// $ExpectType void +testMarker.setShadow('shadow url'); + +// $ExpectType string | Icon | undefined +testMarker.getShadow(); + +// $ExpectType void +testMarker.setShape(); +// $ExpectType void +testMarker.setShape(markerShape); + +// $ExpectType MarkerShape | undefined +testMarker.getShape(); + +testMarker.on('click', (event: AMap.Marker.EventMap['click']) => { + // $ExpectType {} | MarkerExtraData + event.target.getExtData(); +}); + +/** + * overlay/markerShape.ts + */ + +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1, 1] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'poly', + coords: [1, 2, 3, 4, 5] +}); + +// $ExpectError +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1] +}); +// $ExpectError +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2, 2] +}); + +/** + * overlay/overlay.ts + */ + +interface OverlayExtraData { + test: number; +} +declare const testOverlay: AMap.Overlay; + +// $ExpectType void +testOverlay.show(); + +// $ExpectType void +testOverlay.hide(); + +// $ExpectType Map | null | undefined +testOverlay.getMap(); + +// $ExpectType void +testOverlay.setMap(map); +// $ExpectType void +testOverlay.setMap(null); + +// $ExpectError +testOverlay.setExtData({ any: 123 }); + +// $ExpectError OverlayExtraData +testOverlay.getExtData(); + +/** + * overlay/overlayGroup.ts + */ + +// $ExpectType OverlayGroup, any> +const testOverlayGroup2 = new AMap.OverlayGroup(); +// $ExpectType OverlayGroup, any> +new AMap.OverlayGroup(marker); +// $ExpectType OverlayGroup, any> +const testOverlayGroup = new AMap.OverlayGroup([marker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlay(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlay([marker]); +// $ExpectError +testOverlayGroup.addOverlay([testCircle]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlays(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlays([marker]); + +// $ExpectType Marker[] +testOverlayGroup.getOverlays(); + +// $ExpectType boolean +testOverlayGroup.hasOverlay(marker); +// $ExpectType boolean +testOverlayGroup.hasOverlay(o => o === marker); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlay(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlay([marker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlays(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlays([marker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.clearOverlays(); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.eachOverlay(function(overlay, index, overlays) { + // $ExpectType Marker + overlay; + // $ExpectType number + index; + // $ExpectType Marker[] + overlays; + // $ExpectType Marker + this; +}); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.setMap(null); +// $ExpectType OverlayGroup, any> +testOverlayGroup.setMap(map); + +// $ExpectType OverlayGroup, any> +testOverlayGroup2.setOptions({ + test: 1 +}); +// $ExpectType OverlayGroup, any> +testOverlayGroup.setOptions({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.show(); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.hide(); + +testOverlayGroup.on('click', (event: AMap.MapsEvent<'click', AMap.Overlay>) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); + +/** + * overlay/polygon.ts + */ + +interface PolygonExtraData { + test: number; +} + +const polygonPath1 = [lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple]; +const polygonPath2 = [lnglat, lnglat, lnglat, lnglat, lnglat]; + +// $ExpectType Polygon +new AMap.Polygon(); +// $ExpectType Polygon +new AMap.Polygon({}); +// $ExpectType Polygon +const testPolygon = new AMap.Polygon({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.3, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [2, 4], + path: polygonPath1 +}); + +// $ExpectType void +testPolygon.setPath(polygonPath1); +// $ExpectType void +testPolygon.setPath(polygonPath2); +// $ExpectType void +testPolygon.setPath([polygonPath1, polygonPath2]); + +// $ExpectType LngLat[] | LngLat[][] +testPolygon.getPath(); + +// $ExpectType void +testPolygon.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [4, 2], + path: [polygonPath2, polygonPath1] +}); + +{ + const options = testPolygon.getOptions(); + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | PolygonExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | LngLat[][] | undefined + options.path; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType Bounds | null +testPolygon.getBounds(); + +// $ExpectType number +testPolygon.getArea(); + +// $ExpectType void +testPolygon.setMap(null); +// $ExpectType void +testPolygon.setMap(map); + +// $ExpectType void +testPolygon.setExtData({ test: 1 }); + +// $ExpectType {} | PolygonExtraData +testPolygon.getExtData(); + +// $ExpectType boolean +testPolygon.contains(lnglat); +// $ExpectType boolean +testPolygon.contains(lnglatTuple); + +testPolygon.on('click', (event: AMap.Polygon.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polygon + event.target; +}); + +/** + * overlay/polyline.ts + */ + +interface PolylineExtraData { + test: number; +} + +// $ExpectType Polyline +new AMap.Polyline(); +// $ExpectType Polyline +new AMap.Polyline({}); +// $ExpectType Polyline +const testPolyline = new AMap.Polyline({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); +// Polyline + +// $ExpectType void +testPolyline.setPath([lnglat]); +// $ExpectType void +testPolyline.setPath([lnglatTuple]); + +// $ExpectType void +testPolyline.setOptions({}); +// $ExpectType void +testPolyline.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat, lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); + +{ + const options = testPolyline.getOptions(); + // $ExpectType number | undefined + options.borderWeight; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType string | undefined + options.dirColor; + // $ExpectType string | undefined + options.dirImg; + // $ExpectType {} | PolylineExtraData | undefined + options.extData; + // $ExpectType boolean | undefined + options.geodesic; + // $ExpectType boolean | undefined + options.isOutline; + // $ExpectType "round" | "butt" | "square" | undefined + options.lineCap; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType string | undefined + options.outlineColor; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType boolean | undefined + options.showDir; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType number +testPolyline.getLength(); + +// $ExpectType Bounds | null +testPolyline.getBounds(); + +// $ExpectType void +testPolyline.hide(); + +// $ExpectType void +testPolyline.show(); + +// $ExpectType void +testPolyline.setMap(null); +// $ExpectType void +testPolyline.setMap(map); + +// $ExpectType void +testPolyline.setExtData({ test: 1 }); + +// $ExpectType {} | PolylineExtraData +testPolyline.getExtData(); + +testPolyline.on('click', (event: AMap.Polyline.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polyline + event.target; +}); + +/** + * overlay/rectangle.ts + */ + +interface RectangleExtraData { + test: number; +} + +// $ExpectType Rectangle +new AMap.Rectangle(); +// $ExpectType Rectangle +new AMap.Rectangle({}); +// $ExpectType Rectangle +const testRectangle = new AMap.Rectangle({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType Bounds | undefined +testRectangle.getBounds(); + +// $ExpectType void +testRectangle.setBounds(bounds); + +// $ExpectType void +testRectangle.setOptions({}); +// $ExpectType void +testRectangle.setOptions({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +{ + const options = testRectangle.getOptions(); + // $ExpectType Bounds | undefined + options.bounds; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | RectangleExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType void +testRectangle.hide(); + +// $ExpectType void +testRectangle.show(); + +// $ExpectType void +testRectangle.setExtData({test: 2}); + +// $ExpectType {} | RectangleExtraData +testRectangle.getExtData(); + +// $ExpectType boolean +testRectangle.contains(lnglat); +// $ExpectType boolean +testRectangle.contains(lnglatTuple); + +testRectangle.on('click', (event: AMap.Rectangle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Rectangle + event.target; +}); + +testRectangle.on('setBounds', (event: AMap.Rectangle.EventMap['setBounds']) => { + // $ExpectType "setBounds" + event.type; + // $ExpectError + event.target; +}); + +/** + * overlay/text.ts + */ + +interface TextExtraData { + test: number; +} + +// $ExpectType Text +new AMap.Text(); +// $ExpectType Text +new AMap.Text({}); +// $ExpectType Text +const testText = new AMap.Text({ + text: 'content', + textAlign: 'center', + verticalAlign: 'top', + map, + position: lnglat, + offset: pixel, + topWhenClick: true, + bubble: true, + draggable: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 100, + angle: 45, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: 'https://webapi.amap.com/theme/v1.3/markers/0.png', + title: 'title', + clickable: true, + extData: { test: 1 } +}); + +// $ExpectType string +testText.getText(); + +// $ExpectType void +testText.setText('123'); + +// $ExpectType void +testText.setStyle({ + background: 'red', + width: '200px' +}); + +// $ExpectType void +testText.markOnAMAP({ + name: '123', + position: lnglatTuple +}); + +// $ExpectType Pixel +testText.getOffset(); + +// $ExpectType void +testText.setOffset(pixel); + +// $ExpectType void +testText.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +testText.getAnimation(); + +// $ExpectType void +testText.setClickable(true); + +// $ExpectType boolean +testText.getClickable(); + +// $ExpectType LngLat | undefined +testText.getPosition(); + +// $ExpectType void +testText.setAngle(10); + +// $ExpectType number +testText.getAngle(); + +// $ExpectType void +testText.setzIndex(1); + +// $ExpectType number +testText.getzIndex(); + +// $ExpectType void +testText.setDraggable(true); + +// $ExpectType boolean +testText.getDraggable(); + +// $ExpectType void +testText.hide(); + +// $ExpectType void +testText.show(); + +// $ExpectType void +testText.setCursor('default'); + +// $ExpectType void +testText.moveAlong([lnglat], 100); + +// $ExpectType void +testText.moveAlong([lnglat], 100); +// $ExpectError +testText.moveAlong([[1, 2]], 100); +// $ExpectType void +testText.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +testText.moveTo(lnglat, 100); +// $ExpectType void +testText.moveTo([1, 2], 100); +// $ExpectType void +testText.moveTo([1, 2], 100, t => t); + +// $ExpectType void +testText.stopMove(); + +// $ExpectType boolean +testText.pauseMove(); + +// $ExpectType boolean +testText.resumeMove(); + +// $ExpectType void +testText.setMap(map); + +// $ExpectType void +testText.setTitle('title'); +// $ExpectError +testText.setTitle(); + +// $ExpectType string | undefined +testText.getTitle(); + +// $ExpectType void +testText.setTop(true); + +// $ExpectType boolean +testText.getTop(); + +// $ExpectType void +testText.setShadow(); +// $ExpectType void +testText.setShadow(icon); +// $ExpectType void +testText.setShadow('shadow url'); + +// $ExpectType void +testText.setExtData({test: 1}); + +// $ExpectType {} | TextExtraData +testText.getExtData(); + +testText.on('click', (event: AMap.Text.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Text + event.target; +}); diff --git a/types/amap-js-api/array-bounds.d.ts b/types/amap-js-api/array-bounds.d.ts new file mode 100644 index 0000000000..419d8e4b1d --- /dev/null +++ b/types/amap-js-api/array-bounds.d.ts @@ -0,0 +1,10 @@ +declare namespace AMap { + class ArrayBounds { + constructor(bounds: LocationValue[]); + bounds: LngLat[]; + contains(point: LocationValue): boolean; + // internal + toBounds(): Bounds; + getCenter(): LngLat; + } +} diff --git a/types/amap-js-api/bounds.d.ts b/types/amap-js-api/bounds.d.ts new file mode 100644 index 0000000000..63e880fe65 --- /dev/null +++ b/types/amap-js-api/bounds.d.ts @@ -0,0 +1,12 @@ +declare namespace AMap { + class Bounds { + constructor(southWest: LngLat, northEast: LngLat); + contains(point: LocationValue): boolean; + getCenter(): LngLat; + getSouthWest(): LngLat; + getSouthEast(): LngLat; + getNorthEast(): LngLat; + getNorthWest(): LngLat; + toString(): string; + } +} diff --git a/types/amap-js-api/browser.d.ts b/types/amap-js-api/browser.d.ts new file mode 100644 index 0000000000..71bfaa8fea --- /dev/null +++ b/types/amap-js-api/browser.d.ts @@ -0,0 +1,51 @@ +declare namespace AMap { + namespace Browser { + const ua: string; + const mobile: boolean; + const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other'; + const mac: boolean; + const windows: boolean; + const ios: boolean; + const iPad: boolean; + const iPhone: boolean; + const android: boolean; + const android23: boolean; + const chrome: boolean; + const firefox: boolean; + const safari: boolean; + const wechat: boolean; + const uc: boolean; + const qq: boolean; + const ie: boolean; + const ie6: boolean; + const ie7: boolean; + const ie8: boolean; + const ie9: boolean; + const ie10: boolean; + const ie11: boolean; + const edge: boolean; + const ielt9: boolean; + const baidu: boolean; + const isLocalStorage: boolean; + const isGeolocation: boolean; + const mobileWebkit: boolean; + const mobileWebkit3d: boolean; + const mobileOpera: boolean; + const retina: boolean; + const touch: boolean; + const msPointer: boolean; + const pointer: boolean; + const webkit: boolean; + const ie3d: boolean; + const webkit3d: boolean; + const gecko3d: boolean; + const opera3d: boolean; + const any3d: boolean; + const isCanvas: boolean; + const isSvg: boolean; + const isVML: boolean; + const isWorker: boolean; + const isWebsocket: boolean; + function isWebGL(): boolean; + } +} diff --git a/types/amap-js-api/common.d.ts b/types/amap-js-api/common.d.ts new file mode 100644 index 0000000000..3d51dc719e --- /dev/null +++ b/types/amap-js-api/common.d.ts @@ -0,0 +1,22 @@ +declare namespace AMap { + type SizeValue = Size | [number, number]; + type LocationValue = LngLat | [number, number]; + type Lang = 'zh_cn' | 'en' | 'zh_en'; + + type Event = { type: N } & + (V extends HTMLElement ? { value: V } + : V extends object ? V + : V extends undefined ? {} + : { value: V }); + type MapsEvent = Event; + + type StrokeLineJoin = 'miter' | 'round' | 'bevel'; + type StrokeLineCap = 'butt' | 'round' | 'square'; + type StrokeStyle = 'dashed' | 'solid'; + + type AnimationName = 'AMAP_ANIMATION_NONE' | 'AMAP_ANIMATION_DROP' | 'AMAP_ANIMATION_BOUNCE'; +} diff --git a/types/amap-js-api/convert-from.d.ts b/types/amap-js-api/convert-from.d.ts new file mode 100644 index 0000000000..9fe1f1e76d --- /dev/null +++ b/types/amap-js-api/convert-from.d.ts @@ -0,0 +1,15 @@ +declare namespace AMap { + namespace convertFrom { + interface Result { + info: string; // 'ok' + locations: LngLat[]; + } + type Type = 'gps' | 'baidu' | 'mapbar'; + type SearchStatus = 'complete' | 'error'; + } + function convertFrom( + lnglat: LocationValue | LocationValue[], + type: convertFrom.Type | null, + callback: (status: convertFrom.SearchStatus, result: string | convertFrom.Result) => void + ): void; +} diff --git a/types/amap-js-api/dom-util.d.ts b/types/amap-js-api/dom-util.d.ts new file mode 100644 index 0000000000..d83a2ca69a --- /dev/null +++ b/types/amap-js-api/dom-util.d.ts @@ -0,0 +1,31 @@ +declare namespace AMap { + namespace DomUtil { + function getViewport(dom: HTMLElement): Size; + + function getViewportOffset(dom: HTMLElement): Pixel; + + function create( + tagName: K, + parent?: HTMLElement, + className?: string + ): HTMLElementTagNameMap[K]; + + function setClass(dom: HTMLElement, className?: string): void; + + function hasClass(dom: HTMLElement, className: string): boolean; + + function addClass(dom: HTMLElement, className: string): void; + + function removeClass(dom: HTMLElement, className: string): void; + + function setOpacity(dom: HTMLElement, opacity: number): void; + + function rotate(dom: HTMLElement, deg: number, origin?: { x: number, y: number }): void; + + function setCss(dom: HTMLElement | HTMLElement[], style: Partial): typeof DomUtil; // this + + function empty(dom: HTMLElement): void; + + function remove(dom: HTMLElement): void; + } +} diff --git a/types/amap-js-api/event.d.ts b/types/amap-js-api/event.d.ts new file mode 100644 index 0000000000..d8ff5753c9 --- /dev/null +++ b/types/amap-js-api/event.d.ts @@ -0,0 +1,59 @@ +declare namespace AMap { + abstract class EventEmitter { + on( + eventName: string, + // tslint:disable-next-line:no-unnecessary-generics + handler: (this: C, event: E) => void, + context?: C, + once?: boolean, + unshift?: boolean + ): this; + + off( + eventName: string, + // tslint:disable-next-line + handler: ((this: C, event: E) => void) | 'mv', + context?: C + ): this; + + emit(eventName: string, data?: any): this; + } + + namespace event { + interface EventListener { + type: T; + } + + function addDomListener( + // tslint:disable-next-line: no-unnecessary-generics + instance: HTMLElementTagNameMap[N], + eventName: E, + handler: (this: C, event: HTMLElementEventMap[E]) => void, + context?: C + ): EventListener<0>; + + function addListener( + // tslint:disable-next-line: no-unnecessary-generics + instance: I, + eventName: string, + // tslint:disable-next-line: no-unnecessary-generics + handler: (this: C, event: E) => void, + // tslint:disable-next-line: no-unnecessary-generics + context?: C + ): EventListener<1>; + + function addListenerOnce( + // tslint:disable-next-line: no-unnecessary-generics + instance: I, + eventName: string, + // tslint:disable-next-line: no-unnecessary-generics + handler: (this: C, event: E) => void, + // tslint:disable-next-line: no-unnecessary-generics + context?: C + ): EventListener<1>; + + function removeListener(listener: EventListener<0 | 1>): void; + + function trigger(instance: EventEmitter, eventName: string, data?: any): void; + } +} diff --git a/types/amap-js-api/geometry-util.d.ts b/types/amap-js-api/geometry-util.d.ts new file mode 100644 index 0000000000..03f6800088 --- /dev/null +++ b/types/amap-js-api/geometry-util.d.ts @@ -0,0 +1,122 @@ +declare namespace AMap { + namespace GeometryUtil { + function distance( + point1: LocationValue, + point2: LocationValue | LocationValue[] + ): number; + + function ringArea(ring: LocationValue[]): number; + + function isClockwise(path: LocationValue[]): boolean; + + function distanceOfLine(line: LocationValue[]): number; + + function ringRingClip( + ring1: LocationValue[], + ring2: LocationValue[] + ): Array<[number, number]>; + + function doesRingRingIntersect( + ring1: LocationValue[], + ring2: LocationValue[] + ): boolean; + + function doesLineRingIntersect( + line: LocationValue[], + ring: LocationValue[] + ): boolean; + + function doesLineLineIntersect( + line1: LocationValue[], + line2: LocationValue[] + ): boolean; + + function doesSegmentPolygonIntersect( + point1: LocationValue, + point2: LocationValue, + polygon: LocationValue[][] + ): boolean; + + function doesSegmentRingIntersect( + point1: LocationValue, + point2: LocationValue, + ring: LocationValue[] + ): boolean; + + function doesSegmentLineIntersect( + point1: LocationValue, + point2: LocationValue, + line: LocationValue[] + ): boolean; + + function doesSegmentsIntersect( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue, + point4: LocationValue + ): boolean; + + function isPointInRing(point: LocationValue, ring: LocationValue[]): boolean; + + function isRingInRing(ring1: LocationValue[], ring2: LocationValue[]): boolean; + + function isPointInPolygon(point: LocationValue, polygon: LocationValue[][]): boolean; + + function makesureClockwise(path: Array<[number, number]>): Array<[number, number]>; + + function makesureAntiClockwise(path: Array<[number, number]>): Array<[number, number]>; + + function closestOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): [number, number]; + + function closestOnLine(point: LocationValue, line: LocationValue[]): [number, number]; + + function distanceToSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): number; + + function distanceToLine(point: LocationValue, line: LocationValue[]): number; + + function isPointOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue, + tolerance?: number + ): boolean; + + function isPointOnLine( + point: LocationValue, + line: LocationValue[], + tolerance?: number + ): boolean; + + function isPointOnRing( + point: LocationValue, + ring: LocationValue[], + tolerance?: number + ): boolean; + + function isPointOnPolygon( + point: LocationValue, + polygon: LocationValue[][], + tolerance?: number + ): boolean; + + function doesPolygonPolygonIntersect( + polygon1: LocationValue[], + polygon2: LocationValue[] + ): boolean; + + function distanceToPolygon(point: LocationValue, polygon: LocationValue[]): number; + + function triangulateShape( + shape1: LngLat[] | Pixel[] | [number, number], + shape2: LngLat[] | Pixel[] | [number, number] + ): number[]; + } +} diff --git a/types/amap-js-api/index.d.ts b/types/amap-js-api/index.d.ts new file mode 100644 index 0000000000..5b8c1a5b94 --- /dev/null +++ b/types/amap-js-api/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for non-npm package amap-js-api 1.4 +// Project: https://lbs.amap.com/api/javascript-api/summary +// Definitions by: breeze9527 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/types/amap-js-api/layer/building.d.ts b/types/amap-js-api/layer/building.d.ts new file mode 100644 index 0000000000..30dd7c4092 --- /dev/null +++ b/types/amap-js-api/layer/building.d.ts @@ -0,0 +1,30 @@ +declare namespace AMap { + namespace Buildings { + interface Options extends Layer.Options { + zooms?: [number, number]; + opacity?: number; + heightFactor?: number; + visible?: boolean; + zIndex?: number; + // inner + merge?: boolean; + sort?: boolean; + } + interface AreaStyle { + color1: string; + path: LocationValue[]; + color2?: string; + visible?: boolean; + rejectTexture?: boolean; + } + interface Style { + hideWithoutStyle?: boolean; + areas: AreaStyle[]; + } + } + + class Buildings extends Layer { + constructor(opts?: Buildings.Options); + setStyle(style: Buildings.Style): void; + } +} diff --git a/types/amap-js-api/layer/flexible.d.ts b/types/amap-js-api/layer/flexible.d.ts new file mode 100644 index 0000000000..bdb4001a7c --- /dev/null +++ b/types/amap-js-api/layer/flexible.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace TileLayer { + namespace Flexible { + interface Options extends TileLayer.Options { + createTile?( + x: number, + y: number, + z: number, + success: (tile: HTMLImageElement | HTMLCanvasElement) => void, + fail: () => void + ): void; + cacheSize?: number; + visible?: boolean; + } + } + class Flexible extends TileLayer { + constructor(options?: Flexible.Options); + } + } +} diff --git a/types/amap-js-api/layer/layer.d.ts b/types/amap-js-api/layer/layer.d.ts new file mode 100644 index 0000000000..8f35d949fd --- /dev/null +++ b/types/amap-js-api/layer/layer.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace Layer { + interface Options { + map?: Map; + } + } + + abstract class Layer extends EventEmitter { + getContainer(): HTMLDivElement | undefined; + getZooms(): [number, number]; + setOpacity(alpha: number): void; + getOpacity(): number; + show(): void; + hide(): void; + setMap(map?: Map | null): void; + getMap(): Map | null | undefined; + setzIndex(index: number): void; + getzIndex(): number; + } +} diff --git a/types/amap-js-api/layer/layerGroup.d.ts b/types/amap-js-api/layer/layerGroup.d.ts new file mode 100644 index 0000000000..4cc463eef7 --- /dev/null +++ b/types/amap-js-api/layer/layerGroup.d.ts @@ -0,0 +1,21 @@ +declare namespace AMap { + class LayerGroup extends Layer { + constructor(layers: L | L[]); + addLayer(layer: L | L[]): this; + addLayers(layers: L | L[]): this; + getLayers(): L[]; + getLayer(finder: (this: null, item: L, index: number, list: L[]) => boolean): L | null; + hasLayer(layer: L | ((this: null, item: L, index: number, list: L[]) => boolean)): boolean; + removeLayer(layer: L | L[]): this; + removeLayers(layer: L | L[]): this; + clearLayers(): this; + eachLayer(iterator: (this: C, layer: L, index: number, list: L[]) => void, context?: C): void; + + // overwrite + setMap(map?: Map): this; + hide(): this; + show(): this; + reload(): this; + setOptions(options: any): this; + } +} diff --git a/types/amap-js-api/layer/massMarks.d.ts b/types/amap-js-api/layer/massMarks.d.ts new file mode 100644 index 0000000000..1ab5464a5b --- /dev/null +++ b/types/amap-js-api/layer/massMarks.d.ts @@ -0,0 +1,47 @@ +declare namespace AMap { + namespace MassMarks { + interface EventMap { + click: UIEvent<'click', I>; + dblclick: UIEvent<'dblclick', I>; + mousedown: UIEvent<'mousedown', I>; + mouseup: UIEvent<'mouseup', I>; + mouseover: UIEvent<'mouseover', I>; + mouseout: UIEvent<'mouseout', I>; + touchstart: UIEvent<'touchstart', I>; + touchend: UIEvent<'touchend', I>; + } + + interface Style { + anchor: Pixel; + url: string; + size: Size; + rotation?: number; + } + + type UIEvent = Event ? D : Data; + }>; + + interface Options extends Layer.Options { + zIndex?: number; + cursor?: string; + alwayRender?: boolean; + style: Style | Style[]; + // rejectMapMask + } + interface Data { + lnglat: LocationValue; + style?: number; + } + } + + class MassMarks extends Layer { + constructor(data: D[] | string, opts: MassMarks.Options); + setStyle(style: MassMarks.Style | MassMarks.Style[]): void; + getStyle(): MassMarks.Style | MassMarks.Style[]; + setData(data: D[] | string): void; + getData(): Array> & { lnglat: LngLat }>; + clear(): void; + } +} diff --git a/types/amap-js-api/layer/mediaLayer.d.ts b/types/amap-js-api/layer/mediaLayer.d.ts new file mode 100644 index 0000000000..a38f5ba025 --- /dev/null +++ b/types/amap-js-api/layer/mediaLayer.d.ts @@ -0,0 +1,35 @@ +declare namespace AMap { + namespace MediaLayer { + interface Options extends Layer.Options { + bounds?: Bounds; + visible?: boolean; + zooms?: [number, number]; + opacity?: number; + } + } + + abstract class MediaLayer extends Layer { + constructor(options?: MediaLayer.Options); + setBounds(bounds: Bounds): void; + getBounds(): Bounds; + setOptions(options: Partial): void; + getOptions(): Partial; + getElement(): E | null; + } + + class ImageLayer extends MediaLayer { + setImageUrl(url: string): void; + getImageUrl(): string | undefined; + } + + class VideoLayer extends MediaLayer { + setVideoUrl(source: string | string[]): void; + getVideoUrl(): string | string[] | undefined; + } + + class CanvasLayer extends MediaLayer { + setCanvas(canvas: HTMLCanvasElement): void; + getCanvas(): HTMLCanvasElement | undefined; + reFresh(): void; + } +} diff --git a/types/amap-js-api/layer/tileLayer.d.ts b/types/amap-js-api/layer/tileLayer.d.ts new file mode 100644 index 0000000000..7576a70664 --- /dev/null +++ b/types/amap-js-api/layer/tileLayer.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace TileLayer { + interface EventMap { + complete: Event<'complete'>; + } + + interface Options extends Layer.Options { + tileSize?: number; + tileUrl?: string; + errorUrl?: string; + getTileUrl?: string | ((x: number, y: number, level: number) => string); + zIndex?: number; + opacity?: number; + zooms?: [number, number]; + detectRetina?: boolean; + } + class Satellite extends TileLayer { } + class RoadNet extends TileLayer { } + + namespace Traffic { + interface Options extends TileLayer.Options { + autoRefresh?: boolean; + interval?: number; + } + } + class Traffic extends TileLayer { + constructor(options?: Traffic.Options); + } + } + + class TileLayer extends Layer { + constructor(options?: TileLayer.Options); + getTiles(): string[]; + reload(): void; + setTileUrl(url: string | ((x: number, y: number, level: number) => string)): void; + } +} diff --git a/types/amap-js-api/layer/wms.d.ts b/types/amap-js-api/layer/wms.d.ts new file mode 100644 index 0000000000..c4561ddf14 --- /dev/null +++ b/types/amap-js-api/layer/wms.d.ts @@ -0,0 +1,29 @@ +declare namespace AMap { + namespace TileLayer { + namespace WMS { + interface Params { + VERSION?: string; + LAYERS?: string; + STYLES?: string; + FORMAT?: string; + TRANSPARENT?: 'TRUE' | 'FALSE'; + BGCOLOR?: string; + EXCEPTIONS?: string; + TIME?: string; + ELEVATION?: string; + } + interface Options extends Flexible.Options { + url: string; + params: Params; + blend?: boolean; + } + } + class WMS extends Flexible { + constructor(options: WMS.Options); + setUrl(url: string): void; + getUrl(): string; + setParams(params: WMS.Params): void; + getParams(): WMS.Params; + } + } +} diff --git a/types/amap-js-api/layer/wmts.d.ts b/types/amap-js-api/layer/wmts.d.ts new file mode 100644 index 0000000000..5d85e5df48 --- /dev/null +++ b/types/amap-js-api/layer/wmts.d.ts @@ -0,0 +1,25 @@ +declare namespace AMap { + namespace TileLayer { + namespace WMTS { + interface Params { + Version?: string; + Layer?: string; + Style?: string; + Format?: string; + } + interface Options extends Flexible.Options { + url: string; + params: Params; + blend?: boolean; + } + } + + class WMTS extends Flexible { + constructor(options: WMTS.Options); + setUrl(url: string): void; + getUrl(): string; + setParams(params: WMTS.Params): void; + getParams(): WMTS.Params; + } + } +} diff --git a/types/amap-js-api/lngLat.d.ts b/types/amap-js-api/lngLat.d.ts new file mode 100644 index 0000000000..4247002b2b --- /dev/null +++ b/types/amap-js-api/lngLat.d.ts @@ -0,0 +1,17 @@ +declare namespace AMap { + class LngLat { + constructor(lng: number, lat: number, noAutofix?: boolean); + offset(east: number, north: number): LngLat; + distance(lnglat: LngLat | LngLat[]): number; + getLng(): number; + getLat(): number; + equals(lnglat: LngLat): boolean; + toString(): string; + + // internal + add(lnglat: LngLat, noAutofix?: boolean): LngLat; + subtract(lnglat: LngLat, noAutofix?: boolean): LngLat; + divideBy(num: number, noAutofix?: boolean): LngLat; + multiplyBy(num: number, noAutofix?: boolean): LngLat; + } +} diff --git a/types/amap-js-api/map.d.ts b/types/amap-js-api/map.d.ts new file mode 100644 index 0000000000..46edc68577 --- /dev/null +++ b/types/amap-js-api/map.d.ts @@ -0,0 +1,187 @@ +declare namespace AMap { + namespace Map { + type Feature = 'bg' | 'point' | 'road' | 'building'; + type ViewMode = '2D' | '3D'; + interface Options { + view?: View2D; + layers?: Layer[]; + zoom?: number; + center?: LocationValue; + labelzIndex?: number; + zooms?: [number, number]; + lang?: Lang; + defaultCursor?: string; + crs?: 'EPSG3857' | 'EPSG3395' | 'EPSG4326'; + animateEnable?: boolean; + isHotspot?: boolean; + defaultLayer?: TileLayer; + rotateEnable?: boolean; + resizeEnable?: boolean; + showIndoorMap?: boolean; + expandZoomRange?: boolean; + dragEnable?: boolean; + zoomEnable?: boolean; + doubleClickZoom?: boolean; + keyboardEnable?: boolean; + jogEnable?: boolean; + scrollWheel?: boolean; + touchZoom?: boolean; + touchZoomCenter?: number; + mapStyle?: string; + features?: Feature[] | 'all' | Feature; + showBuildingBlock?: boolean; + viewMode?: ViewMode; + pitch?: number; + pitchEnable?: boolean; + buildingAnimation?: boolean; + skyColor?: string; + preloadMode?: boolean; + mask?: Array<[number, number]> | Array> | Array>>; + maxPitch?: number; + rotation?: number; + forceVector?: boolean; + + // internal + baseRender?: 'vw' | 'd' | 'dv' | 'v'; + overlayRender?: 'c' | 'd'; + showLabel?: boolean; + gridMapForeign?: boolean; + logoUrl?: string; + logoUrlRetina?: string; + copyright?: string; + turboMode?: boolean; + workerMode?: boolean; + // continuousZoomEnable?: boolean; + // showFog: boolean; + // yaw: number; + // scale: number; + // detectRetina: number; + } + interface Status { + animateEnable: boolean; + doubleClickZoom: boolean; + dragEnable: boolean; + isHotspot: boolean; + jogEnable: boolean; + keyboardEnable: boolean; + pitchEnable: boolean; + resizeEnable: boolean; + rotateEnable: boolean; + scrollWheel: boolean; + touchZoom: boolean; + zoomEnable: boolean; + } + type HotspotEvent = Event; + interface EventMap { + click: MapsEvent<'click', Map>; + dblclick: MapsEvent<'dblclick', Map>; + rightclick: MapsEvent<'rightclick', Map>; + rdblclick: MapsEvent<'rdblclick', Map>; + mouseup: MapsEvent<'mouseup', Map>; + mousedown: MapsEvent<'mousedown', Map>; + mousemove: MapsEvent<'mousemove', Map>; + mousewheel: MapsEvent<'mousewheel', Map>; + mouseover: MapsEvent<'mouseover', Map>; + mouseout: MapsEvent<'mouseout', Map>; + touchstart: MapsEvent<'touchstart', Map>; + touchmove: MapsEvent<'touchmove', Map>; + touchend: MapsEvent<'touchend', Map>; + contextmenu: MapsEvent<'contextmenu', Map>; + + hotspotclick: HotspotEvent<'hotspotclick'>; + hotspotover: HotspotEvent<'hotspotover'>; + hotspotout: HotspotEvent<'hotspotout'>; + + complete: Event<'complete'>; + mapmove: Event<'mapmove'>; + movestart: Event<'movestart'>; + moveend: Event<'moveend'>; + zoomchange: Event<'zoomchange'>; + zoomstart: Event<'zoomstart'>; + zoomend: Event<'zoomend'>; + dragstart: Event<'dragstart'>; + dragging: Event<'dragging'>; + dragend: Event<'dragend'>; + resize: Event<'resize'>; + } + } + + class Map extends EventEmitter { + constructor(container: string | HTMLElement, opts?: Map.Options); + poiOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void; + detailOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void; + getZoom(): number; + getLayers(): Layer[]; + getCenter(): LngLat; + getContainer(): HTMLElement | null; + getCity(callback: (cityData: { + city: string; + citycode: string; + district: string; + province: string | never[]; // province is empty array when getCity fail + }) => void): void; + getBounds(): Bounds; + getLabelzIndex(): number; + getLimitBounds(): Bounds; + getLang(): Lang; + getSize(): Size; + getRotation(): number; + getStatus(): Map.Status; + getDefaultCursor(): string; + getResolution(point?: LocationValue): number; + getScale(dpi?: number): number; + setZoom(level: number): void; + setLabelzIndex(index: number): void; + setLayers(layers: Layer[]): void; + add(overlay: Overlay | Overlay[]): void; + remove(overlay: Overlay | Overlay[]): void; + getAllOverlays(type?: 'marker' | 'circle' | 'polyline' | 'polygon'): Overlay[]; + setCenter(center: LocationValue): void; + setZoomAndCenter(zoomLevel: number, center: LocationValue): void; + setCity(city: string, callback: (this: this, coord: [string, string], zoom: number) => void): void; + setBounds(bound: Bounds): Bounds; + setLimitBounds(bound: Bounds): void; + clearLimitBounds(): void; + setLang(lang: Lang): void; + setRotation(rotation: number): void; + setStatus(status: Partial): void; + setDefaultCursor(cursor: string): void; + zoomIn(): void; + zoomOut(): void; + panTo(position: LocationValue): void; + panBy(x: number, y: number): void; + setFitView( + overlayList?: Overlay | Overlay[], + immediately?: boolean, + avoid?: [number, number, number, number], + maxZoom?: number + ): Bounds | false | undefined; + clearMap(): void; + destroy(): void; + plugin(name: string | string[], callback: () => void): this; + addControl(control: {}): void; // TODO + removeControl(control: {}): void; // TODO + clearInfoWindow(): void; + pixelToLngLat(pixel: Pixel, level?: number): LngLat; + lnglatToPixel(lnglat: LocationValue, level?: number): Pixel; + containerToLngLat(pixel: Pixel): LngLat; + lngLatToContainer(lnglat: LocationValue): Pixel; + lnglatTocontainer(lnglat: LocationValue): Pixel; + setMapStyle(style: string): void; + getMapStyle(): string; + setFeatures(feature: Map.Feature | Map.Feature[] | 'all'): void; + getFeatures(): Map.Feature | Map.Feature[] | 'all'; + setDefaultLayer(layer: TileLayer): void; + setPitch(pitch: number): void; + getPitch(): number; + getViewMode_(): Map.ViewMode; + lngLatToGeodeticCoord(lnglat: LocationValue): Pixel; + geodeticCoordToLngLat(pixel: Pixel): LngLat; + } +} diff --git a/types/amap-js-api/overlay/bezierCurve.d.ts b/types/amap-js-api/overlay/bezierCurve.d.ts new file mode 100644 index 0000000000..5778cb72a6 --- /dev/null +++ b/types/amap-js-api/overlay/bezierCurve.d.ts @@ -0,0 +1,22 @@ +declare namespace AMap { + namespace BezierCurve { + interface EventMap extends Polyline.EventMap { } + type Options = Merge, { + // internal + path: Array>>; + tolerance?: number; + interpolateNumLimit?: [number | number]; + }>; + + interface GetOptionsResult extends Polyline.GetOptionsResult { + path: Array; + } + } + class BezierCurve extends Polyline { + constructor(options: BezierCurve.Options); + getOptions(): Partial>; + // internal + getInterpolateLngLats(): LngLat[]; + getSerializedPath(): number[][]; + } +} diff --git a/types/amap-js-api/overlay/circle.d.ts b/types/amap-js-api/overlay/circle.d.ts new file mode 100644 index 0000000000..2a1cbd9020 --- /dev/null +++ b/types/amap-js-api/overlay/circle.d.ts @@ -0,0 +1,49 @@ +declare namespace AMap { + namespace Circle { + interface EventMap extends ShapeOverlay.EventMap { + setCenter: Event<'setCenter'>; + setRadius: Event<'setRadius'>; + } + + interface Options { + map?: Map; + zIndex?: number; + center?: LocationValue; + bubble?: boolean; + cursor?: string; + radius?: number; + strokeColor?: string; + strokeOpcity?: number; + strokeWeight?: number; + fillColor?: string; + fillOpacity?: number; + strokeStyle?: StrokeStyle; + extData?: ExtraData; + strokeDasharray?: number[]; + + // internal + visible?: boolean; + unit?: 'meter' | 'px'; // 'might be typo' + } + + type GetOptionsResult = Merge, { + path: LngLat[]; + center: LngLat; + radius: number; + }>; + } + + class Circle extends ShapeOverlay { + constructor(options?: Circle.Options); + setCenter(center: LocationValue, preventEvent?: boolean): void; + getCenter(): LngLat | undefined; + getBounds(): Bounds | null; + setRadius(radius: number, preventEvent?: boolean): void; + getRadius(): number; + setOptions(options?: Circle.Options): void; + getOptions(): Partial>; + contains(point: LocationValue): boolean; + // internal + getPath(count?: number): LngLat[]; + } +} diff --git a/types/amap-js-api/overlay/circleMarker.d.ts b/types/amap-js-api/overlay/circleMarker.d.ts new file mode 100644 index 0000000000..13e4162f46 --- /dev/null +++ b/types/amap-js-api/overlay/circleMarker.d.ts @@ -0,0 +1,4 @@ +declare namespace AMap { + // tslint:disable-next-line; + class CircleMarker extends Circle {} +} diff --git a/types/amap-js-api/overlay/contextMenu.d.ts b/types/amap-js-api/overlay/contextMenu.d.ts new file mode 100644 index 0000000000..72c7fc2852 --- /dev/null +++ b/types/amap-js-api/overlay/contextMenu.d.ts @@ -0,0 +1,23 @@ +declare namespace AMap { + namespace ContextMenu { + interface Options { + content?: string | HTMLElement; + // internal + visible?: boolean; + } + + interface EventMap { + items: Event<'items'>; + open: Event<'open', { target: I }>; + close: Event<'close', { target: I }>; + } + } + + class ContextMenu extends Overlay { + constructor(options?: ContextMenu.Options); + addItem(text: string, fn: (this: HTMLLIElement) => void, num?: number): void; + removeItem(test: string, fn: (this: HTMLLIElement) => void): void; + open(map: Map, position: LocationValue): void; + close(): void; + } +} diff --git a/types/amap-js-api/overlay/ellipse.d.ts b/types/amap-js-api/overlay/ellipse.d.ts new file mode 100644 index 0000000000..55feaf3112 --- /dev/null +++ b/types/amap-js-api/overlay/ellipse.d.ts @@ -0,0 +1,27 @@ +declare namespace AMap { + namespace Ellipse { + interface EventMap extends ShapeOverlay.EventMap { + setPath: Event<'setPath'>; + setCenter: Event<'setCenter'>; + } + + interface Options extends Polygon.Options { + center?: LocationValue; + radius?: [number, number]; + } + type GetOptionsResult = Merge, { + radius: [number, number]; + }>; + } + + class Ellipse extends Polygon { + constructor(options?: Ellipse.Options); + getCenter(): LngLat | undefined; + setCenter(center: LocationValue, preventEvent?: boolean): void; + setOptions(options: Ellipse.Options): void; + + // internal + setRadius(radius: [number, number], preventEvent?: boolean): void; + getRadius(): [number, number]; + } +} diff --git a/types/amap-js-api/overlay/geoJSON.d.ts b/types/amap-js-api/overlay/geoJSON.d.ts new file mode 100644 index 0000000000..75098a59f0 --- /dev/null +++ b/types/amap-js-api/overlay/geoJSON.d.ts @@ -0,0 +1,43 @@ +declare namespace AMap { + namespace GeoJSON { + type Geometry = { + type: 'Point'; + coordinates: [number, number]; + } | { + type: 'MultiPoint' | 'LineString' | 'Polygon'; + coordinates: Array<[number, number]>; + } | { + type: 'MultiLineString' | 'MultiPolygon'; + coordinates: Array>; + } | { + type: 'GeometryCollection'; + geometries: Geometry[]; + }; + + type GeoJSONObject = { + type: 'Feature'; + properties: any; + geometry: Geometry; + } | { + type: 'FeatureCollection', + properties: any; + features: GeoJSONObject[]; + }; + interface Options { + geoJSON?: GeoJSONObject | GeoJSONObject[]; + getMarker?(obj: GeoJSONObject, lnglat: LngLat): Marker; + getPolyline?(obj: GeoJSONObject, lnglats: LngLat[]): Polyline; + getPolygon?(obj: GeoJSONObject, lnglats: LngLat[]): Polygon; + coordsToLatLng?(lnglat: LngLat): LngLat; + + // internal + coordsToLatLngs?(lnglats: LngLat[]): LngLat[]; + } + } + + class GeoJSON extends OverlayGroup { + constructor(options?: GeoJSON.Options); + importData(obj: GeoJSON.GeoJSONObject | GeoJSON.GeoJSONObject[]): void; + toGeoJSON(): GeoJSON.GeoJSONObject[]; + } +} diff --git a/types/amap-js-api/overlay/icon.d.ts b/types/amap-js-api/overlay/icon.d.ts new file mode 100644 index 0000000000..be300feef3 --- /dev/null +++ b/types/amap-js-api/overlay/icon.d.ts @@ -0,0 +1,16 @@ +declare namespace AMap { + namespace Icon { + interface Options { + size?: SizeValue; + imageOffset?: Pixel; + image?: string; + imageSize?: SizeValue; + } + } + + class Icon extends EventEmitter { + constructor(options?: Icon.Options); + setImageSize(size: SizeValue): void; + getImageSize(): Size; + } +} diff --git a/types/amap-js-api/overlay/infoWindow.d.ts b/types/amap-js-api/overlay/infoWindow.d.ts new file mode 100644 index 0000000000..54bedd95a8 --- /dev/null +++ b/types/amap-js-api/overlay/infoWindow.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace InfoWindow { + interface EventMap { + change: Event<'change', { target: I }>; + open: Event<'open', { target: I }>; + close: Event<'close', { target: I }>; + } + + interface Options extends Overlay.Options { + isCustom?: boolean; + autoMove?: boolean; + closeWhenClickMap?: boolean; + content?: string | HTMLElement; + size?: SizeValue; + offset?: Pixel; + position?: LocationValue; + showShadow?: boolean; + // internal + height?: number; + } + } + + class InfoWindow extends Overlay { + constructor(options?: InfoWindow.Options); + open(map: Map, position?: LocationValue): void; + close(): void; + getIsOpen(): boolean; + setContent(content: string | HTMLElement): void; + getContent(): string | HTMLElement | undefined; + setPosition(lnglat: LocationValue): void; + getPosition(): LngLat | undefined; + setSize(size: SizeValue): void; + getSize(): Size | undefined; + // internal + setOffset(offset: Pixel): void; + } +} diff --git a/types/amap-js-api/overlay/marker.d.ts b/types/amap-js-api/overlay/marker.d.ts new file mode 100644 index 0000000000..e24ce7be8f --- /dev/null +++ b/types/amap-js-api/overlay/marker.d.ts @@ -0,0 +1,103 @@ +declare namespace AMap { + namespace Marker { + interface EventMap { + click: MapsEvent<'click', I>; + dblclick: MapsEvent<'dblclick', I>; + rightclick: MapsEvent<'rightclick', I>; + mousemove: MapsEvent<'mousemove', I>; + mouseover: MapsEvent<'mouseover', I>; + mouseout: MapsEvent<'mouseout', I>; + mousedown: MapsEvent<'mousedown', I>; + mouseup: MapsEvent<'mouseup', I>; + dragstart: MapsEvent<'dragstart', I>; + dragging: MapsEvent<'dragging', I>; + dragend: MapsEvent<'dragend', I>; + moving: Event<'moving', { passwdPath: LngLat[]; }>; + moveend: Event<'moveend'>; + movealong: Event<'movealong'>; + touchstart: MapsEvent<'touchstart', I>; + touchmove: MapsEvent<'touchmove', I>; + touchend: MapsEvent<'touchend', I>; + } + + interface Label { + content?: string; + offset?: Pixel; + } + + interface Options extends Overlay.Options { + position?: LocationValue; + offset?: Pixel; + icon?: string | Icon; + content?: string | HTMLElement; + topWhenClick?: boolean; + bubble?: boolean; + draggable?: boolean; + raiseOnDrag?: boolean; + cursor?: string; + visible?: boolean; + zIndex?: number; + angle?: number; + autoRotation?: boolean; + animation?: AnimationName; + shadow?: Icon | string; + title?: string; + shape?: MarkerShape; + label?: Label; + zooms?: [number, number]; + + // internal + topWhenMouseOver?: boolean; + height?: number; + } + } + + class Marker extends Overlay { + constructor(options?: Marker.Options); + markOnAMAP(obj?: { name?: string, position?: LocationValue }): void; + getOffset(): Pixel; + setOffset(offset: Pixel): void; + setAnimation(animate: AnimationName, prevent?: boolean): void; + getAnimation(): AnimationName; + setClickable(cilckable: boolean): void; + getClickable(): boolean; + getPosition(): LngLat | undefined; + setPosition(position: LocationValue): void; + setAngle(angle: number): void; + setLabel(label?: Marker.Label): void; + getLabel(): Marker.Label | undefined; + getAngle(): number; + setzIndex(index: number): void; + getzIndex(): number; + setIcon(content: string | Icon): void; + getIcon(): string | Icon | undefined; + setDraggable(draggable: boolean): void; + getDraggable(): boolean; + setCursor(cursor: string): void; + setContent(content: string | HTMLElement): void; + getContent(): string | HTMLElement; + moveAlong( + path: LngLat[], + speed: number, + timingFunction?: (t: number) => number, + circleable?: boolean + ): void; + moveTo( + path: LocationValue, + speed: number, + timingFunction?: (t: number) => number + ): void; + stopMove(): void; + pauseMove(): boolean; + resumeMove(): boolean; + setMap(map: null | Map): void; + setTitle(title: string): void; + getTitle(): string | undefined; + setTop(isTop: boolean): void; + getTop(): boolean; + setShadow(icon?: Icon | string): void; + getShadow(): Icon | undefined | string; + setShape(shape?: MarkerShape): void; + getShape(): MarkerShape | undefined; + } +} diff --git a/types/amap-js-api/overlay/markerShape.d.ts b/types/amap-js-api/overlay/markerShape.d.ts new file mode 100644 index 0000000000..f0d6c39bac --- /dev/null +++ b/types/amap-js-api/overlay/markerShape.d.ts @@ -0,0 +1,21 @@ +declare namespace AMap { + namespace MarkerShape { + interface CircleOptions { + type: 'circle'; + coords: [number, number, number]; + } + interface PolyOptions { + type: 'poly'; + coords: number[]; + } + interface RectOptions { + type: 'rect'; + coords: [number, number, number, number]; + } + type Options = CircleOptions | PolyOptions | RectOptions; + } + + class MarkerShape extends EventEmitter { + constructor(options: MarkerShape.Options); + } +} diff --git a/types/amap-js-api/overlay/overlay.d.ts b/types/amap-js-api/overlay/overlay.d.ts new file mode 100644 index 0000000000..1726b39c3e --- /dev/null +++ b/types/amap-js-api/overlay/overlay.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace Overlay { + interface EventMap { + touchstart: MapsEvent<'touchstart', I>; + touchmove: MapsEvent<'touchmove', I>; + touchend: MapsEvent<'touchend', I>; + click: MapsEvent<'click', I>; + rightclick: MapsEvent<'rightclick', I>; + dblclick: MapsEvent<'dblclick', I>; + mousemove: MapsEvent<'mousemove', I>; + mouseover: MapsEvent<'mouseover', I>; + mousedown: MapsEvent<'mousedown', I>; + mouseup: MapsEvent<'mouseup', I>; + } + interface Options { + map?: Map; + cursor?: string; + extData?: ExtraData; + bubble?: boolean; + clickable?: boolean; + draggable?: boolean; + } + } + abstract class Overlay extends EventEmitter { + constructor(options?: Overlay.Options); + show(): void; + hide(): void; + getMap(): Map | null | undefined; + setMap(map: Map | null): void; + setExtData(extData: ExtraData): void; + getExtData(): ExtraData | {}; + + // internal + setHeight(height?: number | string): void; + getHeight(): number | string; + } +} diff --git a/types/amap-js-api/overlay/overlayGroup.d.ts b/types/amap-js-api/overlay/overlayGroup.d.ts new file mode 100644 index 0000000000..d397505b04 --- /dev/null +++ b/types/amap-js-api/overlay/overlayGroup.d.ts @@ -0,0 +1,30 @@ +type ReferOverlayOptions = + O extends AMap.BezierCurve ? AMap.BezierCurve.Options + : O extends AMap.Polyline ? AMap.Polyline.Options + : O extends AMap.Circle ? AMap.Circle.Options + : O extends AMap.Ellipse ? AMap.Ellipse.Options + : O extends AMap.Polygon ? AMap.Polygon.Options + : O extends AMap.Text ? AMap.Text.Options + : O extends AMap.Marker ? AMap.Marker.Options + : O extends AMap.Rectangle ? AMap.Rectangle.Options + : any; + +declare namespace AMap { + class OverlayGroup extends Overlay { + constructor(overlays?: O | O[]); + addOverlay(overlay: O | O[]): this; + addOverlays(overlay: O | O[]): this; + getOverlays(): O[]; + hasOverlay(overlay: O | ((this: null, item: O, index: number, list: O[]) => boolean)): boolean; + removeOverlay(overlay: O | O[]): this; + removeOverlays(overlay: O | O[]): this; + clearOverlays(): this; + eachOverlay(iterator: (this: C, overlay: O, index: number, overlays: O[]) => void, context?: C): this; + setMap(map: null | Map): this; + setOptions(options: ReferOverlayOptions): this; + show(): this; + hide(): this; + + getOverlay(finder: ((this: null, item: O, index: number, list: O[]) => boolean) | O): O | null; + } +} diff --git a/types/amap-js-api/overlay/pathOverlay.d.ts b/types/amap-js-api/overlay/pathOverlay.d.ts new file mode 100644 index 0000000000..de21aa35a7 --- /dev/null +++ b/types/amap-js-api/overlay/pathOverlay.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace PathOverlay { + interface EventMap extends ShapeOverlay.EventMap { } + interface Options extends Overlay.Options { + visible?: boolean; + zIndex?: number; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + strokeStyle?: StrokeStyle; + strokeDasharray?: number[]; + lineJoin?: StrokeLineJoin; + lineCap?: StrokeLineCap; + } + } + abstract class PathOverlay extends ShapeOverlay { + constructor(options?: PathOverlay.Options); + getBounds(): Bounds | (this extends Rectangle ? undefined : null); + } +} diff --git a/types/amap-js-api/overlay/polygon.d.ts b/types/amap-js-api/overlay/polygon.d.ts new file mode 100644 index 0000000000..8792e0e135 --- /dev/null +++ b/types/amap-js-api/overlay/polygon.d.ts @@ -0,0 +1,32 @@ +declare namespace AMap { + namespace Polygon { + interface EventMap extends PathOverlay.EventMap { } + interface Options extends PathOverlay.Options { + path?: LocationValue[] | LocationValue[][]; + fillColor?: string; + fillOpacity?: number; + } + + interface GetOptionsResult extends ShapeOverlay.GetOptionsResult { + fillColor: string; + fillOpacity: number; + path: LngLat[] | LngLat[][]; + lineJoin: StrokeLineJoin; + texture: string; + } + } + + class Polygon extends PathOverlay { + constructor(options?: Polygon.Options); + setPath(path: LocationValue[] | LocationValue[][]): void; + getPath(): LngLat[] | LngLat[][]; + setOptions(options: Polygon.Options): void; + getOptions(): Partial< + this extends Omit ? Ellipse.GetOptionsResult : + this extends Omit ? Rectangle.GetOptionsResult : + Polygon.GetOptionsResult + >; + getArea(): number; + contains(point: LocationValue): boolean; + } +} diff --git a/types/amap-js-api/overlay/polyline.d.ts b/types/amap-js-api/overlay/polyline.d.ts new file mode 100644 index 0000000000..207279b208 --- /dev/null +++ b/types/amap-js-api/overlay/polyline.d.ts @@ -0,0 +1,46 @@ +declare namespace AMap { + namespace Polyline { + interface EventMap extends PathOverlay.EventMap { } + interface GetOptionsResult extends ShapeOverlay.GetOptionsResult { + isOutline: boolean; + outlineColor: string; + geodesic: boolean; + path: LngLat[]; + lineJoin: StrokeLineJoin; + lineCap: StrokeLineCap; + borderWeight: number; + showDir: boolean; + dirColor: string; + dirImg: string; + } + + interface Options extends PathOverlay.Options { + isOutline?: boolean; + outlineColor?: string; + geodesic?: boolean; + dirColor?: string; + borderWeight?: number; + showDir?: boolean; + // internal + path?: LocationValue[]; + } + } + + class Polyline extends PathOverlay { + constructor(options?: BezierCurve.Options | Polyline.Options); + setPath( + path: this extends Omit ? + Array>> + : LocationValue[] + ): void; + getPath(): this extends Omit ? + Array + : LngLat[]; + getLength(): number; + setOptions(options: this extends Omit ? + Partial> + : Polyline.Options + ): void; + getOptions(): Partial>; + } +} diff --git a/types/amap-js-api/overlay/rectangle.d.ts b/types/amap-js-api/overlay/rectangle.d.ts new file mode 100644 index 0000000000..259e2072de --- /dev/null +++ b/types/amap-js-api/overlay/rectangle.d.ts @@ -0,0 +1,21 @@ +declare namespace AMap { + namespace Rectangle { + interface EventMap extends Polygon.EventMap { + setBounds: Event<'setBounds'>; + } + + interface Options extends Polygon.Options { + bounds?: Bounds; + } + type GetOptionsResult = Merge, { + path: LngLat[]; + bounds: Bounds; + texture: string; + }>; + } + class Rectangle extends Polygon { + constructor(options?: Rectangle.Options); + setBounds(bounds: Bounds, preventEvent?: boolean): void; + setOptions(options: Partial): void; + } +} diff --git a/types/amap-js-api/overlay/shapeOverlay.d.ts b/types/amap-js-api/overlay/shapeOverlay.d.ts new file mode 100644 index 0000000000..b8f239aac1 --- /dev/null +++ b/types/amap-js-api/overlay/shapeOverlay.d.ts @@ -0,0 +1,30 @@ +declare namespace AMap { + namespace ShapeOverlay { + interface EventMap extends Overlay.EventMap { + show: Event<'show', { target: I }>; + hide: Event<'hide', { target: I }>; + options: Event<'options'>; + change: Event<'change', { target: I }>; + } + interface GetOptionsResult { + map: Map; + zIndex: number; + strokeColor: string; + strokeOpacity: number; + strokeWeight: number; + strokeStyle: StrokeStyle; + strokeDasharray: number[]; + extData: ExtraData | {}; + bubble: boolean; + clickable: boolean; + } + } + abstract class ShapeOverlay extends Overlay { + abstract setOptions(options: {}): void; + abstract getOptions(): {}; + getzIndex(): number; + setzIndex(zIndex: number): void; + getVisible(): boolean; + setDraggable(draggable: boolean): void; + } +} diff --git a/types/amap-js-api/overlay/text.d.ts b/types/amap-js-api/overlay/text.d.ts new file mode 100644 index 0000000000..db15ae08ce --- /dev/null +++ b/types/amap-js-api/overlay/text.d.ts @@ -0,0 +1,19 @@ +declare namespace AMap { + namespace Text { + type TextAlign = 'left' | 'right' | 'center'; + type VerticalAlign = 'top' | 'middle' | 'bottom'; + interface EventMap extends Marker.EventMap { } + interface Options extends Marker.Options { + text?: string; + textAlign?: TextAlign; + verticalAlign?: VerticalAlign; + } + } + + class Text extends Marker { + constructor(options?: Text.Options); + getText(): string; + setText(text: string): void; + setStyle(style: object): void; + } +} diff --git a/types/amap-js-api/pixel.d.ts b/types/amap-js-api/pixel.d.ts new file mode 100644 index 0000000000..fab4605b7a --- /dev/null +++ b/types/amap-js-api/pixel.d.ts @@ -0,0 +1,17 @@ +declare namespace AMap { + class Pixel { + constructor(x: number, y: number, round?: boolean); + getX(): number; + getY(): number; + equals(point: Pixel): boolean; + toString(): string; + + // internal + add(offset: {x: number; y: number}, round?: boolean): Pixel; + round(): Pixel; + floor(): Pixel; + length(): number; + direction(): null | number; + toFixed(decimals?: number): this; + } +} diff --git a/types/amap-js-api/size.d.ts b/types/amap-js-api/size.d.ts new file mode 100644 index 0000000000..12a1e25423 --- /dev/null +++ b/types/amap-js-api/size.d.ts @@ -0,0 +1,10 @@ +declare namespace AMap { + class Size { + constructor(width: number, height: number); + getWidth(): number; + getHeight(): number; + toString(): string; + // internal + contains(size: { x: number; y: number }): boolean; + } +} diff --git a/types/amap-js-api/tsconfig.json b/types/amap-js-api/tsconfig.json new file mode 100644 index 0000000000..a26facba9e --- /dev/null +++ b/types/amap-js-api/tsconfig.json @@ -0,0 +1,66 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "forceConsistentCasingInFileNames": true + }, + "files": [ + "array-bounds.d.ts", + "bounds.d.ts", + "browser.d.ts", + "common.d.ts", + "convert-from.d.ts", + "dom-util.d.ts", + "event.d.ts", + "geometry-util.d.ts", + "index.d.ts", + "layer/building.d.ts", + "layer/flexible.d.ts", + "layer/layer.d.ts", + "layer/layerGroup.d.ts", + "layer/massMarks.d.ts", + "layer/mediaLayer.d.ts", + "layer/tileLayer.d.ts", + "layer/wms.d.ts", + "layer/wmts.d.ts", + "lngLat.d.ts", + "map.d.ts", + "overlay/bezierCurve.d.ts", + "overlay/circle.d.ts", + "overlay/circleMarker.d.ts", + "overlay/contextMenu.d.ts", + "overlay/ellipse.d.ts", + "overlay/geoJSON.d.ts", + "overlay/icon.d.ts", + "overlay/infoWindow.d.ts", + "overlay/marker.d.ts", + "overlay/markerShape.d.ts", + "overlay/overlay.d.ts", + "overlay/overlayGroup.d.ts", + "overlay/pathOverlay.d.ts", + "overlay/polygon.d.ts", + "overlay/polyline.d.ts", + "overlay/rectangle.d.ts", + "overlay/shapeOverlay.d.ts", + "overlay/text.d.ts", + "pixel.d.ts", + "size.d.ts", + "type-util.d.ts", + "util.d.ts", + "view2D.d.ts", + "amap-js-api-tests.ts" + ] +} diff --git a/types/make-dir/tslint.json b/types/amap-js-api/tslint.json similarity index 100% rename from types/make-dir/tslint.json rename to types/amap-js-api/tslint.json diff --git a/types/amap-js-api/type-util.d.ts b/types/amap-js-api/type-util.d.ts new file mode 100644 index 0000000000..1ced3d69c1 --- /dev/null +++ b/types/amap-js-api/type-util.d.ts @@ -0,0 +1,12 @@ +type Omit = { + [K in Exclude]: T[K] +}; + +type OptionalKey = { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T]; +// type OmitUndefined = Omit; +// type PickUndefined = Omit>; + +type Merge = + { [K in Exclude>]-?: O[K]; } & + { [K in Extract, OptionalKey>]?: O[K]; } & + T; diff --git a/types/amap-js-api/util.d.ts b/types/amap-js-api/util.d.ts new file mode 100644 index 0000000000..70b48c31d1 --- /dev/null +++ b/types/amap-js-api/util.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace Util { + function colorNameToHex(colorName: string): string; + + function rgbHex2Rgba(hex: string): string; + + function argbHex2Rgba(hex: string): string; + + function isEmpty(obj: object): boolean; + + function deleteItemFromArray(array: T[], item: T): T[]; + + function deleteItemFromArrayByIndex(array: T[], index: number): T[]; + + function indexOf(array: T[], item: T): number; + + function format(floatNumber: number, digits?: number): number; + + function isArray(data: any): data is any[]; + + function isDOM(data: any): data is HTMLElement; + + function includes(array: T[], item: T): boolean; + + function requestIdleCallback(callback: (...args: any[]) => any, options?: { timeout?: number }): number; + + function cancelIdleCallback(handle: number): void; + + function requestAnimFrame(callback: (this: C, ...args: any[]) => any, context?: C): number; + + function cancelAnimFrame(handle: number): void; + + function color2RgbaArray(color: string | number[]): [number, number, number, number]; + + function color2Rgba(color: string | number[]): string; + } +} diff --git a/types/amap-js-api/view2D.d.ts b/types/amap-js-api/view2D.d.ts new file mode 100644 index 0000000000..d662b4c50e --- /dev/null +++ b/types/amap-js-api/view2D.d.ts @@ -0,0 +1,13 @@ +declare namespace AMap { + namespace View2D { + interface Options { + center?: LocationValue; + rotation?: number; + zoom?: number; + crs?: 'EPGS3857' | 'EPGS3395' | 'EPGS4326'; + } + } + class View2D extends EventEmitter { + constructor(options?: View2D.Options); + } +} diff --git a/types/amqplib/amqplib-tests.ts b/types/amqplib/amqplib-tests.ts index ef448d5b36..a42d2f717d 100644 --- a/types/amqplib/amqplib-tests.ts +++ b/types/amqplib/amqplib-tests.ts @@ -14,6 +14,14 @@ amqp.connect('amqp://localhost') amqp.connect('amqp://localhost') .then(connection => { + connection.serverProperties.copyright; // $ExpectType string | undefined + connection.serverProperties.platform; // $ExpectType string + connection.serverProperties.information; // $ExpectType string + connection.serverProperties.host; // $ExpectType string + connection.serverProperties.product; // $ExpectType string + connection.serverProperties.version; // $ExpectType string + connection.serverProperties.customField; // $ExpectType string | undefined + return connection.createChannel() .tap(channel => channel.checkQueue('myQueue')) .then(channel => { @@ -37,6 +45,14 @@ import amqpcb = require('amqplib/callback_api'); amqpcb.connect('amqp://localhost', (err, connection) => { if (!err) { + connection.serverProperties.copyright; // $ExpectType string | undefined + connection.serverProperties.platform; // $ExpectType string + connection.serverProperties.information; // $ExpectType string + connection.serverProperties.host; // $ExpectType string + connection.serverProperties.product; // $ExpectType string + connection.serverProperties.version; // $ExpectType string + connection.serverProperties.customField; // $ExpectType string | undefined + connection.createChannel((err, channel) => { if (!err) { channel.assertQueue('myQueue', {}, (err, ok) => { diff --git a/types/amqplib/callback_api.d.ts b/types/amqplib/callback_api.d.ts index 9fca3972e4..56842abc26 100644 --- a/types/amqplib/callback_api.d.ts +++ b/types/amqplib/callback_api.d.ts @@ -1,11 +1,12 @@ import events = require('events'); -import { Replies, Options, Message } from './properties'; +import { Replies, Options, Message, ServerProperties } from './properties'; export * from './properties'; export interface Connection extends events.EventEmitter { close(callback?: (err: any) => void): void; createChannel(callback: (err: any, channel: Channel) => void): void; createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; + serverProperties: ServerProperties; } export interface Channel extends events.EventEmitter { diff --git a/types/amqplib/index.d.ts b/types/amqplib/index.d.ts index 7087d74edc..77e5d19ca9 100644 --- a/types/amqplib/index.d.ts +++ b/types/amqplib/index.d.ts @@ -8,13 +8,14 @@ import * as Promise from 'bluebird'; import * as events from 'events'; -import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties'; +import { Replies, Options, Message, GetMessage, ConsumeMessage, ServerProperties } from './properties'; export * from './properties'; export interface Connection extends events.EventEmitter { close(): Promise; createChannel(): Promise; createConfirmChannel(): Promise; + serverProperties: ServerProperties; } export interface Channel extends events.EventEmitter { diff --git a/types/amqplib/properties.d.ts b/types/amqplib/properties.d.ts index 97dc8ac393..4c7a210c6f 100644 --- a/types/amqplib/properties.d.ts +++ b/types/amqplib/properties.d.ts @@ -210,3 +210,13 @@ export interface XDeath { "original-expiration"?: any; "routing-keys": string[]; } + +export interface ServerProperties { + host: string; + product: string; + version: string; + platform: string; + copyright?: string; + information: string; + [key: string]: string | undefined; +} diff --git a/types/animejs/animejs-tests.ts b/types/animejs/animejs-tests.ts index 697c79f738..8ed6fccf8e 100644 --- a/types/animejs/animejs-tests.ts +++ b/types/animejs/animejs-tests.ts @@ -1,4 +1,4 @@ -import * as anime from 'animejs'; +import anime from 'animejs'; const test1 = anime({ targets: 'div', @@ -17,9 +17,9 @@ const test2 = anime({ }, translateY: '40px', color: [ - {value: '#FF0000', duration: 2000}, - {value: '#00FF00', duration: 2000}, - {value: '#0000FF', duration: 2000}, + { value: '#FF0000', duration: 2000 }, + { value: '#00FF00', duration: 2000 }, + { value: '#0000FF', duration: 2000 }, ], duration: () => { return 1000000000000; @@ -69,3 +69,9 @@ const bezier = anime.bezier(0, 0, 100, 100); anime.easings['hello'] = anime.bezier(0, 0, 1900, 3020); const runningAnims = anime.running; anime.remove(".tiny-divvy-div"); + +anime.timeline().add({ + targets: [], + duration: 1000, + easing: "linear", +}, 0); diff --git a/types/animejs/index.d.ts b/types/animejs/index.d.ts index 069187b15e..607872039f 100644 --- a/types/animejs/index.d.ts +++ b/types/animejs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for animejs 2.0 // Project: http://animejs.com -// Definitions by: Andrew Babin +// Definitions by: Andrew Babin +// supaiku0 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -110,7 +111,7 @@ declare namespace anime { } interface AnimeTimelineInstance extends AnimeInstance { - add(params: AnimeAnimParams): AnimeTimelineInstance; + add(params: AnimeAnimParams, timelineOffset?: string | number): AnimeTimelineInstance; } // Helpers diff --git a/types/animejs/tsconfig.json b/types/animejs/tsconfig.json index 02c5552371..9ed0aa7d69 100644 --- a/types/animejs/tsconfig.json +++ b/types/animejs/tsconfig.json @@ -14,6 +14,7 @@ "../" ], "types": [], + "allowSyntheticDefaultImports": true, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/ansi-escapes/index.d.ts b/types/ansi-escapes/index.d.ts index 519d429545..d01e74661a 100644 --- a/types/ansi-escapes/index.d.ts +++ b/types/ansi-escapes/index.d.ts @@ -19,10 +19,10 @@ declare namespace Ansi { interface AnsiEscapes { cursorTo(x: number, y?: number): string; cursorMove(x: number, y?: number): string; - cursorUp(count: number): string; - cursorDown(count: number): string; - cursorForward(count: number): string; - cursorBackward(count: number): string; + cursorUp(count?: number): string; + cursorDown(count?: number): string; + cursorForward(count?: number): string; + cursorBackward(count?: number): string; cursorLeft: string; cursorSavePosition: string; diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index ad063c20b6..dc5f9b3eba 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1003,7 +1003,15 @@ const SQSEvent: AWSLambda.SQSEvent = { SenderId: "594035263019", ApproximateFirstReceiveTimestamp: "1529104986230" }, - messageAttributes: {}, + messageAttributes: { + testAttr: { + stringValue: "100", + binaryValue: "base64Str", + stringListValues: [], + binaryListValues: [], + dataType: "Number" + } + }, md5OfBody: "9bb58f26192e4ba00f01e2e7b136bbd8", eventSource: "aws:sqs", eventSourceARN: "arn:aws:sqs:us-west-2:594035263019:NOTFIFOQUEUE", @@ -1039,6 +1047,10 @@ const SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async ( event; str = event.Records[0].messageId; anyObj = event.Records[0].body; + strOrUndefined = event.Records[0].messageAttributes.testAttr.stringValue; + strOrUndefined = event.Records[0].messageAttributes.testAttr.binaryValue; + str = event.Records[0].messageAttributes.testAttr.dataType; + // $ExpectType Context context; str = context.functionName; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 6ebccd452a..910324d7ab 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -27,6 +27,7 @@ // Erik Dalén // Loïk Gaonac'h // Roberto Zen +// Richard Cornelissen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -536,10 +537,10 @@ export type StatementResource = MaybeStatementPrincipal & ({ Resource: string | export type StatementPrincipal = MaybeStatementResource & ({ Principal: PrincipalValue } | { NotPrincipal: PrincipalValue }); /** * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. - * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output + * https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html */ export interface AuthResponseContext { - [name: string]: any; + [name: string]: boolean | number | string; } /** @@ -878,11 +879,17 @@ export interface SQSRecordAttributes { SenderId: string; ApproximateFirstReceiveTimestamp: string; } + +export type SQSMessageAttributeDataType = 'String' | 'Number' | 'Binary' | string; + export interface SQSMessageAttribute { - Name: string; - Type: string; - Value: string; + stringValue?: string; + binaryValue?: string; + stringListValues: never[]; // Not implemented. Reserved for future use. + binaryListValues: never[]; // Not implemented. Reserved for future use. + dataType: SQSMessageAttributeDataType; } + export interface SQSMessageAttributes { [name: string]: SQSMessageAttribute; } diff --git a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts index cc24c6573b..a2db324e39 100644 --- a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts +++ b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts @@ -20,6 +20,10 @@ keyPair3.toWIF(); bitcoin.payments.p2pkh({ pubkey: keyPair3.publicKey }); const network = keyPair3.network; +const keyPair4 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.regtest, rng}); +keyPair4.toWIF(); +bitcoin.payments.p2pkh({ pubkey: keyPair4.publicKey }); + // Test TransactionBuilder and Transaction const txb = new bitcoin.TransactionBuilder(); txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0); diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 4fb1bb16a7..7cedbc822a 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -191,6 +191,7 @@ export class TransactionBuilder { export const networks: { bitcoin: Network; testnet: Network; + regtest: Network; }; export const opcodes: { diff --git a/types/bootstrap-notify/bootstrap-notify-tests.ts b/types/bootstrap-notify/bootstrap-notify-tests.ts index 2977d39abf..4b288b2ca0 100644 --- a/types/bootstrap-notify/bootstrap-notify-tests.ts +++ b/types/bootstrap-notify/bootstrap-notify-tests.ts @@ -46,4 +46,21 @@ $.notify({ '' + '' + '' -}); \ No newline at end of file +}); + +const notifyResult = $.notify({ + message: 'Callbacks have the popup element as an argument', +},{ + onShow: function($ele) { + notifyResult.$ele === $ele; + }, + onShown: function($ele) { + notifyResult.$ele === $ele; + }, + onClose: function($ele) { + notifyResult.$ele === $ele; + }, + onClosed: function($ele) { + notifyResult.$ele === $ele; + }, +}); diff --git a/types/bootstrap-notify/index.d.ts b/types/bootstrap-notify/index.d.ts index 540f200d9c..75994ad365 100644 --- a/types/bootstrap-notify/index.d.ts +++ b/types/bootstrap-notify/index.d.ts @@ -48,16 +48,16 @@ interface NotifySettings { enter?: string; exit?: string; }; - onShow?: () => void; - onShown?: () => void; - onClose?: () => void; - onClosed?: () => void; + onShow?: ($ele: JQuery) => void; + onShown?: ($ele: JQuery) => void; + onClose?: ($ele: JQuery) => void; + onClosed?: ($ele: JQuery) => void; icon_type?: string; template?: string; } interface NotifyReturn { - $ele: JQueryStatic; + $ele: JQuery; close: () => void; update: (command: string, update: any) => void; } diff --git a/types/bootstrap/bootstrap-tests.ts b/types/bootstrap/bootstrap-tests.ts index 9344423cfb..01e5d5352f 100755 --- a/types/bootstrap/bootstrap-tests.ts +++ b/types/bootstrap/bootstrap-tests.ts @@ -196,6 +196,12 @@ $("#popover").popover({ offset: 10, fallbackPlacement: ["flip", "clockwise"], boundary: "scrollParent", + sanitize: false, + whiteList: { + h1: [], + img: ['src', 'alt', 'title', 'width', 'height'], + }, + sanitizeFn: (x: string) => x.replace("<", ""), }); $("#popover").popover({ @@ -207,6 +213,10 @@ $("#popover").popover({ }, }); +$("#popover").popover({ + sanitizeFn: null, +}); + // -------------------------------------------------------------------------------------- // Scrollspy // -------------------------------------------------------------------------------------- @@ -280,10 +290,23 @@ $("#tooltip").on("hide.bs.tooltip", () => {}); $("#tooltip").tooltip({ animation: false, -}); - -$("#tooltip").tooltip({ container: "#container", + delay: {show: 500, hide: 100}, + html: true, + placement: "auto", + selector: "[rel=\"tooltip\"]", + template: '', + title: "Hello world", + trigger: "hover focus", + offset: 10, + fallbackPlacement: ["flip", "clockwise"], + boundary: "scrollParent", + sanitize: false, + whiteList: { + h1: [], + img: ['src', 'alt', 'title', 'width', 'height'], + }, + sanitizeFn: (x: string) => x.replace("<", ""), }); $("#tooltip").tooltip({ @@ -298,18 +321,6 @@ $("#tooltip").tooltip({ delay: 250, }); -$("#tooltip").tooltip({ - delay: {show: 500, hide: 100}, -}); - -$("#tooltip").tooltip({ - html: true, -}); - -$("#tooltip").tooltip({ - placement: "auto", -}); - $("#tooltip").tooltip({ placement(this, tooltip, trigger) { console.log(this.tip === tooltip); @@ -327,22 +338,10 @@ $("#tooltip").tooltip({ }, }); -$("#tooltip").tooltip({ - selector: "[rel=\"tooltip\"]", -}); - $("#tooltip").tooltip({ selector: false, }); -$("#tooltip").tooltip({ - template: '', -}); - -$("#tooltip").tooltip({ - title: "Hello world", -}); - $("#tooltip").tooltip({ title: document.getElementById("title-element") as HTMLElement, }); @@ -353,14 +352,6 @@ $("#tooltip").tooltip({ }, }); -$("#tooltip").tooltip({ - trigger: "hover focus", -}); - -$("#tooltip").tooltip({ - offset: 10, -}); - $("#tooltip").tooltip({ offset: "10px", }); @@ -369,14 +360,10 @@ $("#tooltip").tooltip({ fallbackPlacement: "clockwise", }); -$("#tooltip").tooltip({ - fallbackPlacement: ["flip", "clockwise"], -}); - -$("#tooltip").tooltip({ - boundary: "scrollParent", -}); - $("#tooltip").tooltip({ boundary: aHtmlElement, }); + +$("#popover").popover({ + sanitizeFn: null, +}); diff --git a/types/bootstrap/index.d.ts b/types/bootstrap/index.d.ts index 2fb473fc29..6dc5f21a28 100755 --- a/types/bootstrap/index.d.ts +++ b/types/bootstrap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Bootstrap 4.2 +// Type definitions for Bootstrap 4.3 // Project: https://github.com/twbs/bootstrap/, https://getbootstrap.com // Definitions by: denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -352,6 +352,25 @@ export interface TooltipOption { * @default "scrollParent" */ boundary?: Popper.Boundary | HTMLElement; + + /** + * Enable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized. + * + * @default true + */ + sanitize?: boolean; + + /** + * Object which contains allowed attributes and tags. + */ + whiteList?: {[key: string]: string[]}; + + /** + * Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization. + * + * @default null + */ + sanitizeFn?: null | ((input: string) => string); } // -------------------------------------------------------------------------------------- diff --git a/types/bpmn-moddle/index.d.ts b/types/bpmn-moddle/index.d.ts index f4411e05fa..43a6431308 100644 --- a/types/bpmn-moddle/index.d.ts +++ b/types/bpmn-moddle/index.d.ts @@ -25,6 +25,7 @@ declare namespace BPMNModdle { interface TypeDerived { $type: ElementType; + $parent: TypeDerived; } interface BaseElement extends TypeDerived { /** diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index 72399f1618..58b85e09f3 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -7,7 +7,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -/// /// /// diff --git a/types/browser-sync/package.json b/types/browser-sync/package.json new file mode 100644 index 0000000000..a0e2ec3c5c --- /dev/null +++ b/types/browser-sync/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chokidar": "^2.1.2" + } +} diff --git a/types/camelcase/camelcase-tests.ts b/types/camelcase/camelcase-tests.ts deleted file mode 100644 index 871ec5c3b2..0000000000 --- a/types/camelcase/camelcase-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import camelCase = require('camelcase'); - -camelCase('foo-bar'); -camelCase('foo_bar'); -camelCase('Foo-Bar'); -camelCase('--foo.bar'); -camelCase('__foo__bar__'); -camelCase('foo bar'); -camelCase('foo', 'bar'); -camelCase('__foo__', '--bar'); diff --git a/types/camelcase/index.d.ts b/types/camelcase/index.d.ts deleted file mode 100644 index 83abf5a8a5..0000000000 --- a/types/camelcase/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for camelcase 4.1 -// Project: https://github.com/sindresorhus/camelcase -// Definitions by: Sam Verschueren -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = camelcase; - -declare function camelcase(...args: string[]): string; -declare namespace camelcase {} diff --git a/types/camelcase/tsconfig.json b/types/camelcase/tsconfig.json deleted file mode 100644 index bcc1b505e1..0000000000 --- a/types/camelcase/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "camelcase-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cassanknex/cassanknex-tests.ts b/types/cassanknex/cassanknex-tests.ts new file mode 100644 index 0000000000..b874d2a784 --- /dev/null +++ b/types/cassanknex/cassanknex-tests.ts @@ -0,0 +1,74 @@ +import cassanknex = require('cassanknex'); + +const knex = cassanknex({ + connection: { + contactPoints: ['127.0.0.1'] + } +}); + +knex.on('ready', (err) => { +}); + +interface BirdRow { + type: string; + canFly: boolean; +} + +const qb = knex("animals") + .insert({ + type: 'Stork', + canFly: true + }) + .into('birds'); + +qb.exec((err, res) => { +}); + +qb.eachRow((n, row) => { +}, (err) => { +}); + +interface FooRow { + id: string; + foo: string; + bar: number; + baz: string[]; +} + +const query2 = knex("keyspace") + .select("id", "foo", "bar", "baz") + .ttl('foo') + .where("id", "=", "1") + .orWhere("id", "in", ["2", "3"]) + .orWhere("baz", "=", ["bar"]) + .andWhere("foo", "IN", ["baz", "bar"]) + .limit(10) + .from("table"); + +query2.stream({ + readable() { + const row = this.read(); + }, + end() {}, + error() {} +}); + +const values = { + id: "foo", + bar: 13, + baz: ["foo", "bar"] +}; + +const query3 = knex("cassanKnexy") + .insert(values) + .usingTimestamp(250000) + .usingTTL(50000) + .into("columnFamily"); + +const [cql, params] = [query3.cql(), query3.bindings()]; + +const query4 = knex("cassanKnexy") + .update("columnFamily") + .add("bar", { foo: "baz" }) // "bar" is a map + .remove("foo", ["bar"]) // "foo" is a set + .where("id", "=", 1); diff --git a/types/cassanknex/index.d.ts b/types/cassanknex/index.d.ts new file mode 100644 index 0000000000..fd7f9c53f4 --- /dev/null +++ b/types/cassanknex/index.d.ts @@ -0,0 +1,204 @@ +// Type definitions for cassanknex 1.19 +// Project: https://github.com/azuqua/cassanknex +// Definitions by: Daniel Chao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +import { EventEmitter } from "events"; +import { Client, ClientOptions, types, ResultCallback } from "cassandra-driver"; +import * as Long from "long"; +import { Readable } from "stream"; + +declare function CassanKnex(options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex; + +export = CassanKnex; + +declare namespace CassanKnex { + interface DriverOptions { + debug?: boolean; + connection?: Client | ClientOptions; + } + + /** + * Will return the `never` type if `T[K]` is not a member of `Type`, for all `T[K]`. + */ + type TypeMatchedValue = T[K] extends Type ? This : never; + + interface MappedDict { + [key: string]: B; + } + + type InRestriction = 'in' | 'IN'; + + type ComparisonRestriction = '=' | '<' | '>' | '<=' | '>='; + + type SelectAsClause = { + [P in keyof T]: string; + }; + + interface CassanKnex extends EventEmitter { + (keyspace?: string): QueryBuilderRoot; + } + + interface StreamParams { + readable: (this: Readable) => any; + end: (this: Readable) => any; + error: (err: Error) => any; + } + + interface QueryBuilderRoot { + insert (values: Partial | T): InsertQueryBuilder; + select (...columns: Array): SelectQueryBuilder; + select (values: SelectAsClause): SelectQueryBuilder; + update (table: string): UpdateQueryBuilder; + delete (): DeleteQueryBuilder; + alterColumnFamily (columnFamily: string): AlterColumnFamilyQueryBuilder; + createColumnFamily (columnFamily: string): CreateColumnFamilyQueryBuilder; + createColumnFamilyIfNotExists (columnFamily: string): CreateColumnFamilyQueryBuilder; + createIndex (columnFamily: string, indexName: string, column: keyof T): QueryBuilder; + createIndexCustom (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder; + createType (typeName: string): CreateTypeQueryBuilder; + createTypeIfNotExists (typeName: string): CreateTypeQueryBuilder; + dropColumnFamily(columnFamily: string): QueryBuilder; + dropColumnFamilyIfExists(columnFamily: string): QueryBuilder; + dropType(): QueryBuilder; + dropTypeIfExists(): QueryBuilder; + truncate(columnFamily: string): QueryBuilder; + alterKeyspace(keyspace: string): KeyspaceQueryBuilder; + createKeyspace(keyspace: string): KeyspaceQueryBuilder; + createKeyspaceIfNotExists(keyspace: string): KeyspaceQueryBuilder; + dropKeyspace(): QueryBuilder; + dropKeyspaceIfExists(): QueryBuilder; + } + + interface QueryBuilder { + cql(): string; + bindings(): any[]; + exec(cb: ResultCallback): undefined; + eachRow(onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined; + stream(params: StreamParams): undefined; + } + + interface FieldValueQueryBuilder { + decimal (columnName: K): TypeMatchedValue; + boolean (columnName: K): TypeMatchedValue; + blob (columnName: K): TypeMatchedValue; + timestamp (columnName: K): TypeMatchedValue; + date (columnName: K): TypeMatchedValue; + inet (columnName: K): TypeMatchedValue; + bigint (columnName: K): TypeMatchedValue; + counter (columnName: K): TypeMatchedValue; + double (columnName: K): TypeMatchedValue; + int (columnName: K): TypeMatchedValue; + float (columnName: K): TypeMatchedValue; + map (columnName: K, a: A, b: B): TypeMatchedValue, this>; + ascii (columnName: K): TypeMatchedValue; + text (columnName: K): TypeMatchedValue; + timeuuid (columnName: K): TypeMatchedValue; + uuid (columnName: K): TypeMatchedValue; + varchar (columnName: K): TypeMatchedValue; + list (columnName: K, typeName: string): TypeMatchedValue; + primary(primaryKey: string): this; + set (columnName: K, a: A): TypeMatchedValue, this>; + } + + interface CreateableColumnFamilyBuilder { + withCaching(): this; + withCompression(): this; + withCompaction(): this; + withClusteringOrderBy (value: K, direction: 'desc' | 'asc'): this; + } + + interface CreateableIndexBuilder { + withOptions(opts: MappedDict): this; + } + + interface KeyspaceableQueryBuilder { + withNetworkTopologyStrategy(strategy: MappedDict): this; + withSimpleStrategy(replicas: number): this; + withDurableWrites(durableWrites: boolean): this; + } + + interface InsertableQueryBuilder { + into(table: string): this; + ifNotExists(): this; + } + + interface TtlableQueryBuilder { + usingTimestamp(timestamp: number): this; + usingTTL(ttl: number): this; + } + + interface WhereableQueryBuilder { + where (lhs: K, comparison: InRestriction, rhs: Array): this; + where (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + orWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + orWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + andWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + andWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + tokenWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + tokenWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + ttl (columnName: K): this; + } + + interface IfableQueryBuilder { + if (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this; + } + + interface LimitableQueryBuilder { + limit(limit: number): this; + limitPerPartition(limit: number): this; + } + + interface FromableQueryBuilder { + from(table: string): this; + } + + interface UpdateableQueryBuilder { + set (key: K, value: T[K]): this; + set(object: Partial): this; + add (key: K, value: { [str: string]: T[K] }): TypeMatchedValue, this>; + add (key: K, value: Array): TypeMatchedValue, this>; + add(object: Partial): this; + remove (key: K, value: Array): this; + remove(object: Partial): this; + increment(column: keyof T, amount: number): this; + increment(object: Partial): this; + decrement(column: keyof T, amount: number): this; + decrement(object: Partial): this; + } + + interface AlterableQueryBuilder { + drop (...columns: K[]): this; + rename (column: K, newColumn: K): this; + alter (column: K, newType: string): this; + } + + type InsertQueryBuilder = QueryBuilder + & InsertableQueryBuilder + & TtlableQueryBuilder; + type SelectQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & LimitableQueryBuilder + & FromableQueryBuilder; + type UpdateQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & UpdateableQueryBuilder + & IfableQueryBuilder + & TtlableQueryBuilder; + type DeleteQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & FromableQueryBuilder; + type CreateColumnFamilyQueryBuilder = QueryBuilder + & FieldValueQueryBuilder + & CreateableColumnFamilyBuilder; + type KeyspaceQueryBuilder = QueryBuilder + & KeyspaceableQueryBuilder; + type CreateTypeQueryBuilder = QueryBuilder + & FieldValueQueryBuilder; + type AlterColumnFamilyQueryBuilder = QueryBuilder + & AlterableQueryBuilder + & FieldValueQueryBuilder; +} diff --git a/types/cassanknex/tsconfig.json b/types/cassanknex/tsconfig.json new file mode 100644 index 0000000000..d77cbaca70 --- /dev/null +++ b/types/cassanknex/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", + "cassanknex-tests.ts" + ] +} \ No newline at end of file diff --git a/types/cassanknex/tslint.json b/types/cassanknex/tslint.json new file mode 100644 index 0000000000..4074d3cece --- /dev/null +++ b/types/cassanknex/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false, + "strict-export-declare-modifiers": false + } +} \ No newline at end of file diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 398d05ad33..086d7c24b4 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cesium 1.47 +// Type definitions for cesium 1.54 // Project: http://cesiumjs.org // Definitions by: Aigars Zeiza // Harry Nicholls @@ -706,8 +706,8 @@ declare namespace Cesium { class Event { numberOfListeners: number; - addEventListener(listener: () => void, scope?: any): Event.RemoveCallback; - removeEventListener(listener: () => void, scope?: any): boolean; + addEventListener(listener: (...args: any[]) => void, scope?: any): Event.RemoveCallback; + removeEventListener(listener: (...args: any[]) => void, scope?: any): boolean; raiseEvent(...args: any[]): void; } @@ -1393,7 +1393,7 @@ declare namespace Cesium { class ScreenSpaceEventHandler { constructor(element?: HTMLCanvasElement); - setInputAction(action: () => void, type: number, modifier?: number): void; + setInputAction(action: (click: { position: Cartesian2 }) => void, type: number, modifier?: number): void; getInputAction(type: number, modifier?: number): () => void; removeInputAction(type: number, modifier?: number): void; isDestroyed(): boolean; @@ -3134,6 +3134,15 @@ declare namespace Cesium { static clone(hpr: HeadingPitchRange, result?: HeadingPitchRange): HeadingPitchRange; } + // tslint:disable-next-line:no-unnecessary-class + class Cesium3DTileset { + constructor(Cesium3DTilesetItem: { + url: string; + maximumScreenSpaceError: number; + maximumNumberOfLoadedTiles: number; + }) + } + class ImageryLayer { alpha: number; brightness: number; diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 7745713c84..c601631280 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Chart.js 2.7 -// Project: https://github.com/nnnick/Chart.js, http://www.chartjs.org +// Project: https://github.com/nnnick/Chart.js, https://www.chartjs.org // Definitions by: Alberto Nuti // Fabien Lavocat // KentarouTakeda @@ -357,7 +357,7 @@ declare namespace Chart { cornerRadius?: number; multiKeyBackground?: string; callbacks?: ChartTooltipCallback; - filter?(item: ChartTooltipItem): boolean; + filter?(item: ChartTooltipItem, data: ChartData): boolean; itemSort?(itemA: ChartTooltipItem, itemB: ChartTooltipItem): number; position?: string; caretPadding?: number; diff --git a/types/cheerio/cheerio-tests.ts b/types/cheerio/cheerio-tests.ts index 719c0c70da..89ffb9e28f 100644 --- a/types/cheerio/cheerio-tests.ts +++ b/types/cheerio/cheerio-tests.ts @@ -24,6 +24,8 @@ if ($fromElement("ul > li").length !== 3) { throw new Error("Expecting 3 elements when passing `CheerioElement` to `load()`"); } +$ = cheerio.load(Buffer.from(html)); + $ = cheerio.load(html, { normalizeWhitespace: true, xmlMode: true diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 6c893021a3..f25c978ed0 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -1,8 +1,10 @@ // 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 , AzSiAz +// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani , LiJinyao , Chennakrishna , AzSiAz , Ryo Ota // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + interface Cheerio { // Document References // Cheerio https://github.com/cheeriojs/cheerio @@ -266,7 +268,7 @@ interface CheerioElement { } interface CheerioAPI extends CheerioSelector, CheerioStatic { - load(html: string, options?: CheerioOptionsInterface): CheerioStatic; + load(html: string | Buffer, options?: CheerioOptionsInterface): CheerioStatic; load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic; } diff --git a/types/chokidar/chokidar-tests.ts b/types/chokidar/chokidar-tests.ts deleted file mode 100644 index 13e5fe6a90..0000000000 --- a/types/chokidar/chokidar-tests.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as fs from 'fs'; -import chokidar = require('chokidar'); - -const watcher = chokidar.watch('file, dir, or glob', { - ignored: /[\/\\]\./, persistent: true -}); - -const log = console.log.bind(console); - -watcher - .on('add', (path: string) => { - log('File', path, 'has been added'); - }) - .on('addDir', (path: string) => { - log('Directory', path, 'has been added'); - }) - .on('change', (path: string) => { - log('File', path, 'has been changed'); - }) - .on('unlink', (path: string) => { - log('File', path, 'has been removed'); - }) - .on('unlinkDir', (path: string) => { - log('Directory', path, 'has been removed'); - }) - .on('error', (error: any) => { - log('Error happened', error); - }) - .on('ready', () => { - log('Initial scan complete. Ready for changes.'); - }) - .on('raw', (event: string, path: string, details: any) => { - log('Raw event info:', event, path, details); - }); - -// 'add', 'addDir' and 'change' events also receive stat() results as second -// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats -watcher.on('change', (path: string, stats: fs.Stats) => { - if (stats) { - console.log('File', path, 'changed size to', stats.size); - } -}); - -// Watch new files. -watcher.add('new-file'); -watcher.add(['new-file-2', 'new-file-3', '**/other-file*']); - -// Un-watch some files. -watcher.unwatch('new-file*'); - -// Only needed if watching is `persistent: true`. -watcher.close(); - -// One-liner -chokidar.watch('.', { ignored: /[\/\\]\./ }).on('all', (event: string, path: string) => { - console.log(event, path); -}); diff --git a/types/chokidar/index.d.ts b/types/chokidar/index.d.ts deleted file mode 100644 index 6acc9af265..0000000000 --- a/types/chokidar/index.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -// Type definitions for chokidar 1.7 -// Project: https://github.com/paulmillr/chokidar -// Definitions by: Stefan Steinhart -// Felix Becker -// Zach Cardoza -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -import * as fs from 'fs'; -import { EventEmitter } from 'events'; - -/** - * The object's keys are all the directories (using absolute paths unless the `cwd` option was - * used), and the values are arrays of the names of the items contained in each directory. - */ -export interface WatchedPaths { - [directory: string]: string[]; -} - -export class FSWatcher extends EventEmitter implements fs.FSWatcher { - /** - * Constructs a new FSWatcher instance with optional WatchOptions parameter. - */ - constructor(options?: WatchOptions); - - /** - * Add files, directories, or glob patterns for tracking. Takes an array of strings or just one - * string. - */ - add(paths: string | string[]): void; - - /** - * Stop watching files, directories, or glob patterns. Takes an array of strings or just one - * string. - */ - unwatch(paths: string | string[]): void; - - /** - * Returns an object representing all the paths on the file system being watched by this - * `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless - * the `cwd` option was used), and the values are arrays of the names of the items contained in - * each directory. - */ - getWatched(): WatchedPaths; - - /** - * Removes all listeners from watched files. - */ - close(): void; -} - -export interface WatchOptions { - /** - * Indicates whether the process should continue to run as long as files are being watched. If - * set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`, - * even if the process continues to run. - */ - persistent?: boolean; - - /** - * ([anymatch](https://github.com/es128/anymatch)-compatible definition) Defines files/paths to - * be ignored. The whole relative or absolute path is tested, not just filename. If a function - * with two arguments is provided, it gets called twice per path - once with a single argument - * (the path), second time with two arguments (the path and the - * [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path). - */ - ignored?: any; - - /** - * If set to `false` then `add`/`addDir` events are also emitted for matching paths while - * instantiating the watching as chokidar discovers these file paths (before the `ready` event). - */ - ignoreInitial?: boolean; - - /** - * When `false`, only the symlinks themselves will be watched for changes instead of following - * the link references and bubbling events through the link's path. - */ - followSymlinks?: boolean; - - /** - * The base directory from which watch `paths` are to be derived. Paths emitted with events will - * be relative to this. - */ - cwd?: string; - - /** - * If set to true then the strings passed to .watch() and .add() are treated as literal path - * names, even if they look like globs. Default: false. - */ - disableGlobbing?: boolean; - - /** - * Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU - * utilization, consider setting this to `false`. It is typically necessary to **set this to - * `true` to successfully watch files over a network**, and it may be necessary to successfully - * watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides - * the `useFsEvents` default. - */ - usePolling?: boolean; - - /** - * Whether to use the `fsevents` watching interface if available. When set to `true` explicitly - * and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on - * OS X, `usePolling: true` becomes the default. - */ - useFsEvents?: boolean; - - /** - * If relying upon the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object that - * may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is - * provided even in cases where it wasn't already available from the underlying watch events. - */ - alwaysStat?: boolean; - - /** - * If set, limits how many levels of subdirectories will be traversed. - */ - depth?: number; - - /** - * Interval of file system polling. - */ - interval?: number; - - /** - * Interval of file system polling for binary files. ([see list of binary extensions](https://gi - * thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) - */ - binaryInterval?: number; - - /** - * Indicates whether to watch files that don't have read permissions if possible. If watching - * fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed - * silently. - */ - ignorePermissionErrors?: boolean; - - /** - * `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts - * that occur when using editors that use "atomic writes" instead of writing directly to the - * source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change` - * event rather than `unlink` then `add`. If the default of 100 ms does not work well for you, - * you can override it by setting `atomic` to a custom value, in milliseconds. - */ - atomic?: boolean | number; - - /** - * can be set to an object in order to adjust timing params: - */ - awaitWriteFinish?: AwaitWriteFinishOptions | boolean; -} - -export interface AwaitWriteFinishOptions { - /** - * Amount of time in milliseconds for a file size to remain constant before emitting its event. - */ - stabilityThreshold?: number; - - /** - * File size polling interval. - */ - pollInterval?: number; -} - -/** - * produces an instance of `FSWatcher`. - */ -export function watch(paths: string | string[], options?: WatchOptions): FSWatcher; diff --git a/types/cipher-base/cipher-base-tests.ts b/types/cipher-base/cipher-base-tests.ts new file mode 100644 index 0000000000..b81238ee98 --- /dev/null +++ b/types/cipher-base/cipher-base-tests.ts @@ -0,0 +1,17 @@ +import CipherBase = require("cipher-base"); + +const buf = new Buffer(1); + +class CipherTest extends CipherBase { + constructor() { + super(); + } + + final() { + return buf; + } + + update(testBuffer: Buffer) { + return testBuffer; + } +} diff --git a/types/cipher-base/index.d.ts b/types/cipher-base/index.d.ts new file mode 100644 index 0000000000..f43ca2cdb9 --- /dev/null +++ b/types/cipher-base/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for cipher-base 1.0 +// Project: https://github.com/crypto-browserify/cipher-base +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare abstract class CipherBase { + constructor(hashMode?: string); + abstract final(): Buffer; + abstract update(value: Buffer, inputEnc?: string, outputEnc?: string): Buffer; +} + +export = CipherBase; diff --git a/types/cipher-base/tsconfig.json b/types/cipher-base/tsconfig.json new file mode 100644 index 0000000000..217193ea64 --- /dev/null +++ b/types/cipher-base/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cipher-base-tests.ts" + ] +} diff --git a/types/cipher-base/tslint.json b/types/cipher-base/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/cipher-base/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/cls-hooked/cls-hooked-tests.ts b/types/cls-hooked/cls-hooked-tests.ts index affaa6c54a..60931e1253 100644 --- a/types/cls-hooked/cls-hooked-tests.ts +++ b/types/cls-hooked/cls-hooked-tests.ts @@ -21,3 +21,24 @@ bindLater((x: number) => { const session2 = cls.getNamespace('my session'); session2.get('user'); + +const appNamespace = cls.createNamespace('applicationNameSpace'); +const context = appNamespace.createContext(); + +function bindWithMiddleware(middlewareFn: () => void) { + return session.bind(middlewareFn, context); +} + +bindWithMiddleware(() => { + // Some middleware that doing something in the application +}); + +// In some place in the application, we want to set a value to a given key to be used elsewhere +appNamespace.enter(context); +appNamespace.set('requestId', 'someId'); +appNamespace.exit(context); + +// Retrieve that value set before without losing the context when chaining several middleware +appNamespace.enter(context); +appNamespace.get('requestId'); +appNamespace.exit(context); diff --git a/types/cls-hooked/index.d.ts b/types/cls-hooked/index.d.ts index 57e6b79c60..4fa385c52f 100644 --- a/types/cls-hooked/index.d.ts +++ b/types/cls-hooked/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cls-hooked 4.2 +// Type definitions for cls-hooked 4.3 // Project: https://github.com/jeff-lewis/cls-hooked // Definitions by: Leo Liang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,8 @@ export interface Namespace { bind(fn: F, context?: any): F; // tslint:disable-line: ban-types bindEmitter(emitter: EventEmitter): void; createContext(): any; + enter(context: any): void; + exit(context: any): void; } export function createNamespace(name: string): Namespace; diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts new file mode 100644 index 0000000000..47ab0b00bb --- /dev/null +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -0,0 +1,61 @@ +import Collection from 'collectionsjs'; + +const collectable = [ + { name: 'Arya Stark', age: 9 }, + { name: 'Bran Stark', age: 7 }, + { name: 'Jon Snow', age: 14 } +]; + +const characters = [ + { name: 'Ned Stark', age: 40}, + { name: 'Catelyn Stark', age: 35} +]; + +const item = { name: 'Sansa Stark', age: 13 }; + +const array = [ + { name: 'Robert Baratheon', age: 40 }, + { name: 'Joffrey Baratheon', age: 13 } +]; + +const collection = new Collection(collectable); // $ExpectType Collection<{ name: string; age: number; }> + +collection.add(item); // $ExpectType Collection<{ name: string; age: number; }> +collection.all(); // $ExpectType Collection<{ name: string; age: number; }> +collection.average('age'); // $ExpectType number +collection.chunk(2).all(); // $ExpectType Collection<{ name: string; age: number; }> +collection.collect(collectable); // $ExpectType Collection<{ name: string; age: number; }> +collection.concat(characters); // $ExpectType Collection<{ name: string; age: number; }> +collection.contains(stark => stark.name === 'John Snow'); // $ExpectType boolean +collection.count(); // $ExpectType number +collection.each(stark => stark.age = 3); // $ExpectType Collection<{ name: string; age: number; }> +collection.filter(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.find({ name: 'Bran Stark', age: 7 }); // $ExpectType number +collection.first(item => item.age > 7); // $ExpectType { name: string; age: number; } +collection.flatten(true); // $ExpectType Collection<{ name: string; age: number; }> +collection.get(2); // $ExpectType { name: string; age: number; } +collection.has({ name: 'Bran Stark', age: 7 }); // $ExpectType boolean +collection.join(); // $ExpectType string +collection.keys(); // $ExpectType Collection<{ name: string; age: number; }> +collection.last(); // $ExpectType { name: string; age: number; } +collection.map(stark => stark.name); // $ExpectType Collection +collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }> +collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }> +const value = new Collection([1, 2, 3]).reduce((previous, current) => previous + current, 0); // $ExpectType number +collection.reject(stark => stark.age < 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean +collection.reverse(); // $ExpectType Collection<{ name: string; age: number; }> +collection.skip(2); // $ExpectType Collection<{ name: string; age: number; }> +collection.slice(1, 3); // $ExpectType Collection<{ name: string; age: number; }> +collection.sort(); // $ExpectType Collection<{ name: string; age: number; }> +collection.sortBy('name'); // $ExpectType Collection<{ name: string; age: number; }> +collection.stringify(); // $ExpectType string +collection.sum('age'); // $ExpectType number +collection.take(2); // $ExpectType Collection<{ name: string; age: number; }> +Collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); + +collection.unique(stark => stark.age); // $ExpectType Collection<{ name: string; age: number; }> +collection.values(); // $ExpectType Collection<{ name: string; age: number; }> +collection.where('age', 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.where(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.zip(array); // $ExpectType Collection<{ name: string; age: number; }> diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts new file mode 100644 index 0000000000..1a9bfe7062 --- /dev/null +++ b/types/collectionsjs/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for collectionsjs 0.3 +// Project: https://github.com/logaretm/collectionsjs#readme +// Definitions by: Jaymeh +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +export default class Collection { + constructor(items?: T[]); + add(item: T): Collection; + all(): Collection; + average(property?: string | ((property?: number) => number)): number; + chunk(size: number): Collection; + collect(collectable: T[]): Collection; + concat(collection: T[]|Collection): Collection; + contains(closure: ((item: T) => boolean)): boolean; + count(): number; + each(callback: (item: T) => void): Collection; + filter(callback: (item: T) => boolean): Collection; + find(item: T): number; + first(callback?: ((item: T) => boolean)|null): T; + flatten(deep?: boolean): Collection; + get(index: number): T; + has(item: T): boolean; + join(separator?: string): string; + keys(): Collection; + last(callback?: ((item: T) => boolean)|null): T; + map(callback: (item: T) => R): Collection; + pluck(property: string): Collection; + push(item: T): Collection; + reduce(callback: (previous: R, current: T) => R, initial: R): R; + reject(callback: (item: T) => boolean): Collection; + remove(item: T): boolean; + reverse(): Collection; + skip(count: number): Collection; + slice(start: number, end?: number): Collection; + sort(compare?: () => boolean): Collection; + sortBy(property: string, order?: string): Collection; + stringify(): string; + sum(property: T extends object ? keyof T : never): number; + take(count: number): Collection; + static macro(name: string, callback: (coll: Collection, ...args: unknown[]) => unknown): void; + unique(callback?: string|null|((item: T) => any)): Collection; + values(): Collection; + where(key: K, value: T[K]): Collection; + where(callback: (item: T) => boolean): Collection; + zip(array: T[]|Collection): Collection; +} diff --git a/types/ora/tsconfig.json b/types/collectionsjs/tsconfig.json similarity index 82% rename from types/ora/tsconfig.json rename to types/collectionsjs/tsconfig.json index 302dc253cc..6ec4a9edc3 100644 --- a/types/ora/tsconfig.json +++ b/types/collectionsjs/tsconfig.json @@ -7,7 +7,6 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -15,10 +14,10 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "esModuleInterop": true + "strictFunctionTypes": true }, "files": [ "index.d.ts", - "ora-tests.ts" + "collectionsjs-tests.ts" ] } diff --git a/types/camelcase/tslint.json b/types/collectionsjs/tslint.json similarity index 100% rename from types/camelcase/tslint.json rename to types/collectionsjs/tslint.json diff --git a/types/cometd/index.d.ts b/types/cometd/index.d.ts index d7103f15cd..ff780cfd42 100644 --- a/types/cometd/index.d.ts +++ b/types/cometd/index.d.ts @@ -70,6 +70,15 @@ export interface Configuration { * CometD may fail to remain within the max URI length when encoded in JSON. */ maxURILength?: number; + /** + * Uses the scheduler service available in Web Workers via Worker.setTimeout(fn, delay) rather + * than using that available via Window.setTimeout(fn, delay). Browsers are now throttling the + * Window scheduler in background tabs to save battery in mobile devices, so the Window scheduler + * events are delayed by possibly several seconds, causing CometD sessions to timeout on the + * server. The Worker scheduler is not throttled and guarantees that scheduler events happen + * on time. + */ + useWorkerScheduler?: boolean; } export interface Message { diff --git a/types/condense-whitespace/condense-whitespace-tests.ts b/types/condense-whitespace/condense-whitespace-tests.ts new file mode 100644 index 0000000000..027b106195 --- /dev/null +++ b/types/condense-whitespace/condense-whitespace-tests.ts @@ -0,0 +1,7 @@ +import condense = require("condense-whitespace"); + +// $ExpectType string +condense(" \n\n\t Hello World \t\n"); + +// $ExpectError +condense(1); diff --git a/types/condense-whitespace/index.d.ts b/types/condense-whitespace/index.d.ts new file mode 100644 index 0000000000..403d0eeec1 --- /dev/null +++ b/types/condense-whitespace/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for condense-whitespace 1.0 +// Project: https://github.com/sindresorhus/condense-whitespace +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function condenseWhitespace(str: string): string; + +export = condenseWhitespace; diff --git a/types/condense-whitespace/tsconfig.json b/types/condense-whitespace/tsconfig.json new file mode 100644 index 0000000000..8d5705205d --- /dev/null +++ b/types/condense-whitespace/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", + "condense-whitespace-tests.ts" + ] +} diff --git a/types/chokidar/tslint.json b/types/condense-whitespace/tslint.json similarity index 100% rename from types/chokidar/tslint.json rename to types/condense-whitespace/tslint.json diff --git a/types/conf/conf-tests.ts b/types/conf/conf-tests.ts deleted file mode 100644 index ce67cd4799..0000000000 --- a/types/conf/conf-tests.ts +++ /dev/null @@ -1,54 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -new Conf({ - defaults: { - foo: 'bar', - unicorn: 'rainbow', - }, -}); -new Conf({ configName: '' }); -new Conf({ projectName: 'foo' }); -new Conf({ cwd: '' }); -new Conf({ encryptionKey: '' }); -new Conf({ encryptionKey: new Buffer('') }); -new Conf({ encryptionKey: new Uint8Array([1]) }); -new Conf({ encryptionKey: new DataView(new ArrayBuffer(2)) }); -new Conf({ fileExtension: '.foo' }); - -// $ExpectError -new Conf({ - defaults: { - foo: 'bar', - unicorn: ['rainbow'], - }, -}); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('null', null); // $ExpectError - -conf.get('foo'); // $ExpectType string | number | boolean -conf.get('foo', 'bar'); // $ExpectType string | number | boolean -conf.get('foo', null); // $ExpectError -conf.delete('foo'); -conf.has('foo'); // $ExpectType boolean -conf.clear(); -conf.onDidChange('foo', (oldVal, newVal) => { - // $ExpectType string | number | boolean | undefined - oldVal; - // $ExpectType string | number | boolean | undefined - newVal; -}); - -conf.size; // $ExpectType number -conf.store = { - foo: 'bar', - unicorn: 'rainbow', -}; -conf.path; // $ExpectType string - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean -} diff --git a/types/conf/index.d.ts b/types/conf/index.d.ts deleted file mode 100644 index 57d7285a3e..0000000000 --- a/types/conf/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Type definitions for conf 2.1 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -declare class Conf implements Iterable<[string, T]> { - store: { [key: string]: T }; - readonly path: string; - readonly size: number; - - constructor(options?: Conf.Options); - get(key: string, defaultValue?: T): T; - set(key: string, val: T): void; - set(object: { [key: string]: T }): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - onDidChange(key: string, callback: (oldVal: T | undefined, newVal: T | undefined) => void): void; - [Symbol.iterator](): Iterator<[string, T]>; -} - -declare namespace Conf { - interface Options { - defaults?: { [key: string]: T }; - configName?: string; - projectName?: string; - cwd?: string; - encryptionKey?: string | Buffer | NodeJS.TypedArray | DataView; - fileExtension?: string; - } -} - -export = Conf; diff --git a/types/conf/v0/conf-tests.ts b/types/conf/v0/conf-tests.ts deleted file mode 100644 index 1368e45c29..0000000000 --- a/types/conf/v0/conf-tests.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('object', { - foo: 'bar', - unicorn: ['rainbow'] -}); - -conf.get('foo'); -conf.delete('foo'); -conf.has('foo'); -conf.clear(); - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean | symbol | {} -} diff --git a/types/conf/v0/index.d.ts b/types/conf/v0/index.d.ts deleted file mode 100644 index 21c136e823..0000000000 --- a/types/conf/v0/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for conf 0.11 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface Options { - defaults?: any; - configName?: string; - projectName?: string; - cwd?: string; -} - -declare class Conf implements Iterable<[string, string | number | boolean | symbol | {}]> { - path: string; - store: any; - - readonly size: number; - - constructor(options?: Options); - get(key: string): any; - set(key: string, val: string | number | boolean | symbol | {}): void; - set(object: {}): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - [Symbol.iterator](): Iterator<[string, string | number | boolean | symbol | {}]>; -} - -export = Conf; diff --git a/types/conf/v0/tsconfig.json b/types/conf/v0/tsconfig.json deleted file mode 100644 index 004bd4a1b5..0000000000 --- a/types/conf/v0/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "conf": [ - "conf/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "conf-tests.ts" - ] -} \ No newline at end of file diff --git a/types/conf/v1/conf-tests.ts b/types/conf/v1/conf-tests.ts deleted file mode 100644 index 4ee492da8d..0000000000 --- a/types/conf/v1/conf-tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -new Conf({ - defaults: { - foo: 'bar', - unicorn: 'rainbow', - }, - configName: '', - projectName: 'foo', - cwd: '', -}); -// $ExpectError -new Conf({ - defaults: { - foo: 'bar', - unicorn: ['rainbow'], - }, -}); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('null', null); // $ExpectError - -conf.get('foo'); // $ExpectType string | number | boolean -conf.get('foo', 'bar'); // $ExpectType string | number | boolean -conf.get('foo', null); // $ExpectError -conf.delete('foo'); -conf.has('foo'); // $ExpectType boolean -conf.clear(); - -conf.store = { - foo: 'bar', - unicorn: 'rainbow', -}; -conf.path; // $ExpectType string - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean -} diff --git a/types/conf/v1/index.d.ts b/types/conf/v1/index.d.ts deleted file mode 100644 index f08cff1584..0000000000 --- a/types/conf/v1/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Type definitions for conf 1.4 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -interface Options { - defaults?: { [key: string]: T }; - configName?: string; - projectName?: string; - cwd?: string; -} - -declare class Conf implements Iterable<[string, T]> { - store: { [key: string]: T }; - readonly path: string; - readonly size: number; - - constructor(options?: Options); - get(key: string, defaultValue?: T): T; - set(key: string, val: T): void; - set(object: { [key: string]: T }): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void; - [Symbol.iterator](): Iterator<[string, T]>; -} - -export = Conf; diff --git a/types/conf/v1/tsconfig.json b/types/conf/v1/tsconfig.json deleted file mode 100644 index 86b3a62f41..0000000000 --- a/types/conf/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "conf": [ - "conf/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "conf-tests.ts" - ] -} diff --git a/types/connect-datadog/index.d.ts b/types/connect-datadog/index.d.ts index df18c0c208..9b68fb6a4f 100644 --- a/types/connect-datadog/index.d.ts +++ b/types/connect-datadog/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for connect-datadog 0.0 // Project: https://github.com/datadog/node-connect-datadog // Definitions by: Moshe Good +// Michael Mifsud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -19,6 +20,6 @@ declare namespace Factory { method?: boolean; protocol?: boolean; response_code?: boolean; - dogstatsd?: dogstatsd.StatsD; + dogstatsd?: dogstatsd.StatsDClient; } } diff --git a/types/connect-mongo/connect-mongo-tests.ts b/types/connect-mongo/connect-mongo-tests.ts index 351975d84c..4e3c7f8381 100644 --- a/types/connect-mongo/connect-mongo-tests.ts +++ b/types/connect-mongo/connect-mongo-tests.ts @@ -45,8 +45,8 @@ app.use(session({ // NativeMongoPromiseOptions var Client = mongodb.MongoClient; -var mongoDbPromise = Client.connect('mongodb://localhost/test'); +var mongoDbPromise = Client.connect('mongodb://localhost/test').then(client => client.db()) app.use(session({ secret: 'secret', - store: new MongoStore({ dbPromise: mongoDbPromise}) + store: new MongoStore({ dbPromise: mongoDbPromise }) })); diff --git a/types/connect-mongo/tsconfig.json b/types/connect-mongo/tsconfig.json index c0c9ab3043..dc0b76551d 100644 --- a/types/connect-mongo/tsconfig.json +++ b/types/connect-mongo/tsconfig.json @@ -4,14 +4,6 @@ "lib": [ "es6" ], - "paths": { - "mongodb": [ - "mongodb/v2" - ], - "mongoose": [ - "mongoose/v4" - ] - }, "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, diff --git a/types/connect-redis/connect-redis-tests.ts b/types/connect-redis/connect-redis-tests.ts index a312ffd3ca..603b226dcc 100644 --- a/types/connect-redis/connect-redis-tests.ts +++ b/types/connect-redis/connect-redis-tests.ts @@ -6,5 +6,8 @@ const store = new RedisStore({ host: 'localhost', port: 6379, logErrors: error => console.warn(error), - scanCount: 80, + scanCount: 80, + ttl: (store, sess, sessionID) => { + return 60; + } }); diff --git a/types/connect-redis/index.d.ts b/types/connect-redis/index.d.ts index c5a26de73a..9b56777ac3 100644 --- a/types/connect-redis/index.d.ts +++ b/types/connect-redis/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for connect-redis // Project: https://npmjs.com/package/connect-redis // Definitions by: Xavier Stouder +// Seth Butler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -26,7 +27,7 @@ declare module "connect-redis" { port?: number; socket?: string; url?: string; - ttl?: number; + ttl?: number | string | ((store: RedisStore, sess: Express.SessionData, sid: string) => number); disableTTL?: boolean; db?: number; pass?: string; diff --git a/types/cypress-axe/index.d.ts b/types/cypress-axe/index.d.ts index 507a5f773d..3ba776e14f 100644 --- a/types/cypress-axe/index.d.ts +++ b/types/cypress-axe/index.d.ts @@ -1,12 +1,21 @@ -// Type definitions for cypress-axe 0.3 +// Type definitions for cypress-axe 0.4 // Project: https://github.com/avanslaars/cypress-axe#readme // Definitions by: Justin Hall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare namespace Cypress { - interface Chainable { - injectAxe(): void; - checkA11y(): void; +import { ElementContext, RunOptions } from 'axe-core'; + +declare module 'axe-core' { + interface Node {} +} + +declare global { + namespace Cypress { + interface Chainable { + injectAxe(): void; + checkA11y(context?: ElementContext, options?: RunOptions): void; + configureAxe(options?: RunOptions): void; + } } } diff --git a/types/globby/package.json b/types/cypress-axe/package.json similarity index 63% rename from types/globby/package.json rename to types/cypress-axe/package.json index 136d4694e9..71df6dd355 100644 --- a/types/globby/package.json +++ b/types/cypress-axe/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "fast-glob": "^2.0.2" + "axe-core": "^3.1.2" } } diff --git a/types/cypress-axe/tslint.json b/types/cypress-axe/tslint.json index 3db14f85ea..4f44991c3c 100644 --- a/types/cypress-axe/tslint.json +++ b/types/cypress-axe/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} diff --git a/types/d3-cloud/d3-cloud-tests.ts b/types/d3-cloud/d3-cloud-tests.ts index e3bffed4cb..19a140959f 100644 --- a/types/d3-cloud/d3-cloud-tests.ts +++ b/types/d3-cloud/d3-cloud-tests.ts @@ -27,8 +27,11 @@ d3.layout.cloud().size([300, 300]) .font("Impact") .fontSize(function(d:ICompTextSize) { return d.size; }) .on("end", draw) + .random() + .canvas() .start(); + function draw(words:ICompTextSize[]) { d3.select("body").append("svg") .attr("width", 300) diff --git a/types/d3-cloud/index.d.ts b/types/d3-cloud/index.d.ts index fdf2dbc719..b0a3b8a78c 100644 --- a/types/d3-cloud/index.d.ts +++ b/types/d3-cloud/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.2 +// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.5 // Project: https://github.com/jasondavies/d3-cloud -// Definitions by: hans windhoff +// Definitions by: hans windhoff , locknono // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as d3 from 'd3'; @@ -71,6 +71,24 @@ declare module 'd3' { padding(padding: number): Cloud; padding(padding: (datum: T, index: number) => number): Cloud; + /** + * If specified, sets the internal random number generator,used for selecting the initial position of each word, + * and the clockwise/counterclockwise direction of the spiral for each word. + * + * @param randomFunction should return a number in the range [0, 1).The default is Math.random. + */ + random(): Cloud; + random(randomFunction: () => number): Cloud; + + /** + * If specified, sets the canvas generator function, which is used internally to draw text. + * When using Node.js, you will almost definitely override the default, e.g. using the canvas module. + * @param canvasGenerator should return a HTMLCanvasElement.The default is: ()=>{document.createElement("canvas");} + * + */ + canvas():Cloud; + canvas(canvasGenerator: () => HTMLCanvasElement): Cloud; + on(type: "word", listener: (word: T) => void): Cloud; on(type: "end", listener: (tags: T[], bounds: { x: number; y: number }[]) => void): Cloud; on(type: string, listener: (...args: any[]) => void): Cloud; diff --git a/types/datadog-statsd-metrics-collector/datadog-statsd-metrics-collector-tests.ts b/types/datadog-statsd-metrics-collector/datadog-statsd-metrics-collector-tests.ts new file mode 100644 index 0000000000..ef5691a57d --- /dev/null +++ b/types/datadog-statsd-metrics-collector/datadog-statsd-metrics-collector-tests.ts @@ -0,0 +1,43 @@ +import datadog = require('node-dogstatsd'); +import Collector = require('datadog-statsd-metrics-collector'); + +const client = new datadog.StatsD('localhost'); + +// constructors +let collector = new Collector(client); +collector = new Collector(client, 1000); + +// interface +const key = 'key'; +const timeValue = 99; +const sampleRate = 0.85; +const incrementBy = 7; +const decrementBy = 5; +const gaugeValue = 199; +const tags: string[] = ['tag1', 'tag2']; + +collector.timing(key, timeValue); +collector.timing(key, timeValue, sampleRate); +collector.timing(key, timeValue, sampleRate, tags); + +collector.increment(key); +collector.increment(key, sampleRate); +collector.increment(key, sampleRate, tags); + +collector.incrementBy(key, incrementBy); +collector.incrementBy(key, incrementBy, tags); + +collector.decrement(key); +collector.decrement(key, sampleRate); +collector.decrement(key, sampleRate, tags); + +collector.decrementBy(key, decrementBy); +collector.decrementBy(key, decrementBy, tags); + +collector.gauge(key, gaugeValue); +collector.gauge(key, gaugeValue, sampleRate); +collector.gauge(key, gaugeValue, sampleRate, tags); + +collector.histogram(key, timeValue); +collector.histogram(key, timeValue, sampleRate); +collector.histogram(key, timeValue, sampleRate, tags); diff --git a/types/datadog-statsd-metrics-collector/index.d.ts b/types/datadog-statsd-metrics-collector/index.d.ts new file mode 100644 index 0000000000..741c5a9f43 --- /dev/null +++ b/types/datadog-statsd-metrics-collector/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for datadog-statsd-metrics-collector 1.1 +// Project: https://github.com/xzyfer/datadog-statsd-metrics-collector#readme +// Definitions by: Michael Mifsud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import dogstatsd = require('node-dogstatsd'); + +declare class Collector implements dogstatsd.StatsDClient { + constructor(client: dogstatsd.StatsDClient, delayMilliseconds?: number); + + timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void; + + increment(stat: string, sample_rate?: number, tags?: string[]): void; + incrementBy(stat: string, value: number, tags?: string[]): void; + + decrement(stat: string, sample_rate?: number, tags?: string[]): void; + decrementBy(stat: string, value: number, tags?: string[]): void; + + gauge(stat: string, value: number, sample_rate?: number, tags?: string[]): void; + + histogram(stat: string, time: number, sample_rate?: number, tags?: string[]): void; +} + +export = Collector; diff --git a/types/conf/tsconfig.json b/types/datadog-statsd-metrics-collector/tsconfig.json similarity index 89% rename from types/conf/tsconfig.json rename to types/datadog-statsd-metrics-collector/tsconfig.json index 479fa6b41f..d136060376 100644 --- a/types/conf/tsconfig.json +++ b/types/datadog-statsd-metrics-collector/tsconfig.json @@ -4,7 +4,6 @@ "lib": [ "es6" ], - "target": "es6", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, @@ -19,6 +18,6 @@ }, "files": [ "index.d.ts", - "conf-tests.ts" + "datadog-statsd-metrics-collector-tests.ts" ] } diff --git a/types/conf/tslint.json b/types/datadog-statsd-metrics-collector/tslint.json similarity index 100% rename from types/conf/tslint.json rename to types/datadog-statsd-metrics-collector/tslint.json diff --git a/types/date-now/date-now-tests.ts b/types/date-now/date-now-tests.ts new file mode 100644 index 0000000000..f16487de44 --- /dev/null +++ b/types/date-now/date-now-tests.ts @@ -0,0 +1,5 @@ +import seeded = require('date-now/seed'); +import dateNow = require('date-now'); + +seeded(123); +dateNow(); diff --git a/types/date-now/index.d.ts b/types/date-now/index.d.ts new file mode 100644 index 0000000000..7ed6ab7df3 --- /dev/null +++ b/types/date-now/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for date-now 1.0 +// Project: https://github.com/Raynos/date-now +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function dateNow(): number; + +export = dateNow; diff --git a/types/date-now/seed.d.ts b/types/date-now/seed.d.ts new file mode 100644 index 0000000000..c87a702c55 --- /dev/null +++ b/types/date-now/seed.d.ts @@ -0,0 +1,6 @@ +/** + * Returns a Date.now() like function that's in sync with the seed value. + */ +declare function seeded(seed: number): number; + +export = seeded; diff --git a/types/date-now/tsconfig.json b/types/date-now/tsconfig.json new file mode 100644 index 0000000000..705da71b7b --- /dev/null +++ b/types/date-now/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "seed.d.ts", + "date-now-tests.ts" + ] +} diff --git a/types/date-now/tslint.json b/types/date-now/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/date-now/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/del/del-tests.ts b/types/del/del-tests.ts deleted file mode 100644 index f9d01f644f..0000000000 --- a/types/del/del-tests.ts +++ /dev/null @@ -1,47 +0,0 @@ -import del = require('del'); - -let paths = ['build', 'dist/**/*.js']; - -del(['tmp/*.js', '!tmp/unicorn.js']); -del(['tmp/*.js', '!tmp/unicorn.js'], { force: true }); -del(['tmp/*.js', '!tmp/unicorn.js'], { dryRun: true }); -del(['tmp/*.js', '!tmp/unicorn.js'], { concurrency: 20 }); -del(['tmp/*.js', '!tmp/unicorn.js'], { cwd: '' }); - -del(['tmp/*.js', '!tmp/unicorn.js']).then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); - -del(['tmp/*.js', '!tmp/unicorn.js'], { force: true }).then( - (paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); - } -); - -del('tmp/*.js'); -del('tmp/*.js', { force: true }); -del('tmp/*.js', { dryRun: true }); -del('tmp/*.js', { concurrency: 20 }); -del('tmp/*.js', { cwd: '' }); -del('tmp/*.js').then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); - -del('tmp/*.js', { force: true }).then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); - -paths = del.sync(['tmp/*.js', '!tmp/unicorn.js']); -paths = del.sync(['tmp/*.js', '!tmp/unicorn.js'], { force: true }); - -paths = del.sync('tmp/*.js'); -paths = del.sync('tmp/*.js', { force: true }); -paths = del.sync('tmp/*.js', { dryRun: true }); -paths = del.sync('tmp/*.js', { concurrency: 20 }); -paths = del.sync('tmp/*.js', { cwd: '' }); - -const immutable: ReadonlyArray = ['tmp/*.js', '!tmp/unicorn.js']; -const mutable = del(immutable); -const mutablePaths = del.sync(immutable); -mutable.then(paths => paths.push('test')); -mutablePaths.push('test'); diff --git a/types/del/index.d.ts b/types/del/index.d.ts deleted file mode 100644 index ec92f96c84..0000000000 --- a/types/del/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for del 3.0 -// Project: https://github.com/sindresorhus/del -// Definitions by: Asana -// Aya Morisawa -// BendingBender -// Jason Dreyzehner -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import glob = require('glob'); - -declare function del( - patterns: string | ReadonlyArray, - options?: del.Options -): Promise; - -declare namespace del { - function sync( - patterns: string | ReadonlyArray, - options?: Options - ): string[]; - - interface Options extends glob.IOptions { - force?: boolean; - dryRun?: boolean; - concurrency?: number; - } -} - -export = del; diff --git a/types/del/v2/del-tests.ts b/types/del/v2/del-tests.ts deleted file mode 100644 index 09702c4b39..0000000000 --- a/types/del/v2/del-tests.ts +++ /dev/null @@ -1,37 +0,0 @@ -import del = require("del"); - -let paths = ["build", "dist/**/*.js"]; - -del(["tmp/*.js", "!tmp/unicorn.js"]); - -del(["tmp/*.js", "!tmp/unicorn.js"], {force: true}); - -del(["tmp/*.js", "!tmp/unicorn.js"]).then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); - -del(["tmp/*.js", "!tmp/unicorn.js"], {force: true}).then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); - -del("tmp/*.js"); - -del("tmp/*.js", {force: true}); - -del("tmp/*.js").then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); - -del("tmp/*.js", {force: true}).then((paths: string[]) => { - console.log('Deleted files/folders:\n', paths.join('\n')); -}); - -paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"]); - -paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true}); - -paths = del.sync("tmp/*.js"); - -paths = del.sync("tmp/*.js", {force: true}); - -paths = del.sync("tmp/*.js", {dryRun: true}); diff --git a/types/del/v2/index.d.ts b/types/del/v2/index.d.ts deleted file mode 100644 index 50634e39eb..0000000000 --- a/types/del/v2/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Type definitions for del 2.2 -// Project: https://github.com/sindresorhus/del -// Definitions by: Asana , Aya Morisawa -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import glob = require("glob"); - -declare function del(patterns: string | string[], options?: del.Options): Promise; - -declare namespace del { - function sync(patterns: string | string[], options?: Options): string[]; - - interface Options extends glob.IOptions { - force?: boolean; - dryRun?: boolean; - } -} - -export = del; diff --git a/types/del/v2/tsconfig.json b/types/del/v2/tsconfig.json deleted file mode 100644 index 568d1a8a21..0000000000 --- a/types/del/v2/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "del": [ - "del/v2" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "del-tests.ts" - ] -} \ No newline at end of file diff --git a/types/del/v2/tslint.json b/types/del/v2/tslint.json deleted file mode 100644 index 65c83fb1e3..0000000000 --- a/types/del/v2/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "dt-header": false - } -} diff --git a/types/detox/index.d.ts b/types/detox/index.d.ts index 977f32e249..e89e73a794 100644 --- a/types/detox/index.d.ts +++ b/types/detox/index.d.ts @@ -42,6 +42,16 @@ declare global { */ cleanup(): Promise; } + + // Detox exports all methods from detox global and all of the global constants. + interface DetoxExport extends Detox { + device: Device; + element: Element; + waitFor: WaitFor; + expect: Expect>; + by: Matchers; + } + interface Device { /** * Launch the app @@ -434,10 +444,6 @@ declare global { } } -export { by, detox, device, element, waitFor }; +declare const detoxExport: Detox.DetoxExport; -// Not exporting the global `expect` from the top of the file here -// because `expect` conflicts with the global `expect` of jest and -// therefore exporting it doesn't work. The global `expect` is kept -// for backwards compatibility though. -export const expect: Detox.Expect>; +export = detoxExport; diff --git a/types/detox/runners/jest/adapter/index.d.ts b/types/detox/runners/jest/adapter/index.d.ts index f479eda256..ca64f30820 100644 --- a/types/detox/runners/jest/adapter/index.d.ts +++ b/types/detox/runners/jest/adapter/index.d.ts @@ -9,4 +9,4 @@ interface DetoxJestAdapter { declare const adapter: DetoxJestAdapter; -export default adapter; +export = adapter; diff --git a/types/detox/runners/mocha/adapter/index.d.ts b/types/detox/runners/mocha/adapter/index.d.ts index 8e13b3bc01..3249031eee 100644 --- a/types/detox/runners/mocha/adapter/index.d.ts +++ b/types/detox/runners/mocha/adapter/index.d.ts @@ -6,4 +6,4 @@ interface DetoxMochaAdapter { declare const adapter: DetoxMochaAdapter; -export default adapter; +export = adapter; diff --git a/types/detox/test/detox-jest-setup-tests.ts b/types/detox/test/detox-jest-setup-tests.ts index 7a2a9a3901..1c38c3658f 100644 --- a/types/detox/test/detox-jest-setup-tests.ts +++ b/types/detox/test/detox-jest-setup-tests.ts @@ -2,7 +2,8 @@ declare var beforeAll: (callback: () => void) => void; declare var beforeEach: (callback: () => void) => void; declare var afterAll: (callback: () => void) => void; -import adapter from "detox/runners/jest/adapter"; +import detox = require("detox"); +import adapter = require("detox/runners/jest/adapter"); // Normally the Detox configuration from the project's package.json like so: // const config = require("./package.json").detox; diff --git a/types/detox/test/detox-mocha-setup-tests.ts b/types/detox/test/detox-mocha-setup-tests.ts index c415eed696..42e955ab4f 100644 --- a/types/detox/test/detox-mocha-setup-tests.ts +++ b/types/detox/test/detox-mocha-setup-tests.ts @@ -5,7 +5,8 @@ declare var beforeEach: (callback: () => void) => void; declare var after: (callback: () => void) => void; declare var afterEach: (callback: () => void) => void; -import adapter from "detox/runners/mocha/adapter"; +import * as detox from "detox"; +import * as adapter from "detox/runners/mocha/adapter"; // Normally the Detox configuration from the project's package.json like so: // const config = require("./package.json").detox; diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index 2f58d64a52..1a3eb0e39a 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -623,7 +623,7 @@ declare namespace Draft { interface DraftBlockRenderConfig { element: string; - wrapper?: React.ReactElement; + wrapper?: React.ReactNode; } class EditorState extends Record { diff --git a/types/dragscroll/dragscroll-tests.ts b/types/dragscroll/dragscroll-tests.ts new file mode 100644 index 0000000000..fcf4818bf4 --- /dev/null +++ b/types/dragscroll/dragscroll-tests.ts @@ -0,0 +1,3 @@ +import * as dragscroll from "dragscroll"; + +dragscroll.reset(); diff --git a/types/dragscroll/index.d.ts b/types/dragscroll/index.d.ts new file mode 100644 index 0000000000..cd125c6591 --- /dev/null +++ b/types/dragscroll/index.d.ts @@ -0,0 +1,5 @@ +// Type definitions for dragscroll v 0.0 +// Project: https://github.com/asvd/dragscroll#readme +// Definitions by: Sean Kelly +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export function reset(i ?: number, el ?: any): void; diff --git a/types/dragscroll/tsconfig.json b/types/dragscroll/tsconfig.json new file mode 100644 index 0000000000..20e259be9e --- /dev/null +++ b/types/dragscroll/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", + "dragscroll-tests.ts" + ] +} diff --git a/types/conf/v0/tslint.json b/types/dragscroll/tslint.json similarity index 100% rename from types/conf/v0/tslint.json rename to types/dragscroll/tslint.json diff --git a/types/dv/dv-tests.ts b/types/dv/dv-tests.ts new file mode 100644 index 0000000000..4dd9f0e88e --- /dev/null +++ b/types/dv/dv-tests.ts @@ -0,0 +1,18 @@ +import dv = require('dv'); +import fs = require('fs'); + +const image = new dv.Image('png', fs.readFileSync('textpage300.png')); +const tesseract = new dv.Tesseract('eng', image); +console.log(tesseract.findText('plain')); + +const barcodes = new dv.Image('png', fs.readFileSync('form2.png')); +const open = barcodes.thin('bg', 8, 5).dilate(3, 3); +const openMap = open.distanceFunction(8); +const openMask = openMap.threshold(10).erode(22, 22); +const boxes = openMask.invert().connectedComponents(8); +boxes.forEach((box) => { + const boxImage = barcodes.crop( + // Do something useful with our image. + box.x, box.y, + box.width, box.height); +}); diff --git a/types/dv/index.d.ts b/types/dv/index.d.ts new file mode 100644 index 0000000000..5a0447966a --- /dev/null +++ b/types/dv/index.d.ts @@ -0,0 +1,477 @@ +// Type definitions for dv 2.1 +// Project: https://github.com/creatale/node-dv +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/// + +export interface Box { + x: number; + y: number; + width: number; + height: number; +} + +export interface Point { + x: number; + y: number; +} + +export interface Segment { + p1: Point; + p2: Point; + error: number; +} + +export interface Skew { + angle: number; + confidence: number; +} + +export interface Component { + x: number; + y: number; + width: number; + height: number; +} + +export class Image { + /** + * Creates a copy of otherImage. + */ + constructor(otherImage: Image); + /** + * Creates a 32 bit imagen from three 8 bit images, where each image represents one channel of RGB or HSV. + */ + constructor(image1: Image, image2: Image, image3: Image); + /** + * Creates an empty image with the specified dimensions (!!! note: this constructor is experimental and likely to change). + */ + constructor(width: number, height: number, depth: number); + /** + * Creates an image from a Buffer object, that contains the PNG/JPG encoded image. + */ + constructor(type: 'png' | 'jpg', buffer: Buffer); + constructor(type: 'rgba' | 'rgb' | 'gray', buffer: Buffer, width: number, height: number); + + readonly width: number; + readonly height: number; + /** + * The depth of the image in bits per pixel, i.e. one of 32 (color), 8 (grayscale) or 1 (monochrome). + */ + readonly depth: number; + + /** + * Returns the (boolean) inverse of this image. + */ + invert(): Image; + /** + * Returns the (boolean) union of two images with equal depth, aligning them to the upper left corner. + */ + or(otherImage: Image): Image; + /** + * Returns the (boolean) difference of two images with equal depth, aligning them to the upper left corner. + */ + and(otherImage: Image): Image; + /** + * Returns the (boolean) exclusive disjunction of two images with equal depth, aligning them to the upper left corner. + */ + xor(otherImage: Image): Image; + /** + * If the images are monochrome, dispatches to Leptonica's pixOr. Otherwise, returns the channelwise addition of b to a, clipped at 255. + */ + add(otherImage: Image): Image; + + /** + * If the images are monochrome, dispatches to Leptonica's pixSubtract and is equivalent to a.and(b.invert()). + * For grayscale images, returns the pixelwise subtraction of b from a, clipped at zero. + * For color, the entire RGB value is subtracted instead of doing channelwise subtraction (ask Leptonica why). + * @example: + * redness = colorImage.toGray(1, 0, 0).subtract(colorImage.toGray(0, 0.5, 0.5)) + */ + subtract(otherImage: Image): Image; + /** + * Applies a convoltuion kernel with the specified dimensions. Image convolution is an operation where each destination pixel is computed based on a weighted sum of a set of nearby source pixels. + */ + convolve(halfWidth: number, halfHeight: number): Image; + + /** + * Unsharp Masking creates an unsharp mask using halfWidth. + * The fraction determines how much of the edge is added back into image. + * The resulting image appears clearer, but it is generally less accurate. + */ + unsharp(halfWidth: number, fraction: number): Image; + /** + * Rotates the image around its center by the specified angle in degrees. + */ + rotate(angle: number): Image; + /** + * Scales an image proportionally by scale (1.0 = 100%). + */ + scale(scale: number): Image; + + /** + * Scales an image by scaleX and scaleY (1.0 = 100%). + */ + scale(scaleX: number, scaleY: number): Image; + + /** + * Crops an image from this image by the specified rectangle and returns the resulting image. + */ + crop(box: Box): Image; + crop(x: number, y: number, width: number, height: number): Image; + /** + * Creates a mask by testing if pixels (RGB, HSV, ...) are between lower and upper. Formally speaking: + * lower1 ≤ pixel1 ≤ upper1 + * ∧ lower2 ≤ pixel2 ≤ upper2 + * ∧ lower3 ≤ pixel3 ≤ upper3 + */ + inRange(lower1: number, lower2: number, lower3: number, upper1: number, upper2: number, upper3: number): Image; + /** + * Only available for grayscale images. Returns the histogram in an array of length 256, where each entry represents the fraction (0.0 to 1.0) of that color in the image. + * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be counted. + */ + histogram(mask?: Image): Image; + /** + * Computes the horizontal or vertical projection of an 1bpp or 8bpp image. + */ + projection(mode: 'horizontal' | 'vertical'): number[]; + /** + * Sets the specified value to each pixel set in the mask. + */ + setMasked(mask: Image, value: number): Image; + /** + * Available for grayscale and color images. Channelwise maps each pixel of image using mapping, which must be an array of length 256 with integer values between 0 and 255. + * !!! !!! Note: this function actually changes the image! + * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be modified. + */ + applyCurve(mapping: number[], mask?: Image): this; + /** + * Applies a rank (0.0 ... 1.0) filter of the specified width + * and height (think of it as radius) to this image + * and returns the result. + * If you set rank to 0.5 you'll get a Median Filter. + * Note that this type of filter works best with odd sizes like 3 or 5. + */ + rankFilter(width: number, height: number, rank: number): Image; + /** + * Color image quantization using an octree based algorithm. + * colors must be between 2 and 256. + * Note that support for the resulting palette image is highly experimental at this point; + * only toGray() and toBuffer('png') are guaranteed to work. + */ + octreeColorQuant(colors: number): Image; + /** + * Color image quantization using median cut algorithm. + * colors must be between 2 and 256. + * Note that support for the resulting palette image is highly experimental at this point; + * only toGray() and toBuffer('png') are guaranteed to work. + */ + medianCutQuant(colors: number): Image; + /** + * Converts a grayscale image to monochrome using a global threshold. value must be between 0 and 255. + */ + threshold(value: number): Image; + /** + * Converts an image to grayscale using default settings. Can be used to convert monochrome images back to grayscale. + */ + toGray(): Image; + /** + * Converts an RGB image to grayscale using the specified widths for each channel. + */ + toGray(redWeight: number, greenWeight: number, blueWeight: number): Image; + /** + * Converts an RGB image to grayscale by selecting either the 'min' or 'max' channel. + * This can act as a simple color filter: 'max' maps colored pixels towards white, + * while 'min' maps colored pixels towards black. + */ + toGray(selector: 'min' | 'max'): Image; + /** + * Converts a grayscale image to a color image. + */ + toColor(): Image; + /** + * Converts from RGB to HSV color space. HSV has the following ranges: + * Hue: [0 .. 239] + * Saturation: [0 .. 255] + * Value: [0 .. 255] + */ + toHSV(): Image; + /** + * Converts from HSV to RGB color space. + */ + toRGB(): Image; + /** + * Applies an Erode Filter and returns the result. + */ + erode(width: number, height: number): Image; + /** + * Applies a Dilate Filter and returns the result. + */ + dilate(width: number, height: number): Image; + /** + * Applies an Open Filter and returns the result. + */ + open(width: number, height: number): Image; + /** + * Applies a Close Filter and returns the result. + */ + close(width: number, height: number): Image; + /** + * Applies morphological thinning of type (fg or bg) with the specified connectivitiy (4 or 8) and maxIterations (0 to iterate until complete). + */ + thin(type: 'fg' | 'bg', connectivity: number, maxIterations: number): Image; + /** + * Scales an 8bpp image for maximum dynamic range. scale must be either log or linear. + */ + maxDynamicRange(scale: 'log' | 'linear'): Image; + /** + * Applies Otsu's Method for computing the threshold of a grayscale image. + * It computes a threshold for each tile of the specified size and performs the threshold operation, + * resulting in a binary image for each tile. These are stitched into the final result. + * The smooth size controls the a convolution kernel applied to threshold array (use 0 for no smoothing). + * The score factor controls the fraction of the max. Otsu score (typically 0.1; use 0.0 for standard Otsu). + */ + otsuAdaptiveThreshold(tileWidth: number, tileHeight: number, smoothWidth: number, smoothHeight: number, scoreFactor: number): Image; + /** + * Detects Line Segments with the specified accuracy (3 is a good start). The number of found line segments can be limited using maxLineSegments (0 is unlimited). + */ + lineSegments(accuracy: number, maxLineSegments: number, useWeightedMeanShift: boolean): Segment[]; + /** + * Only available for monochrome images. Tries to find the skew of this image. The resulting angle is in degree. The confidence is between 0.0 and 1.0. + */ + findSkew(): Skew; + /** + * Only available for monochrome images. Tries to extract connected components (think of flood fill). The connectivity can be specified as 4 or 8 directions. + */ + connectedComponents(connectivity: 4 | 8): Component[]; + /** + * The Distance Function works on 1bpp images. It labels each pixel with the largest distance between this and any other pixel in its connected component. The connectivity is either 4 or 8. + */ + distanceFunction(connectivity: 4 | 8): Image; + /** + * !!! Note: this function actually changes the image! + * Fills a specified rectangle with white. + */ + clearBox(box: Box): this; + clearBox(x: number, y: number, width: number, height: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a filled rectangle to this image with the specified value. Works for 8bpp and 1bpp images. + */ + fillBox(box: Box, value: number): this; + fillBox(x: number, y: number, width: number, height: number, value: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a filled rectangle to this image in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + fillBox(box: Box, r: number, g: number, b: number, fraction?: number): this; + fillBox(x: number, y: number, width: number, height: number, r: number, g: number, b: number, fraction?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a rectangle to this image with the specified border. The possible pixel manipulating operations are set, clear and flip. + */ + drawBox(box: Box, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + drawBox(x: number, y: number, width: number, height: number, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + /** + * !!! Note: this function actually changes the image! + * Draws a rectangle to this image with the specified border in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + drawBox(box: Box, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + drawBox(x: number, y: number, width: number, height: number, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a line between p1 and p2 to this image with the specified line width. The possible pixel manipulating operations are set, clear and flip. + */ + drawLine(p1: Point, p2: Point, width: number, operation: 'set' | 'clear' | 'flip'): this; + /** + * !!! Note: this function actually changes the image! + * Draws a line between p1 and p2 to this image with the specified line width in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + drawLine(p1: Point, p2: Point, width: number, red: number, green: number, blue: number, frac?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws an image to this image with the specified destination box. + */ + drawImage(image: Image, box: Box): this; + drawImage(image: Image, x: number, y: number, width: number, height: number): this; + /** + * Converts the Image in the specified format to a buffer. + * Specifying raw returns the raw image data as buffer. + * For color images, the result contains three bytes per pixel in the order R, G, B; + * for grayscale and monochrome images, it contains one byte per pixel. + * Specifying png returns a PNG encoded image as buffer. + * Specifying jpg returns a JPG encoded image as buffer. + */ + toBuffer(format?: 'raw' | 'png' | 'jpg'): Buffer; +} + +export interface Rect { + x: number; + y: number; + width: number; + height: number; +} + +export interface Region { + box: Box; + text: string; + confidence: number; +} + +export type Paragaph = Region; + +export interface Textline { + box: Box; +} + +export type Word = Region; + +export interface Choice { + text: string; + confidence: number; +} + +export interface Symbol extends Region { + choices: Choice[]; +} + +export type Text = Choice; + +/** + * A Tesseract object represents an optical character recognition engine, that reads text using Tesseract from an image. + * Tesseract supports many langauges and fonts (see Tesseract/Downloads). + * New language files have to be installed in node-dv/tessdata. + */ +export class Tesseract { + /** + * Creates a Tesseract engine with language set to english. + */ + constructor(); + constructor(datapath: string); + /** + * Creates a Tesseract engine with the specified language. + */ + constructor(lang: string, image: Image); + /** + * Creates a Tesseract engine with the specified language and image. + */ + constructor(datapath: string, lang: string, image: Image); + + /** + * Accessor for the input image. + */ + image: Image; + /** + * Accessor for the rectangle that specifies a "visible" area on the image. + */ + rectangle: Rect; + /** + * Accessor for the page segmentation mode. + */ + pageSegMode: 'osd_only' | 'auto_osd' | 'auto_only' | 'auto' + | 'single_column' | 'single_block_vert_text' | 'single_block' + | 'single_line' | 'single_word' | 'circle_word' | 'single_char' + | 'sparse_text' | 'sparse_text_osd'; + [key: string]: unknown; + + /** + * Clears the tesseract image and its last results. + */ + clear(): void; + /** + * Clears all adaptive classifiers (use this when results vary during scanning). + */ + clearAdaptiveClassifier(): void; + /** + * Returns the binarized image Tesseract uses for its recognition. + */ + thresholdImage(): Image; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findRegions(recognize: boolean): Region[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findParagraphs(recognize: boolean): Paragaph[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findTextLines(recognize: boolean): Textline[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findWords(recognize: boolean): Word[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findSymbols(recognize: boolean): symbol[]; + /** + * Returns text in the specified format. Valid formats are: plain, unlv. + */ + findText(format: 'plain' | 'unlv', withConfidence?: boolean): string; + findText(format: 'hocr' | 'box', pageNumber: number): string; +} + +export interface Barcodeformat { + QR_CODE: boolean; + DATA_MATRIX: boolean; + PDF_417: boolean; + UPC_E: boolean; + UPC_A: boolean; + EAN_8: boolean; + EAN_13: boolean; + CODE_128: boolean; + CODE_39: boolean; + ITF: boolean; + AZTEC: boolean; +} + +export interface BarCode { + type: string; + data: string; + buffer: Buffer; + points: Point[]; +} + +/** + * A ZXing object represents a barcode reader. By default it attempts to decode all barcode formats that ZXing supports. + */ +export class ZXing { + constructor(image?: Image); + + /** + * Accessor for the input image this barcode reader operates on. + */ + image: Image; + /** + * List of barcodes the reader tries to find. It's specified as an object and missing properties account as false + */ + formats: Barcodeformat; + /** + * If try harder is enabled, the barcode reader spends more time trying to find a barcode (optimize for accuracy, not speed). + */ + tryHarder: boolean; + /** + * Returns the first barcode found as an object with the following format: + */ + findCode(): BarCode; + /** + * enotes the barcodes type. + */ + readonly type: 'None' | 'QR_CODE' | 'DATA_MATRIX' | 'PDF_417' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'ITF' | 'AZTEC'; + /** + * denotes the stringified data read from the barcode. + */ + readonly data: string; + /** + * denotes the decoded binary data of the barcode before conversion into another character encoding. + */ + readonly buffer: Buffer; + /** + * denotes the points in pixels which were used by the barcode reader to detect the barcode. + */ + readonly points: Point[]; +} diff --git a/types/dv/tsconfig.json b/types/dv/tsconfig.json new file mode 100644 index 0000000000..ad0aaa212b --- /dev/null +++ b/types/dv/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", + "dv-tests.ts" + ] +} \ No newline at end of file diff --git a/types/del/tslint.json b/types/dv/tslint.json similarity index 60% rename from types/del/tslint.json rename to types/dv/tslint.json index 26bcea6634..8765f2428f 100644 --- a/types/del/tslint.json +++ b/types/dv/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "dt-header": false + "unified-signatures": false } -} +} \ No newline at end of file diff --git a/types/electron-spellchecker/index.d.ts b/types/electron-spellchecker/index.d.ts index fc10d13f34..6db76278d2 100644 --- a/types/electron-spellchecker/index.d.ts +++ b/types/electron-spellchecker/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for electron-spellchecker 1.1 -// Project: https://github.com/paulcbetts/electron-spellchecker +// Project: https://github.com/electron-userland/electron-spellchecker // Definitions by: Daniel Perez Alvarez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/electron-store/electron-store-tests.ts b/types/electron-store/electron-store-tests.ts index f27cd6aca3..318af19f5c 100644 --- a/types/electron-store/electron-store-tests.ts +++ b/types/electron-store/electron-store-tests.ts @@ -52,3 +52,7 @@ typedElectronStore.set({ enabled: true, interval: 10000, }); + +const offDidChange = typedElectronStore.onDidChange("enabled", (n: boolean | undefined, p: boolean | undefined) => {}); + +offDidChange(); diff --git a/types/electron-store/index.d.ts b/types/electron-store/index.d.ts index 66e579b392..721386de2f 100644 --- a/types/electron-store/index.d.ts +++ b/types/electron-store/index.d.ts @@ -8,6 +8,8 @@ /// +import EventEmitter = require("events"); + type JSONValue = string | number | boolean | JSONObject | JSONArray; interface JSONObject { @@ -79,12 +81,12 @@ declare class ElectronStore implements Iterable<[string, JSONValue]> { */ onDidChange( key: K, - callback: (newValue: T[K], oldValue: T[K]) => void - ): void; + callback: (newValue: T[K] | undefined, oldValue: T[K] | undefined) => void + ): () => EventEmitter; onDidChange( key: string, - callback: (newValue: JSONValue, oldValue: JSONValue) => void - ): void; + callback: (newValue: JSONValue | undefined, oldValue: JSONValue | undefined) => void + ): () => EventEmitter; /** * Get the item count. diff --git a/types/ember-data/tsconfig.json b/types/ember-data/tsconfig.json index f476362aaf..aadbbe7f5f 100644 --- a/types/ember-data/tsconfig.json +++ b/types/ember-data/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-feature-flags/tsconfig.json b/types/ember-feature-flags/tsconfig.json index 957a7a00f8..dc3260af3a 100644 --- a/types/ember-feature-flags/tsconfig.json +++ b/types/ember-feature-flags/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-mocha/tsconfig.json b/types/ember-mocha/tsconfig.json index 4e9b406e2e..c6c6a09f65 100644 --- a/types/ember-mocha/tsconfig.json +++ b/types/ember-mocha/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-modal-dialog/tsconfig.json b/types/ember-modal-dialog/tsconfig.json index 0b0b6f91fb..8fc7a37808 100644 --- a/types/ember-modal-dialog/tsconfig.json +++ b/types/ember-modal-dialog/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-qunit/tsconfig.json b/types/ember-qunit/tsconfig.json index df4899b37c..92a555a59f 100644 --- a/types/ember-qunit/tsconfig.json +++ b/types/ember-qunit/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-resolver/tsconfig.json b/types/ember-resolver/tsconfig.json index bc476c5723..7263220f71 100644 --- a/types/ember-resolver/tsconfig.json +++ b/types/ember-resolver/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember-test-helpers/tsconfig.json b/types/ember-test-helpers/tsconfig.json index 2e0ddf49b1..ca139535f3 100644 --- a/types/ember-test-helpers/tsconfig.json +++ b/types/ember-test-helpers/tsconfig.json @@ -35,6 +35,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index fbe058a643..d7aaa35b36 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -38,15 +38,17 @@ import { ComputedPropertyCallback, ObserverMethod } from '@ember/object/-private/types'; -import * as HandlebarsNamespace from 'handlebars'; + // Capitalization is intentional: this makes it much easier to re-export RSVP on // the Ember namespace. import Rsvp from 'rsvp'; + import { TemplateFactory } from 'htmlbars-inline-precompile'; import { Registry as ServiceRegistry } from '@ember/service'; import { Registry as ControllerRegistry } from '@ember/controller'; import * as EmberStringNs from '@ember/string'; +import * as EmberStringHandlebarsNs from '@ember/string/-private/handlebars'; // tslint:disable-next-line:no-duplicate-imports import * as EmberServiceNs from '@ember/service'; import * as EmberPolyfillsNs from '@ember/polyfills'; @@ -424,11 +426,12 @@ export namespace Ember { function K(): any; function createFrame(objec: any): any; function Exception(message: string): void; - const SafeString: typeof HandlebarsNamespace.SafeString; + class SafeString extends EmberStringHandlebarsNs.SafeString {} function parse(string: string): any; function print(ast: any): void; const logger: typeof Logger; function log(level: string, str: string): void; + function registerHelper(name: string, helper: any): void; } namespace String { const camelize: typeof EmberStringNs.camelize; @@ -495,7 +498,6 @@ export namespace Ember { // TODO: replace with an es6 reexport when declare module 'ember' is removed /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ const assign: typeof EmberPolyfillsNs.assign; /** diff --git a/types/ember/test/ember-tests.ts b/types/ember/test/ember-tests.ts index 01aaab7452..eb317c3ab1 100755 --- a/types/ember/test/ember-tests.ts +++ b/types/ember/test/ember-tests.ts @@ -92,10 +92,10 @@ App.userController = Ember.Object.create({ }), }); -Handlebars.registerHelper( +Ember.Handlebars.registerHelper( 'highlight', (property: string, options: any) => - new Handlebars.SafeString('' + 'some value' + '') + new Ember.Handlebars.SafeString('' + 'some value' + '') ); const coolView = App.CoolView.create(); diff --git a/types/ember/test/string.ts b/types/ember/test/string.ts index 4363b375f3..d812a52dd5 100644 --- a/types/ember/test/string.ts +++ b/types/ember/test/string.ts @@ -1,5 +1,5 @@ import Ember from 'ember'; -import { SafeString } from 'handlebars'; +import { SafeString } from '@ember/string/-private/handlebars'; const { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } = Ember.String; diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index be47225e72..6e494f5a03 100755 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -36,6 +36,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember/v1/package.json b/types/ember/v1/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/ember/v1/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/ember/v2/index.d.ts b/types/ember/v2/index.d.ts index 54b6d2e4a9..783fcca14c 100755 --- a/types/ember/v2/index.d.ts +++ b/types/ember/v2/index.d.ts @@ -12,7 +12,6 @@ // TypeScript Version: 2.4 /// -/// declare module 'ember' { // Capitalization is intentional: this makes it much easier to re-export RSVP on @@ -274,6 +273,12 @@ declare module 'ember' { triggerAction(opts: TriggerActionOptions): boolean; } + interface DeprecationOptions { + id: string; + until: string; + url?: string; + } + export namespace Ember { interface FunctionPrototypeExtensions { /** @@ -2415,6 +2420,7 @@ declare module 'ember' { function print(ast: any): void; const logger: typeof Ember.Logger; function log(level: string, str: string): void; + function registerHelper(name: string, helper: any): void; } namespace String { function camelize(str: string): string; @@ -2574,14 +2580,14 @@ declare module 'ember' { */ deprecatingAlias( dependentKey: string, - options: { id: string; until: string } + options: DeprecationOptions ): ComputedProperty; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options */ deprecatingAlias( dependentKey: string, - options?: { id?: string; until?: string } + options?: Partial ): ComputedProperty; /** * A computed property that returns the sum of the values @@ -2977,7 +2983,7 @@ declare module 'ember' { function deprecate( message: string, test: boolean, - options: { id: string; until: string } + options: DeprecationOptions ): any; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options @@ -2985,7 +2991,7 @@ declare module 'ember' { function deprecate( message: string, test: boolean, - options?: { id?: string; until?: string } + options?: Partial ): any; /** * Define an assertion that will throw an exception if the condition is not met. @@ -3012,7 +3018,7 @@ declare module 'ember' { */ function deprecateFunc any)>( message: string, - options: { id: string; until: string }, + options: DeprecationOptions, func: Func ): Func; /** @@ -3131,7 +3137,7 @@ declare module 'ember' { function isPresent(obj: any): boolean; /** * Merge the contents of two objects together into the first object. - * @deprecated Use Object.assign + * @deprecated Use Ember.assign */ function merge(original: T, updates: U): T & U; /** @@ -3284,7 +3290,6 @@ declare module 'ember' { function typeOf(item: any): string; /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ function assign(target: T, source: U): T & U; function assign(target: T, source1: U, source2: V): T & U & V; diff --git a/types/ember/v2/package.json b/types/ember/v2/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/ember/v2/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/ember/v2/test/ember-tests.ts b/types/ember/v2/test/ember-tests.ts index c049512eb0..892c9ed9a8 100755 --- a/types/ember/v2/test/ember-tests.ts +++ b/types/ember/v2/test/ember-tests.ts @@ -92,10 +92,10 @@ App.userController = Ember.Object.create({ }), }); -Handlebars.registerHelper( +Ember.Handlebars.registerHelper( 'highlight', (property: string, options: any) => - new Handlebars.SafeString('' + 'some value' + '') + new Ember.Handlebars.SafeString('' + 'some value' + '') ); const coolView = App.CoolView.create(); diff --git a/types/ember/v2/test/utils.ts b/types/ember/v2/test/utils.ts index d729d472b8..72d55184ab 100755 --- a/types/ember/v2/test/utils.ts +++ b/types/ember/v2/test/utils.ts @@ -50,6 +50,14 @@ function testDeprecateFunc() { assertType(oldMethod('first', 123)); } +function testDeprecate() { + Ember.deprecate('This has been deprecated', false, { + id: 'some.id', + until: '1.0.0', + url: 'http://www.emberjs.com' + }); +} + function testDefineProperty() { const contact = {}; diff --git a/types/ember__application/deprecations.d.ts b/types/ember__application/deprecations.d.ts index 8509e2f69d..ddc5af5019 100644 --- a/types/ember__application/deprecations.d.ts +++ b/types/ember__application/deprecations.d.ts @@ -1,3 +1,10 @@ +// tslint:disable-next-line:strict-export-declare-modifiers +interface DeprecationOptions { + id: string; + until: string; + url?: string; +} + /** * Display a deprecation warning with the provided message and a stack trace * (Chrome and Firefox only). @@ -5,7 +12,7 @@ export function deprecate( message: string, test: boolean, - options: { id: string; until: string } + options: DeprecationOptions ): any; /** @@ -13,6 +20,6 @@ export function deprecate( */ export function deprecateFunc any)>( message: string, - options: { id: string; until: string }, + options: DeprecationOptions, func: Func ): Func; diff --git a/types/ember__application/test/deprecations.ts b/types/ember__application/test/deprecations.ts index 30d1e8a075..c5db468535 100644 --- a/types/ember__application/test/deprecations.ts +++ b/types/ember__application/test/deprecations.ts @@ -1,8 +1,13 @@ import { deprecate, deprecateFunc } from '@ember/application/deprecations'; +deprecate('this is no longer advised', false, { + id: 'no-longer-advised', + until: 'v4.0' +}); deprecate('this is no longer advised', false, { id: 'no-longer-advised', - until: 'v4.0' + until: 'v4.0', + url: 'https://emberjs.com' }); deprecate('this is no longer advised', false); // $ExpectError diff --git a/types/ember__object/proxy.d.ts b/types/ember__object/proxy.d.ts index 841b211e49..38c690fe72 100644 --- a/types/ember__object/proxy.d.ts +++ b/types/ember__object/proxy.d.ts @@ -1,12 +1,32 @@ import EmberObject from "@ember/object"; +import { + UnwrapComputedPropertyGetter, + UnwrapComputedPropertyGetters +} from "@ember/object/-private/types"; /** * `Ember.ObjectProxy` forwards all properties not defined by the proxy itself * to a proxied `content` object. */ -export default class ObjectProxy extends EmberObject { +export default class ObjectProxy extends EmberObject { /** * The object whose properties will be forwarded. */ - content: object; + content: T | undefined; + + get(key: K): UnwrapComputedPropertyGetter; + get(key: K): UnwrapComputedPropertyGetter | undefined; + + getProperties( + list: K[] + ): Pick, K>; + getProperties( + ...list: K[] + ): Pick, K>; + getProperties( + list: K[] + ): Pick>, K>; + getProperties( + ...list: K[] + ): Pick>, K>; } diff --git a/types/ember__object/test/proxy.ts b/types/ember__object/test/proxy.ts new file mode 100644 index 0000000000..bacfd013f1 --- /dev/null +++ b/types/ember__object/test/proxy.ts @@ -0,0 +1,38 @@ +import ObjectProxy from "@ember/object/proxy"; + +interface Book { + title: string; + subtitle: string; + chapters: Array<{ title: string }>; +} + +class DefaultProxy extends ObjectProxy {} +DefaultProxy.create().content; // $ExpectType object | undefined + +class BookProxy extends ObjectProxy { + private readonly baz = 'baz'; + + getTitle() { + return this.get('title'); + } + + getPropertiesTitleSubtitle() { + return this.getProperties('title', 'subtitle'); + } +} + +const book = BookProxy.create(); +book.content; // $ExpectType Book | undefined + +book.get("unknownProperty"); // $ExpectError +book.get("title"); // $ExpectType string | undefined +book.getTitle(); // $ExpectType string | undefined + +book.getProperties("title", "unknownProperty"); // $ExpectError +book.getProperties("title", "subtitle"); // $ExpectType Pick>, "title" | "subtitle"> +book.getPropertiesTitleSubtitle(); // $ExpectType Pick>, "title" | "subtitle"> + +book.getProperties(["subtitle", "chapters"]); // $ExpectType Pick>, "subtitle" | "chapters"> +book.getProperties(["title", "unknownProperty"]); // $ExpectError + +book.get("baz"); // $ExpectError diff --git a/types/ember__object/tsconfig.json b/types/ember__object/tsconfig.json index 5ed61a24d3..deeb128e7b 100644 --- a/types/ember__object/tsconfig.json +++ b/types/ember__object/tsconfig.json @@ -49,6 +49,7 @@ "test/extend.ts", "test/object.ts", "test/observable.ts", + "test/proxy.ts", "test/reopen.ts" ] } diff --git a/types/ember__polyfills/index.d.ts b/types/ember__polyfills/index.d.ts index e5ace0fe2e..01820351e5 100644 --- a/types/ember__polyfills/index.d.ts +++ b/types/ember__polyfills/index.d.ts @@ -8,7 +8,6 @@ import { Mix, Mix3, Mix4 } from './types'; /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ export function assign(target: T, source: U): Mix; export function assign(target: T, source1: U, source2: V): Mix3; @@ -17,6 +16,6 @@ export function assign(target: object, ...sources: object[]): any; /** * Merge the contents of two objects together into the first object. - * @deprecated Use Object.assign + * @deprecated Use Ember.assign */ export function merge(original: T, updates: U): Mix; diff --git a/types/ember__runloop/-private/backburner.d.ts b/types/ember__runloop/-private/backburner.d.ts new file mode 100644 index 0000000000..98e01b230b --- /dev/null +++ b/types/ember__runloop/-private/backburner.d.ts @@ -0,0 +1,37 @@ +export interface QueueItem { + method: string; + target: object; + args: object[]; + stack: string | undefined; +} + +export interface DeferredActionQueues { + [index: string]: any; + queues: object; + schedule( + queueName: string, + target: any, + method: any, + args: any, + onceFlag: boolean, + stack: any + ): any; + flush(fromAutorun: boolean): any; +} + +export interface DebugInfo { + autorun: Error | undefined | null; + counters: object; + timers: QueueItem[]; + instanceStack: DeferredActionQueues[]; +} + +export interface Backburner { + join(...args: any[]): void; + on(...args: any[]): void; + scheduleOnce(...args: any[]): void; + schedule(queueName: string, target: object | null, method: () => void | string): void; + ensureInstance(): void; + DEBUG: boolean; + getDebugInfo(): DebugInfo; +} diff --git a/types/ember__runloop/ember__runloop-tests.ts b/types/ember__runloop/ember__runloop-tests.ts index cf9cfd7db1..37d1fc18e4 100644 --- a/types/ember__runloop/ember__runloop-tests.ts +++ b/types/ember__runloop/ember__runloop-tests.ts @@ -1,9 +1,19 @@ import { run } from '@ember/runloop'; import EmberObject from '@ember/object'; +import { Backburner, DebugInfo, QueueItem, DeferredActionQueues } from '@ember/runloop/-private/backburner'; +run; // $ExpectType RunNamespace run.queues; // $ExpectType EmberRunQueues[] const queues: string[] = run.queues; +// It will be the responsibility of each consuming package that needs access to the backburner property +// to merge the private types in the public API. +declare module '@ember/runloop' { + interface RunNamespace { + backburner: Backburner; + } +} + function testRun() { run(() => { // $ExpectType number // code to be executed within a RunLoop @@ -198,3 +208,9 @@ function testThrottle() { run.throttle(runIt, 150); run.throttle(myContext, runIt, 150); } + +function testBackburner() { + const debugInfo: DebugInfo = run.backburner.getDebugInfo(); + const queueItems: QueueItem[] = debugInfo.timers; + const deferredActionQueues: DeferredActionQueues[] = debugInfo.instanceStack; +} diff --git a/types/ember__runloop/index.d.ts b/types/ember__runloop/index.d.ts index 79b3b5973b..9f1fd6c260 100644 --- a/types/ember__runloop/index.d.ts +++ b/types/ember__runloop/index.d.ts @@ -1,320 +1,322 @@ // Type definitions for non-npm package @ember/runloop 3.0 // Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Frunloop // Definitions by: Mike North +// Steve Calvert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { RunMethod, EmberRunQueues } from "@ember/runloop/-private/types"; import { EmberRunTimer } from "@ember/runloop/types"; +import '@ember/runloop/-private/backburner'; -// tslint:disable-next-line:strict-export-declare-modifiers -export const run: { - /** - * Runs the passed target and method inside of a RunLoop, ensuring any - * deferred actions including bindings and views updates are flushed at the - * end. - */ - (method: (...args: any[]) => Ret): Ret; - (target: Target, method: RunMethod): Ret; - /** - * If no run-loop is present, it creates a new one. If a run loop is - * present it will queue itself to run on the existing run-loops action - * queue. - */ - join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; - join( - target: Target, - method: RunMethod, - ...args: any[] - ): Ret | undefined; - /** - * Allows you to specify which context to call the specified function in while - * adding the execution of that function to the Ember run loop. This ability - * makes this method a great way to asynchronously integrate third-party libraries - * into your Ember application. - */ - bind( - target: Target, - method: RunMethod, - ...args: any[] - ): (...args: any[]) => Ret; - /** - * Begins a new RunLoop. Any deferred actions invoked after the begin will - * be buffered until you invoke a matching call to `run.end()`. This is - * a lower-level way to use a RunLoop instead of using `run()`. - */ - begin(): void; - /** - * Ends a RunLoop. This must be called sometime after you call - * `run.begin()` to flush any deferred actions. This is a lower-level way - * to use a RunLoop instead of using `run()`. - */ - end(): void; - /** - * Adds the passed target/method and any optional arguments to the named - * queue to be executed at the end of the RunLoop. If you have not already - * started a RunLoop when calling this method one will be started for you - * automatically. - */ - schedule( - queue: EmberRunQueues, - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - schedule( - queue: EmberRunQueues, - method: (args: any[]) => any, - ...args: any[] - ): EmberRunTimer; - /** - * Invokes the passed target/method and optional arguments after a specified - * period of time. The last parameter of this method must always be a number - * of milliseconds. - */ - later(method: (...args: any[]) => any, wait: number): EmberRunTimer; - later( - target: Target, - method: RunMethod, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - wait: number - ): EmberRunTimer; - /** - * Schedule a function to run one time during the current RunLoop. This is equivalent - * to calling `scheduleOnce` with the "actions" queue. - */ - once( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Schedules a function to run one time in a given queue of the current RunLoop. - * Calling this method with the same queue/target/method combination will have - * no effect (past the initial call). - */ - scheduleOnce( - queue: EmberRunQueues, - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Schedules an item to run from within a separate run loop, after - * control has been returned to the system. This is equivalent to calling - * `run.later` with a wait time of 1ms. - */ - next( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Cancels a scheduled item. Must be a value returned by `run.later()`, - * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or - * `run.throttle()`. - */ - cancel(timer: EmberRunTimer): boolean; - /** - * Delay calling the target method until the debounce period has elapsed - * with no additional debounce calls. If `debounce` is called again before - * the specified time has elapsed, the timer is reset and the entire period - * must pass again before the target method is called. - */ - debounce( - method: (...args: any[]) => any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - /** - * Ensure that the target method is never called more frequently than - * the specified spacing period. The target method is called immediately. - */ - throttle( - method: (...args: any[]) => any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; +export interface RunNamespace { + /** + * Runs the passed target and method inside of a RunLoop, ensuring any + * deferred actions including bindings and views updates are flushed at the + * end. + */ + (method: (...args: any[]) => Ret): Ret; + (target: Target, method: RunMethod): Ret; + /** + * If no run-loop is present, it creates a new one. If a run loop is + * present it will queue itself to run on the existing run-loops action + * queue. + */ + join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; + join( + target: Target, + method: RunMethod, + ...args: any[] + ): Ret | undefined; + /** + * Allows you to specify which context to call the specified function in while + * adding the execution of that function to the Ember run loop. This ability + * makes this method a great way to asynchronously integrate third-party libraries + * into your Ember application. + */ + bind( + target: Target, + method: RunMethod, + ...args: any[] + ): (...args: any[]) => Ret; + /** + * Begins a new RunLoop. Any deferred actions invoked after the begin will + * be buffered until you invoke a matching call to `run.end()`. This is + * a lower-level way to use a RunLoop instead of using `run()`. + */ + begin(): void; + /** + * Ends a RunLoop. This must be called sometime after you call + * `run.begin()` to flush any deferred actions. This is a lower-level way + * to use a RunLoop instead of using `run()`. + */ + end(): void; + /** + * Adds the passed target/method and any optional arguments to the named + * queue to be executed at the end of the RunLoop. If you have not already + * started a RunLoop when calling this method one will be started for you + * automatically. + */ + schedule( + queue: EmberRunQueues, + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + schedule( + queue: EmberRunQueues, + method: (args: any[]) => any, + ...args: any[] + ): EmberRunTimer; + /** + * Invokes the passed target/method and optional arguments after a specified + * period of time. The last parameter of this method must always be a number + * of milliseconds. + */ + later(method: (...args: any[]) => any, wait: number): EmberRunTimer; + later( + target: Target, + method: RunMethod, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + wait: number + ): EmberRunTimer; + /** + * Schedule a function to run one time during the current RunLoop. This is equivalent + * to calling `scheduleOnce` with the "actions" queue. + */ + once( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Schedules a function to run one time in a given queue of the current RunLoop. + * Calling this method with the same queue/target/method combination will have + * no effect (past the initial call). + */ + scheduleOnce( + queue: EmberRunQueues, + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Schedules an item to run from within a separate run loop, after + * control has been returned to the system. This is equivalent to calling + * `run.later` with a wait time of 1ms. + */ + next( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Cancels a scheduled item. Must be a value returned by `run.later()`, + * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or + * `run.throttle()`. + */ + cancel(timer: EmberRunTimer): boolean; + /** + * Delay calling the target method until the debounce period has elapsed + * with no additional debounce calls. If `debounce` is called again before + * the specified time has elapsed, the timer is reset and the entire period + * must pass again before the target method is called. + */ + debounce( + method: (...args: any[]) => any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + /** + * Ensure that the target method is never called more frequently than + * the specified spacing period. The target method is called immediately. + */ + throttle( + method: (...args: any[]) => any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; - queues: EmberRunQueues[]; -}; + queues: EmberRunQueues[]; +} +export const run: RunNamespace; export const begin: typeof run.begin; export const bind: typeof run.bind; export const cancel: typeof run.cancel; diff --git a/types/ember__runloop/tsconfig.json b/types/ember__runloop/tsconfig.json index d06cb5216c..158a3d6459 100644 --- a/types/ember__runloop/tsconfig.json +++ b/types/ember__runloop/tsconfig.json @@ -28,6 +28,7 @@ "index.d.ts", "types.d.ts", "-private/types.d.ts", + "-private/backburner.d.ts", "ember__runloop-tests.ts" ] } diff --git a/types/ember__string/-private/handlebars.d.ts b/types/ember__string/-private/handlebars.d.ts new file mode 100644 index 0000000000..8d8dce118c --- /dev/null +++ b/types/ember__string/-private/handlebars.d.ts @@ -0,0 +1,5 @@ +export class SafeString { + constructor(str: string); + toString(): string; + toHTML(): string; +} diff --git a/types/ember__string/ember__string-tests.ts b/types/ember__string/ember__string-tests.ts index 500c67546e..c6474cd266 100644 --- a/types/ember__string/ember__string-tests.ts +++ b/types/ember__string/ember__string-tests.ts @@ -1,5 +1,5 @@ import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string'; -import { SafeString } from 'handlebars'; +import { SafeString } from '@ember/string/-private/handlebars'; dasherize(); // $ExpectError dasherize('blue man group'); // $ExpectType string @@ -37,7 +37,7 @@ const handlebarsSafeString: SafeString = htmlSafe('lorem ipsum...'); htmlSafe('lorem ipsum...'); // $ExpectType SafeString const regularString: string = htmlSafe('lorem ipsum...'); // $ExpectError -function isSafeTest(a: string|Handlebars.SafeString) { +function isSafeTest(a: string | SafeString) { if (isHTMLSafe(a)) { a = a.toString(); } diff --git a/types/ember__string/index.d.ts b/types/ember__string/index.d.ts index c25da1f823..2a65c9b5df 100644 --- a/types/ember__string/index.d.ts +++ b/types/ember__string/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import { SafeString } from 'handlebars'; +import { SafeString } from "./-private/handlebars"; export function camelize(str: string): string; export function capitalize(str: string): string; diff --git a/types/ember__string/tsconfig.json b/types/ember__string/tsconfig.json index 100fad10f5..a5a7ecc944 100644 --- a/types/ember__string/tsconfig.json +++ b/types/ember__string/tsconfig.json @@ -15,13 +15,15 @@ "../" ], "paths": { - "@ember/string": ["ember__string"] + "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"] }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ + "-private/handlebars.d.ts", "index.d.ts", "ember__string-tests.ts" ] diff --git a/types/ember__test-helpers/tsconfig.json b/types/ember__test-helpers/tsconfig.json index 7b167f14d5..35638865d8 100644 --- a/types/ember__test-helpers/tsconfig.json +++ b/types/ember__test-helpers/tsconfig.json @@ -38,6 +38,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/ember__test/tsconfig.json b/types/ember__test/tsconfig.json index da00f05337..bb95710392 100644 --- a/types/ember__test/tsconfig.json +++ b/types/ember__test/tsconfig.json @@ -36,6 +36,7 @@ "@ember/runloop/*": ["ember__runloop/*"], "@ember/service": ["ember__service"], "@ember/string": ["ember__string"], + "@ember/string/*": ["ember__string/*"], "@ember/test": ["ember__test"], "@ember/test/*": ["ember__test/*"], "@ember/utils": ["ember__utils"], diff --git a/types/env-paths/env-paths-tests.ts b/types/env-paths/env-paths-tests.ts deleted file mode 100644 index 9f360bbe41..0000000000 --- a/types/env-paths/env-paths-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import envPaths = require('env-paths'); - -// $ExpectType Paths -envPaths('./'); -// $ExpectType Paths -envPaths('./', {suffix: 'test'}); -// $ExpectType Paths -envPaths('./', {suffix: false}); -// $ExpectType Paths -envPaths('./', {suffix: true}); diff --git a/types/env-paths/index.d.ts b/types/env-paths/index.d.ts deleted file mode 100644 index 8b594d8a61..0000000000 --- a/types/env-paths/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for env-paths 1.0 -// Project: https://github.com/sindresorhus/env-paths -// Definitions by: Daniel Byrne -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = envPaths; - -declare function envPaths(name: string, opts?: { suffix: string | boolean }): envPaths.Paths; - -declare namespace envPaths { - interface Paths { - readonly data: string; - readonly config: string; - readonly cache: string; - readonly log: string; - readonly temp: string; - } -} diff --git a/types/env-paths/tsconfig.json b/types/env-paths/tsconfig.json deleted file mode 100644 index 62dcbca022..0000000000 --- a/types/env-paths/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "env-paths-tests.ts" - ] -} diff --git a/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts new file mode 100644 index 0000000000..50dc0dffe4 --- /dev/null +++ b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts @@ -0,0 +1,31 @@ +import ExpoMixpanelAnalytics from 'expo-mixpanel-analytics'; + +const analytics = new ExpoMixpanelAnalytics('5224da5bbbed3fdeaad0911820f1bf2x'); + +analytics.identify("13793"); + +analytics.track("Signed Up", { "Referred By": "Friend" }); + +analytics.people_set({ + $first_name: "Joe", + $last_name: "Doe", + $email: "joe.doe@example.com", + $created: "2013-04-01T13:20:00", + $phone: "4805551212", + Address: "1313 Mockingbird Lane", + Birthday: "1948-01-01" +}); + +analytics.people_set_once({ "First login date": "2013-04-01T13:20:00" }); + +analytics.people_unset([ "Days Overdue" ]); + +analytics.people_increment({ "Coins Gathered": 12 }); + +analytics.people_append({ "Power Ups": "Bubble Lead" }); + +analytics.people_union({ "Items purchased": ["socks", "shirts"] }); + +analytics.people_delete_user(); + +analytics.reset(); diff --git a/types/expo-mixpanel-analytics/index.d.ts b/types/expo-mixpanel-analytics/index.d.ts new file mode 100644 index 0000000000..6b51a15585 --- /dev/null +++ b/types/expo-mixpanel-analytics/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for expo-mixpanel-analytics 0.0 +// Project: https://github.com/codekadiya/expo-mixpanel-analytics +// Definitions by: Martin Treurnicht +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare class ExpoMixpanelAnalytics { + constructor(token: string); + identify(userId: string): void; + track(name: string, props: Props): void; + people_set(props: Props): void; + people_set_once(props: Props): void; + people_unset(keys: string[]): void; + people_increment(props: Props): void; + people_append(props: Props): void; + people_union(props: Props): void; + people_delete_user(): void; + reset(): void; + token: string; +} + +interface Props { + [key: string]: T; +} + +export default ExpoMixpanelAnalytics; diff --git a/types/expo-mixpanel-analytics/tsconfig.json b/types/expo-mixpanel-analytics/tsconfig.json new file mode 100644 index 0000000000..57ee3b6a41 --- /dev/null +++ b/types/expo-mixpanel-analytics/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", + "expo-mixpanel-analytics-tests.ts" + ] +} diff --git a/types/conf/v1/tslint.json b/types/expo-mixpanel-analytics/tslint.json similarity index 100% rename from types/conf/v1/tslint.json rename to types/expo-mixpanel-analytics/tslint.json diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index f2ce8d8197..ab34955ce2 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -37,6 +37,7 @@ import { LinearGradient, Linking, Location, + Localization, MailComposer, MapEvent, MapStyleElement, @@ -57,6 +58,16 @@ const reverseGeocode: Promise = Location.reverseGeocodeA longitude: 0 }); +Location.watchPositionAsync({ + accuracy: Location.Accuracy.BestForNavigation, + timeInterval: 10000, + distanceInterval: 0, + timeout: 10000 +}, (data) => { + data.coords; + data.timestamp; +}); + Accelerometer.addListener((obj) => { obj.x; obj.y; @@ -1094,6 +1105,28 @@ async () => { }; // #endregion +// #region Localization + +let locale: string = Localization.locale; +let locales: string[] = Localization.locales; +let country: string | undefined = Localization.country; +let isoCurrencyCodes: string[] | undefined = Localization.isoCurrencyCodes; +let timezone: string = Localization.timezone; +let isRTL: boolean = Localization.isRTL; + +async () => { + const localizationData = await Localization.getLocalizationAsync(); + + locale = localizationData.locale; + locales = localizationData.locales; + country = localizationData.country; + isoCurrencyCodes = localizationData.isoCurrencyCodes; + timezone = localizationData.timezone; + isRTL = localizationData.isRTL; +}; + +// #endregion + // #region Contacts Contacts.Fields.ID === 'id'; Contacts.Fields.Name === 'name'; diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 7e75c1b7d6..2752410316 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -16,6 +16,7 @@ // Bartosz Dotryw // Jason Killian // Satyajit Sahoo +// Vinit Sood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -200,6 +201,9 @@ export interface AppLoadingProps { /** If `startAsync` throws an error, it is caught and passed into the function provided to `onError`. */ onError?: (error: Error) => void; + + /** Whether to hide the native splash screen as soon as you unmount the AppLoading component. */ + autoHideSplash?: boolean; } /** @@ -2242,6 +2246,38 @@ export namespace Location { function stopGeofencingAsync(taskName: string): Promise; function hasStartedGeofencingAsync(taskName: string): Promise; function setApiKey(key: string): void; + + enum Accuracy { + Lowest = 1, + Low = 2, + Balanced = 3, + High = 4, + Highest = 5, + BestForNavigation = 6 + } +} + +/** + * Localization + */ +export namespace Localization { + const locale: string; + const locales: string[]; + const country: string | undefined; + const isoCurrencyCodes: string[] | undefined; + const timezone: string; + const isRTL: boolean; + + interface LocalizationData { + locale: string; + locales: string[]; + country?: string; + isoCurrencyCodes?: string[]; + timezone: string; + isRTL: boolean; + } + + function getLocalizationAsync(): Promise; } /** @@ -2431,7 +2467,11 @@ export namespace ScreenOrientation { const Orientation: Orientations; + /** Deprecated in favour of ScreenOrientation.allowAsync. */ function allow(orientation: keyof Orientations): void; + + /** Allow a screen orientation. You can call this function multiple times with multiple orientations to allow multiple orientations. */ + function allowAsync(orientation: keyof Orientations): void; } /** diff --git a/types/facebook-js-sdk/facebook-js-sdk-tests.ts b/types/facebook-js-sdk/facebook-js-sdk-tests.ts index db8b13686e..8bcd07cbed 100644 --- a/types/facebook-js-sdk/facebook-js-sdk-tests.ts +++ b/types/facebook-js-sdk/facebook-js-sdk-tests.ts @@ -48,6 +48,10 @@ FB.logout(function(response: fb.StatusResponse) { console.log(response.authResponse.accessToken); }); +FB.login({ auth_type: 'reauthenticate' }); +FB.login({ auth_type: 'reauthorize' }); +FB.login({ auth_type: 'rerequest' }); + FB.logout(); /** diff --git a/types/facebook-js-sdk/index.d.ts b/types/facebook-js-sdk/index.d.ts index c4f3b78c31..18da6b5ae9 100644 --- a/types/facebook-js-sdk/index.d.ts +++ b/types/facebook-js-sdk/index.d.ts @@ -150,7 +150,7 @@ declare namespace facebook { } interface LoginOptions { - auth_type?: 'rerequest'; + auth_type?: 'reauthenticate' | 'reauthorize' | 'rerequest'; scope?: string; return_scopes?: boolean; enable_profile_selector?: boolean; diff --git a/types/filesize/filesize-tests.ts b/types/filesize/filesize-tests.ts index 6980ac892d..aadc0542fa 100644 --- a/types/filesize/filesize-tests.ts +++ b/types/filesize/filesize-tests.ts @@ -15,6 +15,7 @@ filesize(265318, {standard: "iec"}); // "259.1 KiB" filesize(265318, {standard: "iec", fullform: true}); // "259.1 kibibytes" filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов" filesize(265318, {separator: ","}); // "259,1 KB" +filesize(265318, {locale: 'de-DE'}); // "259,1 KB" const size = filesize.partial({standard: "iec"}); size(265318); diff --git a/types/filesize/index.d.ts b/types/filesize/index.d.ts index 33d04b66ff..958a5e3973 100644 --- a/types/filesize/index.d.ts +++ b/types/filesize/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for filesize 4.0 +// Type definitions for filesize 4.1 // Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com // Definitions by: Giedrius Grabauskas // Renaud Chaput // Roman Nuritdinov +// Sam Hulick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var fileSize: Filesize.Filesize; @@ -57,6 +58,10 @@ declare namespace Filesize { * Array of full form overrides, default is [] */ fullforms?: string[]; + /** + * BCP 47 language tag to specify a locale, or true to use default locale, default is "" + */ + locale?: string | boolean; /** * Output of function (array, exponent, object, or string), default is string */ diff --git a/types/flexmonster/index.d.ts b/types/flexmonster/index.d.ts index 2c5ea0b0ec..fad76ca64d 100644 --- a/types/flexmonster/index.d.ts +++ b/types/flexmonster/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for flexmonster 2.6 -// Project: https://flexmonster.com +// Project: https://flexmonster.com/ // Definitions by: Flexmonster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -135,6 +135,7 @@ declare namespace Flexmonster { showGridAndCharts(type?: string, position?: string, multiple?: boolean): void; sortingMethod(hierarchyName: string, compareFunction: (a: string, b: string) => boolean): void; sortValues(axisName: string, type: string, tuple: number[], measure: MeasureObject): void; + toolbar: Toolbar; updateData(object: DataSource | object[]): void; version: string; fusioncharts?: { @@ -179,6 +180,7 @@ declare namespace Flexmonster { dataSourceInfo?: string; dataSourceType?: string; fieldSeparator?: string; + thousandSeparator?: string; filename?: string; ignoreQuotedLineBreaks?: boolean; proxyUrl?: string; @@ -191,6 +193,8 @@ declare namespace Flexmonster { hash?: string; username?: string; password?: string; + requestHeader?: object; + subquery?: string; } interface Slice { @@ -276,6 +280,7 @@ declare namespace Flexmonster { saveAllFormats?: boolean; showDrillThroughConfigurator?: boolean; grouping?: boolean; + showAllFieldsDrillThrough?: boolean; } interface PrintOptions { @@ -343,6 +348,7 @@ declare namespace Flexmonster { useOlapFormattingInExcel?: boolean; useCustomizeCellForData?: boolean; excelExportAll?: boolean; + requestHeader?: object; } interface Hierarchy { @@ -463,6 +469,34 @@ declare namespace Flexmonster { interface Toolbar { getTabs: () => ToolbarTab[]; + // Connect tab + connectLocalCSVHandler: () => void; + connectLocalJSONHandler: () => void; + connectRemoteCSV: () => void; + connectRemoteJSON: () => void; + connectOLAP: () => void; + // Open tab + openLocalReport: () => void; + openRemoteReport: () => void; + // Save tab + saveHandler: () => void; + // Export tab + printHandler: () => void; + exportHandler: (type: string) => void; + // Grid tab + gridHandler: () => void; + // Charts tab + chartsHandler: (type: string) => void; + chartsMultipleHandler: () => void; + // Format tab + formatCellsHandler: () => void; + conditionalFormattingHandler: () => void; + // Options tab + optionsHandler: () => void; + // Fields tab + fieldsHandler: () => void; + // Fullscreen tab + fullscreenHandler: () => void; } interface ToolbarTab { diff --git a/types/forge-viewer/index.d.ts b/types/forge-viewer/index.d.ts index bff0c637a0..8bb90b6d59 100644 --- a/types/forge-viewer/index.d.ts +++ b/types/forge-viewer/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Forge Viewer 6.3 +// Type definitions for Forge Viewer 6.4 // Project: https://forge.autodesk.com/en/docs/viewer/v6/reference/javascript/viewer3d/ // Definitions by: Autodesk Forge Partner Development , Alan Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -150,6 +150,13 @@ declare namespace Autodesk { interface ViewerConfig { disableBrowserContextMenu?: boolean; + disabledExtensions?: { + bimwalk?: boolean; + hyperlink?: boolean; + measure?: boolean; + scalarisSimulation?: boolean; + section?: boolean; + }; extensions?: string[]; useConsolidation?: boolean; consolidationMemoryLimit?: number; @@ -238,10 +245,14 @@ declare namespace Autodesk { [key: string]: any; } + const AGGREGATE_FIT_TO_VIEW_EVENT = 'aggregateFitToView'; + const AGGREGATE_ISOLATION_CHANGED_EVENT = 'aggregateIsolation'; const AGGREGATE_SELECTION_CHANGED_EVENT = 'aggregateSelection'; const ANIMATION_READY_EVENT = 'animationReady'; const CAMERA_CHANGE_EVENT = 'cameraChanged'; + const CAMERA_TRANSITION_COMPLETED = 'cameraTransitionCompleted'; const CUTPLANES_CHANGE_EVENT = 'cutplanesChanged'; + const CANCEL_LEAFLET_SCREENSHOT = 'cancelLeafletScreenshot'; const ESCAPE_EVENT = 'escape'; const EXPLODE_CHANGE_EVENT = 'explodeChanged'; const EXTENSION_LOADED_EVENT = 'extensionLoaded'; @@ -251,12 +262,17 @@ declare namespace Autodesk { const FRAGMENTS_LOADED_EVENT = 'fragmentsLoaded'; const FULLSCREEN_MODE_EVENT = 'fullscreenMode'; const GEOMETRY_LOADED_EVENT = 'geometryLoaded'; + const GEOMETRY_DOWNLOAD_COMPLETE_EVENT = 'geometryDownloadComplete'; const HIDE_EVENT = 'hide'; const HYPERLINK_EVENT = 'hyperlink'; const ISOLATE_EVENT = 'isolate'; const LAYER_VISIBILITY_CHANGED_EVENT = 'layerVisibilityChanged'; + const LOAD_GEOMETRY_EVENT = 'loadGeometry'; const LOAD_MISSING_GEOMETRY = 'loadMissingGeometry'; + const MODEL_ADDED_EVENT = 'modelAdded'; const MODEL_ROOT_LOADED_EVENT = 'modelRootLoaded'; + const MODEL_REMOVED_EVENT = 'modelRemoved'; + const MODEL_LAYERS_LOADED_EVENT = 'modelLayersLoaded'; const MODEL_UNLOADED_EVENT = 'modelUnloaded'; const NAVIGATION_MODE_CHANGED_EVENT = 'navigationModeChanged'; const OBJECT_TREE_CREATED_EVENT = 'objectTreeCreated'; @@ -277,6 +293,7 @@ declare namespace Autodesk { const VIEWER_RESIZE_EVENT = 'viewerResize'; const VIEWER_STATE_RESTORED_EVENT = 'viewerStateRestored'; const VIEWER_UNINITIALIZED = 'viewerUninitialized'; + const WEBGL_CONTEXT_LOST_EVENT = 'webGlContextLost'; interface ViewerEventArgs { target?: Viewer3D; @@ -333,6 +350,7 @@ declare namespace Autodesk { setTag(tag: string, value: any): void; traverse(cb: () => void): boolean; urn(searchParent: boolean): string; + useAsDefault(): boolean; } let theExtensionManager: ExtensionManager; @@ -345,6 +363,7 @@ declare namespace Autodesk { language?: string; accessToken?: string; useADP?: boolean; + useConsolidation?: boolean; [key: string]: any; } @@ -438,16 +457,42 @@ declare namespace Autodesk { } class Model { - getBoundingBox(): THREE.Box3; + fetchTopology(maxSizeMB: number): Promise; getBulkProperties(dbIds: number[], propFilter?: string[], successCallback?: (r: any) => void, errorCallback?: (err: any) => void): void; getData(): any; getFragmentList(): any; getObjectTree(successCallback?: (result: InstanceTree) => void, errorCallback?: (err: any) => void): void; getProperties(dbId: number, successCallback?: (r: PropertyResult) => void, errorCallback?: (err: any) => void): void; + geomPolyCount(): number; + getDefaultCamera(): THREE.Camera; + getDisplayUnit(): string; + getDocumentNode(): object; + getExternalIdMapping(onSuccessCallback: () => void, onErrorCallback: () => void): any; + getFastLoadList(): any; + getFragmentMap(): any; // DbidFragmentMap|InstanceTree; + getLayersRoot(): object; + getMetadata(itemName: string, subitemName?: string, defaultValue?: any): any; + getRoot(): object; + getRootId(): number; + getTopoIndex(fragId: number): number; + getTopology(index: number): object; + getUnitData(unit: string): object; getUnitScale(): number; - getUnitString(): number; - - search(text: string, successCallback: (r: number[]) => void, errorCallback?: (err: any) => void, attributeNames?: string[]): void; + getUnitString(): string; + getUpVector(): any; + hasTopology(): boolean; + instancePolyCount(): number; + is2d(): boolean; + is3d(): boolean; + isAEC(): boolean; + isLoadDone(): boolean; + isObjectTreeCreated(): boolean; + isObjectTreeLoaded(): boolean; + pageToModel(): void; + pointInClip(): void; + search(text: string, onSuccessCallback: () => void, onErrorCallback: () => void, attributeNames?: string[]): void; + setData(data: object): void; + setUUID(urn: string): void; clearThemingColors(): void; getInstanceTree(): InstanceTree; @@ -760,6 +805,13 @@ declare namespace Autodesk { getHitPoint(x: number, y: number): THREE.Vector3; } + namespace Extensions { + class ViewerPropertyPanel extends UI.PropertyPanel { + constructor(viewer: Private.GuiViewer3D); + currentNodeIds: object[]; + } + } + namespace Private { function getHtmlTemplate(url: string, callback: (error: string, content: string) => void): void; @@ -850,11 +902,16 @@ declare namespace Autodesk { hitTestViewport(vpVec: THREE.Vector3, ignoreTransparent: boolean): HitTestResult; initialize(): void; setLightPreset(index: number, force?: boolean): void; - viewportToClient(viewportX: number, viewportY: number): THREE.Vector3; + viewportToClient(viewportX: number, viewportY: number): THREE.Vector3; + modelqueue(): any; + matman(): any; getMaterials(): any; + getScreenShotProgressive(w: number, h: number, onFinished?: () => void, options?: any): any; + getRenderProxy(model: Model, fragId: number): any; sceneUpdated(param: boolean): void; + setViewFromCamera(camera: THREE.Camera, skipTransition?: boolean, useExactCamera?: boolean): void; } class VisibilityManager { diff --git a/types/gestalt/index.d.ts b/types/gestalt/index.d.ts index 77c88b6d35..a38b1d94d1 100644 --- a/types/gestalt/index.d.ts +++ b/types/gestalt/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for gestalt 0.75 // Project: https://github.com/pinterest/gestalt, https://pinterest.github.io/gestalt // Definitions by: Nicolás Serrano Arévalo +// Josh Gachnang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -938,7 +939,7 @@ export class Pog extends React.Component {} export class Pulsar extends React.Component {} export class RadioButton extends React.Component {} export class SearchField extends React.Component {} -export class SegmentedControl extends React.Component {} +export class SegmentedControl extends React.Component {} export class SelectList extends React.Component {} export class Spinner extends React.Component {} export class Sticky extends React.Component {} diff --git a/types/gl-vec2/add.d.ts b/types/gl-vec2/add.d.ts new file mode 100644 index 0000000000..f19025387f --- /dev/null +++ b/types/gl-vec2/add.d.ts @@ -0,0 +1,6 @@ +/** + * Adds two vec2's + */ +declare function add(out: number[], a: number[], b: number[]): number[]; + +export = add; diff --git a/types/gl-vec2/clone.d.ts b/types/gl-vec2/clone.d.ts new file mode 100644 index 0000000000..53f4fd9aea --- /dev/null +++ b/types/gl-vec2/clone.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new vec2 initialized with values from an existing vector + */ +declare function clone(a: number[]): number[]; + +export = clone; diff --git a/types/gl-vec2/copy.d.ts b/types/gl-vec2/copy.d.ts new file mode 100644 index 0000000000..8236100308 --- /dev/null +++ b/types/gl-vec2/copy.d.ts @@ -0,0 +1,6 @@ +/** + * Copy the values from one vec2 to another. + */ +declare function copy(out: number[], a: number[]): number[]; + +export = copy; diff --git a/types/gl-vec2/create.d.ts b/types/gl-vec2/create.d.ts new file mode 100644 index 0000000000..26b76eee80 --- /dev/null +++ b/types/gl-vec2/create.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new, empty vec2. + */ +declare function create(): number[]; + +export = create; diff --git a/types/gl-vec2/cross.d.ts b/types/gl-vec2/cross.d.ts new file mode 100644 index 0000000000..6ce6cab5f4 --- /dev/null +++ b/types/gl-vec2/cross.d.ts @@ -0,0 +1,6 @@ +/** + * Computes the cross product of two vec2's Note that the cross product must by definition produce a 3D vector. + */ +declare function cross(out: number[], a: number[], b: number[]): number[]; + +export = cross; diff --git a/types/gl-vec2/dist.d.ts b/types/gl-vec2/dist.d.ts new file mode 100644 index 0000000000..d83a49e3fb --- /dev/null +++ b/types/gl-vec2/dist.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the euclidian distance between two vec2's. Aliased as dist. + */ +declare function dist(a: number[], b: number[]): number; + +export = dist; diff --git a/types/gl-vec2/div.d.ts b/types/gl-vec2/div.d.ts new file mode 100644 index 0000000000..7999d6f3e9 --- /dev/null +++ b/types/gl-vec2/div.d.ts @@ -0,0 +1,6 @@ +/** + * Divides two vec2's. Aliased as div. + */ +declare function div(out: number[], a: number[], b: number[]): number[]; + +export = div; diff --git a/types/gl-vec2/dot.d.ts b/types/gl-vec2/dot.d.ts new file mode 100644 index 0000000000..60a7c484dc --- /dev/null +++ b/types/gl-vec2/dot.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the dot product of two vec2's. + */ +declare function dot(a: number[], b: number[]): number; + +export = dot; diff --git a/types/gl-vec2/equals.d.ts b/types/gl-vec2/equals.d.ts new file mode 100644 index 0000000000..3892372e7e --- /dev/null +++ b/types/gl-vec2/equals.d.ts @@ -0,0 +1,6 @@ +/** + * Returns whether or not the vectors have approximately the same elements in the same position. + */ +declare function equals(a: number[], b: number[]): boolean; + +export = equals; diff --git a/types/gl-vec2/exactEquals.d.ts b/types/gl-vec2/exactEquals.d.ts new file mode 100644 index 0000000000..ce8772b5fc --- /dev/null +++ b/types/gl-vec2/exactEquals.d.ts @@ -0,0 +1,6 @@ +/** + * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===). + */ +declare function exactEquals(a: number[], b: number[]): boolean; + +export = exactEquals; diff --git a/types/gl-vec2/floor.d.ts b/types/gl-vec2/floor.d.ts new file mode 100644 index 0000000000..7909d20a23 --- /dev/null +++ b/types/gl-vec2/floor.d.ts @@ -0,0 +1,6 @@ +/** + * Math.floor the components of a vec2. + */ +declare function floor(out: number[], a: number[]): number[]; + +export = floor; diff --git a/types/gl-vec2/forEach.d.ts b/types/gl-vec2/forEach.d.ts new file mode 100644 index 0000000000..7da060f549 --- /dev/null +++ b/types/gl-vec2/forEach.d.ts @@ -0,0 +1,6 @@ +/** + * Perform some operation over an array of vec2s. + */ +declare function forEach(a: number[], stride: number, offset: number, count: number, fn: (a: number[], b: number[], arg: object) => number[], arg: object): number[]; + +export = forEach; diff --git a/types/gl-vec2/fromValues.d.ts b/types/gl-vec2/fromValues.d.ts new file mode 100644 index 0000000000..7a3f7928e9 --- /dev/null +++ b/types/gl-vec2/fromValues.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new vec2 initialized with the given values. + */ +declare function fromValues(x: number, y: number): number[]; + +export = fromValues; diff --git a/types/gl-vec2/gl-vec2-tests.ts b/types/gl-vec2/gl-vec2-tests.ts new file mode 100644 index 0000000000..6db61462ac --- /dev/null +++ b/types/gl-vec2/gl-vec2-tests.ts @@ -0,0 +1,134 @@ +import GlVec2 = require("gl-vec2"); + +import GlVec2Add = require("gl-vec2/add"); +import GlVec2Clone = require("gl-vec2/clone"); +import GlVec2Copy = require("gl-vec2/copy"); +import GlVec2Create = require("gl-vec2/create"); +import GlVec2Cross = require("gl-vec2/cross"); +import GlVec2Dist = require("gl-vec2/dist"); +import GlVec2Div = require("gl-vec2/div"); +import GlVec2Dot = require("gl-vec2/dot"); +import GlVec2Equals = require("gl-vec2/equals"); +import GlVec2exactEquals = require("gl-vec2/exactEquals"); +import GlVec2forEach = require("gl-vec2/forEach"); +import GlVec2fromValues = require("gl-vec2/fromValues"); +import GlVec2Floor = require("gl-vec2/floor"); +import GlVec2Inverse = require("gl-vec2/inverse"); +import GlVec2Len = require("gl-vec2/len"); +import GlVec2Lerp = require("gl-vec2/lerp"); +import GlVec2Limit = require("gl-vec2/limit"); +import GlVec2Max = require("gl-vec2/max"); +import GlVec2Min = require("gl-vec2/min"); +import GlVec2Mul = require("gl-vec2/mul"); +import GlVec2Negate = require("gl-vec2/negate"); +import GlVec2Normalize = require("gl-vec2/normalize"); +import GlVec2Random = require("gl-vec2/random"); +import GlVec2Scale = require("gl-vec2/scale"); +import GlVec2ScaleAndAdd = require("gl-vec2/scaleAndAdd"); +import GlVec2Set = require("gl-vec2/set"); +import GlVec2SqrDist = require("gl-vec2/sqrDist"); +import GlVec2SqrLen = require("gl-vec2/sqrLen"); +import GlVec2Sub = require("gl-vec2/sub"); +import GlVec2TransformMat2 = require("gl-vec2/transformMat2"); +import GlVec2TransformMat2d = require("gl-vec2/transformMat2d"); +import GlVec2TransformMat3 = require("gl-vec2/transformMat3"); +import GlVec2TransformMat4 = require("gl-vec2/transformMat4"); + +GlVec2.add([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Add([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.clone([1, 2, 3]); +GlVec2Clone([1, 2, 3]); + +GlVec2.copy([1, 2, 3], [1, 2, 3]); +GlVec2Copy([1, 2, 3], [1, 2, 3]); + +GlVec2.create(); +GlVec2Create(); + +GlVec2.cross([1, 2], [1, 2], [1, 2]); +GlVec2Cross([1, 2], [1, 2], [1, 2]); + +GlVec2.dist([1, 2, 3], [1, 2, 3]); +GlVec2Dist([1, 2, 3], [1, 2, 3]); + +GlVec2.div([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Div([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.dot([1, 2, 3], [1, 2, 3]); +GlVec2Dot([1, 2, 3], [1, 2, 3]); + +GlVec2.forEach([1, 2, 3], 5, 6, 1, () => [3], {}); +GlVec2forEach([1, 2, 3], 5, 6, 1, () => [3], {}); + +GlVec2.fromValues(1, 2); +GlVec2fromValues(1, 2); + +GlVec2.floor([1, 2], [1, 2]); +GlVec2Floor([1, 2], [1, 2]); + +GlVec2.equals([1, 2, 3], [1, 2, 3]); +GlVec2Equals([1, 2, 3], [1, 2, 3]); + +GlVec2.exactEquals([1, 2, 3], [1, 2, 3]); +GlVec2exactEquals([1, 2, 3], [1, 2, 3]); + +GlVec2.inverse([1, 2, 3], [1, 2, 3]); +GlVec2Inverse([1, 2, 3], [1, 2, 3]); + +GlVec2.len([1, 2, 3]); +GlVec2Len([1, 2, 3]); + +GlVec2.lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); +GlVec2Lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); + +GlVec2.limit([1, 2], [1, 2], 5); +GlVec2Limit([1, 2], [1, 2], 5); + +GlVec2.max([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Max([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.min([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Min([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.mul([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Mul([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.negate([1, 2, 3], [1, 2, 3]); +GlVec2Negate([1, 2, 3], [1, 2, 3]); + +GlVec2.normalize([1, 2, 3], [1, 2, 3]); +GlVec2Normalize([1, 2, 3], [1, 2, 3]); + +GlVec2.random([1, 2, 3], 6); +GlVec2Random([1, 2, 3], 6); + +GlVec2.scale([1, 2, 3], [1, 2, 3], 6); +GlVec2Scale([1, 2, 3], [1, 2, 3], 6); + +GlVec2.scaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); +GlVec2ScaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); + +GlVec2.set([1, 2], 1, 2); +GlVec2Set([1, 2], 1, 2); + +GlVec2.sqrDist([1, 2, 3], [1, 2, 3]); +GlVec2SqrDist([1, 2, 3], [1, 2, 3]); + +GlVec2.sqrLen([1, 2, 3]); +GlVec2SqrLen([1, 2, 3]); + +GlVec2.sub([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Sub([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat2d([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]); diff --git a/types/gl-vec2/index.d.ts b/types/gl-vec2/index.d.ts new file mode 100644 index 0000000000..65eb6ae91a --- /dev/null +++ b/types/gl-vec2/index.d.ts @@ -0,0 +1,75 @@ +// Type definitions for gl-vec2 1.3 +// Project: https://github.com/stackgl/gl-vec2 +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import add = require('./add'); +import clone = require('./clone'); +import copy = require('./copy'); +import create = require('./create'); +import cross = require('./cross'); +import dist = require('./dist'); +import div = require('./div'); +import dot = require('./dot'); +import equals = require('./equals'); +import exactEquals = require('./exactEquals'); +import floor = require('./floor'); +import forEach = require('./forEach'); +import fromValues = require('./fromValues'); +import inverse = require('./inverse'); +import len = require('./len'); +import lerp = require('./lerp'); +import limit = require('./limit'); +import max = require('./max'); +import min = require('./min'); +import mul = require('./mul'); +import negate = require('./negate'); +import normalize = require('./normalize'); +import random = require('./random'); +import scale = require('./scale'); +import scaleAndAdd = require('./scaleAndAdd'); +import set = require('./set'); +import sqrDist = require('./sqrDist'); +import sqrLen = require('./sqrLen'); +import sub = require('./sub'); +import transformMat2 = require('./transformMat2'); +import transformMat2d = require('./transformMat2d'); +import transformMat3 = require('./transformMat3'); +import transformMat4 = require('./transformMat4'); + +export { + add, + clone, + copy, + create, + cross, + dist, + div, + dot, + equals, + exactEquals, + floor, + forEach, + fromValues, + inverse, + len, + lerp, + limit, + max, + min, + mul, + negate, + normalize, + random, + scale, + scaleAndAdd, + set, + sqrDist, + sqrLen, + sub, + transformMat2, + transformMat2d, + transformMat3, + transformMat4 +}; diff --git a/types/gl-vec2/inverse.d.ts b/types/gl-vec2/inverse.d.ts new file mode 100644 index 0000000000..af3840b2a0 --- /dev/null +++ b/types/gl-vec2/inverse.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the inverse of the components of a vec2. + */ +declare function inverse(out: number[], a: number[]): number[]; + +export = inverse; diff --git a/types/gl-vec2/len.d.ts b/types/gl-vec2/len.d.ts new file mode 100644 index 0000000000..cfb66abfae --- /dev/null +++ b/types/gl-vec2/len.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the length of a vec2. Aliased as len. + */ +declare function len(a: number[]): number; + +export = len; diff --git a/types/gl-vec2/lerp.d.ts b/types/gl-vec2/lerp.d.ts new file mode 100644 index 0000000000..d0c4ed4cda --- /dev/null +++ b/types/gl-vec2/lerp.d.ts @@ -0,0 +1,6 @@ +/** + * Performs a linear interpolation between two vec2's + */ +declare function lerp(out: number[], a: number[], b: number[], t: number): number[]; + +export = lerp; diff --git a/types/gl-vec2/limit.d.ts b/types/gl-vec2/limit.d.ts new file mode 100644 index 0000000000..abf7af287a --- /dev/null +++ b/types/gl-vec2/limit.d.ts @@ -0,0 +1,6 @@ +/** + * Limit the magnitude of this vector to the value used for the max parameter. + */ +declare function limit(out: number[], a: number[], max: number): number[]; + +export = limit; diff --git a/types/gl-vec2/max.d.ts b/types/gl-vec2/max.d.ts new file mode 100644 index 0000000000..38a64a2c34 --- /dev/null +++ b/types/gl-vec2/max.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the maximum of two vec2's. + */ +declare function max(out: number[], a: number[], b: number[]): number[]; + +export = max; diff --git a/types/gl-vec2/min.d.ts b/types/gl-vec2/min.d.ts new file mode 100644 index 0000000000..19727a0e4e --- /dev/null +++ b/types/gl-vec2/min.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the minimum of two vec2's. + */ +declare function min(out: number[], a: number[], b: number[]): number[]; + +export = min; diff --git a/types/gl-vec2/mul.d.ts b/types/gl-vec2/mul.d.ts new file mode 100644 index 0000000000..0322ca0e9d --- /dev/null +++ b/types/gl-vec2/mul.d.ts @@ -0,0 +1,6 @@ +/** + * Multiplies two vec2's. Aliased as mul. + */ +declare function mul(out: number[], a: number[], b: number[]): number[]; + +export = mul; diff --git a/types/gl-vec2/negate.d.ts b/types/gl-vec2/negate.d.ts new file mode 100644 index 0000000000..6edb8f50f6 --- /dev/null +++ b/types/gl-vec2/negate.d.ts @@ -0,0 +1,6 @@ +/** + * Negates the components of a vec2. + */ +declare function negate(out: number[], a: number[]): number[]; + +export = negate; diff --git a/types/gl-vec2/normalize.d.ts b/types/gl-vec2/normalize.d.ts new file mode 100644 index 0000000000..139a1c708e --- /dev/null +++ b/types/gl-vec2/normalize.d.ts @@ -0,0 +1,6 @@ +/** + * Normalize a number + */ +declare function normalize(out: number[], a: number[]): number[]; + +export = normalize; diff --git a/types/gl-vec2/random.d.ts b/types/gl-vec2/random.d.ts new file mode 100644 index 0000000000..0fa076543a --- /dev/null +++ b/types/gl-vec2/random.d.ts @@ -0,0 +1,6 @@ +/** + * Generates a random vector with the given scale. + */ +declare function random(out: number[], scale: number): number[]; + +export = random; diff --git a/types/gl-vec2/scale.d.ts b/types/gl-vec2/scale.d.ts new file mode 100644 index 0000000000..1348ff78c0 --- /dev/null +++ b/types/gl-vec2/scale.d.ts @@ -0,0 +1,6 @@ +/** + * Scales a vec2 by a scalar number. + */ +declare function scale(out: number[], a: number[], b: number): number[]; + +export = scale; diff --git a/types/gl-vec2/scaleAndAdd.d.ts b/types/gl-vec2/scaleAndAdd.d.ts new file mode 100644 index 0000000000..2a3e9b8a2d --- /dev/null +++ b/types/gl-vec2/scaleAndAdd.d.ts @@ -0,0 +1,6 @@ +/** + * Adds two vec2's after scaling the second operand by a scalar value. + */ +declare function scaleAndAdd(out: number[], a: number[], b: number[], scale: number): number[]; + +export = scaleAndAdd; diff --git a/types/gl-vec2/set.d.ts b/types/gl-vec2/set.d.ts new file mode 100644 index 0000000000..33ed71f0f3 --- /dev/null +++ b/types/gl-vec2/set.d.ts @@ -0,0 +1,6 @@ +/** + * Set the components of a vec2 to the given values. + */ +declare function set(out: number[], x: number, y: number): number[]; + +export = set; diff --git a/types/gl-vec2/sqrDist.d.ts b/types/gl-vec2/sqrDist.d.ts new file mode 100644 index 0000000000..d510d253e0 --- /dev/null +++ b/types/gl-vec2/sqrDist.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the squared euclidian distance between two vec2's. Aliased as sqrDist. + */ +declare function sqrDist(a: number[], b: number[]): number[]; + +export = sqrDist; diff --git a/types/gl-vec2/sqrLen.d.ts b/types/gl-vec2/sqrLen.d.ts new file mode 100644 index 0000000000..3237540072 --- /dev/null +++ b/types/gl-vec2/sqrLen.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the squared length of a vec2. Aliased as sqrLen. + */ +declare function sqrLen(a: number[]): number[]; + +export = sqrLen; diff --git a/types/gl-vec2/sub.d.ts b/types/gl-vec2/sub.d.ts new file mode 100644 index 0000000000..7b5976404d --- /dev/null +++ b/types/gl-vec2/sub.d.ts @@ -0,0 +1,6 @@ +/** + * Subtracts vector b from vector a. Aliased as sub. + */ +declare function sub(out: number[], a: number[], b: number[]): number[]; + +export = sub; diff --git a/types/gl-vec2/transformMat2.d.ts b/types/gl-vec2/transformMat2.d.ts new file mode 100644 index 0000000000..9ee67f7629 --- /dev/null +++ b/types/gl-vec2/transformMat2.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat2. + */ +declare function transformMat2(out: number[], a: number[], m: number[]): number[]; + +export = transformMat2; diff --git a/types/gl-vec2/transformMat2d.d.ts b/types/gl-vec2/transformMat2d.d.ts new file mode 100644 index 0000000000..978078f1da --- /dev/null +++ b/types/gl-vec2/transformMat2d.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec with a mat2d. + */ +declare function transformMat2d(out: number[], a: number[], m: number[]): number[]; + +export = transformMat2d; diff --git a/types/gl-vec2/transformMat3.d.ts b/types/gl-vec2/transformMat3.d.ts new file mode 100644 index 0000000000..682ded3966 --- /dev/null +++ b/types/gl-vec2/transformMat3.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat3 3rd vector component is implicitly '1' + */ +declare function transformMat3(out: number[], a: number[], m: number[]): number[]; + +export = transformMat3; diff --git a/types/gl-vec2/transformMat4.d.ts b/types/gl-vec2/transformMat4.d.ts new file mode 100644 index 0000000000..f7f96e6d41 --- /dev/null +++ b/types/gl-vec2/transformMat4.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat4 3rd vector component is implicitly '0' 4th vector component is implicitly '1' + */ +declare function transformMat4(out: number[], a: number[], m: number[]): number[]; + +export = transformMat4; diff --git a/types/gl-vec2/tsconfig.json b/types/gl-vec2/tsconfig.json new file mode 100644 index 0000000000..c1f24a1dad --- /dev/null +++ b/types/gl-vec2/tsconfig.json @@ -0,0 +1,58 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "add.d.ts", + "clone.d.ts", + "copy.d.ts", + "create.d.ts", + "cross.d.ts", + "dist.d.ts", + "div.d.ts", + "dot.d.ts", + "equals.d.ts", + "exactEquals.d.ts", + "forEach.d.ts", + "fromValues.d.ts", + "floor.d.ts", + "inverse.d.ts", + "len.d.ts", + "lerp.d.ts", + "limit.d.ts", + "max.d.ts", + "min.d.ts", + "mul.d.ts", + "negate.d.ts", + "normalize.d.ts", + "random.d.ts", + "scale.d.ts", + "scaleAndAdd.d.ts", + "set.d.ts", + "sqrDist.d.ts", + "sqrLen.d.ts", + "sub.d.ts", + "transformMat2.d.ts", + "transformMat2d.d.ts", + "transformMat3.d.ts", + "transformMat4.d.ts", + "gl-vec2-tests.ts" + ] +} diff --git a/types/gl-vec2/tslint.json b/types/gl-vec2/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/gl-vec2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts deleted file mode 100644 index e1a57adb74..0000000000 --- a/types/globby/globby-tests.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { IOptions } from 'glob'; - -import globby = require('globby'); - -(async () => { - let result: string[]; - - /** - * Standard `pattern` usage - */ - result = await globby('*.tmp'); - result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - - result = globby.sync('*.tmp'); - result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - - /** - * `expandDirectories` option - */ - result = await globby('*.tmp', { expandDirectories: false }); - result = globby.sync('*.tmp', { expandDirectories: false }); - result = await globby('*.tmp', { expandDirectories: ['a*', 'b*'] }); - result = globby.sync('*.tmp', { expandDirectories: ['a*', 'b*'] }); - result = await globby('*.tmp', { - expandDirectories: { - files: ['a', 'b'], - extensions: ['tmp'] - } - }); - result = globby.sync('*.tmp', { - expandDirectories: { - files: ['a', 'b'], - extensions: ['tmp'] - } - }); - - /** - * Options passed through from `fast-glob` - */ - result = await globby('*.tmp', { ignore: ['**/b.tmp'] }); - result = globby.sync('*.tmp', { ignore: ['**/b.tmp'] }); -})(); - -const tasks: Array<{ - pattern: string; - options: IOptions; -}> = globby.generateGlobTasks(['*.tmp', '!b.tmp'], { ignore: ['c.tmp'] }); - -console.log(globby.hasMagic('**')); -console.log(globby.hasMagic(['**', 'path1', 'path2'])); -console.log(!globby.hasMagic(['path1', 'path2'])); - -(async () => { - let result: (path: string) => boolean; - - /** - * Standard `gitignore` usage - */ - result = await globby.gitignore(); - result = globby.gitignore.sync(); - - /** With options */ - result = await globby.gitignore({ - cwd: __dirname, - ignore: ['**/b.tmp'] - }); - result = globby.gitignore.sync({ - cwd: __dirname, - ignore: ['**/b.tmp'] - }); -})(); diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts deleted file mode 100644 index af49813432..0000000000 --- a/types/globby/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -// Type definitions for globby 8.0 -// Project: https://github.com/sindresorhus/globby#readme -// Definitions by: Douglas Duteil -// Ika -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { IOptions as NodeGlobOptions } from 'glob'; -import { Options as FastGlobOptions } from 'fast-glob'; - -type ExpandDirectoriesOption = boolean | string[] | { files: string[]; extensions: string[] }; - -interface Options extends FastGlobOptions { - /** - * If set to `true`, `globby` will automatically glob directories for you. - * If you define an `Array` it will only glob files that matches the patterns inside the Array. - * You can also define an `Object` with `files` and `extensions` like below: - * - * ```js - * (async () => { - * const paths = await globby('images', { - * expandDirectories: { - * files: ['cat', 'unicorn', '*.jpg'], - * extensions: ['png'] - * } - * }); - * console.log(paths); - * //=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg'] - * })(); - * ``` - * - * Note that if you set this option to `false`, you won't get back matched directories unless - * you set `onlyFiles: false`. - */ - expandDirectories?: ExpandDirectoriesOption; - /** - * Respect ignore patterns in `.gitignore` files that apply to the globbed files. - */ - gitignore?: boolean; -} - -/** - * Returns a `Promise` of matching paths. - */ -declare function globby(patterns: string | string[], options?: Options): Promise; - -declare namespace globby { - /** - * Returns an `Array` of matching paths. - */ - function sync(patterns: string | string[], options?: Options): string[]; - /** - * Returns an `Array` in the format `{ pattern: string, opts: Object }`, - * which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). - * This is useful for other globbing-related packages. - * - * Note that you should avoid running the same tasks multiple times as they contain a file system cache. - * Instead, run this method each time to ensure file system changes are taken into consideration. - */ - function generateGlobTasks(patterns: string | string[], options?: Options): Array<{ pattern: string; options: Options }>; - /** - * Returns a boolean of whether there are any special glob characters in the `patterns`. - * - * Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not - * be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, - * then that is considered magical, unless `nobrace: true` is set. - * - * This function is backed by [`node-glob`](https://github.com/isaacs/node-glob#globhasmagicpattern-options) - */ - function hasMagic(patterns: string | string[], options?: NodeGlobOptions): boolean; - /** - * Returns a Promise<(path: string) => boolean> indicating whether a given path is ignored - * via a `.gitignore` file. - * - * Takes `cwd?: string` and `ignore?: string[]` as options. `.gitignore` files matched by the - * ignore config are not used for the resulting filter function. - * - * ```js - * const {gitignore} = require('globby'); - * - * (async () => { - * const isIgnored = await gitignore(); - * console.log(isIgnored('some/file')); - * })(); - * ``` - */ - function gitignore(options?: { cwd?: string; ignore?: string[]; }): Promise<(path: string) => boolean>; - - namespace gitignore { - /** - * Returns a `(path: string) => boolean` indicating whether a given path is ignored via a `.gitignore` file. - * - * Takes the same options as `globby.gitignore`. - */ - function sync(options?: { cwd?: string; ignore?: string[]; }): (path: string) => boolean; - } -} - -export = globby; diff --git a/types/globby/tsconfig.json b/types/globby/tsconfig.json deleted file mode 100644 index 5cc0a3fe62..0000000000 --- a/types/globby/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "globby-tests.ts" - ] -} \ No newline at end of file diff --git a/types/google.script.client-side/google.script.client-side-tests.ts b/types/google.script.client-side/google.script.client-side-tests.ts index 5e3c059c01..57867f8456 100644 --- a/types/google.script.client-side/google.script.client-side-tests.ts +++ b/types/google.script.client-side/google.script.client-side-tests.ts @@ -1,7 +1,7 @@ google.script.url.getLocation(location => { - location.hash; // $ExpectedType string - location.parameter; // $ExpectedType { [key: string]: string } - location.parameters; // $ExpectedType { [key: string]: ReadonlyArray } + location.hash; // $ExpectType string + location.parameter; // $ExpectType { [key: string]: string; } + location.parameters; // $ExpectType { [key: string]: ReadonlyArray; } }); google.script.history.push(null); @@ -13,10 +13,10 @@ google.script.history.replace({ timestamp: Date.now() }, { foo: 'bar', fiz: 'baz google.script.history.replace({ timestamp: Date.now() }, { foo: ['bar', 'cat'], fiz: 'baz' }, 'anchor1'); google.script.history.setChangeHandler(e => { - e.state; // $ExpectedType google.script.history.State - e.location.hash; // $ExpectedType string - e.location.parameter; // $ExpectedType { [key: string]: string } - e.location.parameters; // $ExpectedType { [key: string]: ReadonlyArray } + e.state; // $ExpectType State + e.location.hash; // $ExpectType string + e.location.parameter; // $ExpectType { [key: string]: string; } + e.location.parameters; // $ExpectType { [key: string]: ReadonlyArray; } }); google.script.host.origin; // $ExpectType string @@ -25,15 +25,79 @@ google.script.host.editor.focus(); google.script.host.setHeight(450); google.script.host.setWidth(300); -google.script.run.withSuccessHandler(() => {}).executeScript({ message: 'test for google.script.run' }); +google.script.run.withSuccessHandler(() => {}); // $ExpectType Runner +google.script.run.withFailureHandler(() => {}); // $ExpectType Runner +google.script.run.withUserObject({}); // $ExpectType Runner google.script.run .withSuccessHandler(value => {}) - .withFailureHandler(error => {}) - .getEmail(); + .withFailureHandler(error => { + error; // $ExpectType Error + }); google.script.run .withSuccessHandler((value, userObject) => {}) - .withFailureHandler((error, userObject) => {}) - .withUserObject({}) - .getSomeData(Date.now(), { options: 'none' }, 'anchor1', true, null); + .withFailureHandler((error, userObject) => { + error; // $ExpectType Error + }) + .withUserObject({}); + +google.script.run.testFunctionWithoutParameter(); +google.script.run.testFunctionWithNumber(0); +google.script.run.testFunctionWithBoolean(true); +google.script.run.testFunctionWithString(""); +google.script.run.testFunctionWithNull(null); +google.script.run.testFunctionWithArray([ + 0, + true, + "", + null, + undefined, + [], + { + number: 0, + boolean: true, + string: "", + nullValue: null, + undef: undefined, + array: [0, true, "", null, undefined, [], {}], + object: {} + } +]); +google.script.run.testFunctionWithObject({ + number: 0, + boolean: true, + string: "", + nullValue: null, + undef: undefined, + array: [0, true, "", null, undefined, [], {}], + object: {} +}); +google.script.run.testFunctionWithMultipleParameters( + 0, + true, + "", + null, + undefined, + [ + 0, + true, + "", + null, + undefined, + [], + {} + ], + { + number: 0, + boolean: true, + string: "", + nullValue: null, + undef: undefined, + array: [0, true, "", null, undefined, [], {}], + object: {} + } +); +google.script.run.testFunctionWithForm(new HTMLFormElement()); +google.script.run.testFunctionWithDateError(new Date()); // $ExpectError +google.script.run.testFunctionWithFunctionError(() => {}); // $ExpectError diff --git a/types/google.script.client-side/index.d.ts b/types/google.script.client-side/index.d.ts index 7d497fd6c2..23e92255a7 100644 --- a/types/google.script.client-side/index.d.ts +++ b/types/google.script.client-side/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Google Apps Script Client-side API 0.0 +// Type definitions for non-npm package Google Apps Script Client-side API 0.1 // Project: https://developers.google.com/apps-script/guides/html/reference/host // Definitions by: clomie // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -118,12 +118,14 @@ declare namespace google.script { const run: Runner; - interface Runner { + type Parameter = number | boolean | string | { [index: number]: Parameter } | { [key: string]: Parameter } | null | undefined; + + type Runner = { /** * Executes the server-side Apps Script function with the corresponding name. */ - [functionName: string]: (...args: any[]) => void; - + [functionName: string]: (first?: Parameter | HTMLFormElement, ...rest: Parameter[]) => void; + } & { /** * Sets a callback function to run if the server-side function throws an exception. * Without a failure handler, failures are logged to the JavaScript console. @@ -147,5 +149,5 @@ declare namespace google.script { * User objects cannot, however, be objects constructed with the new operator */ withUserObject(object: any): Runner; - } + }; } diff --git a/types/google.script.client-side/tsconfig.json b/types/google.script.client-side/tsconfig.json index 83c99e2f06..e573df04f9 100644 --- a/types/google.script.client-side/tsconfig.json +++ b/types/google.script.client-side/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/googlemaps/googlemaps-tests.ts b/types/googlemaps/googlemaps-tests.ts index ac7217dd17..a62a0e23b1 100644 --- a/types/googlemaps/googlemaps-tests.ts +++ b/types/googlemaps/googlemaps-tests.ts @@ -4,6 +4,7 @@ let mapOptions: google.maps.MapOptions = { backgroundColor: "#fff", center: { lat: -25.363, lng: 131.044 }, clickableIcons: true, + controlSize: 30, draggable: true, fullscreenControl: true, fullscreenControlOptions: { @@ -124,7 +125,7 @@ data.setStyle({ cursor: "pointer", fillColor: "#79B55B", fillOpacity: 1, - icon: { url: "//maps.google.com/mapfiles/ms/icons/blue.png" }, + icon: { url: "//maps.google.com/mapfiles/ms/icons/blue.png" } as google.maps.Icon, shape: { coords: [1, 2, 3], type: "circle" }, strokeColor: "#79B55B", strokeOpacity: 1, @@ -449,3 +450,8 @@ service.findPlaceFromPhoneNumber({ results[0].name; // $ExpectType string }); + +/***** google.maps.places.Autocomplete *****/ +const autocomplete = new google.maps.places.Autocomplete(document.createElement('input')); +const placeResult = autocomplete.getPlace(); +placeResult.name; // $ExpectType string diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index 099bb9ef68..000917313b 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -11,6 +11,7 @@ // Sven Kreiss // Umar Bolatov // Michael Gauthier +// Colin Doig // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -93,6 +94,14 @@ declare namespace google.maps { * interest, also known as a POI. By default map icons are clickable. */ clickableIcons?: boolean + /** + * Size in pixels of the controls appearing on the map. This value must be + * supplied directly when creating the Map, updating this value later may + * bring the controls into an undefined state. Only governs the controls + * made by the Maps API itself. Does not scale developer created custom + * controls. + */ + controlSize?: number; /** Enables/disables all default UI. May be overridden individually. */ disableDefaultUI?: boolean; /** Enables/disables zoom and center on double click. Enabled by default. */ @@ -2726,29 +2735,29 @@ declare namespace google.maps { } export interface PlaceResult { - address_components: GeocoderAddressComponent[]; - adr_address: string; - aspects: PlaceAspectRating[]; - formatted_address: string; - formatted_phone_number: string; - geometry: PlaceGeometry; - html_attributions: string[]; - icon: string; - id: string; - international_phone_number: string; + address_components?: GeocoderAddressComponent[]; + adr_address?: string; + aspects?: PlaceAspectRating[]; + formatted_address?: string; + formatted_phone_number?: string; + geometry?: PlaceGeometry; + html_attributions?: string[]; + icon?: string; + id?: string; + international_phone_number?: string; name: string; - opening_hours: OpeningHours; - permanently_closed: boolean; - photos: PlacePhoto[]; - place_id: string; - price_level: number; - rating: number; - reviews: PlaceReview[]; - types: string[]; - url: string; - utc_offset: number; - vicinity: string; - website: string; + opening_hours?: OpeningHours; + permanently_closed?: boolean; + photos?: PlacePhoto[]; + place_id?: string; + price_level?: number; + rating?: number; + reviews?: PlaceReview[]; + types?: string[]; + url?: string; + utc_offset?: number; + vicinity?: string; + website?: string; } export interface PlaceReview { diff --git a/types/gsap/Animation.d.ts b/types/gsap/Animation.d.ts index 8744e205bf..1c26798810 100644 --- a/types/gsap/Animation.d.ts +++ b/types/gsap/Animation.d.ts @@ -29,8 +29,8 @@ declare namespace gsap { * Gets or sets an event callback like "onComplete", "onUpdate", "onStart", "onReverseComplete" or "onRepeat" (onRepeat only applies to TweenMax or TimelineMax instances) along with any * parameters that should be passed to that callback. */ - eventCallback(type: string): () => void; - eventCallback(type: string, callback: () => void, params?: any[], scope?: any): Animation; + eventCallback(type: string): (...args: any[]) => void; + eventCallback(type: string, callback: (...args: any[]) => void, params?: any[], scope?: any): Animation; /** * Clears any initialization data (like starting/ending values in tweens) which can be useful if, for example, you want to restart a tween without reverting to any previously recorded diff --git a/types/gsap/Ease.d.ts b/types/gsap/Ease.d.ts index 56603b5ed1..a7c594ef41 100644 --- a/types/gsap/Ease.d.ts +++ b/types/gsap/Ease.d.ts @@ -1,6 +1,6 @@ declare namespace gsap { class Ease { - constructor(func?: () => void, extraParams?: any[], type?: number, power?: number); + constructor(func?: (...args: any[]) => void, extraParams?: any[], type?: number, power?: number); /** Translates the tween's progress ratio into the corresponding ease ratio. */ getRatio(p: number): number; diff --git a/types/gsap/Timeline.d.ts b/types/gsap/Timeline.d.ts index 232d2ed9a3..74b9e50396 100644 --- a/types/gsap/Timeline.d.ts +++ b/types/gsap/Timeline.d.ts @@ -31,13 +31,13 @@ declare namespace gsap { addLabel(label: string, position: any): TimelineLite; /** Inserts a special callback that pauses playback of the timeline at a particular time or label. */ - addPause(position?: any, callback?: () => void, params?: any[], scope?: any): TimelineLite; + addPause(position?: any, callback?: (...args: any[]) => void, params?: any[], scope?: any): TimelineLite; /** * Adds a callback to the end of the timeline (or elsewhere using the "position" parameter) - this is a convenience method that accomplishes exactly the same thing as * add( TweenLite.delayedCall(...) ) but with less code. */ - call(callback: () => void, params?: any[], scope?: any, position?: any): TimelineLite; + call(callback: (...args: any[]) => void, params?: any[], scope?: any, position?: any): TimelineLite; /** Empties the timeline of all tweens, timelines, and callbacks (and optionally labels too). */ clear(labels?: boolean): TimelineLite; @@ -106,7 +106,7 @@ declare namespace gsap { vars: {}, stagger?: number, position?: any, - onCompleteAll?: () => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteScope?: any ): TimelineLite; @@ -122,7 +122,7 @@ declare namespace gsap { toVars: {}, stagger?: number, position?: any, - onCompleteAll?: () => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): TimelineLite; @@ -137,7 +137,7 @@ declare namespace gsap { vars: {}, stagger: number, position?: any, - onCompleteAll?: () => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): TimelineLite; @@ -156,14 +156,14 @@ declare namespace gsap { class TimelineMax extends TimelineLite { constructor(vars?: {}); - addCallback(callback: () => void, position: any, params?: any[], scope?: any): TimelineMax; + addCallback(callback: (...args: any[]) => void, position: any, params?: any[], scope?: any): TimelineMax; currentLabel(): string; currentLabel(value: string): TimelineMax; getActive(nested?: boolean, tweens?: boolean, timelines?: boolean): Tween | Timeline[]; getLabelAfter(time: number): string; getLabelBefore(time: number): string; getLabelsArray(): Array<{ name: string; time: number }>; - removeCallback(callback: () => void, timeOrLabel?: any): TimelineMax; + removeCallback(callback: (...args: any[]) => void, timeOrLabel?: any): TimelineMax; removePause(position: any): TimelineMax; repeat(): number; repeat(value: number): TimelineMax; diff --git a/types/gsap/Tween.d.ts b/types/gsap/Tween.d.ts index 11de164f00..3dd15ca685 100644 --- a/types/gsap/Tween.d.ts +++ b/types/gsap/Tween.d.ts @@ -22,7 +22,7 @@ declare namespace gsap { static ticker: any; /** Provides a simple way to call a () => void after a set amount of time (or frames). */ - static delayedCall(delay: number, callback: () => void, params?: any[], scope?: any, useFrames?: boolean): TweenLite; + static delayedCall(delay: number, callback: (...args: any[]) => void, params?: any[], scope?: any, useFrames?: boolean): TweenLite; /** * Static method for creating a TweenLite instance that tweens backwards - you define the BEGINNING values and the current values are used as the destination values which is great for doing @@ -49,7 +49,7 @@ declare namespace gsap { invalidate(): TweenLite; /** Immediately kills all of the delayedCalls to a particular () => void. */ - static killDelayedCallsTo(func: () => void): void; + static killDelayedCallsTo(func: (...args: any[]) => void): void; /** Kills all the tweens (or specific tweening properties) of a particular object or delayedCalls to a particular () => void. */ static killTweensOf(target: any, onlyActive?: boolean, vars?: any): void; @@ -74,7 +74,7 @@ declare namespace gsap { constructor(target: {}, duration: number, vars: {}); /** Provides a simple way to call a () => void after a set amount of time (or frames). */ - static delayedCall(delay: number, callback: () => void, params?: any[], scope?: {}, useFrames?: boolean): TweenMax; + static delayedCall(delay: number, callback: (...args: any[]) => void, params?: any[], scope?: {}, useFrames?: boolean): TweenMax; /** * Static method for creating a TweenMax instance that tweens backwards - you define the BEGINNING values and the current values are used as the destination values which is great for @@ -110,7 +110,7 @@ declare namespace gsap { static killChildTweensOf(parent: any, complete?: boolean): void; /** Immediately kills all of the delayedCalls to a particular () => void. */ - static killDelayedCallsTo(func: () => void): void; + static killDelayedCallsTo(func: (...args: any[]) => void): void; /** Kills all the tweens (or specific tweening properties) of a particular object or the delayedCalls to a particular () => void. */ static killTweensOf(target: {}, vars?: {}): void; @@ -144,7 +144,7 @@ declare namespace gsap { duration: number, vars: {}, stagger: number, - onCompleteAll?: () => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): any[]; @@ -159,7 +159,7 @@ declare namespace gsap { fromVars: {}, toVars: {}, stagger: number, - onCompleteAll?: () => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): any[]; @@ -173,7 +173,7 @@ declare namespace gsap { duration: number, vars: {}, stagger: number, - onCompleteAll?: () => void, + onCompleteAll?: (...args: any[]) => void, onCompleteAllParams?: any[], onCompleteAllScope?: any ): any[]; diff --git a/types/gsap/TweenConfig.d.ts b/types/gsap/TweenConfig.d.ts index 38b00404e6..9912613694 100644 --- a/types/gsap/TweenConfig.d.ts +++ b/types/gsap/TweenConfig.d.ts @@ -23,7 +23,7 @@ declare namespace gsap { overwrite?: string | number; /** A () => void that should be called when the animation has completed. */ - onComplete?: () => void; + onComplete?: (...args: any[]) => void; /** An Array of parameters to pass the onComplete () => void */ onCompleteParams?: any[]; @@ -39,7 +39,7 @@ declare namespace gsap { immediateRender?: boolean; /** A () => void that should be called when the tween has reached its beginning again from the reverse direction. */ - onReverseComplete?: () => void; + onReverseComplete?: (...args: any[]) => void; /** An Array of parameters to pass the onReverseComplete () => void. */ onReverseCompleteParams?: any[]; @@ -48,7 +48,7 @@ declare namespace gsap { onReverseCompleteScope?: {}; /** A () => void that should be called when the tween begins (when its time changes from 0 to some other value which can happen more than once if the tween is restarted multiple times). */ - onStart?: () => void; + onStart?: (...args: any[]) => void; /** An Array of parameters to pass the onStart () => void. */ onStartParams?: any[]; @@ -57,7 +57,7 @@ declare namespace gsap { onStartScope?: {}; /** A () => void that should be called every time the animation updates (on every frame while the animation is active). */ - onUpdate?: () => void; + onUpdate?: (...args: any[]) => void; /** An Array of parameters to pass the onUpdate () => void. */ onUpdateParams?: any[]; @@ -81,7 +81,7 @@ declare namespace gsap { lazy?: boolean; /** A () => void that should be called when the tween gets overwritten by another tween. */ - onOverwrite?: () => void; + onOverwrite?: (...args: any[]) => void; /** If true atuomatically populates the css property for tween on DOM elements */ autoCSS?: boolean; @@ -95,7 +95,7 @@ declare namespace gsap { repeatDelay?: number; - onRepeat?: () => void; + onRepeat?: (...args: any[]) => void; onRepeatScope?: {}; } diff --git a/types/gsap/gsap-tests.ts b/types/gsap/gsap-tests.ts index 36192141be..411ca19d0c 100644 --- a/types/gsap/gsap-tests.ts +++ b/types/gsap/gsap-tests.ts @@ -1,11 +1,22 @@ import { TweenLite, TweenMax } from 'gsap'; +const callbackWithoutParams = () => { + console.log('I Have No Parameters.'); +}; + +const callbackWithParams = (...args: any[]) => { + console.log('I Have Parameters.'); + console.log(args); +}; + + const tweenLiteExample = TweenLite .to(document.getElementById('some-div'), 1, { width: '200px', height: '200px', x: '100px', - y: '200px' + y: '200px', + onComplete: callbackWithoutParams }) .seek(0.5); @@ -14,6 +25,8 @@ const tweenMaxExample = TweenMax width: '200px', height: '200px', x: '100px', - y: '200px' + y: '200px', + onComplete: callbackWithParams, + onCompleteParams: ['foo', 'bar'] }) .seek(0.5); diff --git a/types/gsap/index.d.ts b/types/gsap/index.d.ts index 5e3081cc6a..5f1a20a17d 100644 --- a/types/gsap/index.d.ts +++ b/types/gsap/index.d.ts @@ -5,6 +5,7 @@ // Richard Fox , // Philip Bulley , // Leonardo Melo +// Adem Hodzic // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/gulp-template/index.d.ts b/types/gulp-template/index.d.ts index a2270eb387..f325cfb9c1 100644 --- a/types/gulp-template/index.d.ts +++ b/types/gulp-template/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sindresorhus/gulp-template#readme // Definitions by: Peter Safranek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// diff --git a/types/gulp/package.json b/types/gulp/package.json new file mode 100644 index 0000000000..a0e2ec3c5c --- /dev/null +++ b/types/gulp/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chokidar": "^2.1.2" + } +} diff --git a/types/gulp/test/index.ts b/types/gulp/test/index.ts index f5ca436450..4b096a8704 100644 --- a/types/gulp/test/index.ts +++ b/types/gulp/test/index.ts @@ -1,12 +1,12 @@ import * as gulp from 'gulp'; import * as undertaker from 'undertaker'; import * as registry from 'undertaker-registry'; -import del = require("del"); const minify: () => any = () => { }; const jade: () => any = () => { }; const someplugin: () => any = () => { }; const promisedDel: (list: string[]) => any = (list) => { }; +const del: (pattern: string | string[]) => any = (pattern) => { }; gulp.src('client/templates/*.jade') .pipe(jade()) diff --git a/types/gun/gun-tests.ts b/types/gun/gun-tests.ts new file mode 100644 index 0000000000..d196fba695 --- /dev/null +++ b/types/gun/gun-tests.ts @@ -0,0 +1,72 @@ +import GunServer = require('gun'); +import Gun = require('gun/gun'); +import 'gun/lib/path.js'; +import 'gun/lib/not.js'; +import 'gun/lib/open.js'; +import 'gun/lib/load.js'; +import 'gun/lib/then.js'; +import 'gun/lib/bye.js'; +import 'gun/lib/later.js'; +import 'gun/lib/unset.js'; +import 'gun/lib/time.js'; + +GunServer('http://yourdomain.com/gun'); +Gun(['http://server1.com/gun', 'http://server2.com/gun']); +Gun({ + s3: { + key: '', + secret: '', + bucket: '' + }, + file: 'file/path.json', + uuid() { + return 'xxxxxx'; + } +}); + +interface AppState { + object: { + num: number; + str: string; + bool: boolean; + obj: { + arr2: Array<{ foo: number; bar: string }>; + }; + }; + chatRoom: Array<{ by: string; message: string }>; +} + +const app = new Gun(); +app.get('object') + .get('bool') + .put(true); +app.get('object') + .get('num') + .put(1); +app.get('object') + .get('obj') + .get('arr2') + .set({ foo: 1, bar: '2' }); + +app.get('object') + .get('bool') + // $ExpectError + .put(1); + +app.get('object').on(data => { + data.bool; +}); +app.get('object').off(); +app.get('object').once(data => { + if (data) data.bool; +}); +async function name() { + const data = await app.get('object').promise!(); + data.put.bool; +} +app.get('chatRoom').time!({ by: 'A', message: 'Hello' }); +app.get('chatRoom').time!(msg => { + msg.by; +}, 20); +// $ExpectError +app.get('object').time!({ a: 1 }); diff --git a/types/gun/gun.d.ts b/types/gun/gun.d.ts new file mode 100644 index 0000000000..47b40a68f7 --- /dev/null +++ b/types/gun/gun.d.ts @@ -0,0 +1,2 @@ +declare const cons: typeof import('./index'); +export = cons; diff --git a/types/gun/index.d.ts b/types/gun/index.d.ts new file mode 100644 index 0000000000..51d02b68d5 --- /dev/null +++ b/types/gun/index.d.ts @@ -0,0 +1,295 @@ +// Type definitions for gun 0.9 +// Project: https://github.com/amark/gun#readme +// Definitions by: Jack Works +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +declare const cons: Gun.Constructor; +export = cons; + +declare namespace Gun { + type ArrayOf = T extends Array ? U : never; + /** Gun does not accept Array value, so we need extract to make types correct */ + type AllowArray = ArrayOf extends never ? T : ArrayOf; + type DisallowArray = ArrayOf extends never ? T : never; + type ArrayAsRecord = ArrayOf extends never ? DataType : Record; + /** + * options['module name'] allows you to pass options to a 3rd party module. + * Their project README will likely list the exposed options + * https://github.com/amark/gun/wiki/Modules + */ + type ConstructorOptions = Partial<{ + /** Undocumented but mentioned. Write data to a JSON. */ + file: string; + /** Undocumented but mentioned. Create a websocket server */ + web: any; + /** Undocumented but mentioned. Amazon S3 */ + s3: { + key: any; + secret: any; + bucket: any; + }; + /** the URLs are properties, and the value is an empty object. */ + peers: Record; + /** default: true, creates and persists local (nodejs) data using Radisk. */ + radisk: boolean; + /** default: true, persists local (browser) data to localStorage. */ + localStorage: boolean; + /** uuid allows you to override the default 24 random alphanumeric soul generator with your own function. */ + uuid(): string; + /** + * allows you to pass options to a 3rd party module. Their project README will likely list the exposed options + * @see https://github.com/amark/gun/wiki/Modules + */ + [key: string]: any; + }>; + type Saveable = Partial | string | number | boolean | null | ChainReference; + type AckCallback = (ack: { err: Error; ok: any } | { err: undefined; ok: string }) => void; + interface ChainReference { + /** + * Save data into gun, syncing it with your connected peers. + * + * * You cannot save primitive values at the root level. + * + * @param data You do not need to re-save the entire object every time, + * gun will automatically merge your data into what already exists as a "partial" update. + * + * * `undefined`, `NaN`, `Infinity`, `array`, will be rejected. + * * Traditional arrays are dangerous in real-time apps. Use `gun.set` instead. + * + * @param callback invoked on each acknowledgment + */ + put(data: DisallowArray, callback?: AckCallback): ChainReference; + /** + * Where to read data from. + * @param key The key is the ID or property name of the data that you saved from earlier + * (or that will be saved later). + * * Note that if you use .put at any depth after a get it first reads the data and then writes, merging the data as a partial update. + * @param callback You will usually be using gun.on or gun.once to actually retrieve your data, + * not this callback (it is intended for more low level control, for module and extensions). + * + * **Avoid use callback. The type in the document may be wrong.** + * + * **Here the type of callback respect to the actual behavior** + */ + get( + key: ArrayOf extends never ? K : never, + callback?: ( + /** the raw data. Internal node of gun. Will not typed here. */ + paramA: Record< + 'gun' | '$' | 'root' | 'id' | 'back' | 'on' | 'tag' | 'get' | 'soul' | 'ack' | 'put', + any + >, + /** the key, ID, or property name of the data. */ + paramB: Record<'off' | 'to' | 'next' | 'the' | 'on' | 'as' | 'back' | 'rid' | 'id', any> + ) => void + ): ChainReference; + /** + * Change the configuration of the gun database instance. + * @param options The options argument is the same object you pass to the constructor. + * + * The options's properties replace those in the instance's configuration but options.peers are **added** to peers known to the gun instance. + * @returns No mention in the document, behavior as `ChainReference` + */ + opt(options: ConstructorOptions): ChainReference; + /** + * Move up to the parent context on the chain. + * + * Every time a new chain is created, a reference to the old context is kept to go back to. + * @param amount The number of times you want to go back up the chain. + * `-1` or `Infinity` will take you to the root. + * @returns Impossible to determinate final type. You must cast it by yourself. + */ + back(amount?: number): ChainReference; + + // Main API + /** + * Subscribe to updates and changes on a node or property in realtime. + * @param option Currently, the only option is to filter out old data, and just be given the changes. + * If you're listening to a node with 100 fields, and just one changes, + * you'll instead be passed a node with a single property representing that change rather than the full node every time. + * @param callback + * Once initially and whenever the property or node you're focused on changes, this callback is immediately fired with the data as it is at that point in time. + * + * Since gun streams data, the callback will probably be called multiple times as new chunk comes in. + * To remove a listener call .off() on the same property or node. + */ + on( + callback: (data: ArrayAsRecord, key: ReferenceKey) => void, + option?: { change: boolean } | boolean + ): ChainReference; + /** + * Get the current data without subscribing to updates. Or `undefined` if it cannot be found. + * @returns In the document, it said the return value may change in the future. Don't rely on it. + */ + once( + callback?: (data: (ArrayAsRecord) | undefined, key: ReferenceKey) => void, + option?: { wait: number } + ): ChainReference; + /** + * **.set does not means 'set data', it means a Mathematical Set** + * + * Add a unique item to an unordered list. + * `gun.set` works like a mathematical set, where each item in the list is unique. + * If the item is added twice, it will be merged. + * + * **This means only objects, for now, are supported.** + */ + set( + data: DataType extends Array + ? U extends { [key: string]: any; [key: number]: any } + ? ArrayOf + : never + : never, + callback?: AckCallback + ): ChainReference>; + /** + * Map iterates over each property and item on a node, passing it down the chain, + * behaving like a forEach on your data. + * It also subscribes to every item as well and listens for newly inserted items. + */ + map( + callback?: (value: ArrayOf, key: DataType) => ArrayOf | undefined + ): ChainReference, ReferenceKey>; + /** + * Undocumented, but extremely useful and mentioned in the document + * + * Remove **all** listener on this node. + */ + off(): void; + + // Extended API + /** + * + * Path does the same thing as `.get` but has some conveniences built in. + * @deprecated This is not friendly with type system. + * + * **Warning**: This extension was removed from core, you probably shouldn't be using it! + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/path.js')` or + * ``! + */ + path?(path: string | string[]): ChainReference; + /** + * Handle cases where data can't be found. + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/not.js')` or + * ``! + */ + not?(callback: (key: ReferenceKey) => void): ChainReference; + /** + * Open behaves very similarly to gun.on, except it gives you the **full depth of a document** on every update. + * It also works with graphs, tables, or other data structures. Think of it as opening up a live connection to a document. + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/open.js')` or + * ``! + */ + open?(callback: (data: ArrayAsRecord) => void): ChainReference; + /** + * Loads the full object once. It is the same as `open` but with the behavior of `once`. + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/load.js')` or + * ``! + */ + load?(callback: (data: ArrayAsRecord) => void): ChainReference; + /** + * Returns a promise for you to use. + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/then.js')` or + * ``! + */ + then?>( + onfulfilled?: (value: TResult1) => TResult1 | PromiseLike + ): Promise; + /** + * Returns a promise for you to use. + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/then.js')` or + * ``! + */ + promise?< + TResult1 = { put: ArrayAsRecord; key: ReferenceKey; gun: ChainReference } + >( + onfulfilled?: (value: TResult1) => TResult1 | PromiseLike + ): Promise; + /** + * bye lets you change data after that browser peer disconnects. + * This is useful for games and status messages, + * that if a player leaves you can remove them from the game or set a user's status to "away". + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/bye.js')` or + * ``! + */ + bye?(): { + put(data: DisallowArray>): void; + }; + /** + * Say you save some data, but want to do something with it later, like expire it or refresh it. + * Well, then `later` is for you! You could use this to easily implement a TTL or similar behavior. + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/later.js')` or + * ``! + */ + later?( + callback: ( + this: ChainReference, + data: ArrayAsRecord, + key: ReferenceKey + ) => void, + seconds: number + ): ChainReference; + /** + * After you save some data in an unordered list, you may need to remove it. + * + * **Warning**: Not included by default! You must include it yourself via `require('gun/lib/unset.js')` or + * ``! + */ + unset?(data: ArrayOf): ChainReference; + /** + * Subscribes to all future events that occur on the Timegraph and retrieve a specified number of old events + * + * **Warning**: The Timegraph extension isn't required by default, you would need to include at "gun/lib/time.js" + */ + time?( + callback: (data: ArrayOf, key: ReferenceKey, time: number) => void, + alsoReceiveNOldEvents?: number + ): ChainReference; + /** Pushes data to a Timegraph with it's time set to Gun.state()'s time */ + time?(data: ArrayOf): void; + } + + interface GunSEA { + // There is no the only content in the api document. + user: { + create(alias: string, passphrase: string, callback: (...args: any[]) => void): any; + }; + } + + interface Constructor { + /** + * @description + * no parameters creates a local datastore using the default persistence layer, either localStorage or Radisk. + * @param options + * passing a URL creates the above local datastore that also tries to sync with the URL. + * + * or you can pass in an array of URLs to sync with multiple peers. + */ + (options?: string | string[] | ConstructorOptions): ChainReference & GunSEA; + new (options?: string | string[] | ConstructorOptions): ChainReference & GunSEA; + node: { + /** Returns true if data is a gun node, otherwise false. */ + is(anything: any): anything is ChainReference; + /** + * Returns data's gun ID (instead of manually grabbing its metadata i.e. data["_"]["#"], which is faster but could change in the future) + * + * Returns undefined if data is not correct gun data. + */ + soul(data: ChainReference): string; + /** Returns a "gun-ified" variant of the json input by injecting a new gun ID into the metadata field. */ + ify(json: any): any; + }; + /** @see https://gun.eco/docs/SEA */ + SEA: any; + } +} +declare const Gun: Gun.Constructor; diff --git a/types/gun/tsconfig.json b/types/gun/tsconfig.json new file mode 100644 index 0000000000..0b6beab5e6 --- /dev/null +++ b/types/gun/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", + "gun.d.ts", + "gun-tests.ts" + ] +} diff --git a/types/gun/tslint.json b/types/gun/tslint.json new file mode 100644 index 0000000000..982ecfcd14 --- /dev/null +++ b/types/gun/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json", "rules": { "no-unnecessary-generics": false } } diff --git a/types/gyronorm/gyronorm-tests.ts b/types/gyronorm/gyronorm-tests.ts new file mode 100644 index 0000000000..d944b72bd0 --- /dev/null +++ b/types/gyronorm/gyronorm-tests.ts @@ -0,0 +1,21 @@ +import * as gyronorm from 'gyronorm'; + +const instance = new gyronorm.GyroNorm(); +const options: gyronorm.Options = { + frequency: 100 +}; + +instance.init(options) + .then(() => { + instance.startLogging((data) => { + const { message, code } = data; + }); + + instance.start((data) => { + const motion = data.dm; + const orientation = data.do; + }); + }) + .catch(() => { + // init failure + }); diff --git a/types/gyronorm/index.d.ts b/types/gyronorm/index.d.ts new file mode 100644 index 0000000000..2a1508da1f --- /dev/null +++ b/types/gyronorm/index.d.ts @@ -0,0 +1,88 @@ +// Type definitions for gyronorm 2.0 +// Project: https://github.com/dorukeker/gyronorm.js +// Definitions by: Evan Shortiss +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface MotionAndOrientationPayload { + do: { + alpha: number; + beta: number; + gamma: number; + absolute: number; + }; + + dm: { + x: number; + y: number; + z: number; + + gx: number; + gy: number; + gz: number; + + alpha: number; + beta: number; + gamma: number; + }; +} + +export interface Options { + /** + * How often GyroNorm returns data (in milliseconds) + */ + frequency?: number; + + /** + * If the gravity related values to be normalized + */ + gravityNormalized?: boolean; + + /** + * Can be GyroNorm.GAME or GyroNorm.WORLD. gn.GAME returns + * orientation values with respect to the head direction of the device. + * gn.WORLD returns the orientation values with respect to the actual + * north direction of the world. + */ + orientationBase?: string; + + /** + * How many digits after the decimal point will there be in the return values + */ + decimalCount?: number; + + /** + * Function to be called to log messages from gyronorm.js + */ + logger?: LogListener; + + /** + * If set to true it will return screen adjusted values + */ + screenAdjusted?: boolean; +} + +export interface LoggerData { + code: number; + message: string; +} + +export type LogListener = (data: LoggerData) => void; + +export class GyroNorm { + constructor() + + static GAME: string; + static WORLD: string; + + static DEVICE_ORIENTATION: string; + static ACCELERATION: string; + static ACCELERATION_INCLUDING_GRAVITY: string; + static ROTATION_RATE: string; + + init(options: Options): Promise; + + start(callback: (data: MotionAndOrientationPayload) => void): void; + + startLogging(listener: LogListener): void; + stopLogging(): void; +} diff --git a/types/pkg-conf/tsconfig.json b/types/gyronorm/tsconfig.json similarity index 94% rename from types/pkg-conf/tsconfig.json rename to types/gyronorm/tsconfig.json index 449922d19e..8b8dedb9c0 100644 --- a/types/pkg-conf/tsconfig.json +++ b/types/gyronorm/tsconfig.json @@ -7,17 +7,17 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" ], "types": [], "noEmit": true, + "strictFunctionTypes": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "pkg-conf-tests.ts" + "gyronorm-tests.ts" ] } diff --git a/types/globby/tslint.json b/types/gyronorm/tslint.json similarity index 100% rename from types/globby/tslint.json rename to types/gyronorm/tslint.json diff --git a/types/handlebars/handlebars-tests.ts b/types/handlebars/handlebars-tests.ts deleted file mode 100644 index 340bbde590..0000000000 --- a/types/handlebars/handlebars-tests.ts +++ /dev/null @@ -1,87 +0,0 @@ - -//import Handlebars = require('handlebars'); -import * as Handlebars from 'handlebars'; - -const context = { - author: { firstName: 'Alan', lastName: 'Johnson' }, - body: 'I Love Handlebars', - comments: [{ - author: { firstName: 'Yehuda', lastName: 'Katz' }, - body: 'Me too!' - }] -}; -Handlebars.registerHelper('fullName', (person: typeof context.author) => { - return person.firstName + ' ' + person.lastName; -}); - -Handlebars.registerHelper('agree_button', function() { - return new Handlebars.SafeString( - '' - ); -}); - -const source1 = '

Hello, my name is {{name}}. I am from {{hometown}}. I have ' + - '{{kids.length}} kids:

' + - '
    {{#kids}}
  • {{name}} is {{age}}
  • {{/kids}}
'; -const template1 = Handlebars.compile(source1); -template1({ name: "Alan", hometown: "Somewhere, TX", kids: [{name: "Jimmy", age: 12}, {name: "Sally", age: 4}]}); - -Handlebars.registerHelper('link_to', (context: typeof post) => { - return '' + context.body + ''; -}); -const post = { url: "/hello-world", body: "Hello World!" }; -const context2 = { posts: [post] }; -const source2 = '
    {{#posts}}
  • {{{link_to this}}}
  • {{/posts}}
'; -const template2: HandlebarsTemplateDelegate<{ posts: { url: string, body: string }[] }> = Handlebars.compile(source2); -template2(context2); - -Handlebars.registerHelper('link_to', (title: string, context: typeof post) => { - return '' + title + '!'; -}); -const context3 = { posts: [{url: '/hello-world', body: 'Hello World!'}] }; -const source3 = '
    {{#posts}}
  • {{{link_to "Post" this}}}
  • {{/posts}}
'; -const template3 = Handlebars.compile(source3); -template3(context3); - -const source4 = '
    {{#people}}
  • {{#link}}{{name}}{{/link}}
  • {{/people}}
'; -Handlebars.registerHelper('link', function(context: any) { - return '' + context.fn(this) + ''; -}); -const template4 = Handlebars.compile<{ people: { name: string, id: number }[] }>(source4); -const data2 = { 'people': [ - { 'name': 'Alan', 'id': 1 }, - { 'name': 'Yehuda', 'id': 2 } -]}; -template4(data2); - -const source5 = '
    {{#people}}
  • {{> link}}
  • {{/people}}
'; -Handlebars.registerPartial('link', '{{name}}'); -const template5 = Handlebars.compile(source5); -const data3 = { 'people': [ - { 'name': 'Alan', 'id': 1 }, - { 'name': 'Yehuda', 'id': 2 } -]}; -template5(data3); - -const source6 = '{{#list nav}}{{title}}{{/list}}'; -const template6 = Handlebars.compile(source6); -Handlebars.registerHelper('list', (context, options: Handlebars.HelperOptions) => { - let ret = "
    "; - for(let i=0, j=context.length; i" + options.fn(context[i]) + ""; - } - return ret + "
"; -}); -template6([{url:"", title:""}]) - - -const escapedExpression = Handlebars.Utils.escapeExpression(''); - -Handlebars.helpers !== undefined; - -const parsedTmpl = Handlebars.parse('

Hello, my name is {{name}}.

', { - srcName: "/foo/bar/baz.hbs", - ignoreStandalone: true -}); - -const parsedTmplWithoutOptions = Handlebars.parse('

Hello, my name is {{name}}.

'); diff --git a/types/handlebars/index.d.ts b/types/handlebars/index.d.ts deleted file mode 100644 index d6bebcb457..0000000000 --- a/types/handlebars/index.d.ts +++ /dev/null @@ -1,349 +0,0 @@ -// Type definitions for Handlebars v4.0.11 -// Project: http://handlebarsjs.com/ -// Definitions by: Boris Yankov , Sergei Dorogin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -declare namespace Handlebars { - export interface TemplateDelegate { - (context: T, options?: RuntimeOptions): string; - } - - export type Template = TemplateDelegate|string; - - export interface RuntimeOptions { - partial?: boolean; - depths?: any[]; - helpers?: { [name: string]: Function }; - partials?: { [name: string]: HandlebarsTemplateDelegate }; - decorators?: { [name: string]: Function }; - data?: any; - blockParams?: any[]; - } - - export interface HelperOptions { - fn: TemplateDelegate; - inverse: TemplateDelegate; - hash: any; - data?: any; - } - - export interface HelperDelegate { - (context?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, options?: HelperOptions): any; - } - export interface HelperDeclareSpec { - [key: string]: HelperDelegate; - } - - export interface ParseOptions { - srcName?: string, - ignoreStandalone?: boolean - } - - export function registerHelper(name: string, fn: HelperDelegate): void; - export function registerHelper(name: HelperDeclareSpec): void; - export function unregisterHelper(name: string): void; - - export function registerPartial(name: string, fn: Template): void; - export function registerPartial(spec: { [name: string]: HandlebarsTemplateDelegate }): void; - export function unregisterPartial(name: string): void; - - // TODO: replace Function with actual signature - export function registerDecorator(name: string, fn: Function): void; - export function unregisterDecorator(name: string): void; - - export function K(): void; - export function createFrame(object: any): any; - export function blockParams(obj: any[], ids: any[]): any[]; - export function Exception(message: string): void; - export function log(level: number, obj: any): void; - export function parse(input: string, options?: ParseOptions): hbs.AST.Program; - export function compile(input: any, options?: CompileOptions): HandlebarsTemplateDelegate; - export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification; - export function template(precompilation: TemplateSpecification): HandlebarsTemplateDelegate; - - export function create(): typeof Handlebars; - - export const escapeExpression: typeof Utils.escapeExpression; - //export const Utils: typeof hbs.Utils; - export const logger: Logger; - export const templates: HandlebarsTemplates; - export const helpers: { [name: string]: HelperDelegate }; - export const partials: { [name: string]: any }; - // TODO: replace Function with actual signature - export const decorators: { [name: string]: Function }; - - export function noConflict(): typeof Handlebars; - - export class SafeString { - constructor(str: string); - toString(): string; - toHTML(): string; - } - - export namespace Utils { - export function escapeExpression(str: string): string; - export function createFrame(object: any): any; - export function blockParams(obj: any[], ids: any[]): any[]; - export function isEmpty(obj: any) : boolean; - export function extend(obj: any, ...source: any[]): any; - export function toString(obj: any): string; - export function isArray(obj: any): boolean; - export function isFunction(obj: any): boolean; - } - - export namespace AST { - export const helpers: hbs.AST.helpers; - } - - interface ICompiler { - accept(node: hbs.AST.Node): void; - Program(program: hbs.AST.Program): void; - BlockStatement(block: hbs.AST.BlockStatement): void; - PartialStatement(partial: hbs.AST.PartialStatement): void; - PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void; - DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void; - Decorator(decorator: hbs.AST.Decorator): void; - MustacheStatement(mustache: hbs.AST.MustacheStatement): void; - ContentStatement(content: hbs.AST.ContentStatement): void; - CommentStatement(comment?: hbs.AST.CommentStatement): void; - SubExpression(sexpr: hbs.AST.SubExpression): void; - PathExpression(path: hbs.AST.PathExpression): void; - StringLiteral(str: hbs.AST.StringLiteral): void; - NumberLiteral(num: hbs.AST.NumberLiteral): void; - BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; - UndefinedLiteral(): void; - NullLiteral(): void; - Hash(hash: hbs.AST.Hash): void; - } - - export class Visitor implements ICompiler { - accept(node: hbs.AST.Node): void; - acceptKey(node: hbs.AST.Node, name: string): void; - acceptArray(arr: hbs.AST.Expression[]): void; - Program(program: hbs.AST.Program): void; - BlockStatement(block: hbs.AST.BlockStatement): void; - PartialStatement(partial: hbs.AST.PartialStatement): void; - PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void; - DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void; - Decorator(decorator: hbs.AST.Decorator): void; - MustacheStatement(mustache: hbs.AST.MustacheStatement): void; - ContentStatement(content: hbs.AST.ContentStatement): void; - CommentStatement(comment?: hbs.AST.CommentStatement): void; - SubExpression(sexpr: hbs.AST.SubExpression): void; - PathExpression(path: hbs.AST.PathExpression): void; - StringLiteral(str: hbs.AST.StringLiteral): void; - NumberLiteral(num: hbs.AST.NumberLiteral): void; - BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; - UndefinedLiteral(): void; - NullLiteral(): void; - Hash(hash: hbs.AST.Hash): void; - } -} - -/** -* Implement this interface on your MVW/MVVM/MVC views such as Backbone.View -**/ -interface HandlebarsTemplatable { - template: HandlebarsTemplateDelegate; -} - -// NOTE: for backward compatibility of this typing -type HandlebarsTemplateDelegate = Handlebars.TemplateDelegate; - -interface HandlebarsTemplates { - [index: string]: HandlebarsTemplateDelegate; -} - -interface TemplateSpecification { - -} - -// for backward compatibility of this typing -type RuntimeOptions = Handlebars.RuntimeOptions; - -interface CompileOptions { - data?: boolean; - compat?: boolean; - knownHelpers?: { - helperMissing?: boolean; - blockHelperMissing?: boolean; - each?: boolean; - if?: boolean; - unless?: boolean; - with?: boolean; - log?: boolean; - lookup?: boolean; - }; - knownHelpersOnly?: boolean; - noEscape?: boolean; - strict?: boolean; - assumeObjects?: boolean; - preventIndent?: boolean; - ignoreStandalone?: boolean; - explicitPartialContext?: boolean; -} - -interface PrecompileOptions extends CompileOptions { - srcName?: string; - destName?: string; -} - -declare namespace hbs { - // for backward compatibility of this typing - type SafeString = Handlebars.SafeString; - - type Utils = typeof Handlebars.Utils; -} - -interface Logger { - DEBUG: number; - INFO: number; - WARN: number; - ERROR: number; - level: number; - - methodMap: { [level: number]: string }; - - log(level: number, obj: string): void; -} - -declare namespace hbs { - namespace AST { - interface Node { - type: string; - loc: SourceLocation; - } - - interface SourceLocation { - source: string; - start: Position; - end: Position; - } - - interface Position { - line: number; - column: number; - } - - interface Program extends Node { - body: Statement[]; - blockParams: string[]; - } - - interface Statement extends Node {} - - interface MustacheStatement extends Statement { - path: PathExpression | Literal; - params: Expression[]; - hash: Hash; - escaped: boolean; - strip: StripFlags; - } - - interface Decorator extends MustacheStatement { } - - interface BlockStatement extends Statement { - path: PathExpression; - params: Expression[]; - hash: Hash; - program: Program; - inverse: Program; - openStrip: StripFlags; - inverseStrip: StripFlags; - closeStrip: StripFlags; - } - - interface DecoratorBlock extends BlockStatement { } - - interface PartialStatement extends Statement { - name: PathExpression | SubExpression; - params: Expression[]; - hash: Hash; - indent: string; - strip: StripFlags; - } - - interface PartialBlockStatement extends Statement { - name: PathExpression | SubExpression; - params: Expression[]; - hash: Hash; - program: Program; - openStrip: StripFlags; - closeStrip: StripFlags; - } - - interface ContentStatement extends Statement { - value: string; - original: StripFlags; - } - - interface CommentStatement extends Statement { - value: string; - strip: StripFlags; - } - - interface Expression extends Node {} - - interface SubExpression extends Expression { - path: PathExpression; - params: Expression[]; - hash: Hash; - } - - interface PathExpression extends Expression { - data: boolean; - depth: number; - parts: string[]; - original: string; - } - - interface Literal extends Expression {} - interface StringLiteral extends Literal { - value: string; - original: string; - } - - interface BooleanLiteral extends Literal { - value: boolean; - original: boolean; - } - - interface NumberLiteral extends Literal { - value: number; - original: number; - } - - interface UndefinedLiteral extends Literal {} - - interface NullLiteral extends Literal {} - - interface Hash extends Node { - pairs: HashPair[]; - } - - interface HashPair extends Node { - key: string; - value: Expression; - } - - interface StripFlags { - open: boolean; - close: boolean; - } - - interface helpers { - helperExpression(node: Node): boolean; - scopeId(path: PathExpression): boolean; - simpleId(path: PathExpression): boolean; - } - } -} - -declare module "handlebars" { - export = Handlebars; -} - -declare module "handlebars/runtime" { - export = Handlebars; -} diff --git a/types/handlebars/tsconfig.json b/types/handlebars/tsconfig.json deleted file mode 100644 index 0008e2154e..0000000000 --- a/types/handlebars/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "files": [ - "index.d.ts", - "handlebars-tests.ts" - ], - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - } -} diff --git a/types/handlebars/tslint.json b/types/handlebars/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/handlebars/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "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 - } -} diff --git a/types/handlebars/v1/index.d.ts b/types/handlebars/v1/index.d.ts deleted file mode 100644 index a66c8f7ee6..0000000000 --- a/types/handlebars/v1/index.d.ts +++ /dev/null @@ -1,184 +0,0 @@ -// Type definitions for Handlebars 1.0 -// Project: http://handlebarsjs.com/ -// Definitions by: Boris Yankov -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -// Use either HandlebarsStatic or HandlebarsRuntimeStatic -declare var Handlebars: HandlebarsStatic; -//declare var Handlebars: HandlebarsRuntimeStatic; - -/** -* Implement this interface on your MVW/MVVM/MVC views such as Backbone.View -**/ -interface HandlebarsTemplatable { - template: HandlebarsTemplateDelegate; -} - -interface HandlebarsTemplateDelegate { - (context: any, options?: any): string; -} - -interface HandlebarsCommon { - registerHelper(name: string, fn: Function, inverse?: boolean): void; - registerPartial(name: string, str: any): void; - K(): void; - createFrame(object: any): any; - - Exception(message: string): void; - SafeString: typeof hbs.SafeString; - Utils: typeof hbs.Utils; - - logger: Logger; - log(level: number, obj: any): void; -} - -interface HandlebarsStatic extends HandlebarsCommon { - parse(input: string): hbs.AST.ProgramNode; - compile(input: any, options?: any): HandlebarsTemplateDelegate; -} - -interface HandlebarsTemplates { - [index: string]: HandlebarsTemplateDelegate; -} - -interface HandlebarsRuntimeStatic extends HandlebarsCommon { - // Handlebars.templates is the default template namespace in precompiler. - templates: HandlebarsTemplates; -} - -declare namespace hbs { - class SafeString { - constructor(str: string); - static toString(): string; - } - - namespace Utils { - function escapeExpression(str: string): string; - } -} - -interface Logger { - DEBUG: number; - INFO: number; - WARN: number; - ERROR: number; - level: number; - - methodMap: { [level: number]: string }; - - log(level: number, obj: string): void; -} - -declare namespace hbs { - namespace AST { - interface IStripInfo { - left?: boolean; - right?: boolean; - inlineStandalone?: boolean; - } - - class NodeBase { - firstColumn: number; - firstLine: number; - lastColumn: number; - lastLine: number; - type: string; - } - - class ProgramNode extends NodeBase { - statements: NodeBase[]; - } - - class IdNode extends NodeBase { - original: string; - parts: string[]; - string: string; - depth: number; - idName: string; - isSimple: boolean; - stringModeValue: string; - } - - class HashNode extends NodeBase { - pairs: {0: string; - 1: NodeBase}[]; - } - - class SexprNode extends NodeBase { - hash: HashNode; - id: NodeBase; - params: NodeBase[]; - isHelper: boolean; - eligibleHelper: boolean; - } - - class MustacheNode extends NodeBase { - strip: IStripInfo; - escaped: boolean; - sexpr: SexprNode; - - } - - class BlockNode extends NodeBase { - mustache: MustacheNode; - program: ProgramNode; - inverse: ProgramNode; - strip: IStripInfo; - isInverse: boolean; - } - - class PartialNameNode extends NodeBase { - name: string; - } - - class PartialNode extends NodeBase { - partialName: PartialNameNode; - context: NodeBase; - hash: HashNode; - strip: IStripInfo; - } - - class RawBlockNode extends NodeBase { - mustache: MustacheNode; - program: ProgramNode; - } - - class ContentNode extends NodeBase { - original: string; - string: string; - } - - class DataNode extends NodeBase { - id: IdNode; - stringModeValue: string; - idName: string; - } - - class StringNode extends NodeBase { - original: string; - string: string; - stringModeValue: string; - } - - class NumberNode extends NodeBase { - original: string; - number: string; - stringModeValue: number; - } - - class BooleanNode extends NodeBase { - bool: string; - stringModeValue: boolean; - } - - class CommentNode extends NodeBase { - comment: string; - strip: IStripInfo; - } - } -} - -declare module "handlebars" { - export = Handlebars; -} diff --git a/types/handlebars/v1/tsconfig.json b/types/handlebars/v1/tsconfig.json deleted file mode 100644 index 96818b903b..0000000000 --- a/types/handlebars/v1/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "types": [], - "paths": { - "handlebars": [ - "handlebars/v1" - ] - }, - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts" - ] -} \ No newline at end of file diff --git a/types/handlebars/v1/tslint.json b/types/handlebars/v1/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/handlebars/v1/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "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 - } -} diff --git a/types/hbs/package.json b/types/hbs/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/hbs/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/helmet/helmet-tests.ts b/types/helmet/helmet-tests.ts index 8b4c5634ac..39414a7d5f 100644 --- a/types/helmet/helmet-tests.ts +++ b/types/helmet/helmet-tests.ts @@ -119,6 +119,13 @@ function hpkpTest() { sha256s: ['AbCdEf123=', 'ZyXwVu456='], })); + app.use(helmet.hpkp({ + maxAge: 7776000000, + sha256s: ['AbCdEf123=', 'ZyXwVu456='], + includeSubDomains: false + })); + + // Deprecated: Use includeSubDomains instead. (Uppercase "D") app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], @@ -128,7 +135,7 @@ function hpkpTest() { app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hpkp({ @@ -162,6 +169,12 @@ function hstsTest() { maxAge: 7776000000, })); + app.use(helmet.hsts({ + maxAge: 7776000000, + includeSubDomains: true + })); + + // Deprecated: Use includeSubDomains instead. (Uppercase "D") app.use(helmet.hsts({ maxAge: 7776000000, includeSubdomains: true diff --git a/types/helmet/index.d.ts b/types/helmet/index.d.ts index b0a50c901e..1a8c713da1 100644 --- a/types/helmet/index.d.ts +++ b/types/helmet/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for helmet // Project: https://github.com/helmetjs/helmet -// Definitions by: Cyril Schumacher , Evan Hahn , Elliot Blackburn +// Definitions by: Cyril Schumacher , Evan Hahn , Elliot Blackburn , Daniel Müller // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -134,7 +134,11 @@ declare namespace helmet { export interface IHelmetHpkpConfiguration { maxAge: number; sha256s: string[]; + /** + * @deprecated Use includeSubDomains instead. (Uppercase "D") + */ includeSubdomains?: boolean; + includeSubDomains?: boolean; reportUri?: string; reportOnly?: boolean; setIf?: IHelmetSetIfFunction; @@ -142,7 +146,11 @@ declare namespace helmet { export interface IHelmetHstsConfiguration { maxAge?: number; + /** + * @deprecated Use includeSubDomains instead. (Uppercase "D") + */ includeSubdomains?: boolean; + includeSubDomains?: boolean; preload?: boolean; setIf?: IHelmetSetIfFunction; force?: boolean; diff --git a/types/hexo-fs/package.json b/types/hexo-fs/package.json new file mode 100644 index 0000000000..a0e2ec3c5c --- /dev/null +++ b/types/hexo-fs/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chokidar": "^2.1.2" + } +} diff --git a/types/hoist-non-react-statics/hoist-non-react-statics-tests.tsx b/types/hoist-non-react-statics/hoist-non-react-statics-tests.tsx index 0e1beed2e9..954e4cc191 100644 --- a/types/hoist-non-react-statics/hoist-non-react-statics-tests.tsx +++ b/types/hoist-non-react-statics/hoist-non-react-statics-tests.tsx @@ -3,44 +3,220 @@ import * as PropTypes from 'prop-types'; import hoistNonReactStatics = require('hoist-non-react-statics'); -class A extends React.Component<{ x: number; y?: number | null }> { - static a = 'a'; +function TestClassComponents() { + class A extends React.Component<{ x: number; y?: number | null }> { + static a = 'a'; - static propTypes = { - x: PropTypes.number.isRequired, - y: PropTypes.number, - }; + static propTypes = { + x: PropTypes.number.isRequired, + y: PropTypes.number, + }; - getA() { - return A.a; + getA() { + return A.a; + } } + + class B extends React.Component { + static b = 'b'; + + static propTypes = { + n: PropTypes.number.isRequired, + }; + + static defaultProps = { + n: 42, + }; + + getB() { + return B.b; + } + } + + const C = hoistNonReactStatics(A, B); + + C.a !== C.b; + + C.propTypes.x; + C.prototype.getA(); + + C.propTypes.n; // $ExpectError + C.defaultProps; // $ExpectError + C.prototype.getB(); // $ExpectError + + ; + + const CWithType: hoistNonReactStatics.NonReactStatics = C; + + CWithType.propTypes; // $ExpectError + CWithType.defaultProps; // $ExpectError + CWithType.prototype.getB(); // $ExpectError + + const D = hoistNonReactStatics(A, B, { a: true, b: true }); + + D.a; + D.b; // $ExpectError + + const DWithType: hoistNonReactStatics.NonReactStatics = D; + const DWithTypeError: hoistNonReactStatics.NonReactStatics = D; // $ExpectError + + DWithType.b; // $ExpectError } -class B extends React.Component { - static b = 'b'; +// NOTE: We use Object.assign() to assign statics to functional components as a +// convenience to avoid having to model the component's type with static fields. - static propTypes = { - n: PropTypes.number.isRequired, - }; +function TestFunctionalComponents() { + const A = ({x, y}: {x: number; y?: number}) =>
{x + (y || 0)}
; - getB() { - return B.b; - } + // tslint:disable-next-line:prefer-object-spread + const AWithStatics = Object.assign(A, { + a: 'a', + propTypes: { + x: PropTypes.number.isRequired, + y: PropTypes.number, + }, + }); + + const B = ({n}: {n: number}) =>
{n}
; + + // tslint:disable-next-line:prefer-object-spread + const BWithStatics = Object.assign(B, { + b: 'b', + propTypes: { + n: PropTypes.number.isRequired, + }, + defaultProps: { + n: 42, + }, + }); + + const C = hoistNonReactStatics(AWithStatics, BWithStatics); + + C.a !== C.b; + + C.propTypes.x; + C.propTypes.n; // $ExpectError + C.defaultProps; // $ExpectError + + ; + + const CWithType: hoistNonReactStatics.NonReactStatics = C; + + CWithType.propTypes; // $ExpectError + CWithType.defaultProps; // $ExpectError + + const D = hoistNonReactStatics(AWithStatics, BWithStatics, { a: true, b: true }); + + D.a; + D.b; // $ExpectError + + const DWithType: hoistNonReactStatics.NonReactStatics = D; + const DWithTypeError: hoistNonReactStatics.NonReactStatics = D; // $ExpectError + + DWithType.b; // $ExpectError } -const C = hoistNonReactStatics(A, B); +function TestMemoComponents() { + const A = ({x, y}: {x: number; y?: number}) =>
{x + (y || 0)}
; -C.a !== C.b; + // tslint:disable-next-line:prefer-object-spread + const AWithStatics = Object.assign(A, { + a: 'a', + propTypes: { + x: PropTypes.number.isRequired, + y: PropTypes.number, + }, + }); -C.propTypes.x; -C.prototype.getA(); + const B = React.memo(({n}: {n: number}) =>
{n}
); -C.propTypes.n; // $ExpectError -C.prototype.getB(); // $ExpectError + // tslint:disable-next-line:prefer-object-spread + const BWithStatics = Object.assign(B, { + b: 'b', + propTypes: { + n: PropTypes.number.isRequired, + }, + defaultProps: { + n: 42, + }, + }); -; + const C = hoistNonReactStatics(AWithStatics, BWithStatics); -const D = hoistNonReactStatics(A, B, { a: true, b: true }); + C.a !== C.b; -D.a; -D.b; // $ExpectError + C.propTypes.x; + C.propTypes.n; // $ExpectError + C.defaultProps; // $ExpectError + + ; + + const CWithType: hoistNonReactStatics.NonReactStatics = C; + + CWithType.propTypes; // $ExpectError + CWithType.defaultProps; // $ExpectError + + const D = hoistNonReactStatics(AWithStatics, BWithStatics, { a: true, b: true }); + + D.a; + D.b; // $ExpectError + + const DWithType: hoistNonReactStatics.NonReactStatics = D; + const DWithTypeError: hoistNonReactStatics.NonReactStatics = D; // $ExpectError + + DWithType.b; // $ExpectError +} + +function TestForwardRefComponents() { + const A = ({x, y}: {x: number; y?: number}) =>
{x + (y || 0)}
; + + // tslint:disable-next-line:prefer-object-spread + const AWithStatics = Object.assign(A, { + a: 'a', + propTypes: { + x: PropTypes.number.isRequired, + y: PropTypes.number, + }, + }); + + const B = React.forwardRef( + ({n}: {n: number}, ref: React.Ref) =>
{n}
+ ); + + // tslint:disable-next-line:prefer-object-spread + const BWithStatics = Object.assign(B, { + b: 'b', + propTypes: { + n: PropTypes.number.isRequired, + }, + defaultProps: { + n: 42, + }, + }); + + const C = hoistNonReactStatics(AWithStatics, BWithStatics); + + C.a !== C.b; + + C.propTypes.x; + C.propTypes.n; // $ExpectError + C.defaultProps; // $ExpectError + + ; + + const CWithType: hoistNonReactStatics.NonReactStatics = C; + + CWithType.propTypes; // $ExpectError + CWithType.defaultProps; // $ExpectError + + const D = hoistNonReactStatics(AWithStatics, BWithStatics, { a: true, b: true }); + + D.a; + D.b; // $ExpectError + + const DWithType: hoistNonReactStatics.NonReactStatics = D; + const DWithTypeError: hoistNonReactStatics.NonReactStatics = D; // $ExpectError + + DWithType.b; // $ExpectError +} diff --git a/types/hoist-non-react-statics/index.d.ts b/types/hoist-non-react-statics/index.d.ts index 414c4c41f0..fc90d9713d 100644 --- a/types/hoist-non-react-statics/index.d.ts +++ b/types/hoist-non-react-statics/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for hoist-non-react-statics 3.0 +// Type definitions for hoist-non-react-statics 3.3 // Project: https://github.com/mridgway/hoist-non-react-statics#readme -// Definitions by: JounQin +// Definitions by: JounQin , James Reggio // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -8,10 +8,12 @@ import * as React from 'react'; interface REACT_STATICS { childContextTypes: true; + contextType: true; contextTypes: true; defaultProps: true; displayName: true; getDefaultProps: true; + getDerivedStateFromError: true; getDerivedStateFromProps: true; mixins: true; propTypes: true; @@ -28,6 +30,41 @@ interface KNOWN_STATICS { arity: true; } +interface MEMO_STATICS { + '$$typeof': true; + compare: true; + defaultProps: true; + displayName: true; + propTypes: true; + type: true; +} + +interface FORWARD_REF_STATICS { + '$$typeof': true; + render: true; + defaultProps: true; + displayName: true; + propTypes: true; +} + +declare namespace hoistNonReactStatics { + type NonReactStatics< + S extends React.ComponentType, + C extends { + [key: string]: true + } = {} + > = { + [key in Exclude< + keyof S, + S extends React.MemoExoticComponent + ? keyof MEMO_STATICS | keyof C + : S extends React.ForwardRefExoticComponent + ? keyof FORWARD_REF_STATICS | keyof C + : keyof REACT_STATICS | keyof KNOWN_STATICS | keyof C + >]: S[key] + }; +} + declare function hoistNonReactStatics< T extends React.ComponentType, S extends React.ComponentType, @@ -38,13 +75,6 @@ declare function hoistNonReactStatics< TargetComponent: T, SourceComponent: S, customStatic?: C, -): T & - { - [key in Exclude< - keyof S, - // only extends static properties, exclude instance properties and known react statics - keyof REACT_STATICS | keyof KNOWN_STATICS | keyof C - >]: S[key] - }; +): T & hoistNonReactStatics.NonReactStatics; export = hoistNonReactStatics; diff --git a/types/howler/index.d.ts b/types/howler/index.d.ts index 5ee9c40627..6ab3d6e8f0 100644 --- a/types/howler/index.d.ts +++ b/types/howler/index.d.ts @@ -1,20 +1,25 @@ -// Type definitions for howler.js v2.0.5 +// Type definitions for howler.js v2.1.1 // Project: https://github.com/goldfire/howler.js -// Definitions by: Pedro Casaubon , Alexander Leon , Nicholas Higgins +// Definitions by: Pedro Casaubon +// Alexander Leon +// Nicholas Higgins +// Carlos Urango // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface HowlerGlobal { - mute(muted: boolean): void; + mute(muted: boolean): this; volume(): number; volume(volume: number): this; codecs(ext: string): boolean; - unload(): void; + unload(): this; usingWebAudio: boolean; + html5PoolSize: number; noAudio: boolean; - mobileAutoEnable: boolean; + autoUnlock: boolean; autoSuspend: boolean; ctx: AudioContext; masterGain: GainNode; + stereo(pan: number): this; pos(x: number, y: number, z: number): this | void; orientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): this | void; @@ -51,6 +56,7 @@ interface IHowlProperties { onrate?: (soundId: number) => void; onseek?: (soundId: number) => void; onfade?: (soundId: number) => void; + onunlock?: (soundId: number) => void; } interface Howl { @@ -75,7 +81,9 @@ interface Howl { loop(loop?: boolean, id?: number): this; playing(id?: number): boolean; duration(id?: number): number; - + state(): 'unloaded' | 'loading' | 'loaded'; + load(): this; + unload(): void; on(event: 'load', callback: () => void, id?: number): this; on(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this; @@ -90,6 +98,7 @@ interface Howl { on(event: 'seek', callback: (soundId: number) => void, id?: number): this; on(event: 'fade', callback: (soundId: number) => void, id?: number): this; on(event: string, callback: Function, id?: number): this; + on(event: 'unlock', callback: (soundId: number) => void, id?: number): this; once(event: 'load', callback: () => void, id?: number): this; once(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this; @@ -104,12 +113,10 @@ interface Howl { once(event: 'seek', callback: (soundId: number) => void, id?: number): this; once(event: 'fade', callback: (soundId: number) => void, id?: number): this; once(event: string, callback: Function, id?: number): this; + once(event: 'unlock', callback: (soundId: number) => void, id?: number): this; off(event: string, callback?: Function, id?: number): this; - state(): 'unloaded' | 'loading' | 'loaded'; - load(): void; - unload(): void; stereo(pan: number, id?: number): this | void; pos(x: number, y: number, z: number, id?: number): this | void; orientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): this | void; diff --git a/types/html-truncate/html-truncate-tests.ts b/types/html-truncate/html-truncate-tests.ts new file mode 100644 index 0000000000..30f6a19e7c --- /dev/null +++ b/types/html-truncate/html-truncate-tests.ts @@ -0,0 +1,13 @@ +import Truncate = require("html-truncate"); + +Truncate('hello world', 4); + +Truncate('

hello world

', 4, { + keepImageTag: true, + ellipsis: true +}); + +Truncate('

hello world

', 6, { + keepImageTag: false, + ellipsis: '---' +}); diff --git a/types/html-truncate/index.d.ts b/types/html-truncate/index.d.ts new file mode 100644 index 0000000000..4784caa925 --- /dev/null +++ b/types/html-truncate/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for html-truncate 1.2 +// Project: https://github.com/huang47/nodejs-html-truncate +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +interface TruncateOptions { + /** + * Flag to specify if keep image tag, false by default. + */ + keepImageTag: boolean; + /** + * Omission symbol for truncated string, '...' by default. + */ + ellipsis: boolean|string; +} + +/** + * Truncate HTML text and also keep tag safe. + */ +declare function truncate(input: string, maxLength: number, options?: TruncateOptions): string; + +export = truncate; diff --git a/types/html-truncate/tsconfig.json b/types/html-truncate/tsconfig.json new file mode 100644 index 0000000000..693d5d17ba --- /dev/null +++ b/types/html-truncate/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "html-truncate-tests.ts" + ] +} diff --git a/types/html-truncate/tslint.json b/types/html-truncate/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/html-truncate/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/html5-history/html5-history-tests.ts b/types/html5-history/html5-history-tests.ts new file mode 100644 index 0000000000..b492e46366 --- /dev/null +++ b/types/html5-history/html5-history-tests.ts @@ -0,0 +1,10 @@ +import * as History from 'html5-history'; + +History.init(); +History.getState(); +History.getCurrentIndex(); +History.getStateByIndex(1); +History.getHash(0); +History.unescapeHash(0); +History.normalizeHash(0); +History.setHash(1, 2); diff --git a/types/html5-history/index.d.ts b/types/html5-history/index.d.ts new file mode 100644 index 0000000000..614928f79e --- /dev/null +++ b/types/html5-history/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for html5-history 0.1 +// Project: https://github.com/Raynos/html5-history +// Definitions by: Akash Vishwakarma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export function init(options?: any): boolean; +export function getState(friendly?: any, create?: any): any; +export function getCurrentIndex(): number; +export function getStateByIndex(index: number): any; +export function getHash(doc: any): any; +export function unescapeHash(hash: any): any; +export function normalizeHash(hash: any): any; +export function setHash(hash: any, queue: any): boolean; diff --git a/types/html5-history/tsconfig.json b/types/html5-history/tsconfig.json new file mode 100644 index 0000000000..b4bc53cbb5 --- /dev/null +++ b/types/html5-history/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", + "html5-history-tests.ts" + ] +} diff --git a/types/html5-history/tslint.json b/types/html5-history/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/html5-history/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/html5plus/html5plus-tests.ts b/types/html5plus/html5plus-tests.ts new file mode 100644 index 0000000000..371e463473 --- /dev/null +++ b/types/html5plus/html5plus-tests.ts @@ -0,0 +1,2 @@ +const webview = plus.webview.currentWebview(); +const style = webview.getStyle(); diff --git a/types/html5plus/index.d.ts b/types/html5plus/index.d.ts new file mode 100644 index 0000000000..2993f829b6 --- /dev/null +++ b/types/html5plus/index.d.ts @@ -0,0 +1,15472 @@ +// Type definitions for non-npm package html5plus 1.0 +// Project: https://www.html5plus.org/doc/ +// Definitions by: Dcloud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * HTML5+接口,统一浏览器自定义扩展,提供增强的功能、性能扩展规范,使得开发者可开发出跨平台的app,并接近原生的功能和性能。 + * + * 参考: [http://www.html5plus.org/doc/h5p.html](http://www.html5plus.org/doc/h5p.html) + */ +declare const plus: Plus; + +/** + * HTML5+接口,统一浏览器自定义扩展,提供增强的功能、性能扩展规范,使得开发者可开发出跨平台的app,并接近原生的功能和性能。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ +interface Plus { + /** + * Accelerometer模块管理设备加速度传感器,用于获取设备加速度信息,包括x(屏幕水平方向)、y(垂直屏幕水平方向)、z(垂直屏幕平面方向)三个方向的加速度信息。通过plus.accelerometer获取设备加速度传感器管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + accelerometer: PlusAccelerometer; + /** + * Native.js for Android封装一条通过JS语法直接调用Native Java接口通道,通过plus.android可调用几乎所有的系统API。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + android: PlusAndroid; + /** + * Audio模块用于提供音频的录制和播放功能,可调用系统的麦克风设备进行录音操作,也可调用系统的扬声器设备播放音频文件。通过plus.audio获取音频管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + audio: PlusAudio; + /** + * Bluetooth模块用于管理蓝牙设备,搜索附近蓝牙设备、连接实现数据通信等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + bluetooth: PlusBluetooth; + /** + * Camera模块管理设备的摄像头,可用于拍照、摄像操作,通过plus.camera获取摄像头管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + camera: PlusCamera; + /** + * Contacts模块管理系统通讯录,用于可对系统通讯录进行增、删、改、查等操作。通过plus.contacts获取系统通讯录管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + contacts: PlusContacts; + /** + * Device模块管理设备信息,用于获取手机设备的相关信息,如IMEI、IMSI、型号、厂商等。通过plus.device获取设备信息管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + device: PlusDevice; + /** + * Screen模块管理设备屏幕信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + screen: PlusScreen; + /** + * Display模块管理应用可使用的显示区域信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + display: PlusDisplay; + /** + * networkinfo模块用于获取网络信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + networkinfo: PlusNetworkinfo; + /** + * OS模块管理操作系统信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + os: PlusOs; + /** + * Downloader模块管理网络文件下载任务,用于从服务器下载各种文件,并支持跨域访问操作。通过plus.downloader获取下载管理对象。Downloader下载使用HTTP的GET/POST方式请求下载文件,符合标准HTTP/HTTPS传输协议。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + downloader: PlusDownloader; + /** + * Fingerprint模块管理指纹识别。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + fingerprint: PlusFingerprint; + /** + * Gallery模块管理系统相册,支持从相册中选择图片或视频文件、保存图片或视频文件到相册等功能。通过plus.gallery获取相册管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + gallery: PlusGallery; + /** + * Geolocation模块管理设备位置信息,用于获取地理位置信息,如经度、纬度等。通过plus.geolocation可获取设备位置管理对象。虽然W3C已经提供标准API获取位置信息,但在某些平台存在差异或未实现,为了保持各平台的统一性,定义此规范接口获取位置信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + geolocation: PlusGeolocation; + /** + * iBeacon模块用于搜索附件的iBeacon设备(*请使用HBuilderX并更新到最新版本*)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + ibeacon: PlusIbeacon; + /** + * IO模块管理本地文件系统,用于对文件系统的目录浏览、文件的读取、文件的写入等操作。通过plus.io可获取文件系统管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + io: PlusIo; + /** + * Native.js for iOS封装一条通过JS语法直接调用Native Objective-C接口通道,通过plus.ios可调用几乎所有的系统API。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + ios: PlusIos; + /** + * Key管理设备按键事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + key: PlusKey; + /** + * Messaging模块管理设备通讯功能,可用于短信、彩信、邮件发送等。通过plus.messaging可获取设备通讯管理对象。另外也可以直接通过html中的href直接快速发送短信、拨打电话、发送邮件等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + messaging: PlusMessaging; + /** + * nativeObj管理系统原生对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + nativeObj: PlusNativeObj; + /** + * nativeUI管理系统原生界面,可用于弹出系统原生提示对话框窗口、时间日期选择对话框、等待对话框等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + nativeUI: PlusNativeUI; + /** + * navigator用于管理浏览器运行环境信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + navigator: PlusNavigator; + /** + * Orientation模块管理设备的方向信息,包括alpha、beta、gamma三个方向信息,通过plus.orientation可获取设备方向管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + orientation: PlusOrientation; + /** + * Proximity模块管理设备距离传感器,可获取当前设备的接近距离信息,通过plus.proximity可获取设备距离传感管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/proximity.html](http://www.html5plus.org/doc/zh_cn/proximity.html) + */ + proximity: PlusProximity; + /** + * Runtime模块管理运行环境,可用于获取当前运行环境信息、与其它程序进行通讯等。通过plus.runtime可获取运行环境管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + runtime: PlusRuntime; + /** + * Storage模块管理应用本地数据存储区,用于应用数据的保存和读取。应用本地数据与localStorage、sessionStorage的区别在于数据有效域不同,前者可在应用内跨域操作,数据存储期是持久化的,并且没有容量限制。通过plus.storage可获取应用本地数据管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ + storage: PlusStorage; + /** + * Stream模块操作流应用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + stream: PlusStream; + /** + * Uploader模块管理网络上传任务,用于从本地上传各种文件到服务器,并支持跨域访问操作。通过plus.uploader可获取上传管理对象。Uploader上传使用HTTP的POST方式提交数据,数据格式符合Multipart/form-data规范,即rfc1867(Form-based File Upload in HTML)协议。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + uploader: PlusUploader; + /** + * Video模块管理多媒体视频相关能力,可用创建视频播放控件,直播推流控件等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + video: PlusVideo; + /** + * Webview模块管理应用窗口界面,实现多窗口的逻辑控制管理操作。通过plus.webview可获取应用界面管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + webview: PlusWebview; + /** + * XMLHttpRequest模块管理网络请求,与标准HTML中的XMLHttpRequest用途一致,差别在于前者可以进行跨域访问。通过plus.net可获取网络请求管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + net: PlusNet; + /** + * Zip模块管理文件压缩和解压,通过plus.zip可获取压缩管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + zip: PlusZip; + /** + * Barcode模块管理条码扫描,支持常见的条码(一维码及二维码)的扫描识别功能。可调用设备的摄像头对条码图片扫描进行数据输入,解码后返回码数据及码类型。通过plus.barcode可获取条码码管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + barcode: PlusBarcode; + /** + * Maps模块管理地图控件,用于在web页面中显示地图控件,提供各种接口操作地图控件,如添加标点、路线等。通过plus.maps可获取地图管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + maps: PlusMaps; + /** + * OAuth模块管理客户端的用户登录授权验证功能,允许应用访问第三方平台的资源。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + oauth: PlusOauth; + /** + * Payment模块管理支付功能,用于提供网页安全支付能力,支持通过Web接口进行支付操作。通过plus.payment可获取支付管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + payment: PlusPayment; + /** + * Push模块管理推送消息功能,可以实现在线、离线的消息推送,通过plus.push可获取推送消息管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + push: PlusPush; + /** + * Share模块管理客户端的社交分享功能,提供调用终端社交软件的分享能力。通过plus.share可获取社交分享管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + share: PlusShare; + /** + * Speech模块管理语音输入功能,提供语音识别功能,可支持用户通过麦克风设备进行语音输入内容。通过plus.speech可获取语音输入管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + speech: PlusSpeech; + /** + * Statistic模块管理统计功能,用于提供应用内统计的能力,支持统计和分析用户属性和用户行为数据。通过plus.statistic可获取统计管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/statistic.html](http://www.html5plus.org/doc/zh_cn/statistic.html) + */ + statistic: PlusStatistic; +} + +/** + * Accelerometer模块管理设备加速度传感器,用于获取设备加速度信息,包括x(屏幕水平方向)、y(垂直屏幕水平方向)、z(垂直屏幕平面方向)三个方向的加速度信息。通过plus.accelerometer获取设备加速度传感器管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ +interface PlusAccelerometer { + /** + * 设备加速度信息对象 + * JSON对象,保存获取设备的加速度信息,包括x、y、z三个方向的加速度信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + Acceleration?: PlusAccelerometerAcceleration; + /** + * 监听设备加速度感应器参数 + * JSON对象,用于设置获取设备加速度信息的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + AccelerometerOption?: PlusAccelerometerAccelerometerOption; + /** + * 获取当前设备的加速度信息 + * 加速度是设备在当前方向上所做相对运动变化(增、减量)的运动传感器。加速度信息包括x、y、z三个方向的信息。 + * 加速度信息可通过successCB回调函数返回。加速度信息获取失败则调用回调函数errorCB。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + getCurrentAcceleration(successCB?: (result: PlusAccelerometerAcceleration) => void, errorCB?: (result: any) => void): void; + /** + * 监听设备加速度变化信息 + * 加速度是设备在当前方向上所做相对运动变化(增、减量)的运动传感器。加速度信息包括x、y、z三个方向的信息。 + * watchAcceleration每隔固定时间就获取一次设备的加速度信息,通过successCB回调函数返回。可通过option的frequency参数设定获取设备加速度信息的时间间隔。 + * 加速度信息获取失败则调用回调函数errorCB。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + watchAcceleration(successCB?: (result: PlusAccelerometerAcceleration) => void, errorCB?: (result: any) => void, options?: PlusAccelerometerAccelerometerOption): number; + /** + * 关闭监听设备加速度信息 + * 关闭监听设备加速度信息,应用关闭调用watchAcceleration方法的开启的监听操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + clearWatch(watchId?: number): void; +} + +/** + * 设备加速度信息对象 + * JSON对象,保存获取设备的加速度信息,包括x、y、z三个方向的加速度信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ +interface PlusAccelerometerAcceleration { + /** + * x轴方向的加速度 + * 获取当前设备x轴方向的加速度,浮点型数据,与物理学中的加速度值一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + xAxis?: number; + /** + * y轴方向的加速度 + * 获取当前设备y轴方向的加速度,浮点型数据,与物理学中的加速度值一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + yAxis?: number; + /** + * z轴方向的加速度 + * 获取当前设备z轴方向的加速度,浮点型数据,与物理学中的加速度值一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + zAxis?: number; +} + +/** + * 监听设备加速度感应器参数 + * JSON对象,用于设置获取设备加速度信息的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ +interface PlusAccelerometerAccelerometerOption { + /** + * 更新加速度信息间隔时间 + * 监听器获取加速度信息的时间间隔,单位为ms,默认值为500ms + * + * 参考: [http://www.html5plus.org/doc/zh_cn/accelerometer.html](http://www.html5plus.org/doc/zh_cn/accelerometer.html) + */ + frequency?: number; +} + +/** + * Native.js for Android封装一条通过JS语法直接调用Native Java接口通道,通过plus.android可调用几乎所有的系统API。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ +interface PlusAndroid { + /** + * Java类对象 + * Java类对象,可通过其属性获取类的常量,可通过方法来操作类的静态变量和方法,也通过new方法来创建类的实例对象。 + * 对于类的常量,则直接通过.后面跟随常量名称调用即可。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + ClassObject?: PlusAndroidClassObject; + /** + * Java实例对象 + * Java实例对象,可通过其方法来操作实例的变量和方法。 + * 注意:必须通过plusGetAttribute()方法读取实例对象的属性值,通过plusSetAttribute()方法设置实例对象的属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + InstanceObject?: PlusAndroidInstanceObject; + /** + * 导入Java类对象 + * 导入类对象后,就可以通过.操作符直接调用对象(类对象/实例对象)的方法。 + * 注意:导入类对象将会消耗较多的系统资源,通常不应该导入过多的类对象,可以使用plus.android.invoke()来调用未导入类实例对象的方法。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + importClass(classname?: string): PlusAndroidClassObject; + /** + * 创建实例对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + newObject(classname?: string, args?: any): PlusAndroidInstanceObject; + /** + * 获取对象(类对象/实例对象)的属性值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + getAttribute(obj?: PlusAndroidInstanceObject, name?: string): any; + /** + * 设置对象(类对象/实例对象)的属性值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + setAttribute(obj?: PlusAndroidInstanceObject, name?: string, value?: any): void; + /** + * 调用对象(类对象/实例对象)的方法 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + invoke(obj?: PlusAndroidInstanceObject, name?: string, args?: any): any; + /** + * 实现Interface的方法 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + implements(name?: string, obj?: any): PlusAndroidInstanceObject; + /** + * 获取应用主Activity实例对象 + * Android平台完整Java类名为android.app.Activity,完整API请参考Android开发文档 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + runtimeMainActivity(): PlusAndroidInstanceObject; + /** + * 获取当前Webview窗口对象的native层实例对象 + * Android平台完整Java类名为android.webkit.Webview,完整API请参考Android开发文档 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + currentWebview(): PlusAndroidInstanceObject; +} + +/** + * Java类对象 + * Java类对象,可通过其属性获取类的常量,可通过方法来操作类的静态变量和方法,也通过new方法来创建类的实例对象。 + * 对于类的常量,则直接通过.后面跟随常量名称调用即可。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ +interface PlusAndroidClassObject { + /** + * 获取Java类对象的静态属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + plusGetAttribute(name?: string): any; + /** + * 设置Java类对象的静态属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + plusSetAttribute(name?: string, value?: any): void; +} + +/** + * Java实例对象 + * Java实例对象,可通过其方法来操作实例的变量和方法。 + * 注意:必须通过plusGetAttribute()方法读取实例对象的属性值,通过plusSetAttribute()方法设置实例对象的属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ +interface PlusAndroidInstanceObject { + /** + * 获取Java实例对象的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + plusGetAttribute(name?: string): any; + /** + * 设置Java实例对象的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/android.html](http://www.html5plus.org/doc/zh_cn/android.html) + */ + plusSetAttribute(name?: string, value?: any): void; +} + +/** + * Audio模块用于提供音频的录制和播放功能,可调用系统的麦克风设备进行录音操作,也可调用系统的扬声器设备播放音频文件。通过plus.audio获取音频管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ +interface PlusAudio { + /** + * 录音对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + AudioRecorder?: PlusAudioAudioRecorder; + /** + * 音频播放对象 + * 音频播放对象,用于音频文件的播放。不能通过new方法直接创建,只能通过audio.createPlayer方法创建。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + AudioPlayer?: PlusAudioAudioPlayer; + /** + * JSON对象,调用麦克风设备进行录音的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + RecordOptions?: PlusAudioRecordOptions; + /** + * 设备的扬声器音频输出线路 + * 音频输出线路常量,值为0。音频播放时在设备的扬声器输出。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + ROUTE_SPEAKER?: number; + /** + * 设备听筒音频输出线路 + * 音频输出线路常量,值为1。音频播放时在设备的听筒输出。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + ROUTE_EARPIECE?: number; + /** + * 获取当前设备的录音对象 + * 获取当前设备的录音对象,进行录音操作,录音对象是设备的独占资源,在同一时间仅可执行一个录音操作,否则可能会导致操作失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + getRecorder(): PlusAudioAudioRecorder; + /** + * 创建音频播放对象 + * 创建一个音频文件播放对象,用于打开音频文件并播放。 + * 可通过path参数指定要播放的音频文件。创建后返回播放对象,通过Audio.play方法开始播放。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + createPlayer(path?: string): PlusAudioAudioPlayer; +} + +/** + * 录音对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ +interface PlusAudioAudioRecorder { + /** + * 数组,设备录音支持的采用率 + * 属性类型为Array(String),若不支持此属性则返回空数组对象。支持的录音采样率,字符串格式为“采样频率”,如“8000”;其单位为Hz。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + supportedSamplerates?: string; + /** + * 数组,设备录音支持的文件格式 + * 属性类型为Array(String),若不支持此属性则返回空数组对象。支持的录音文件的格式,字符串格式为文件格式后缀名,如"mp3"、"aac"、"wav"等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + supportedFormats?: string; + /** + * 调用设备麦克风进行录音操作 + * 调用设备麦克风开始录音操作,录音完成需调用stop方法停止。录音完成后将通过successCB回调返回录音后的文件数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + record(option?: PlusAudioRecordOptions, successCB?: (result: string) => void, errorCB?: (result: any) => void): void; + /** + * 结束录音操作 + * 结束录音操作,通知设备完成录音操作。录音完成后将调用record方法中传入的successCB回调返回录音文件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + stop(): void; +} + +/** + * 音频播放对象 + * 音频播放对象,用于音频文件的播放。不能通过new方法直接创建,只能通过audio.createPlayer方法创建。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ +interface PlusAudioAudioPlayer { + /** + * 开始播放音频 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + play(successCB?: () => void, errorCB?: (result: any) => void): void; + /** + * 暂停播放音频 + * 需先调用createPlayer方法创建音频播放对象,并开始播放。音频播放对象在播放状态才能暂停,在其它状态调用此方法无任何作用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + pause(): void; + /** + * 恢复播放音频 + * 音频播放对象在暂停状态才能恢复播放,在其它状态调用此方法无任何作用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + resume(): void; + /** + * 停止播放音频 + * 停止播放音频,音频播放对象在播放或暂停状态才能停止播放,在其它状态调用此方法无任何作用。 + * 停止播放后如果需要继续播放,则需调用play方法重新开始播放。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + stop(): void; + /** + * 跳到指定位置播放音频 + * 跳到指定位置播放音频,音频播放对象在播放或暂停状态才能跳到指定播放音频,在其它状态调用此方法无任何作用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + seekTo(position?: number): void; + /** + * 获取音频流的总长度 + * 获取音频流的总长度,单位为秒,若长度未知则返回-1。如果还未获取到音频流信息则返回NaN,此时需要延迟获取此信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + getDuration(): number; + /** + * 获取音频流当前播放的位置 + * 获取音频流当前播放的位置(已播放的长度),单位为s。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + getPosition(): number; + /** + * 设置音频输出线路 + * 可在音频文件开始播放前或播放的过程中改变音频输出线路,默认使用扬声器(plus.audio.ROUTE_SPEAKER)输出线路。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + setRoute(route?: number): void; +} + +/** + * JSON对象,调用麦克风设备进行录音的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ +interface PlusAudioRecordOptions { + /** + * 录音声道 + * 可取值: + * "mono" - 单声道录音; + * "stereo" - 立体声道录音。 + * 默认值为"mono"。 + * - mono: 单声道录音 + * - stereo: 立体声录音 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + channels?: 'mono' | 'stereo'; + /** + * 保存录音文件的路径 + * 可设置具体文件名,也可只设置路径,如果以“/”结尾则表明是路径,文件名由录音程序自动生成。 + * 如未设置则使用默认目录生成随机文件名称,默认目录为应用%APPID%下的documents目录。 + * - _www/: 应用资源目录 + * - _doc/: 应用私有文档目录 + * - _documents/: 共享文档目录 + * - _downloads/: 共享下载目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + filename?: '_www/' | '_doc/' | '_documents/' | '_downloads/'; + /** + * 录音文件的采样率 + * 需通过supportedSamplerates属性获取设备支持的采样率,若设置无效的值,则使用系统默认的采样率。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + samplerate?: string; + /** + * 录音文件的格式 + * 需通过supportedFormats属性获取设备支持的录音格式,若设置无效的值,则使用系统默认的录音格式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/audio.html](http://www.html5plus.org/doc/zh_cn/audio.html) + */ + format?: string; +} + +/** + * Bluetooth模块用于管理蓝牙设备,搜索附近蓝牙设备、连接实现数据通信等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ +interface PlusBluetooth { + /** + * 蓝牙设备信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + BluetoothDeviceInfo?: PlusBluetoothBluetoothDeviceInfo; + /** + * 蓝牙设备服务信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + BluetoothService?: PlusBluetoothBluetoothService; + /** + * 蓝牙设备特征值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + Bluetoothcharacteristic?: PlusBluetoothBluetoothcharacteristic; + /** + * 蓝牙设备特征值支持的操作类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + BluetoothcharacteristicProperties?: PlusBluetoothBluetoothcharacteristicProperties; + /** + * 关闭蓝牙模块 + * 断开所有已经建立的连接,释放系统资源,要求在蓝牙功能使用完成后调用(于openBluetoothAdapter成对使用)。 + * 关闭成功后触发options参数中的success回调,失败触发options参数中的fail回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + closeBluetoothAdapter(success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 获取本机蓝牙适配器状态 + * 获取成功后触发options参数中的success回调,失败触发options参数中的fail回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + getBluetoothAdapterState(success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 获取已搜索到的蓝牙设备 + * 包括已经和本机处于连接状态的设备。 + * 获取成功后触发options参数中的success回调,失败触发options参数中的fail回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + getBluetoothDevices(success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 根据uuid获取处于已连接的设备 + * 获取成功后触发options参数中的success回调,失败触发options参数中的fail回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + getConnectedBluetoothDevices(services?: any [], success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 监听蓝牙适配器状态变化事件 + * 蓝牙适配器状态发生变化时触发回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + onBluetoothAdapterStateChange(changeCB?: (result: any) => void): void; + /** + * 监听搜索到新设备的事件 + * 搜索到新设备时触发回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + onBluetoothDeviceFound(callback?: (result: any) => void): void; + /** + * 初始化蓝牙模块 + * 初始化成功后触发options参数中的success回调,失败触发options参数中的fail回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + openBluetoothAdapter(success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 开始搜索附近的蓝牙设备 + * 此操作比较耗费系统资源,请在搜索并连接到设备后调用stopBluetoothDevicesDiscovery方法停止搜索。 + * 搜索成功后触发options参数中的success回调,失败触发options参数中的fail回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + startBluetoothDevicesDiscovery(services?: any [], allowDuplicatesKey?: boolean, interval?: number, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 停止搜寻附近的蓝牙外围设备 + * 若已经找到需要的蓝牙设备并不需要继续搜索时,应该调用该接口停止蓝牙搜索。 + * 停止成功后触发options参数中的success回调,失败触发options参数中的fail回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + stopBluetoothDevicesDiscovery(success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 断开与低功耗蓝牙设备的连接 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + closeBLEConnection(deviceId?: string, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 连接低功耗蓝牙设备 + * 若之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的deviceId尝试连接该设备,无需进行搜索操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + createBLEConnection(deviceId?: string, timeout?: number, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 获取蓝牙设备指定服务中所有特征值(characteristic) + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + getBLEDeviceCharacteristics(deviceId?: string, serviceId?: string, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 获取蓝牙设备的所有服务(service) + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + getBLEDeviceServices(deviceId?: string, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 启用低功耗蓝牙设备特征值变化时的notify功能,订阅特征值 + * 蓝牙设备服务的特征值必须支持notify或indicate才可以成功调用。 + * 另外,必须先启用notifyBLECharacteristicValueChange才能监听到设备characteristicValueChange事件,即特征值发生变化时通过onBLECharacteristicValueChange注册的事件回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + notifyBLECharacteristicValueChange(deviceId?: string, serviceId?: string, characteristicId?: string, state?: boolean, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 监听低功耗蓝牙设备的特征值变化事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + onBLECharacteristicValueChange(callback?: (result: any) => void): void; + /** + * 监听低功耗蓝牙设备连接状态变化事件 + * 包括开发者主动连接或断开连接,设备丢失,连接异常断开等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + onBLEConnectionStateChange(callback?: (result: any) => void): void; + /** + * 读取低功耗蓝牙设备指定特征值的二进制数据值 + * 指定的特征值需支持read操作才可以成功调用。 + * 并行调用多次可能导致读取失败,读取的数据需要在onBLECharacteristicValueChange方法注册的回调中获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + readBLECharacteristicValue(deviceId?: string, serviceId?: string, characteristicId?: string, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 向低功耗蓝牙设备指定特征值写入二进制数据 + * 指定的特征值需支持write操作才可以成功调用。 + * 并行调用多次可能导致读取失败,系统可能会限制单次传输的数据大小,超过最大字节数后可能会发生写入错误,建议每次写入不超过20字节。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + writeBLECharacteristicValue(deviceId?: string, serviceId?: string, characteristicId?: string, value?: ArrayBuffer, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; +} + +/** + * 蓝牙设备信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ +interface PlusBluetoothBluetoothDeviceInfo { + /** + * 蓝牙设备名称 + * 某些设备可能没有此字段值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + name?: string; + /** + * 蓝牙设备的id + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + deviceId?: string; + /** + * 蓝牙设备的信号强度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + RSSI?: string; + /** + * 蓝牙设备的广播数据段中的ManufacturerData数据段 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + advertisData?: ArrayBuffer; + /** + * 蓝牙设备的广播数据段中的ServiceUUIDs数据段 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + advertisServiceUUIDs?: any []; + /** + * 蓝牙设备的广播数据段中的LocalName数据段 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + localName?: string; + /** + * 蓝牙设备的广播数据段中的ServiceData数据段 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + serviceData?: any; +} + +/** + * 蓝牙设备服务信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ +interface PlusBluetoothBluetoothService { + /** + * 蓝牙设备服务的uuid + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + uuid?: string; + /** + * 是否为设备的主服务 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + isPrimary?: boolean; +} + +/** + * 蓝牙设备特征值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ +interface PlusBluetoothBluetoothcharacteristic { + /** + * 蓝牙设备特征值的uuid + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + uuid?: string; + /** + * 设备特征值支持的操作类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + properties?: PlusBluetoothBluetoothcharacteristicProperties; +} + +/** + * 蓝牙设备特征值支持的操作类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ +interface PlusBluetoothBluetoothcharacteristicProperties { + /** + * 特征值是否支持read操作 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + read?: boolean; + /** + * 特征值是否支持write操作 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + write?: boolean; + /** + * 特征值是否支持notify操作 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + notify?: boolean; + /** + * 特征值是否支持indicate操作 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/bluetooth.html](http://www.html5plus.org/doc/zh_cn/bluetooth.html) + */ + indicate?: boolean; +} + +/** + * Camera模块管理设备的摄像头,可用于拍照、摄像操作,通过plus.camera获取摄像头管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ +interface PlusCamera { + /** + * 摄像头对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + Camera?: PlusCameraCamera; + /** + * JSON对象,调用摄像头的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + CameraOptions?: PlusCameraCameraOptions; + /** + * JSON对象,弹出拍照或摄像界面指示位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + PopPosition?: PlusCameraPopPosition; + /** + * 获取摄像头管理对象 + * 获取需要操作的摄像头对象,如果要进行拍照或摄像操作,需先通过此方法获取摄像头对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + getCamera(index?: number): PlusCameraCamera; +} + +/** + * 摄像头对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ +interface PlusCameraCamera { + /** + * 字符串数组,摄像头支持的拍照分辨率 + * 属性类型为String[],若不支持此属性则返回空数组对象。 + * 摄像头支持的拍照图片分辨率字符串形式“WIDTH*Height”,如“400*800”;如果支持任意自定义分辨率则“*”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + supportedImageResolutions?: any []; + /** + * 字符串数组,摄像头支持的摄像分辨率 + * 属性类型为String[],若不支持此属性则返回空数组对象。 + * 摄像头支持的视频分辨率字符串形式为“WIDTH*Height”,如“400*800”;如果支持任意自定义分辨率则“*”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + supportedVideoResolutions?: any []; + /** + * 字符串数组,摄像头支持的拍照文件格式 + * 属性类型为String[],若不支持此属性则返回空数组对象。 + * 摄像头支持的图片文件格式字符串形式为文件格式后缀名,如“jpg”、“png”、“bmp”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + supportedImageFormats?: any []; + /** + * 字符串数组,摄像头支持的摄像文件格式 + * 属性类型为String[],若不支持此属性则返回空数组对象。 + * 摄像头支持的视频文件格式字符串形式为文件格式后缀名,如“3gp”、“mp4”、“avi”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + supportedVideoFormats?: any []; + /** + * 进行拍照操作 + * 摄像头资源为独占资源,如果其它程序或页面已经占用摄像头,再次操作则失败。 + * 拍照操作成功将通过successCB返回拍照获取的图片路径。 + * 可通过option设置摄像头的各种属性参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + captureImage(successCB?: (result: string) => void, errorCB?: (result: any) => void, options?: PlusCameraCameraOptions): void; + /** + * 调用摄像头进行摄像操作 + * 摄像头资源为独占资源,如果其它程序或页面已经占用摄像头,再次操作则失败。 + * 拍照操作成功将通过successCB返回摄像获取的视频文件路径。 + * 可通过option设置摄像头的各种属性参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + startVideoCapture(successCB?: (result: string) => void, errorCB?: (result: any) => void, option?: PlusCameraCameraOptions): void; + /** + * 结束摄像操作 + * 开始调用摄像头进行摄像操作后,可在后台结束摄像操作,与用户在界面结束操作效果一致。 + * 摄像操作成功将通过startVideoCapture函数中的successCB返回拍照获取的图片路径。 + * 用户如果没有进行摄像操作关闭摄像头页面则调用失败回调函数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + stopVideoCapture(): void; +} + +/** + * JSON对象,调用摄像头的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ +interface PlusCameraCameraOptions { + /** + * 拍照或摄像文件保存的路径 + * 可设置具体文件名(如"_doc/camera/a.jpg");也可只设置路径,以"/"结尾则表明是路径(如"_doc/camera/")。 + * 如未设置文件名称或设置的文件名冲突则文件名由程序程序自动生成。 + * - _doc/: 应用私有文档目录 + * - _documents/: 共享文档目录 + * - _downloads/: 共享下载目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + filename?: '_doc/' | '_documents/' | '_downloads/'; + /** + * 拍照或摄像的文件格式 + * 可通过Camera对象的supportedImageFormats或supportedVideoFormats获取,如果设置的参数无效则使用系统默认值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + format?: string; + /** + * 拍照或摄像默认使用的摄像头 + * 拍照或摄像界面默认使用的摄像头编号,1表示主摄像头,2表示辅摄像头。 + * - 1: 使用设备主摄像头 + * - 2: 使用设备辅摄像头 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + index?: '1' | '2'; + /** + * 视频长度 + * 单位为秒(s),小于等于0表示不限定视频长度。 + * 默认值为0(不限定视频长度)。 + * 注意:仅在调用拍摄视频(startVideoCapture)时有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + videoMaximumDuration?: number; + /** + * 是否优化图片 + * 自动调整图片的方向,在部分设备上可能出现图片方向不正确的问题,此参数将配置是否自动调整图片方向。 + * 可取值: + * true - 自动调整图片方向; + * false - 不调整。 + * 默认值为true。 + * 注意:自动调整图片方向将消耗部分系统资源,可能会导致拍照后回调触发时机延迟,将此值设置为false则可避免延迟问题。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + optimize?: boolean; + /** + * 拍照或摄像使用的分辨率 + * 可通过Camera对象的supportedImageResolutions或supportedVideoResolutions获取,如果设置的参数无效则使用系统默认值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + resolution?: string; + /** + * 拍照或摄像界面弹出指示区域 + * 对于大屏幕设备如iPad,拍照或摄像界面为弹出窗口,此时可通过此参数设置弹出窗口位置,其为JSON对象,格式如{top:"10px",left:"10px",width:"200px",height:"200px"},默认弹出位置为屏幕居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + popover?: PlusCameraPopPosition; +} + +/** + * JSON对象,弹出拍照或摄像界面指示位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ +interface PlusCameraPopPosition { + /** + * 指示区域距离容器顶部的距离 + * 弹出拍照或摄像窗口指示区域距离容器顶部的距离,支持像素值(如"100px")和百分比(如"50%")。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + top?: string; + /** + * 指示区域距离容器左侧的距离 + * 弹出拍照或摄像窗口指示区域距离容器左侧的距离,支持像素值(如"100px")和百分比(如"50%")。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + left?: string; + /** + * 指示区域的宽度 + * 弹出拍照或摄像窗口指示区域的宽度,支持像素值(如"100px")和百分比(如"50%")。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + width?: string; + /** + * 指示区域的高度 + * 弹出拍照或摄像窗口指示区域的高度,支持像素值(如"100px")和百分比(如"50%")。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/camera.html](http://www.html5plus.org/doc/zh_cn/camera.html) + */ + height?: string; +} + +/** + * Contacts模块管理系统通讯录,用于可对系统通讯录进行增、删、改、查等操作。通过plus.contacts获取系统通讯录管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContacts { + /** + * 通讯录对象 + * 通讯录管理对象,可对系统通讯录进行联系人的增、删、改、查操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + AddressBook?: PlusContactsAddressBook; + /** + * 联系人对象 + * 联系人对象,包括联系人的各种信息,如名称、电话号码、地址等。也包括新增、删除联系人的操作方法。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + Contact?: PlusContactsContact; + /** + * JSON对象,联系人域数据对象 + * 联系人域数据对象,保存联系人特定域信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ContactField?: PlusContactsContactField; + /** + * JSON对象,联系人名称对象 + * 联系人名称对象,保存联系人名称信息,如姓、名等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ContactName?: PlusContactsContactName; + /** + * JSON对象,联系人地址对象 + * 联系人地址对象,保存联系人地址信息,如国家、省份、城市等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ContactAddress?: PlusContactsContactAddress; + /** + * JSON对象,联系人所属组织信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ContactOrganization?: PlusContactsContactOrganization; + /** + * JSON对象,查找联系人参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ContactFindOption?: PlusContactsContactFindOption; + /** + * JSON对象,联系人查找过滤器 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ContactFindFilter?: PlusContactsContactFindFilter; + /** + * 手机通讯录 + * 通讯录类型常量,数值类型,固定值为0,用于获取系统的联系人信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ADDRESSBOOK_PHONE?: number; + /** + * SIM卡通讯录 + * 通讯录类型常量,数值类型,固定值为1,用于获取SIM卡上的联系人信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ADDRESSBOOK_SIM?: number; + /** + * 获取通讯录对象 + * 根据指定通讯录类型获取通讯录对象,获取通讯录对象后可对其进行增、删、改操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + getAddressBook(type?: number, successCB?: (result: PlusContactsAddressBook) => void, errorCB?: (result: any) => void): void; +} + +/** + * 通讯录对象 + * 通讯录管理对象,可对系统通讯录进行联系人的增、删、改、查操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsAddressBook { + /** + * 创建联系人 + * 创建一个系统联系人,并返回联系人对象,可对联系人对象进行操作设置联系人信息,如名称、地址、电话等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + create(): PlusContactsContact; + /** + * 在通讯录中查找联系人 + * 在通讯录中安装指定的规则查找联系人,contactFields可设定查找返回的联系人中包含的字段值,查找联系人成功时通过successCB回调返回,查找联系人失败则通过errorCB回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + find(contactFields?: string [], successCB?: (result: PlusContactsContact) => void, errorCB?: (result: any) => void, findOptions?: PlusContactsContactFindOption): void; +} + +/** + * 联系人对象 + * 联系人对象,包括联系人的各种信息,如名称、电话号码、地址等。也包括新增、删除联系人的操作方法。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsContact { + /** + * 联系人的id + * 联系人id由系统分配维护,从系统获取联系人时自动赋值,再次查询时可使用此id值进行检索。 + * 注意:此值为只读属性,改写此值可能会导致无法预期的错误。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + id?: string; + /** + * 联系人显示的名字 + * 联系人显示的名字通常由其姓和名组合而成。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + displayName?: string; + /** + * 联系人的名称 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + name?: PlusContactsContactName; + /** + * 联系人的昵称 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + nickname?: string; + /** + * 数组,联系人的电话 + * 如果联系人中未保存电话信息,则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + phoneNumbers?: PlusContactsContactField; + /** + * 数组,联系人的邮箱 + * 如果联系人中未保存邮箱信息,则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + emails?: PlusContactsContactField; + /** + * 数组,联系人的地址 + * 如果联系人中未保存地址信息,则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + addresses?: PlusContactsContactAddress; + /** + * 数组,联系人的即时通讯地址 + * 如果联系人中未保存即时通讯地址信息,则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + ims?: PlusContactsContactField; + /** + * 数组,联系人所属组织信息 + * 如果联系人中未保存所属组织信息,则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + organizations?: PlusContactsContactOrganization; + /** + * 联系人的生日 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + birthday?: Date; + /** + * 联系人的备注 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + note?: string; + /** + * 数组,联系人的头像 + * 其值为头像图片url地址或图片数据: + * url地址:仅支持本地图片地址,可以是绝对路径或相对路径,如“_doc/a.png”; + * 图片数据:必须符合Data URI scheme(RFC2397)格式的数据,如“image/png;base64,XXXX”,其中XXXX为base64编码的图片数据。在获取联系人时默认返回此类型的数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + photos?: PlusContactsContactField; + /** + * 数组,联系人的组名 + * 如果联系人中未保存组名信息,则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + categories?: PlusContactsContactField; + /** + * 数组,联系人的网址 + * 如果联系人中未保存网址信息,则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + urls?: PlusContactsContactField; + /** + * 克隆联系人 + * 克隆联系人,创建出一个新的联系人对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + clone(): PlusContactsContact; + /** + * 删除联系人 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + remove(successCB?: () => void, errorCB?: (result: any) => void): void; + /** + * 保存联系人 + * 将联系人数据保存到通讯录中,操作成功将通过successCB回调函数返回保存结果,操作失败将通过通过errorCB回调函数返回错误信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + save(successCB?: () => void, errorCB?: (result: any) => void): void; +} + +/** + * JSON对象,联系人域数据对象 + * 联系人域数据对象,保存联系人特定域信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsContactField { + /** + * 联系人域类型,如电话号码中的“mobile”、“home”、“company” + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + type?: string; + /** + * 联系人域值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + value?: string; + /** + * 是否为首选项 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + preferred?: boolean; +} + +/** + * JSON对象,联系人名称对象 + * 联系人名称对象,保存联系人名称信息,如姓、名等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsContactName { + /** + * 联系人的完整名称,由其它字段组合生成 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + formatted?: string; + /** + * 联系人的姓 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + familyName?: string; + /** + * 联系人的名 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + givenName?: string; + /** + * 联系人的中间名 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + middleName?: string; + /** + * 联系人的前缀(如Mr.或Dr.) + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + honorificPrefix?: string; + /** + * 联系人的后缀 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + honorificSuffix?: string; +} + +/** + * JSON对象,联系人地址对象 + * 联系人地址对象,保存联系人地址信息,如国家、省份、城市等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsContactAddress { + /** + * 联系人地址类型,如“home”表示家庭地址、“company”表示单位地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + type?: string; + /** + * 完整地址,由其它字段组合而成 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + formatted?: string; + /** + * 完整的街道地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + streetAddress?: string; + /** + * 城市或地区 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + locality?: string; + /** + * 省或地区 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + region?: string; + /** + * 国家 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + country?: string; + /** + * 邮政编码 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + postalCode?: string; + /** + * 是否为首选项 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + preferred?: boolean; +} + +/** + * JSON对象,联系人所属组织信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsContactOrganization { + /** + * 联系人所属组织类型,如"company" + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + type?: string; + /** + * 联系人所属组织名称 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + name?: string; + /** + * 联系人所属组织部门 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + department?: string; + /** + * 联系人在组织中的职位 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + title?: string; + /** + * 是否为首选项 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + preferred?: boolean; +} + +/** + * JSON对象,查找联系人参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsContactFindOption { + /** + * 数组,查找时的过滤器 + * 可设置为空,表示不过滤。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + filter?: PlusContactsContactFindFilter; + /** + * 是否查找多个联系人,默认值为true + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + multiple?: boolean; +} + +/** + * JSON对象,联系人查找过滤器 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ +interface PlusContactsContactFindFilter { + /** + * 区配的逻辑 + * 可取“and”、“or”、“not”,默认值为“and”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + logic?: string; + /** + * 区配的联系人域,可取联系人的属性名称 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + field?: string; + /** + * 区配的联系人值,可使用区配符号“?”和“*” + * + * 参考: [http://www.html5plus.org/doc/zh_cn/contacts.html](http://www.html5plus.org/doc/zh_cn/contacts.html) + */ + value?: string; +} + +/** + * Device模块管理设备信息,用于获取手机设备的相关信息,如IMEI、IMSI、型号、厂商等。通过plus.device获取设备信息管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ +interface PlusDevice { + /** + * 设备的国际移动设备身份码 + * 调用此属性获取设备的国际移动设备身份码。 + * 如果设备不支持则返回空字符串。 + * 如果设备存在多个身份码,则以“,”字符分割拼接,如“862470039452950,862470039452943”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + imei?: string; + /** + * 设备的国际移动用户识别码 + * 字符串数组类型,获取设备上插入SIM的国际移动设备身份码。 + * 如果设备支持多卡模式则返回所有SIM身份码。 + * 如果设备不支持或没有插入SIM卡则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + imsi?: any []; + /** + * 设备的型号 + * 调用此属性获取设备的型号信息。 + * 如果设备不支持则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + model?: string; + /** + * 设备的生产厂商 + * 调用此属性获取设备的生产厂商信息。 + * 如果设备不支持则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + vendor?: string; + /** + * 设备的唯一标识 + * 调用此属性获取设备的唯一标识号。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + uuid?: string; + /** + * 拨打电话 + * 调用系统程序拨打电话。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + dial(number?: string, confirm?: boolean): void; + /** + * 发出蜂鸣声 + * 调用此方法使得设备发出蜂鸣声。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + beep(times?: number): void; + /** + * 设备振动 + * 调用此方法使得设备振动。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + vibrate(milliseconds?: number): void; + /** + * 设置应用是否保持唤醒(屏幕常亮)状态 + * 调用此方法设置应用是否一直保持唤醒状态,保持唤醒状态将会导致程序屏幕常亮、系统不会自动锁屏,从而导致消耗更多的电量。若未设置一直保持唤醒状态则会根据系统设置自动锁定屏幕。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + setWakelock(lock?: boolean): void; + /** + * 获取程序是否一直保持唤醒(屏幕常亮)状态 + * 调用此方法获取程序是否一致保持唤醒状态。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + isWakelock(): boolean; + /** + * 设置设备的系统音量 + * 调用此方法调节设备的系统音量。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + setVolume(volume?: number): void; + /** + * 获取设备的系统音量 + * 系统音量值范围为0到1,0表示静音,1表示最大音量值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + getVolume(): number; +} + +/** + * Screen模块管理设备屏幕信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ +interface PlusScreen { + /** + * 设备屏幕高度分辨率 + * 设备屏幕区域包括系统状态栏显示区域和应用显示区域,screen获取的是设备屏幕总区域的逻辑分辨率,单位为px。 + * 如果需要获取实际分辨率则需要乘以比例值scale。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + resolutionHeight?: number; + /** + * 设备屏幕宽度分辨率 + * 设备屏幕区域包括系统状态栏显示区域和应用显示区域,screen获取的是设备屏幕总区域的分辨率,单位为px。 + * 如果需要获取实际分辨率则需要乘以比例值scale。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + resolutionWidth?: number; + /** + * 逻辑分辨率与实际分辨率的比例 + * 屏幕分辨率分逻辑分辨率率和实际分辨率,在html页面中使用的像素值都是相对于逻辑分辨率,此值就是逻辑分辨率和实际分辨率的比例,实际分辨率=逻辑分辨率*比例。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + scale?: number; + /** + * 设备屏幕水平方向的密度 + * 设备屏幕的密度为每英寸所显示的像素点数,密度越高显示清晰度越高,单位为dpi。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + dpiX?: number; + /** + * 设备屏幕垂直方向的密度 + * 设备屏幕的密度为每英寸所显示的像素点数,密度越高显示清晰度越高,单位为dpi。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + dpiY?: number; + /** + * 设置屏幕亮度 + * 调用此方法调节设备屏幕亮度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + setBrightness(brightness?: number): void; + /** + * 获取屏幕亮度值 + * 屏幕亮度值范围为0到1,0表示最低亮度值,1表示最高亮度值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + getBrightness(): number; + /** + * 锁定屏幕方向 + * 锁定屏幕方向后屏幕只能按锁定的屏幕方向显示,关闭当前页面后仍然有效。 + * 可再次调用此方法修改屏幕锁定方向或调用unlockOrientation()方法恢复到应用的默认值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + lockOrientation(orientation?: string): void; + /** + * 解除锁定屏幕方向 + * 解除锁定屏幕方向后将恢复应用默认的屏幕显示方向(通常为应用打包发布时设置的方向)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + unlockOrientation(): void; +} + +/** + * Display模块管理应用可使用的显示区域信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ +interface PlusDisplay { + /** + * 应用可使用的屏幕高度逻辑分辨率 + * 设备屏幕区域包括系统状态栏显示区域和应用显示区域,display获取的是应用显示区域的逻辑分辨率,单位为px。 + * 如果需要获取实际分辨率则需要乘以比例值scale。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + resolutionHeight?: number; + /** + * 应用可使用的屏幕宽度逻辑分辨率 + * 设备屏幕区域包括系统状态栏显示区域和应用显示区域,display获取的是应用显示区域的逻辑分辨率,单位为px。 + * 如果需要获取实际分辨率则需要乘以比例值scale。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + resolutionWidth?: number; +} + +/** + * networkinfo模块用于获取网络信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ +interface PlusNetworkinfo { + /** + * 网络连接状态未知 + * 网络状态常量,表示当前设备网络状态未知,固定值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + CONNECTION_UNKNOW?: number; + /** + * 未连接网络 + * 网络状态常量,当前设备网络未连接网络,固定值为1。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + CONNECTION_NONE?: number; + /** + * 有线网络 + * 网络状态常量,当前设备连接到有线网络,固定值为2。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + CONNECTION_ETHERNET?: number; + /** + * 无线WIFI网络 + * 网络状态常量,当前设备连接到无线WIFI网络,固定值为3。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + CONNECTION_WIFI?: number; + /** + * 蜂窝移动2G网络 + * 网络状态常量,当前设备连接到蜂窝移动2G网络,固定值为4。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + CONNECTION_CELL2G?: number; + /** + * 蜂窝移动3G网络 + * 网络状态常量,当前设备连接到蜂窝移动3G网络,固定值为5。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + CONNECTION_CELL3G?: number; + /** + * 蜂窝移动4G网络 + * 网络状态常量,当前设备连接到蜂窝移动4G网络,固定值为6。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + CONNECTION_CELL4G?: number; + /** + * 获取设备当前连接的网络类型 + * 获取当前设备连接的网络类型,返回值为网络类型常量,可取值CONNECTION_*常量。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + getCurrentType(): number; +} + +/** + * OS模块管理操作系统信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ +interface PlusOs { + /** + * 系统语言信息 + * 获取当前操作系统设置的系统语言,字符串类型数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + language?: string; + /** + * 系统版本信息 + * 获取当前操作系统的版本信息,字符串类型数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + version?: string; + /** + * 系统的名称 + * 获取当前操作系统的名称,字符串类型数据。 + * - iOS: + * iOS系统。 + * + * - Android: + * Android系统。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + name?: 'iOS' | 'Android'; + /** + * 系统的供应商信息 + * 获取当前操作系统的供应商名称,字符串类型数据。 + * - Apple: + * iOS设备,包括iPhone、iPad、iTouch。 + * + * - Google: + * Android设备。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/device.html](http://www.html5plus.org/doc/zh_cn/device.html) + */ + vendor?: 'Apple' | 'Google'; +} + +/** + * Downloader模块管理网络文件下载任务,用于从服务器下载各种文件,并支持跨域访问操作。通过plus.downloader获取下载管理对象。Downloader下载使用HTTP的GET/POST方式请求下载文件,符合标准HTTP/HTTPS传输协议。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ +interface PlusDownloader { + /** + * Download对象管理一个下载任务 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + Download?: PlusDownloaderDownload; + /** + * 下载任务事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + DownloadEvent?: PlusDownloaderDownloadEvent; + /** + * 下载任务状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + DownloadState?: PlusDownloaderDownloadState; + /** + * 下载任务参数 + * 在创建下载任务时设置的参数,如设置下载任务使用的HTTP协议类型、优先级等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + DownloadOptions?: PlusDownloaderDownloadOptions; + /** + * 新建下载任务 + * 请求下载管理创建新的下载任务,创建成功则返回Download对象,用于管理下载任务。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + createDownload(url?: string, options?: PlusDownloaderDownloadOptions, completedCB?: (result0: PlusDownloaderDownload, result1: number) => void): PlusDownloaderDownload; + /** + * 枚举下载任务 + * 枚举指定状态的下载任务列表,通过enumCB回调函数返回结果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + enumerate(enumCB?: (result: any []) => void, state?: PlusDownloaderDownloadState): void; + /** + * 清除下载任务 + * 清除指定状态的下载任务。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + clear(state?: PlusDownloaderDownloadState): void; + /** + * 开始所有下载任务 + * 开始所有处于为开始调度或暂停状态的下载任务。 + * 若下载任务数超过可并发处理的总数,超出的任务处于调度状态(等待下载),当有任务完成时根据调度状态任务的优先级选择任务开始下载。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + startAll(): void; +} + +/** + * Download对象管理一个下载任务 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ +interface PlusDownloaderDownload { + /** + * 下载任务的标识 + * 在创建任务时系统自动分配,用于标识下载任务的唯一性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + id?: string; + /** + * 下载文件的地址 + * 调用plus.donwloader.createDownload()方法创建下载任务时设置的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + url?: string; + /** + * 任务的状态 + * 表示当前下载任务的状态,可通过addEventListener()方法监听statechanged事件监听任务状态的变化。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + state?: PlusDownloaderDownloadState; + /** + * 下载任务的参数 + * 调用plus.donwloader.createDownload()方法创建下载任务时设置的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + options?: PlusDownloaderDownloadOptions; + /** + * 下载的文件名称 + * 下载任务在本地保存的文件路径,下载任务完成时更新,可通过此值访问下载的文件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + filename?: string; + /** + * 已完成下载文件的大小 + * 整数类型,单位为字节(byte),下载任务开始传输数据时,每次触发statechanged事件或下载任务完成时更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + downloadedSize?: number; + /** + * 下载任务文件的总大小 + * 整数类型,单位为字节(byte),下载任务开始传输数据时更新,在此之前其值为0。 + * 此值是从HTTP请求头中获取,如果服务器未返回则此值始终为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + totalSize?: number; + /** + * 取消下载任务 + * 如果任务未完成,则终止下载,并从任务列表中删除。 + * 如下载未完成,将删除已下载的临时文件,如果下载已完成,将不删除已下载的文件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + abort(): void; + /** + * 添加下载任务事件监听器 + * 下载任务添加事件监听器后,当监听的事件发生时触发listener回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + addEventListener(type?: string, listener?: (result0: PlusDownloaderDownload, result1: number) => void, capture?: boolean): void; + /** + * 获取下载请求HTTP响应头部信息 + * HTTP响应头部全部内容作为未解析的字符串返回,如果没有接收到这个HTTP响应头数据或者下载请求未完成则为空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + getAllResponseHeaders(): string; + /** + * 获取下载请求指定的HTTP响应头部的值 + * 其参数是要返回的HTTP响应头部的名称,可以使用任何大小写来制定这个头部名字,和响应头部的比较是不区分大小写的。 + * 如果没有接收到这个头部或者下载请求未完成则为空字符串;如果接收到多个有指定名称的头部,这个头部的值被连接起来并返回,使用逗号和空格分隔开各个头部的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + getResponseHeader(headerName?: string): string; + /** + * 暂停下载任务 + * 暂停下载任务,如果任务已经处于初始状态或暂停状态则无任何响应。 + * 通常在任务已开始后暂停任务。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + pause(): void; + /** + * 恢复暂停的下载任务 + * 继续暂停的下载任务,如果任务处于非暂停状态则无任何响应。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + resume(): void; + /** + * 设置下载请求的HTTP头数据 + * Http的Header应该包含在通过后续start()调用而发起的请求中,此方法必需在调用start()之前设置才能生效。 + * 如果带有指定名称的头部已经被指定了,这个头部的新值就是:之前指定的值,加上逗号、以及这个调用指定的值(形成一个数组)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + setRequestHeader(headerName?: string, headerValue?: string): void; + /** + * 开始下载任务 + * 开始下载任务,如果任务已经处于开始状态则无任何响应。 + * 在创建任务或任务下载失败后调用可重新开始下载。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + start(): void; +} + +/** + * 下载任务事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ +interface PlusDownloaderDownloadEvent { + /** + * 下载任务状态变化事件 + * 当下载任务状态发生变化时触发此事件,事件原型参考DownloadStateChangedCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + statechanged?: string; +} + +/** + * 下载任务状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ +type PlusDownloaderDownloadState = undefined | 0 | 1 | 2 | 3 | 4 | 5 | -1; + +/** + * 下载任务参数 + * 在创建下载任务时设置的参数,如设置下载任务使用的HTTP协议类型、优先级等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ +interface PlusDownloaderDownloadOptions { + /** + * 网络请求类型 + * 支持http协议的“GET”、“POST”,默认为“GET”请求。 + * - GET: GET请求 + * - POST: POST请求 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + method?: 'GET' | 'POST'; + /** + * POST请求时提交的数据 + * 仅在网络请求类型method设置为"POST"时有效,"GET"请求时忽略此数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + data?: string; + /** + * 下载文件保存的路径 + * 保存文件路径仅支持以"_downloads/"、"_doc/"、"_documents/"开头的字符串。 + * 文件路径以文件后缀名结尾(如"_doc/download/a.doc")表明指定保存文件目录及名称,以“/”结尾则认为指定保存文件的目录(此时程序自动生成文件名)。 + * 如果指定的文件已经存在,则自动在文件名后面加"(i)",其中i为数字,如果文件名称后面已经是此格式,则数字i递增,如"download(1).doc"。 + * 默认保存目录为("_downloads"),并自动生成文件名称。 + * - _doc/: 应用私有文档目录 + * - _documents/: 共享文档目录 + * - _downloads/: 共享下载目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + filename?: '_doc/' | '_documents/' | '_downloads/'; + /** + * 下载任务的优先级 + * 数值类型,数值越大优先级越高,默认优先级值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + priority?: number; + /** + * 下载任务超时时间 + * 数值类型,单位为s(秒),默认值为120s。 + * 超时时间为服务器响应请求的时间(不是下载任务完成的总时间),如果设置为0则表示永远不超时。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + timeout?: number; + /** + * 下载任务重试次数 + * 数值类型,默认为重试3次。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + retry?: number; + /** + * 下载任务重试间隔时间 + * 数值类型,单位为s(秒),默认值为30s。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/downloader.html](http://www.html5plus.org/doc/zh_cn/downloader.html) + */ + retryInterval?: number; +} + +/** + * Fingerprint模块管理指纹识别。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ +interface PlusFingerprint { + /** + * JSON对象,指纹识别认证参数 + * 用于设置指纹识别认证界面显示的提示信息等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + AuthenticateOptions?: PlusFingerprintAuthenticateOptions; + /** + * JSON对象,指纹识别错误信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + FingerprintError?: PlusFingerprintFingerprintError; + /** + * 当前设备环境是否支持指纹识别 + * 目前还有很多设备没有指纹识别模块,需要调用此方法判断是否可使用指纹识别功能。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + isSupport(): boolean; + /** + * 当前设备是否设置密码锁屏 + * 如果设备没有设置密码锁屏,则无法使用指纹识别功能,建议调用指纹识别前先使用此接口检查。 + * 调用plus.fingerprint.authenticate会返回失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + isKeyguardSecure(): boolean; + /** + * 当前设备是否已经录入指纹 + * 如果设备没有录入指纹,则无法使用指纹识别功能,建议调用指纹识别前先使用此接口检查。 + * 调用plus.fingerprint.authenticate会返回失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + isEnrolledFingerprints(): boolean; + /** + * 指纹识别认证 + * 用户可以开始输入指纹进行识别,如果认证成功则触发successCB回调,识别失败则触发errorCB回调返回错误信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + authenticate(successCB?: () => void, errorCB?: (result: PlusFingerprintFingerprintError) => void, options?: PlusFingerprintAuthenticateOptions): void; + /** + * 取消指纹识别认证 + * 取消当前正在处理的指纹识别认证操作。 + * 如果当前没有进行指纹识别则不进行任何操作;如果当前正在进行指纹识别则触发错误回调(错误码为“CANCEL”)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + cancel(): void; +} + +/** + * JSON对象,指纹识别认证参数 + * 用于设置指纹识别认证界面显示的提示信息等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ +interface PlusFingerprintAuthenticateOptions { + /** + * 在指纹识别过程中显示在界面上的提示信息 + * 如果指纹识别认证过程中不显示提示框,则不显示此信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + message?: string; +} + +/** + * JSON对象,指纹识别错误信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ +interface PlusFingerprintFingerprintError { + /** + * 不支持指纹识别 + * 当前设备不支持指纹识别功能时返回此错误,错误代码常量值为1。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + UNSUPPORT?: number; + /** + * 设备未设置密码锁屏 + * 当前设备为设置密码锁屏导致无法使用指纹识别功能时返回此错误,错误代码常量值为2。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + KEYGUARD_INSECURE?: number; + /** + * 未录入指纹识别 + * 当前设备未录入指纹导致无法使用指纹识别功能时返回此错误,错误代码常量值为3。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + FINGERPRINT_UNENROLLED?: number; + /** + * 指纹识别不匹配 + * 用户指纹识别认证不通过时返回此错误,错误代码常量值为4。 + * 用户每次尝试指纹识别认证未通过都会触发此错误,此时还可以继续识别认证。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + AUTHENTICATE_MISMATCH?: number; + /** + * 指纹识别次数超过限制 + * 用户多次指纹识别认证不通过时返回此错误,错误代码常量值为5。 + * 通常出现此错误后系统会锁定一段时间禁止使用指纹识别,如果再次调用指纹识别认证会立即返回此错误,因此出现此错误时应该提示用户使用其它方式进行认证。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + AUTHENTICATE_OVERLIMIT?: number; + /** + * 取消指纹识别 + * 用户取消指纹识别认证时返回此错误,错误代码常量值为6。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + CANCEL?: number; + /** + * 未知错误 + * 其它未知错误,错误代码常量值为7。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + UNKNOWN_ERROR?: number; + /** + * 错误代码 + * 取值范围为FingerprintError对象的错误常量值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + code?: number; + /** + * 错误描述信息 + * 详细错误描述信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/fingerprint.html](http://www.html5plus.org/doc/zh_cn/fingerprint.html) + */ + message?: string; +} + +/** + * Gallery模块管理系统相册,支持从相册中选择图片或视频文件、保存图片或视频文件到相册等功能。通过plus.gallery获取相册管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ +interface PlusGallery { + /** + * JSON对象,从相册中选择文件的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + GalleryOptions?: PlusGalleryGalleryOptions; + /** + * 相册选择文件过滤类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + GalleryFilter?: PlusGalleryGalleryFilter; + /** + * 保存图片到相册成功事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + GallerySaveEvent?: PlusGalleryGallerySaveEvent; + /** + * JSON对象,弹出拍照或摄像界面指示位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + PopPosition?: PlusGalleryPopPosition; + /** + * 从系统相册选择文件(图片或视频) + * 从系统相册中选择图片或视频文件。每次仅能选择一个文件,选择后将返回选择的文件路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + pick(succesCB?: (result: string) => void, errorCB?: (result: any) => void, options?: PlusGalleryGalleryOptions): void; + /** + * 保存文件到系统相册中 + * 保存文件到系统相册中。 + * 每次仅能保存一个文件,支持图片类型(jpg/jpeg、png、bmp等格式)和视频文件(3gp、mov等格式)。 + * 若保存的文件系统不支持,则通过errorCB返回错误信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + save(path ?: string, succesCB?: (result: PlusGalleryGallerySaveEvent) => void, errorCB?: (result: any) => void): void; +} + +/** + * JSON对象,从相册中选择文件的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ +interface PlusGalleryGalleryOptions { + /** + * 是否显示系统相册文件选择界面的动画 + * 可取值true、false,默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + animation?: boolean; + /** + * 选择文件保存的路径 + * 某些系统不能直接使用系统相册的路径,这时需要将选择的文件保存到应用可访问的目录中,可通过此参数设置保存文件的路径。 + * 如果路径中包括文件后缀名称,则表明指定文件路径及名称,否则仅指定文件保存目录,文件名称自动生成。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + filename?: string; + /** + * 相册中选择文件类型过滤器 + * 系统相册选择器中可选择的文件类型,可设置为仅选择图片文件(“image”)、视频文件(“video”)或所有文件(“none”),默认值为“image”。 + * - image: 仅可选择图片文件 + * - video: 仅可选择视频文件 + * - none: 可选择图片或视频文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + filter?: 'image' | 'video' | 'none'; + /** + * 最多选择的图片数量 + * 仅在支持多选时有效,取值范围为1到Infinity,默认值为Infinity,即不限制选择的图片数。 + * 如果设置的值非法则使用默认值Infinity。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + maximum?: number; + /** + * 是否支持多选图片 + * 可从系统相册中选择多张图片,选择图片后通过GalleryMultiplePickSuccessCallback回调返回选择的图片。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + multiple?: boolean; + /** + * 超过最多选择图片数量事件 + * 使用相册多选图片时,可通过maximum属性设置最多选择的图片数量,当用户操作选择的数量大于此时触发此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + onmaxed?: () => void; + /** + * 相册选择界面弹出指示区域 + * 对于大屏幕设备如iPad,相册选择界面为弹出窗口,此时可通过此参数设置弹出窗口位置。 + * 其为JSON对象,格式如{top:"10px",left:"10px",width:"200px",height:"200px"},所有值为像素值,左上坐标相对于容器的位置,默认弹出位置为屏幕居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + popover?: PlusGalleryPopPosition; + /** + * 已选择的图片路径列表 + * 仅在多图片选择时生效,相册选择界面将选中指定的图片路径列表。 + * 如果指定的路径无效,则忽略此项;如果指定的路径数超过maximum属性指定的最大选择数目则超出的图片不选中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + selected?: any []; + /** + * 是否使用系统相册文件选择界面 + * multiple属性设置为true时,如果系统自带相册选择控件时则优先使用,否则使用5+统一相册选择控件;设置为false则不使用系统自带相册选择控件,直接使用5+统一相册选择界面。 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + system?: boolean; +} + +/** + * 相册选择文件过滤类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ +interface PlusGalleryGalleryFilter { + /** + * 仅可选择图片文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + image?: string; + /** + * 仅可选择视频文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + video?: string; + /** + * 不过滤,可选择图片或视频文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + none?: string; +} + +/** + * 保存图片到相册成功事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ +interface PlusGalleryGallerySaveEvent { + /** + * 保存到相册的图片路径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + path?: string; +} + +/** + * JSON对象,弹出拍照或摄像界面指示位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ +interface PlusGalleryPopPosition { + /** + * 指示区域距离容器顶部的距离 + * 弹出拍照或摄像窗口指示区域距离容器顶部的距离,单位支持像素值(如"100px")和百分比(如"50%"),如不写单位则为像素值值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + top?: string; + /** + * 指示区域距离容器左侧的距离 + * 弹出拍照或摄像窗口指示区域距离容器左侧的距离,单位支持像素值(如"100px")和百分比(如"50%"),如不写单位则为像素值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + left?: string; + /** + * 指示区域的宽度 + * 弹出拍照或摄像窗口指示区域的宽度,单位支持像素值(如"100px")和百分比(如"50%"),如不写单位则为像素值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + width?: string; + /** + * 指示区域的高度 + * 弹出拍照或摄像窗口指示区域的高度,单位支持像素值(如"100px")和百分比(如"50%"),如不写单位则为像素值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/gallery.html](http://www.html5plus.org/doc/zh_cn/gallery.html) + */ + height?: string; +} + +/** + * Geolocation模块管理设备位置信息,用于获取地理位置信息,如经度、纬度等。通过plus.geolocation可获取设备位置管理对象。虽然W3C已经提供标准API获取位置信息,但在某些平台存在差异或未实现,为了保持各平台的统一性,定义此规范接口获取位置信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ +interface PlusGeolocation { + /** + * JSON对象,设备位置信息数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + Position?: PlusGeolocationPosition; + /** + * JSON对象,地址信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + Address?: PlusGeolocationAddress; + /** + * JSON对象,地理坐标信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + Coordinates?: PlusGeolocationCoordinates; + /** + * JSON对象,监听设备位置信息参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + PositionOptions?: PlusGeolocationPositionOptions; + /** + * JSON对象,定位错误信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + GeolocationError?: PlusGeolocationGeolocationError; + /** + * 获取当前设备位置信息 + * 位置信息将通过手机GPS设备或其它信息如IP地址、移动网络信号获取,由于获取位置信息可能需要较长的时间,当成功获取位置信息后将通过successCB回调函数返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + getCurrentPosition(successCB?: (result: PlusGeolocationPosition) => void, errorCB?: (result: PlusGeolocationGeolocationError) => void, options?: PlusGeolocationPositionOptions): void; + /** + * 监听设备位置变化信息 + * 位置信息将通过手机GPS设备或其它信息如IP地址、移动网络信号获取。 + * 当位置信息更新后将通过successCB回调函数返回。 + * 位置信息获取失败则调用回调函数errorCB。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + watchPosition(successCB?: (result: PlusGeolocationPosition) => void, errorCB?: (result: PlusGeolocationGeolocationError) => void, option?: PlusGeolocationPositionOptions): number; + /** + * 关闭监听设备位置信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + clearWatch(watchId?: number): void; +} + +/** + * JSON对象,设备位置信息数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ +interface PlusGeolocationPosition { + /** + * 地理坐标信息,包括经纬度、海拔、速度等信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + coords?: PlusGeolocationCoordinates; + /** + * 获取到地理坐标信息的坐标系类型 + * 可取以下坐标系类型: + * "gps":表示WGS-84坐标系; + * "gcj02":表示国测局经纬度坐标系; + * "bd09":表示百度墨卡托坐标系; + * "bd09ll":表示百度经纬度坐标系。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + coordsType?: string; + /** + * 获取到地理坐标的时间戳信息 + * 时间戳值为从1970年1月1日至今的毫秒数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + timestamp?: number; + /** + * 获取到地理位置对应的地址信息 + * 获取地址信息需要连接到服务器进行解析,所以会消耗更多的资源,如果不需要获取地址信息可通过设置PositionOptions参数的geocode属性值为false避免获取地址信息。 + * 如果没有获取到地址信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + address?: PlusGeolocationAddress; + /** + * 获取完整地址描述信息 + * 如果没有获取到地址信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + addresses?: string; +} + +/** + * JSON对象,地址信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ +interface PlusGeolocationAddress { + /** + * 国家 + * 如“中国”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + country?: string; + /** + * 省份名称 + * 如“北京市”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + province?: string; + /** + * 城市名称 + * 如“北京市”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + city?: string; + /** + * 区(县)名称 + * 如“朝阳区”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + district?: string; + /** + * 街道信息 + * 如“酒仙桥路”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + street?: string; + /** + * 获取街道门牌号信息 + * 如“3号”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + streetNum?: string; + /** + * POI信息 + * 如“电子城.国际电子总部”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + poiName?: string; + /** + * 邮政编码 + * 如“100016”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + postalCode?: string; + /** + * 城市代码 + * 如“010”,如果无法获取此信息则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + cityCode?: string; +} + +/** + * JSON对象,地理坐标信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ +interface PlusGeolocationCoordinates { + /** + * 坐标纬度值 + * 数据类型对象,地理坐标中的纬度值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + latitude?: number; + /** + * 坐标经度值 + * 数据类型对象,地理坐标中的经度值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + longitude?: number; + /** + * 海拔信息 + * 数据类型对象,如果无法获取此信息,则此值为空(null)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + altitude?: number; + /** + * 地理坐标信息的精确度信息 + * 数据类型对象,单位为米,其有效值必须大于0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + accuracy?: number; + /** + * 海拔的精确度信息 + * 数据类型对象,单位为米,其有效值必须大于0。如果无法获取海拔信息,则此值为空(null)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + altitudeAccuracy?: number; + /** + * 表示设备移动的方向 + * 数据类型对象,范围为0到360,表示相对于正北方向的角度。如果无法获取此信息,则此值为空(null)。如果设备没有移动则此值为NaN。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + heading?: number; + /** + * 表示设备移动的速度 + * 数据类型对象,单位为米每秒(m/s),其有效值必须大于0。如果无法获取速度信息,则此值为空(null)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + speed?: number; +} + +/** + * JSON对象,监听设备位置信息参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ +interface PlusGeolocationPositionOptions { + /** + * 是否高精确度获取位置信息 + * 高精度获取表示需要使用更多的系统资源,默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + enableHighAccuracy?: boolean; + /** + * 获取位置信息的超时时间 + * 单位为毫秒(ms),默认值为不超时。如果在指定的时间内没有获取到位置信息则触发错误回调函数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + timeout?: number; + /** + * 获取位置信息的间隔时间 + * 单位为毫秒(ms),默认值为5000(即5秒)。调用plus.geolocation.watchPosition时为更新位置信息的间隔时间。 + * 注意:在不同定位模块下支持范围值可能不同,如百度定位模块的间隔范围为大于等于1秒,如果设置的值小于最小值则使用最小值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + maximumAge?: number; + /** + * 优先使用的定位模块 + * 可取以下供应者: + * "system":表示系统定位模块,支持wgs84坐标系; + * "baidu":表示百度定位模块,支持gcj02/bd09/bd09ll坐标系; + * "amap":表示高德定位模板,支持gcj02坐标系。 + * 默认值按以下优先顺序获取(amap>baidu>system),若指定的provider不存在或无效则返回错误回调。 + * 注意:百度/高德定位模块需要配置百度/高德地图相关参数才能正常使用。 + * - system: 优先使用系统定位模块 + * - baidu: 优先使用百度定位模块 + * - amap: 优先使用高德定位模块 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + provider?: 'system' | 'baidu' | 'amap'; + /** + * 指定获取的定位数据坐标系类型 + * 可取以下坐标系类型: + * "wgs84":表示WGS-84坐标系; + * "gcj02":表示国测局经纬度坐标系; + * "bd09":表示百度墨卡托坐标系; + * "bd09ll":表示百度经纬度坐标系; + * provider为"system"时,默认使用"wgs84"坐标系;provider为"baidu"时,默认使用"gcj02"坐标系;provider为"amap"时,默认使用"gcj02"坐标系。 + * 如果设置的坐标系类型provider不支持,则返回错误。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + coordsType?: string; + /** + * 是否解析地址信息 + * 解析的地址信息保存到Position对象的address、addresses属性中,true表示解析地址信息,false表示不解析地址信息,返回的Position对象的address、addresses属性值为undefined,默认值为true。 + * 如果解析地址信息失败则返回的Position对象的address、addresses属性值为null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + geocode?: boolean; +} + +/** + * JSON对象,定位错误信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ +interface PlusGeolocationGeolocationError { + /** + * 访问权限被拒绝 + * 系统不允许程序获取定位功能,错误代码常量值为1。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + PERMISSION_DENIED?: number; + /** + * 位置信息不可用 + * 无法获取有效的位置信息,错误代码常量值为2。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + POSITION_UNAVAILABLE?: number; + /** + * 获取位置信息超时 + * 无法在指定的时间内获取位置信息,错误代码常量值为3。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + TIMEOUT?: number; + /** + * 未知错误 + * 其它未知错误导致无法获取位置信息,错误代码常量值为4。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + UNKNOWN_ERROR?: number; + /** + * 错误代码 + * 取值范围为GeolocationError对象的常量值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + code?: number; + /** + * 错误描述信息 + * 详细错误描述信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/geolocation.html](http://www.html5plus.org/doc/zh_cn/geolocation.html) + */ + message?: string; +} + +/** + * iBeacon模块用于搜索附件的iBeacon设备(*请使用HBuilderX并更新到最新版本*)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ +interface PlusIbeacon { + /** + * iBeacon设备信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + IBeaconInfo?: PlusIbeaconIBeaconInfo; + /** + * 开始搜索附近的iBeacon设备 + * 搜索成功后触发successCB回调,失败触发errorCB回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + startBeaconDiscovery(uuids?: any [], ignoretoothAvailable?: boolean, success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 停止搜索附近的iBeacon设备 + * 取消成功后触发successCB回调,失败触发errorCB回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + stopBeaconDiscovery(success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 获取已搜索到的iBeacon设备 + * 获取成功后触发successCB回调,失败触发errorCB回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + getBeacons(success?: (result: any) => void, fail?: (result: any) => void, complete?: (result: any) => void): void; + /** + * 监听iBeacon设备更新 + * iBeacon设备更新后触发updateCB回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + onBeaconUpdate(updateCB?: (result: any) => void): void; + /** + * 监听iBeacon服务状态变化 + * iBeacon服务状态变化时触发changeCB回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + onBeaconServiceChange(changeCB?: (result: any) => void): void; +} + +/** + * iBeacon设备信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ +interface PlusIbeaconIBeaconInfo { + /** + * iBeacon设备广播的uuid + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + uuid?: string; + /** + * iBeacon设备的主id + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + major?: string; + /** + * iBeacon设备的次id + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + minor?: string; + /** + * iBeacon设备的距离 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + proximity?: number; + /** + * iBeacon设备的距离精度信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + accuracy?: number; + /** + * iBeacon设备的信号强度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ibeacon.html](http://www.html5plus.org/doc/zh_cn/ibeacon.html) + */ + rssi?: string; +} + +/** + * IO模块管理本地文件系统,用于对文件系统的目录浏览、文件的读取、文件的写入等操作。通过plus.io可获取文件系统管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIo { + /** + * 文件系统中的目录对象,用于管理特定的本地目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + DirectoryEntry?: PlusIoDirectoryEntry; + /** + * 读取目录信息对象,用于获取目录中包含的文件及子目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + DirectoryReader?: PlusIoDirectoryReader; + /** + * 文件系统中的文件数据对象,用于获取文件的数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + File?: PlusIoFile; + /** + * 文件系统中的文件对象,用于管理特定的本地文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + FileEntry?: PlusIoFileEntry; + /** + * 文件系统中的读取文件对象,用于获取文件的内容 + * FileReader对象是从设备文件系统读取文件FileReader对象是从设备文件系统读取文件的一种方式,文件以文本或者Base64编码的字符串形式读出来。 + * 用户注册自己的事件监听器来接收loadstart、progress、load、loadend、error和abort事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + FileReader?: PlusIoFileReader; + /** + * 文件系统中的写文件对象,用于写入文件内容 + * FileWriter对象是从设备文件系统写入文件FileWriter对象是从设备文件系统写入文件的一种方式,用户注册自己的事件监听器来接收writestart、progress、write、writeend、error和abort事件。 + * 一个FileWriter对象是为单个文件的操作而创建。你可以使用该对象多次对相应文件进行写入操作。FileWriter维护该文件的指针位置及长度属性,这样你就可以寻找和写入文件的任何地方。 + * 默认情况下,FileWriter从文件的开头开始写入(将覆盖现有数据)。FileWriter对象的seek方法可设置文件操作指定位置,如fw.seek(fw.length-1)写入操作就会从文件的末尾开始。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + FileWriter?: PlusIoFileWriter; + /** + * 文件系统对象,用于管理特定本地文件目录 + * 文件系统对象表示一个应用可访问的根目录。name属性用于标识此根目录的名称,与LocalFileSystem中的文件系统类型一一对应。root属性为文件目录对象,用于实际操作文件系统,参考DirectoryEntry。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + FileSystem?: PlusIoFileSystem; + /** + * JSON对象,获取文件操作的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + Flags?: PlusIoFlags; + /** + * JSON对象,保存文件或目录的状态信息对象 + * 可通过DirectoryEntry或FileEntry对象的getMetaData方法获取 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + Metadata?: PlusIoMetadata; + /** + * 文件或目录操作事件对象 + * 所有文件或目录操作事件回调函数中都创建该对象的实例。 + * 该对象从DOMEvent继承而来,可通过该其target属性获取事件触发的文件或目录操作对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + FileEvent?: PlusIoFileEvent; + /** + * 文件路径类型 + * 在文件系统中的文件路径需转换成URL格式,已方便runtime快速加载。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + URLType?: PlusIoURLType; + /** + * 相对路径URL + * 只能在扩展API中使用,相对于基座提供的特定目录,以“_”开头。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + RelativeURL?: PlusIoRelativeURL; + /** + * 本地路径URL + * 可在html页面中直接访问本地资源,以“file:///”开头,后面跟随系统的绝对路径。 + * 如示例:“file:///D:/res/hello.html”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + LocalURL?: PlusIoLocalURL; + /** + * 网络路径URL + * 可在html页面中以网络资源模式访问本地资源,以“http://”开头,后面跟随相对路径。 + * 如示例:“http://localhost:13131/_www/res/icon.png”,其中“_www”字段可支持类型与相对路径URL一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + RemoteURL?: PlusIoRemoteURL; + /** + * 应用运行资源目录常量 + * 本地文件系统常量,Number类型,固定值1。应用运行资源目录,仅本应用可访问。 + * 为了确保应用资源的安全性,此目录只可读。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + PRIVATE_WWW?: number; + /** + * 应用私有文档目录常量 + * 本地文件系统常量,Number类型,固定值2。应用私有文档目录,仅本应用可读写。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + PRIVATE_DOC?: number; + /** + * 程序公用文档目录常量 + * 本地文件系统常量,Number类型,固定值3。程序公用文档目录,所有应用可读写。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + PUBLIC_DOCUMENTS?: number; + /** + * 程序公用下载目录常量 + * 本地文件系统常量,Number类型,固定值4。程序公用下载目录,所有应用可读写。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + PUBLIC_DOWNLOADS?: number; + /** + * 请求本地文件系统对象 + * 获取指定的文件系统,可通过type指定获取文件系统的类型。 + * 获取指定的文件系统对象成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + requestFileSystem(type?: number, succesCB?: (result: PlusIoFileSystem) => void, errorCB?: (result: any) => void): void; + /** + * 通过URL参数获取目录对象或文件对象 + * 快速获取指定的目录或文件操作对象,如通过URL值“_www/test.html”可直接获取文件操作对象。 + * url值可支持相对路径URL、本地路径URL。 + * 获取指定的文件或目录操作对象成功通过succesCB回调返回,如果指定URL路径或文件不存在则失败通过errorCB回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + resolveLocalFileSystemURL(url ?: string, succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 将本地URL路径转换成平台绝对路径 + * 绝对路径符合各平台文件路径格式,通常用于Native.JS调用系统原生文件操作API,也可以在前面添加“file://”后在html页面中直接使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + convertLocalFileSystemURL(url?: string): string; + /** + * 将平台绝对路径转换成本地URL路径 + * 绝对路径符合各平台文件路径格式,转换后变成RelativeURL类型格式。 + * 功能与convertLocalFileSystemURL方法相反,将绝对路径转换成相对路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + convertAbsoluteFileSystem(path?: string): string; +} + +/** + * 文件系统中的目录对象,用于管理特定的本地目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoDirectoryEntry { + /** + * 操作对象的是否为文件,DirectoryEntry对象固定其值为false + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + isFile?: boolean; + /** + * 操作对象是否为目录,DirectoryEntry对象固定其值为true + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + isDirectory?: boolean; + /** + * 目录操作对象的名称,不包括路径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + name?: string; + /** + * 目录操作对象的完整路径,文件系统的绝对路径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + fullPath?: string; + /** + * 文件操作对象所属的文件系统对象,参考FileSystem + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + fileSystem?: PlusIoFileSystem; + /** + * 获取目录的属性 + * 用于获取文件或目录的属性信息。 + * 获取属性信息成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + getMetadata(succesCB?: (result: PlusIoMetadata) => void, errorCB?: (result: any) => void, recursive?: boolean): void; + /** + * 移动目录 + * 以下情况移动目录将会导致失败: + * 将父目录移动到子目录中; + * 要移动到的目标目录无效; + * 要移动到的目标路径被文件占用; + * 要移动到的目标目录已经存在并且不为空。 + * 移动目录成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + moveTo(parent?: PlusIoDirectoryEntry, newName?: string, succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 拷贝目录 + * 以下情况拷贝目录将会导致失败: + * 将父目录拷贝到子目录中; + * 要拷贝到的目标目录无效; + * 要拷贝到的目标路径被文件占用; + * 要拷贝到的目标目录已经存在并且不为空。 + * 拷贝目录成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + copyTo(parent?: PlusIoDirectoryEntry, newName?: string, succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 获取目录路径转换为URL地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + toURL(): string; + /** + * 获取目录路径转换为本地路径URL地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + toLocalURL(): string; + /** + * 获取目录路径转换为网络路径URL地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + toRemoteURL(): string; + /** + * 删除目录 + * 以下情况删除目录将会导致失败: + * 目录中存在文件; + * 删除根目录; + * 删除目录成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + remove(succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 获取目录所属的父目录 + * 获取父目录成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + getParent(succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 创建目录读取对象 + * 创建一个目录读取对象,用户读取目下的文件及子目录。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + createReader(): PlusIoDirectoryReader; + /** + * 创建或打开子目录 + * 创建或打开当前目录指定的目录。 + * 创建或打开目录操作成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + getDirectory(path?: string, flag?: PlusIoFlags, succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 创建或打开文件 + * 创建或打开当前目录下指定的文件。 + * 创建或打开文件操作对象成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + getFile(path?: string, flag?: PlusIoFlags, succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 递归删除目录 + * 删除目录将会删除其下的所有文件及子目录 + * 不能删除根目录,如果操作删除根目录将会删除目录下的文件及子目录,不会删除根目录自身。 + * 删除目录成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + removeRecursively(succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; +} + +/** + * 读取目录信息对象,用于获取目录中包含的文件及子目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoDirectoryReader { + /** + * 获取当前目录中的所有文件和子目录 + * 获取当前目录下的所有文件和子目录。 + * 获取操作成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + readEntries(succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; +} + +/** + * 文件系统中的文件数据对象,用于获取文件的数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoFile { + /** + * 文件数据对象的数据大小,单位为字节 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + size?: number; + /** + * 文件数据对象MIME类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + type?: string; + /** + * 文件数据对象的名称,不包括路径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + name?: string; + /** + * 文件对象的最后修改时间 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + lastModifiedDate?: Date; + /** + * 获取文件指定的数据内容 + * 获取文件指定的数据内容,其中end必须大于start。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + slice(start?: number, end?: number): PlusIoFile; + /** + * 关闭文件数据对象 + * 当文件数据对象不再使用时,可通过此方法关闭,释放系统资源。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + close(): void; +} + +/** + * 文件系统中的文件对象,用于管理特定的本地文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoFileEntry { + /** + * 文件操作对象的是否为文件,FileEntry对象固定其值为true + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + isFile?: boolean; + /** + * 文件操作对象是否为目录,FileEntry对象固定其值为false + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + isDirectory?: boolean; + /** + * 文件操作对象的名称,不包括路径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + name?: string; + /** + * 文件操作对象的完整路径,文件系统的绝对路径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + fullPath?: string; + /** + * 文件操作对象所属的文件系统对象,参考FileSystem + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + fileSystem?: PlusIoFileSystem; + /** + * 获取文件的属性信息 + * 用于获取文件的属性信息。 + * 获取属性信息成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + getMetadata(succesCB?: (result: PlusIoMetadata) => void, errorCB?: (result: any) => void): void; + /** + * 移动文件 + * 以下情况移动目录将会导致失败: + * 要移动到的目标目录无效; + * 要移动到的目标路径被其它文件占用; + * 移动文件成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + moveTo(parent?: PlusIoDirectoryEntry, newName?: string, succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 拷贝文件 + * 以下情况拷贝文件将会导致失败: + * 要拷贝到的目标目录无效; + * 要拷贝到的目标路径被其它文件占用; + * 拷贝文件成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + copyTo(parent?: PlusIoDirectoryEntry, newName?: string, succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 获取文件路径转换为URL地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + toURL(): string; + /** + * 获取文件路径转换为本地路径URL地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + toLocalURL(): string; + /** + * 获取文件路径转换为网络路径URL地址 + * URL地址格式为以“http://localhost:13131/”开头的网络路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + toRemoteURL(): string; + /** + * 删除文件 + * 删除文件成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + remove(succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 获取文件所属的父目录 + * 获取父目录成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + getParent(succesCB?: (result: PlusIoDirectoryEntry) => void, errorCB?: (result: any) => void): void; + /** + * 获取文件关联的写文件操作对象FileWriter + * 获取写文件操作对象成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + createWriter(succesCB?: (result: PlusIoFileWriter) => void, errorCB?: (result: any) => void): void; + /** + * 获取文件数据对象 + * 获取文件数据对象成功通过succesCB回调返回,失败则通过errorCB返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + file(succesCB?: (result: PlusIoFile) => void, errorCB?: (result: any) => void): void; +} + +/** + * 文件系统中的读取文件对象,用于获取文件的内容 + * FileReader对象是从设备文件系统读取文件FileReader对象是从设备文件系统读取文件的一种方式,文件以文本或者Base64编码的字符串形式读出来。 + * 用户注册自己的事件监听器来接收loadstart、progress、load、loadend、error和abort事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoFileReader { + /** + * 值为0,开始读取文件状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + EMPTY?: number; + /** + * 值为1,正在读取文件状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + LOADING?: number; + /** + * 值为2,读文件操作完成状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + DONE?: number; + /** + * 当前读取文件所处的状态 + * 可取上面定义的常量值,EMPTY(0)、LOADING(1)、DONE(2)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + readyState?: number; + /** + * 已读取文件的内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + result?: string; + /** + * 文件操作错误代码 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + error?: number; + /** + * 读取文件开始时的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onloadstart?: (result: PlusIoFileEvent) => void; + /** + * 读取文件过程中的回调函数 + * 用于获取文件读取进度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onprogress?: (result: PlusIoFileEvent) => void; + /** + * 读取文件成功完成的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onload?: (result: PlusIoFileEvent) => void; + /** + * 取消读取文件时的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onabort?: (result: PlusIoFileEvent) => void; + /** + * 文件读取操作失败时调用的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onerror?: (result: PlusIoFileEvent) => void; + /** + * 文件读取操作完成时的回调函数 + * 不管成功或失败都会触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onloadend?: (result: PlusIoFileEvent) => void; + /** + * 终止文件读取操作 + * 读取文件操作开始后,可通过此方法取消读取文件。 + * 调用此方法后将触发文件读取对象的onabort事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + abort(): void; + /** + * 以URL编码格式读取文件数据内容 + * 读取文件的数据内容,并将数据内容进行URL编码。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + readAsDataURL(file?: PlusIoFile, encoding ?: string): void; + /** + * 以文本格式读取文件数据内容 + * 读取文件的数据内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + readAsText(file?: PlusIoFile, encoding ?: string): void; +} + +/** + * 文件系统中的写文件对象,用于写入文件内容 + * FileWriter对象是从设备文件系统写入文件FileWriter对象是从设备文件系统写入文件的一种方式,用户注册自己的事件监听器来接收writestart、progress、write、writeend、error和abort事件。 + * 一个FileWriter对象是为单个文件的操作而创建。你可以使用该对象多次对相应文件进行写入操作。FileWriter维护该文件的指针位置及长度属性,这样你就可以寻找和写入文件的任何地方。 + * 默认情况下,FileWriter从文件的开头开始写入(将覆盖现有数据)。FileWriter对象的seek方法可设置文件操作指定位置,如fw.seek(fw.length-1)写入操作就会从文件的末尾开始。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoFileWriter { + /** + * 值为0,写文件初始化状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + INIT?: number; + /** + * 值为1,正在写入文件状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + WRITING?: number; + /** + * 值为2,写文件操作完成状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + DONE?: number; + /** + * 当前写入文件所处的状态 + * 可取上面定义的常量值,INIT(0)、WRITING(1)、DONE(2)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + readyState?: number; + /** + * 文件当前的长度,单位为字节 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + length?: number; + /** + * 文件当前操作的指针位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + position?: number; + /** + * 文件写入操作错误代码 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + error?: number; + /** + * 写入文件开始时的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onwritestart?: (result: PlusIoFileEvent) => void; + /** + * 写入文件过程中的回调函数 + * 用于获取文件读取进度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onprogress?: (result: PlusIoFileEvent) => void; + /** + * 写入文件成功完成的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onwrite?: (result: PlusIoFileEvent) => void; + /** + * 取消写入文件时的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onabort?: (result: PlusIoFileEvent) => void; + /** + * 文件写入操作失败时调用的回调函数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onerror?: (result: PlusIoFileEvent) => void; + /** + * 文件写入操作完成时的回调函数 + * 不管成功或失败都会触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + onwriteend?: (result: PlusIoFileEvent) => void; + /** + * 终止文件写入操作 + * 写入文件数据操作开始后,可通过此方法取消写入文件数据操作。 + * 调用此方法后将触发文件写入对象的onabort事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + abort(): void; + /** + * 定位文件操作位置 + * 定位文件的操作位置,有效值为0到文件的总长度减1。 + * 0表示文件的起始位置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + seek(position?: number): void; + /** + * 按照指定长度截断文件 + * 从文件当前定位的位置开始,按照指定长度截断文件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + truncate(length ?: number): void; + /** + * 向文件中写入数据 + * 从文件当前定位的位置开始,写入数据到文件中。 + * 如果文件中已经存在数据,新写入的数据将覆盖已有数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + write(data ?: string): void; +} + +/** + * 文件系统对象,用于管理特定本地文件目录 + * 文件系统对象表示一个应用可访问的根目录。name属性用于标识此根目录的名称,与LocalFileSystem中的文件系统类型一一对应。root属性为文件目录对象,用于实际操作文件系统,参考DirectoryEntry。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoFileSystem { + /** + * 文件系统的名称 + * 值为文件系统类型常量值字符串,如“PRIVATE_WWW”、“PRIVATE_DOCUMENTS”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + name?: string; + /** + * 文件系统的根目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + root?: PlusIoDirectoryEntry; +} + +/** + * JSON对象,获取文件操作的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoFlags { + /** + * 是否创建对象标记 + * 指示如果文件或目录不存在时是否进行创建,默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + create?: boolean; + /** + * 反向操作标记 + * 其本身没有任何效果,需与create属性值设置为true时一起使用,如果目标文件或目录已经存在则会导致文件或目录打开失败,默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + exclusive?: boolean; +} + +/** + * JSON对象,保存文件或目录的状态信息对象 + * 可通过DirectoryEntry或FileEntry对象的getMetaData方法获取 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoMetadata { + /** + * 文件或目录的最后修改时间 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + modificationTime?: Date; + /** + * 文件的大小 + * 若获取的是目录对象的属性则值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + size?: number; + /** + * 包含的子目录数 + * 若自身是文件则其值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + directoryCount?: number; + /** + * 目录的文件数 + * 若自身是文件则其值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + fileCount?: number; +} + +/** + * 文件或目录操作事件对象 + * 所有文件或目录操作事件回调函数中都创建该对象的实例。 + * 该对象从DOMEvent继承而来,可通过该其target属性获取事件触发的文件或目录操作对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoFileEvent { + /** + * 文件或目录操作对象 + * 在不同的回调中指向的对象不同,可指向的对象包括:FileEntry、DirectoryEntry、FileReader、FileWriter。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + target?: PlusIoDirectoryEntry; +} + +/** + * 文件路径类型 + * 在文件系统中的文件路径需转换成URL格式,已方便runtime快速加载。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoURLType { + /** + * 相对路径URL + * 只能在扩展API中使用,相对于基座提供的特定目录,以“_”开头。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + RelativeURL?: PlusIoRelativeURL; + /** + * 本地路径URL + * 可在html页面中直接访问本地资源,以“file:///”开头,后面跟随系统的绝对路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + LocalURL?: PlusIoLocalURL; + /** + * 网络路径URL + * 可在html页面中以网络资源模式访问本地资源,以“http://”开头,后面跟随相对路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + RomoteURL?: string; +} + +/** + * 相对路径URL + * 只能在扩展API中使用,相对于基座提供的特定目录,以“_”开头。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +interface PlusIoRelativeURL { + /** + * 应用资源目录 + * 保存应用的所有html、css、js等资源文件,与文件系统中根目录PRIVATE_WWW一致,后面加相对路径如“_www/res/icon.png”。 + * 注意:应用资源目录是只读目录,只能读取次目录下的文件,不能修改或新建。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + _www?: string; + /** + * 应用私有文档目录 + * 用于保存应用运行期业务逻辑数据,与文件系统中根目录PRIVATE_DOCUMENTS,如“_doc/userdata.xml”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + _doc?: string; + /** + * 程序公用文档目录 + * 用于保存程序中各应用间可共享文件的目录,与文件系统中根目录PUBLIC_DOCUMENTS,如“_document/share.doc”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + _documents?: string; + /** + * 程序公用下载目录 + * 用于保存程序下载文件的目录,与文件系统中根目录PUBLIC_DOWNLOADS,如“_download/mydoc.doc”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ + _downloads?: string; +} + +/** + * 本地路径URL + * 可在html页面中直接访问本地资源,以“file:///”开头,后面跟随系统的绝对路径。 + * 如示例:“file:///D:/res/hello.html”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +type PlusIoLocalURL = any; +/** + * 网络路径URL + * 可在html页面中以网络资源模式访问本地资源,以“http://”开头,后面跟随相对路径。 + * 如示例:“http://localhost:13131/_www/res/icon.png”,其中“_www”字段可支持类型与相对路径URL一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/io.html](http://www.html5plus.org/doc/zh_cn/io.html) + */ +type PlusIoRemoteURL = any; + +/** + * Native.js for iOS封装一条通过JS语法直接调用Native Objective-C接口通道,通过plus.ios可调用几乎所有的系统API。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ +interface PlusIos { + /** + * Objective-C类对象 + * Objective-C类对象,可通过其属性获取类的常量,可通过方法来操作类的静态方法,也通过new方法来创建类的实例对象。 + * 对于类的静态方法,则直接通过.后面跟随方法名称调用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + ClassObject?: PlusIosClassObject; + /** + * Objective-C实例对象 + * Objective-C实例对象,可通过其方法来操作示例的变量和方法。 + * 注意:必须通过plusGetAttribute()方法读取示例对象的属性值,通过plusSetAttribute()方法设置示例对象的属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + InstanceObject?: PlusIosInstanceObject; + /** + * 导入Objective-C类对象 + * 导入类对象后,就可以通过.操作符直接调用对象(类对象/实例对象)的方法。 + * 通过.操作符号调用方法时,不需要使用":"来分割参数。 + * 注意:导入类对象将会消耗较多的系统资源,不应该导入过多的类对象,可以使用plus.ios.invoke()来调用未导入类实例对象的方法。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + importClass(classname?: string): PlusIosClassObject; + /** + * 创建实例对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + newObject(classname?: string, args?: any): PlusIosInstanceObject; + /** + * 销毁实例对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + deleteObject(obj?: any): void; + /** + * 调用对象(类对象/示例对象)的方法 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + invoke(obj?: PlusIosInstanceObject, name?: string, args?: any): any; + /** + * 实现代理的方法 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + implements(name?: string, obj?: any): PlusIosInstanceObject; + /** + * 获取当前Webview窗口对象的native层UIWebview实例对象 + * UIWebview对象的API请参考Apple开发文档 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + currentWebview(): PlusIosInstanceObject; +} + +/** + * Objective-C类对象 + * Objective-C类对象,可通过其属性获取类的常量,可通过方法来操作类的静态方法,也通过new方法来创建类的实例对象。 + * 对于类的静态方法,则直接通过.后面跟随方法名称调用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ +type PlusIosClassObject = any; + +/** + * Objective-C实例对象 + * Objective-C实例对象,可通过其方法来操作示例的变量和方法。 + * 注意:必须通过plusGetAttribute()方法读取示例对象的属性值,通过plusSetAttribute()方法设置示例对象的属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ +interface PlusIosInstanceObject { + /** + * 获取Objective-C实例对象的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + plusGetAttribute(name?: string): any; + /** + * 设置Objective-C示例对象的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/ios.html](http://www.html5plus.org/doc/zh_cn/ios.html) + */ + plusSetAttribute(name?: string, value?: any): void; +} + +/** + * Key管理设备按键事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ +interface PlusKey { + /** + * 按键类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + KeyType?: PlusKeyKeyType; + /** + * 按键事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + KeyEvent?: PlusKeyKeyEvent; + /** + * 添加按键事件监听器 + * 添加按键事件监听器,当指定的按键事件发生时,回调函数将触发。 + * 应用中存在多个Webview窗口时,按照窗口的显示栈顺序从后往前查找,查找到添加按键事件监听器的窗口后停止(中断前面Webview窗口对按键事件的监听),并向窗口触发执行按键回调事件。 + * 在同一Webview窗口中可多次调用此方法对同一事件添加多个监听器,触发时按照添加的顺序先后调用。 + * 注意:此方法无法监听软键盘的按键事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + addEventListener(event?: PlusKeyKeyType, listener?: (result: PlusKeyKeyEvent) => void, capture?: boolean): void; + /** + * 隐藏软键盘 + * 隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + hideSoftKeybord(): void; + /** + * 设置辅助输入类型 + * input的type类型为text获取焦点时,在软键盘上方显示辅助输入条方便用户快速输入。 + * 在页面中input编辑框type类型不为"tel"、"email"时生效(type为tel类型时一定显示tel的辅助输入条,type为email时一定显示email的辅助输入条)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + setAssistantType(type?: string): void; + /** + * 显示软键盘 + * 强制显示系统软键盘,如果软键盘已经显示则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + showSoftKeybord(): void; + /** + * 移除按键事件监听器 + * 从窗口移除指定的事件监听器。若没有查找到对应的事件监听器,则无任何作用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + removeEventListener(event?: PlusKeyKeyType, listener?: (result: PlusKeyKeyEvent) => void): void; +} + +/** + * 按键类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ +interface PlusKeyKeyType { + /** + * 设备“返回”按钮按键事件 + * 如果需要改变默认“返回”按钮的处理逻辑,则可通过plus.key.addEventListener来注册监听"backbutton"事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + backbutton?: string; + /** + * 键按下事件 + * 如果需要改变默认键按下的处理逻辑,则可通过plus.key.addEventListener来注册监听"keydown"事件。 + * 可通过回调函数中KeyEvent对象的keyCode来获取按下的键值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + keydown?: string; + /** + * 键松开事件 + * 如果需要改变默认键松开的处理逻辑,则可通过plus.key.addEventListener来注册监听"keyup"事件。 + * 可通过回调函数中KeyEvent对象的keyCode来获取松开的键值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + keyup?: string; + /** + * 长按键事件 + * 如果需要改变默认长按键的处理逻辑,则可通过plus.key.addEventListener来注册监听"longpressed"事件。 + * 长按键时会多次触发回调函数,通过回调函数中KeyEvent对象的keyCode来获取长按的键值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + longpressed?: string; + /** + * 设备“菜单”按钮按键事件 + * 如果需要改变默认“菜单”按钮的处理逻辑,则可通过plus.key.addEventListener来注册监听"menubutton"事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + menubutton?: string; + /** + * 设备“搜索”按钮按键事件 + * 如果需要改变默认“搜索”按钮的处理逻辑,则可通过plus.key.addEventListener来注册监听"searchbutton"事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + searchbutton?: string; + /** + * 设备“音量+”按钮按键事件 + * 如果需要改变默认“音量+”按钮的处理逻辑,则可通过plus.key.addEventListener来注册监听"volumeupbutton"事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + volumeupbutton?: string; + /** + * 设备“音量-”按钮按键事件 + * 如果需要改变默认“音量-”按钮的处理逻辑,则可通过plus.key.addEventListener来注册监听"volumedownbutton"事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + volumedownbutton?: string; +} + +/** + * 按键事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ +interface PlusKeyKeyEvent { + /** + * 触发按键事件的键值 + * 键值由各系统平台定义,一些特殊按键在不同的设备上可能存在差异。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + keyCode?: number; + /** + * 按键事件类型 + * 用于表明触发此按键事件的类型,值为KeyType中定义的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/key.html](http://www.html5plus.org/doc/zh_cn/key.html) + */ + keyType?: PlusKeyKeyType; +} + +/** + * Messaging模块管理设备通讯功能,可用于短信、彩信、邮件发送等。通过plus.messaging可获取设备通讯管理对象。另外也可以直接通过html中的href直接快速发送短信、拨打电话、发送邮件等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ +interface PlusMessaging { + /** + * 消息对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + Message?: PlusMessagingMessage; + /** + * 消息体内容类型 + * 用于设定消息的消息体内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + BodyType?: PlusMessagingBodyType; + /** + * 简单短信类型常量 + * 消息类型常量,Number类型,固定值为1,用于创建并发送短信。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + TYPE_SMS?: number; + /** + * 彩信类型常量 + * 消息类型常量,Number类型,固定值为2,用于创建并发送多媒体短信(彩信)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + TYPE_MMS?: number; + /** + * 邮件类型常量 + * 消息类型常量,Number类型,固定值为3,用于创建并发送邮件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + TYPE_EMAIL?: number; + /** + * 创建消息对象 + * 创建指定类型的消息,消息类型可取plus.messaging.TYPE_SMS、plus.messaging.TYPE_MMS、plus.messaging.TYPE_EMAIL。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + createMessage(type ?: number): PlusMessagingMessage; + /** + * 发送消息 + * 发送消息,发送成功回调successCB函数,发送失败回调errorCB函数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + sendMessage(msg?: PlusMessagingMessage, successCB?: () => void, errorCB?: (result: any) => void): void; +} + +/** + * 消息对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ +interface PlusMessagingMessage { + /** + * 收件人信息 + * 字符串数组类型,输入的地址收件人信息必须符合消息类型格式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + to?: any []; + /** + * 抄送人信息 + * 字符串数组类型,仅发送邮件时有效,输入的地址收件人信息必须符合消息类型格式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + cc?: any []; + /** + * 暗送人信息 + * 字符串数组类型,仅发送邮件时有效,输入的地址收件人信息必须符合消息类型格式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + bcc?: any []; + /** + * 发件人信息 + * 仅在监听接收到的信息时有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + from?: string; + /** + * 发送消息主题 + * 字符串类型,仅发送邮件时有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + subject?: string; + /** + * 发送消息内容 + * 字符串类型,要发送的消息体内容,其格式必须与bodyType指定的一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + body?: string; + /** + * 发送消息内容类型 + * 要发送消息体内容的类型,可取值"text"表示文本内容,"html"表示为html页面,默认值为"text"。 + * - text/plain: 纯文本类型消息体内容 + * - text/html: 网页数据类型消息体内容(用于发送邮件) + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + bodyType?: 'text/plain' | 'text/html'; + /** + * 是否采用静默方式发送消息 + * 布尔类型,可取值为true或false,true表示静默方式发送,不弹出界面;false表示非静默方式发送。默认采用非静默方式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + silent?: boolean; + /** + * 添加附件 + * 向消息中添加附件,仅邮件类型消息支持,其它类型消息不支持。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + addAttachment(url?: string): void; +} + +/** + * 消息体内容类型 + * 用于设定消息的消息体内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ +interface PlusMessagingBodyType { + /** + * 文本类型 + * 纯文本类型消息体内容,默认消息体内容类型。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + 'text/plain'?: string; + /** + * Html类型 + * 网页数据类型消息体内容,可用于发送邮件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/messaging.html](http://www.html5plus.org/doc/zh_cn/messaging.html) + */ + 'text/html'?: string; +} + +/** + * nativeObj管理系统原生对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObj { + /** + * 原生动画参数 + * 指定动画的类型、持续时间等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + AnimationOptions?: PlusNativeObjAnimationOptions; + /** + * 原生动画窗口样式 + * 指定动画窗口的样式,如背景图片,绘制的文字等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + AnimationViewStyles?: PlusNativeObjAnimationViewStyles; + /** + * 原生图片对象 + * 原生图片对象会占用较大的内存资源,在使用时需谨慎管理,当图片不再使用时应该及时调用clear方法进行销毁。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + Bitmap?: PlusNativeObjBitmap; + /** + * JSON对象,保存图片的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + BitmapSaveOptions?: PlusNativeObjBitmapSaveOptions; + /** + * 原生图片轮播控件对象 + * 原生图片轮播控件对象从原生View控件(plus.nativeObj.View)继承而来,用于绘制图片轮播内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ImageSlider?: PlusNativeObjImageSlider; + /** + * 图片轮播控件样式 + * 从ViewStyles继承而来,扩展支持轮播图片等配置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ImageSliderStyles?: PlusNativeObjImageSliderStyles; + /** + * 图片轮播控件中图片项配置参数 + * 用于指定图片地址等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ImageSliderImageStyles?: PlusNativeObjImageSliderImageStyles; + /** + * 输入框样式 + * 用于定义输入框的显示样式,如字体大小,提示内容等信息。 + * 输入文本内容在指定区域水平居左,垂直居中显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + InputStyles?: PlusNativeObjInputStyles; + /** + * 区域信息对象 + * 包括位置、大小等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + Rect?: PlusNativeObjRect; + /** + * 绘制区域样式对象 + * 用于定义矩形区域的显示样式,如空心/实心样式、圆角等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + RectStyles?: PlusNativeObjRectStyles; + /** + * 富文本样式 + * 用于定义富文本使用的默认使用的字体名称、字体文件路径等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + RichTextStyles?: PlusNativeObjRichTextStyles; + /** + * 区域信息对象 + * 包括位置、大小等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + Position?: PlusNativeObjPosition; + /** + * 绘制文本样式对象 + * 用于定义文本的显示样式,如字体大小、字体颜色、字体粗细、字体样式、字体名称等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + TextStyles?: PlusNativeObjTextStyles; + /** + * 原生控件对象 + * 原生控件对象可用于在屏幕上绘制图片或文本内容,当控件不再使用时需要调用close方法销毁控件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + View?: PlusNativeObjView; + /** + * View控件动画参数 + * 指定动画的类型、持续时间等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ViewAnimationOptions?: PlusNativeObjViewAnimationOptions; + /** + * View控件绘制元素参数 + * 指定绘制图片、矩形区域、文本内容等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ViewDrawTagStyles?: PlusNativeObjViewDrawTagStyles; + /** + * View控件事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ViewEvents?: PlusNativeObjViewEvents; + /** + * JSON对象,View控件的系统状态栏区域样式 + * 仅在应用设置为沉浸式状态栏样式下有效,非沉浸式状态栏样式下忽略此属性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ViewStatusbarStyles?: PlusNativeObjViewStatusbarStyles; + /** + * View控件样式 + * 包括位置、大小等信息等,其中位置信息相对于父容器控件进行计算。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + ViewStyles?: PlusNativeObjViewStyles; +} + +/** + * 原生动画参数 + * 指定动画的类型、持续时间等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjAnimationOptions { + /** + * 动画类型 + * 可取值: + * "pop-in" - 从右侧平移入栈动画效果(副窗口从右侧向左平移滑出显示,主窗口从当前屏幕区域向左侧平移滑出被遮盖),如果仅传入一个View控件对象则自动降级为slide-in-right动画; + * "pop-out" - 从右侧平移出栈动画效果(副窗口从当前屏幕区域向右侧平移出可视区域,主窗口从左侧向右平移滑出显示),如果仅出入一个View控件对象则自动降级为slide-out-right动画; + * "slide-in-right" - 从右侧横向滑动效果(主窗口从当前屏幕右侧外向内横向滑动显示); + * "slide-out-right - 横向向右侧滑出屏幕动画(主窗口从屏幕中横向向右侧滑动到屏幕外)。 + * - pop-in: + * 从右侧平移入栈动画效果(副窗口从右侧向左平移滑出显示,主窗口从当前屏幕区域向左侧平移滑出被遮盖)。 + * + * - pop-out: + * 从右侧平移出栈动画效果(副窗口从当前屏幕区域向右侧平移出可视区域,主窗口从左侧向右平移滑出显示)。 + * + * - slide-in-right: + * 从右侧横向滑动效果(主窗口从当前屏幕右侧外向内横向滑动显示)。 + * + * - slide-out-right: + * 横向向右侧滑出屏幕动画(主窗口从屏幕中横向向右侧滑动到屏幕外)。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + type?: 'pop-in' | 'pop-out' | 'slide-in-right' | 'slide-out-right'; + /** + * 动画持续时间 + * 单位为毫秒,默认值为200ms。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + duration?: number; +} + +/** + * 原生动画窗口样式 + * 指定动画窗口的样式,如背景图片,绘制的文字等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjAnimationViewStyles { + /** + * 动画窗口上绘制的背景图片 + * 图片可以通过Webview对象的draw方法截图,也可以通过Bitmap的API从本地文件中加载。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + bitmap?: PlusNativeObjBitmap; + /** + * 动画窗口上绘制的文本内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + text?: string; + /** + * 动画窗口上绘制的文本样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + textStyles?: PlusNativeObjTextStyles; + /** + * 动画窗口上绘制的文本区域 + * 默认值为{top:'0px',left:'0px',width:'100%',height:'44px'}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + textRect?: PlusNativeObjRect; +} + +/** + * 原生图片对象 + * 原生图片对象会占用较大的内存资源,在使用时需谨慎管理,当图片不再使用时应该及时调用clear方法进行销毁。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjBitmap { + /** + * Bitmap对象的标识 + * 在创建Bitmap对象时设置,如果没有设置标识,此属性值为null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + id?: string; + /** + * 静态方法,获取所有Bitmap图片对象 + * 获取应用运行期创建的所有Bitmap图片对象,包含所有空Bitmap对象,不包含已经销毁的Bitmap对象。返回的Bitmap对象在数组中按创建的属性排列,及数组中第一个是最先创建的Bitmap对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + getItems(): PlusNativeObj []; + /** + * 静态方法,获取指定标识的Bitmap图片对象 + * 在应用中已创建的图片对象中查找指定标识的Bitmap对象并返回。 + * 若存在多个相同标识的Bitmap图片,则返回第一个创建的Bitmap图片。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + getBitmapById(id?: string): PlusNativeObjBitmap; + /** + * 销毁Bitmap图片 + * 释放Bitmap图片占用的内存资源,销毁后图片对象将不可使用,其id属性值为undefined,调用其所有方法操作都会失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + clear(): void; + /** + * 加载Bitmap图片 + * 从指定的路径(仅支持本地文件系统)中加载图片,此操作将覆盖之前的图片内容, + * 如果加载图片失败则保留之前的图片内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + load(path?: string, successCallback?: () => void, errorCallback?: (result: any) => void): void; + /** + * 加载Base64编码格式图片到Bitmap对象 + * 从Base64编码格式图片数据中加载图片,此操作将覆盖之前的图片内容, + * 如果加载图片失败则保留之前的图片内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + loadBase64Data(data?: string, successCallback?: () => void, errorCallback?: (result: any) => void): void; + /** + * 回收Bitmap图片内存 + * 释放Bitmap图片占用的内存资源,但不销毁图片对象,依然可以继续使用图片对象。 + * 当图片对象再次被使用时会自动从设置的路径(构造函数或load/save方法设置)加载到内存中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + recycle(): void; + /** + * 保存图片 + * 将图片保存到指定的路径(仅支持本地文件系统),如果图片为空或者指定的路径文件已经存在则返回失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + save(path?: string, options?: PlusNativeObjBitmapSaveOptions, successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 获取图片的Base64编码数据 + * 读取图片的数据内容,并转换为Base64编码格式字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + toBase64Data(): string; +} + +/** + * JSON对象,保存图片的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjBitmapSaveOptions { + /** + * 覆盖保存图片文件 + * 仅在保存的图片路径文件存在时有效: + * true表示覆盖存在的文件; + * false表示不覆盖,如果文件存在,则返回失败。 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + overwrite?: boolean; + /** + * 保存图片的格式 + * 支持"jpg"、"png",如果未指定则默认使用指定的保存路径后缀对应的文件格式,如果后缀文件格式无效则使用jpg格式。 + * - jpg: JPG格式图片 + * - png: PNG格式图片 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + format?: 'jpg' | 'png'; + /** + * 保存图片的质量 + * 取值范围为1-100,1表示使用最低的图片质量(保存后的图片文件最小)、100表示使用最高的图片质量(保存后的图片文件最大); + * 默认值为50。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + quality?: number; + /** + * 指定裁剪区域保存图片 + * 相对于图片的区域信息,默认值为{top:'0px',left:'0px',width:'100%',height:'100%'}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + clip?: PlusNativeObjRect; +} + +/** + * 原生图片轮播控件对象 + * 原生图片轮播控件对象从原生View控件(plus.nativeObj.View)继承而来,用于绘制图片轮播内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjImageSlider { + /** + * 添加图片轮播控件的图片 + * 动态添加图片轮播控件显示的图片。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + addImages(images?: PlusNativeObj []): void; + /** + * 获取当前图片轮播控件显示的图片索引值 + * 索引值从0开始,即0表示图片轮播控件当前显示第一张图片。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + currentImageIndex(): number; + /** + * 设置图片轮播控件的图片 + * 动态更新图片轮播控件显示的图片。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + setImages(images?: PlusNativeObj []): void; +} + +/** + * 图片轮播控件样式 + * 从ViewStyles继承而来,扩展支持轮播图片等配置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjImageSliderStyles { + /** + * 是否自动播放 + * 可取值: + * "true" - 自动播放; + * "false" - 不自动播放。 + * 默认值为"false"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + autoplay?: boolean; + /** + * 是否可全屏显示 + * 可取值: + * "true" - 表示可全屏显示,用户点击轮播图片时全屏显示; + * "false" - 表示不可全屏显示,用户点击轮播图片时无响应。 + * 默认值为"true"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + fullscreen?: boolean; + /** + * 是否可循环轮播 + * 可取值: + * "true" - 支持循环轮播; + * "false" - 不支持循环轮播。 + * 默认值为"false"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + loop?: boolean; + /** + * 轮播的图片 + * 至少必须设置一张图片的地址信息,否则可能导致图片轮播控件显示不正常。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + images?: PlusNativeObj []; + /** + * 自动播放切换时间 + * 当autoplay属性值为true时生效,单位为毫秒。默认值为3000(3秒)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + interval?: number; +} + +/** + * 图片轮播控件中图片项配置参数 + * 用于指定图片地址等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjImageSliderImageStyles { + /** + * 图片地址 + * 支持本地地址(相对地址、绝对路径、RelativeURL、本地路径URL); + * 也支持网络地址(http://或https://)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + src?: string; + /** + * 图片水平对齐方式 + * 仅在图片显示的宽度与图片轮播控件宽度不一致时有效,可取值: + * "left" - 图片在轮播控件中水平居左对齐; + * "center" - 图片在轮播控件中水平居中对齐; + * "right" - 图片在轮播控件中水平居右对齐。 + * 默认值为"center"。 + * - left: 图片在轮播控件中水平居左对齐 + * - center: 图片在轮播控件中水平居中对齐 + * - right: 图片在轮播控件中水平居右对齐 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + align?: 'left' | 'center' | 'right'; + /** + * 图片显示的高度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",现对于图片轮播控件的高度; + * 自动计算"auto",如果指定图片宽度(width),则按图片实际大小等比缩放图片高度值,如果没有指定宽度(width值为"auto")则自动缩放图片至可完整显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + height?: string; + /** + * 图片显示的宽度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于图片轮播控件的宽度; + * 自动计算"auto",如果指定图片高度(height),则按图片实际大小等比缩放图片宽度值,如果没有指定高度(height值为"auto")则自动缩放图片至可完整显示。 + * 默认值为"auto"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + width?: string; + /** + * 图片垂直对齐方式 + * 仅在图片显示的高度与图片轮播控件宽度不一致时有效,可取值: + * "top" - 图片在轮播控件中垂直居顶对齐; + * "middle" - 图片在轮播控件中垂直居中对齐; + * "bottom" - 图片在轮播控件中垂直居底对齐。 + * 默认值为"middle"。 + * - top: 图片在轮播控件中垂直居顶对齐 + * - middle: 图片在轮播控件中垂直居中对齐 + * - bottom: 图片在轮播控件中垂直居底对齐 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + verticalAlign?: 'top' | 'middle' | 'bottom'; +} + +/** + * 输入框样式 + * 用于定义输入框的显示样式,如字体大小,提示内容等信息。 + * 输入文本内容在指定区域水平居左,垂直居中显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjInputStyles { + /** + * 输入框类型 + * 可取值: + * "email" - 邮箱地址输入框; + * "number" - 数字输入框; + * "search" - 搜索文本输入框; + * "tel" - 电话号码输入框; + * "text" - 普通文本输入框; + * "url" - URL地址输入框。 + * 默认为text(即普通文本输入框)。 + * - email: 邮箱地址输入框 + * - number: 数字输入框 + * - search: 搜索文本输入框 + * - tel: 电话号码输入框 + * - text: 普通文本输入框 + * - url: URL地址输入框 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + type?: 'email' | 'number' | 'search' | 'tel' | 'text' | 'url'; + /** + * 输入框的提示文本 + * 当用户未输入内容时显示在编辑框中(灰色文字)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + placeholder?: string; + /** + * 输入框的字体大小 + * 可取值:字体高度像素值,数字加"px"格式字符串,如"12px"。 + * 默认值为"16px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + fontSize?: string; + /** + * 输入框的边框颜色 + * 可取值: "#RRGGBB"格式字符串,如"#FF0000"表示红色边框。默认值为"#000000"(黑色)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + borderColor?: string; + /** + * 输入框边框圆角半径 + * 可取值:圆角半径像素值,数字加"px"格式字符串,如"6px"。 + * 默认值为"0px"(边框无圆角)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + borderRadius?: string; + /** + * 输入框的边框宽度 + * 可取值:像素值,数字加"px"格式字符串,如"2px"。 默认值为"1px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + borderWidth?: string; + /** + * 输入框完成输入事件 + * 弹出软键盘完成输入后,点击软键盘上的“完成”、“前往”按钮时触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + onComplete?: (result: any) => void; + /** + * 输入框获取焦点事件 + * 当编辑框获取焦点时触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + onFocus?: (result: any) => void; + /** + * 输入框失去焦点事件 + * 当编辑框失去焦点时触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + onBlur?: (result: any) => void; +} + +/** + * 区域信息对象 + * 包括位置、大小等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjRect { + /** + * 区域左上角的垂直偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于作用对象的高度; + * 自动计算,如"auto",根据height值自动计算,相对于作用对象垂直居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + top?: string; + /** + * 区域左上角的水平偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于作用对象的宽度; + * 自动计算,如"auto",根据width值自动计算,相对于作用对象水平居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + left?: string; + /** + * 区域的宽度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于作用对象的宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + width?: string; + /** + * 区域的高度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于作用对象的高度。 + * 内容自适应,如"wrap_content",根据内容计算高度(如调用drawText绘制文本时支持)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + height?: string; +} + +/** + * 绘制区域样式对象 + * 用于定义矩形区域的显示样式,如空心/实心样式、圆角等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjRectStyles { + /** + * 绘制颜色 + * 矩形填充区域的颜色,可取值: + * "#RRGGBB"格式字符串,如"#FF0000"表示绘制红色区域; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为"#FFFFFF"(白色)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + color?: string; + /** + * 矩形区域的圆角半径 + * 可取值:圆角半径像素值,数字加"px"格式字符串,如"6px"。 + * 默认值为"0px"(矩形无圆角)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + radius?: string; + /** + * 矩形边框颜色 + * 绘制矩形边框的颜色,可取值: + * "#RRGGBB"格式字符串,如"#FF0000"表示绘制红色区域; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为矩形填充区域颜色(color属性值)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + borderColor?: string; + /** + * 矩形边框宽度 + * 可取值:像素值,数字加"px"格式字符串,如"2px"。 + * 默认值为"0px"(无边框)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + borderWidth?: string; +} + +/** + * 富文本样式 + * 用于定义富文本使用的默认使用的字体名称、字体文件路径等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjRichTextStyles { + /** + * 富文本内容的水平对齐方式 + * 对整体内容有效,无法单独控制每行的内容。 + * 可取值: + * "left"-字体在指定的区域中水平居左对齐; + * "center"-字体在指定的区域中水平居中对齐; + * "right"-字体在指定的区域中水平居右对齐。 + * 默认值为"left"。 + * - left: 富文本内容水平居左对齐 + * - center: 富文本内容水平居中对齐 + * - right: 富文本内容水平居右对齐 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + align?: 'left' | 'center' | 'right'; + /** + * 富文本默认使用的字体名称 + * 例如"Times New Roman", 如果指定名称的字体不存在,则使用系统默认字体。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + family?: string; + /** + * 富文本默认使用的字体文件路径 + * 加载字体文件路径,必须为本地路径,如果指定的文件路径无效,则使用系统默认字体。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + fontSrc?: string; + /** + * 点击事件回调函数 + * 如果设置此属性,则表示拦截所有RichText上的点击事件(不透传事件)。 + * 如果没有设置此属性,则仅拦截操作包含onclick属性的a/img标签的点击事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + onClick?: (result: any) => void; +} + +/** + * 区域信息对象 + * 包括位置、大小等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjPosition { + /** + * 区域顶部相对于作用对象(或容器)向下的偏移量 + * 可取值:像素值,如"100px";百分比,如"10%",相对于作用对象(或容器)的高度; + * 自动计算,如"auto",根据height值自动计算,相对于作用对象(或容器)垂直居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + top?: string; + /** + * 区域左侧相对于作用对象(或容器)向右的偏移量 + * 可取值:像素值,如"100px";百分比,如"10%",相对于作用对象(或容器)的宽度; + * 自动计算,如"auto",根据width值自动计算,相对于作用对象(或容器)水平居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + left?: string; + /** + * 区域的宽度 + * 可取值:像素值,如"100px";百分比,如"10%",相对于作用对象(或容器)的宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + width?: string; + /** + * 区域的高度 + * 可取值:像素值,如"100px";百分比,如"10%",相对于作用对象(或容器)的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + height?: string; + /** + * 区域底部相对于作用对象(或容器)向上的偏移量 + * 可取值:像素值,如"100px";百分比,如"10%",相对于作用对象(或容器)的高度。 + * 当设置了top和height值时,忽略此属性值; + * 当未设置top值时,可通过bottom属性值来确定区域的垂直位置; + * 当未设置height值时,可通过top和bottom属性值来确定区域的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + bottom?: string; + /** + * 区域右侧相对于作用对象(或容器)向左的偏移量 + * 可取值:像素值,如"100px";百分比,如"10%",相对于作用对象(或容器)的宽度。 + * 当设置了left和width值时,忽略此属性值; + * 当未设置left值时,可通过right属性值来确定区域的水平位置; + * 当未设置width值时,可通过left和right属性值来确定区域的宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + right?: string; +} + +/** + * 绘制文本样式对象 + * 用于定义文本的显示样式,如字体大小、字体颜色、字体粗细、字体样式、字体名称等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjTextStyles { + /** + * 水平对齐方式 + * 可取值: + * "left"-字体在指定的区域中水平居左对齐; + * "center"-字体在指定的区域中水平居中对齐; + * "right"-字体在指定的区域中水平居右对齐。 + * 默认值为"center"。 + * - left: 字体在指定的区域中水平居左对齐 + * - center: 字体在指定的区域中水平居中对齐 + * - right: 字体在指定的区域中水平居右对齐 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + align?: 'left' | 'center' | 'right'; + /** + * 字体颜色 + * 可取值: + * "#RRGGBB"格式字符串,如"#FF0000"表示绘制红色区域; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为"#000000"(黑色)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + color?: string; + /** + * 文本装饰 + * 可取值: + * "none" - 无装饰效果; + * "underline" - 文本带下划线效果; + * "line-through" - 文本带贯穿线(删除线)效果。 + * 默认值为"none"。 + * - none: + * 无装饰效果 + * + * - underline: + * 文本带下划线效果 + * + * - line-through: + * 文本带贯穿线(删除线)效果 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + decoration?: 'none' | 'underline' | 'line-through'; + /** + * 字体名称 + * 例如"Times New Roman", 如果指定名称的字体不存在,则使用默认字体。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + family?: string; + /** + * 字体文件路径 + * 加载字体文件路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + fontSrc?: string; + /** + * 文本的行间距 + * 可取值: + * 像素值,如"100px";百分比,如"10%",相对于字体的高度(size属性); + * 默认值为"20%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + lineSpacing?: string; + /** + * 字体的边距 + * 用于设置字体在绘制目标区域四个方向(top/right/bottom/left)的边距,可取值:像素值,如"10px";百分比,相对于绘制目标区域,如"5%"; + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + margin?: string; + /** + * 文本内容超出显示区域时处理方式 + * 可取值: + * "clip" - 超出显示区域时内容裁剪; + * "ellipsis" - 超出显示区域时尾部显示省略标记(...)。 + * 默认值为"clip"。 + * - clip: + * + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + overflow?: 'clip'; + /** + * 字体大小 + * 可取值:字体高度像素值,数字加"px"格式字符串,如"12px"。 + * 默认值为"16px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + size?: string; + /** + * 字体样式 + * 可取值:"normal" - 正常字体样式;"italic" - 斜体样式。默认值为"normal"。 + * - normal: 正常字体样式 + * - italic: 斜体样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + style?: 'normal' | 'italic'; + /** + * 垂直对齐方式 + * 文本内容在指定绘制区域中的垂直对齐方式,可取值: + * "top" - 垂直居顶对齐; + * "middle" - 垂直居中对齐; + * "bottom" - 垂直居底对齐。 + * 默认值为"middle"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + verticalAlign?: string; + /** + * 字体粗细 + * 可取值:"normal" - 普通字体;"bold" - 粗字体。默认值为"normal"。 + * - normal: 普通字体 + * - bold: 粗字体 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + weight?: 'normal' | 'bold'; + /** + * 文本换行模式 + * 可取值: + * "nowrap" - 不换行,将所有文本在一行中绘制,忽略换行符("\n"); + * "normal" - 自动换行,当指定的宽度无法绘制所有文本时自动换行绘制,碰到'\n'字符时强制换行。 + * 默认值为"nowrap"。 + * - nowrap: + * 不换行,将所有文本在一行中绘制,忽略换行符("\n") + * + * - normal: + * 自动换行,当指定的宽度无法绘制所有文本时自动换行绘制,碰到'\n'字符时强制换行 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + whiteSpace?: 'nowrap' | 'normal'; +} + +/** + * 原生控件对象 + * 原生控件对象可用于在屏幕上绘制图片或文本内容,当控件不再使用时需要调用close方法销毁控件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjView { + /** + * View对象的标识 + * 在创建原生控件View对象时设置,如果没有设置标识,此属性值为null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + id?: string; + /** + * 静态方法,开始原生动画 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + startAnimation(options?: PlusNativeObjAnimationOptions, view?: PlusNativeObjAnimationViewStyles, otherview?: PlusNativeObjAnimationViewStyles, callback?: () => void): void; + /** + * 静态方法,关闭原生动画窗口 + * 通过plus.nativeObj.View.startAnimation方法开始原生动画后,不会自动关闭原生动画窗口对象,需要调用此方法关闭原生动画。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + clearAnimation(type?: string): void; + /** + * 静态方法,获取指定标识的View控件对象 + * 如果存在多个指定id标识的View对象,则返回第一个创建的View控件对象。 + * 如果不存在指定id标识的View对象,则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + getViewById(id?: string): PlusNativeObjView; + /** + * 添加事件监听器 + * 向View控件添加事件监听器,当指定的事件发生时,将触发listener函数的执行。 + * 可多次调用此方法向Webview添加多个监听器,当监听的事件发生时,将按照添加的先后顺序执行。 + * 可通过setTouchEventRect方法指定监听触屏操作的区域。 + * 注意:默认View控件拦截处理触屏事件,可调用view.interceptTouchEvent(false)改变为不拦截处理触屏事件(透传)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + addEventListener(event?: PlusNativeObjViewEvents, listener?: (result: any) => void, capture?: boolean): void; + /** + * View控件内容动画 + * 动画后可能会导致View控件显示内容改变,可通过调用restore方法恢复。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + animate(options?: PlusNativeObjViewAnimationOptions, callback?: () => void): void; + /** + * 关闭View控件 + * 释放View控件资源,View对象不可再操作,如果View控件已经显示则自动隐藏。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + close(): void; + /** + * 清空矩形区域 + * 清除指定矩形区域内容,透明显示其后面的内容。 + * 可多次调用设置多个区域透明。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + clearRect(position?: PlusNativeObjPosition, id?: string): void; + /** + * 绘制内容 + * 在当前View控件之上绘制指定的内容,可一次指定绘制多个元素,绘制元素可以是图片/矩形区域/文本, + * 即将多次调用drawBitmap/drawRect/drawText方法合并调用一次draw方法来实现, + * 推荐使用draw方法来替换多次调用drawBitmap/drawRect/drawText。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + draw(tags?: PlusNativeObj []): void; + /** + * 绘制图片 + * 在当前View控件之上绘制指定的图片,如果图片无效则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + drawBitmap(src?: string, sprite?: PlusNativeObjPosition, position?: PlusNativeObjPosition, id?: string): void; + /** + * 绘制矩形区域 + * 在当前View控件之上绘制指定颜色的矩形区域。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + drawRect(styles?: PlusNativeObjRectStyles, position?: PlusNativeObjPosition, id?: string): void; + /** + * 绘制文本 + * 在当前View控件之上绘制指定的文本内容,如果文本为空则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + drawText(text?: string, position?: PlusNativeObjPosition, styles?: PlusNativeObjTextStyles, id?: string): void; + /** + * 绘制富文本 + * 在当前View控件之上绘制指定的文本内容,如果文本为空则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + drawRichText(text?: string, position?: PlusNativeObjPosition, styles?: PlusNativeObjRichTextStyles, id?: string): void; + /** + * 绘制输入框 + * 在当前View控件之上绘制输入框。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + drawInput(position?: PlusNativeObjPosition, styles?: PlusNativeObjInputStyles, id?: string): void; + /** + * 获取编辑框的焦点状态 + * 通过id查找到指定的编辑框,获取其焦点状态。 + * 如果指定的id无效则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + getInputFocusById(id?: string): boolean; + /** + * 获取编辑框的内容 + * 通过id查找到指定的编辑框,获取其输入的字符串。 + * 如果指定的id无效则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + getInputValueById(id?: string): string; + /** + * 重置view控件显示内容 + * 清除调用drawBitmap、drawText方法绘制的内容,将View控件重置为空内容(透明不可见)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + reset(): void; + /** + * 恢复View控件显示内容 + * 恢复调用animate方法改变View控件的内容,更新至动画前的内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + restore(): void; + /** + * 显示View控件 + * 将View控件显示到屏幕,显示在所有Webview窗口之上。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + show(): void; + /** + * 设置编辑框的焦点状态 + * 通过id查找到指定的编辑框,并设置编辑框的焦点状态。 + * 如果指定的id无效则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + setInputFocusById(id?: string, focusable?: boolean): string; + /** + * 设置View控件的样式 + * 动态更新View控件样式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + setStyle(styles?: PlusNativeObjViewStyles): void; + /** + * 指定监听触屏事件区域 + * 当调用addEventListener监听View控件事件时,可调用此方法限定监听事件的区域,仅当用户触屏操作在指定区域时才触发监听事件。 + * 非限定监听事件的区域则不拦截,透传给其它窗口处理。 + * 注意:此操作覆盖之前设置的区域。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + setTouchEventRect(rect?: PlusNativeObj []): void; + /** + * 隐藏View控件 + * 将View控件从屏幕隐藏,如果View控件未显示则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + hide(): void; + /** + * 是否拦截View控件的触屏事件 + * 设置为拦截后View控件上的触屏事件不再传递(即不透传),否则触屏事件将继续传递给View控件下的其它窗口处理(即透传)。 + * 注意:View控件默认拦截触屏事件(不透传)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + interceptTouchEvent(intercept?: boolean): void; + /** + * 获取View控件的显示状态 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + isVisible(): boolean; +} + +/** + * View控件动画参数 + * 指定动画的类型、持续时间等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjViewAnimationOptions { + /** + * 动画类型 + * 可取值:"shrink" - 从上到下分块收缩清除窗口动画。 + * - shrink: 从上到下分块清除动画 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + type?: 'shrink'; + /** + * 动画持续时间 + * 单位为毫秒,默认值为200ms。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + duration?: number; + /** + * 动画帧数 + * 必须为大于0的整数,默认值为12。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + frames?: number; + /** + * 动画作用区域 + * 支持以下属性: + * top - 区域距离控件顶部的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的高度),默认值为'0px'; + * bottom - 区域距离控件底部的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的高度),默认值为'0px'; + * left - 区域距离控件左侧的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的宽度),默认值为'0px'; + * right - 区域距离控件右侧的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的宽度),默认值为'0px'。 + * 如“{top:'44px',bottom:'48px'}”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + region?: PlusNativeObjRect; +} + +/** + * View控件绘制元素参数 + * 指定绘制图片、矩形区域、文本内容等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjViewDrawTagStyles { + /** + * 绘制操作标识 + * 可通过view对象的drawBitmap/drawRect/drawText/clearRect方法进行更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + id?: string; + /** + * 绘制操作类型 + * 可取值: + * "img" - 绘制图片,与drawBitmap操作一致,此时id、src、position、sprite属性值有效; + * "rect" - 绘制矩形区域,与drawRect操作一致,此时id、color、position、rectStyles属性值有效; + * "font" - 绘制文本内容,与drawText操作一致,此时id、position、text、textStyles属性值有效; + * "richtext" - 绘制富文本内容,与drawRichText操作一致,此时id、position、text、richTextStyles属性值有效; + * "input" - 绘制输入框内容,此时id、position、inputStyles属性值有效。 + * - img: 绘制图片 + * - rect: 绘制矩形区域 + * - font: 绘制文本内容 + * - richtext: 绘制富文本内容 + * - input: 绘制输入框内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + tag?: 'img' | 'rect' | 'font' | 'richtext' | 'input'; + /** + * 矩形区域颜色 + * 不推荐使用(推荐使用rectStyles),可取值: + * "#RRGGBB"格式字符串,如红色为"#FF0000"。 + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 当tag属性值为"rect"时有效,用于指定矩形区域颜色,默认值为"#FFFFFF"(白色)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + color?: string; + /** + * 绘制输入框的样式 + * 当tag属性值为"input"时有效,用于指定绘制输入框的样式、大小位置等信息。, + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + inputStyles?: PlusNativeObjInputStyles; + /** + * 绘制内容区域 + * 当tag属性值为"img"时,用于指定绘制图片的目标区域; + * 当tag属性值为"rect"时,用于指定绘制的矩形区域; + * 当tag属性值为"font"时,用于指定绘制文本的目标区域,此时height属性值支持设置为"wrap_content",表示文本高度根据内容自动计算,此时通过top来定位文本绘制的起始位置。 + * 相对于View控件的区域信息,默认值为{top:'0px',left:'0px',width:'100%',height:'100%'}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + position?: PlusNativeObjPosition; + /** + * 绘制区域的样式 + * 当tag属性值为"rect"时有效,用于指定绘制区域的样式、填充颜色、圆角大小等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + rectStyles?: PlusNativeObjRectStyles; + /** + * 绘制的图片资源 + * 当tag属性值为"img"时有效,可以是图片资源路径(字符串类型)或者图片对象(plus.nativeObj.Bitmap对象)。 + * src路径支持gif图片,但设置的图片路径文件使用".gif"后缀时则认为是gif图片,如"_www/loading.gif"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + src?: string; + /** + * 图片源的绘制区域 + * 当tag属性值为"img"时有效,用于指定图片源的绘制区域,相对于图片的区域信息,默认值为{top:'0px',left:'0px',width:'100%',height:'100%'}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + sprite?: PlusNativeObjPosition; + /** + * 绘制的文本内容 + * 当tag属性值为"font"时有效,用于保存绘制的文本内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + text?: string; + /** + * 绘制文本的样式 + * 当tag属性值为"font"时有效,用于指定绘制文本内容的字体大小、字体颜色、字体类型等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + textStyles?: PlusNativeObjTextStyles; + /** + * 绘制富文本的样式 + * 当tag属性值为"richtext"时有效,用于指定绘制富文本内容的默认字体颜色、字体类型等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + richTextStyles?: PlusNativeObjRichTextStyles; +} + +/** + * View控件事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjViewEvents { + /** + * 双击事件 + * 双击屏幕时触发。 + * 注意:如果将View控件设置为不拦截触屏事件(view.interceptTouchEvent(false))则不会触发此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + doubleclick?: string; + /** + * 点击事件 + * 当手指点击屏幕时触发。 + * 注意:如果将View控件设置为不拦截触屏事件(view.interceptTouchEvent(false))则不会触发此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + click?: string; + /** + * 开始触屏事件 + * 当手指触摸屏幕时候触发。 + * 注意:如果将View控件设置为不拦截触屏事件(view.interceptTouchEvent(false))则不会触发此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + touchstart?: string; + /** + * 触摸滑屏事件 + * 当手指在屏幕上滑动的时候连续地触发。 + * 注意:如果将View控件设置为不拦截触屏事件(view.interceptTouchEvent(false))则不会触发此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + touchmove?: string; + /** + * 结束触屏事件 + * 当手指从屏幕上离开的时候触发。 + * 注意:如果将View控件设置为不拦截触屏事件(view.interceptTouchEvent(false))则不会触发此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + touchend?: string; +} + +/** + * JSON对象,View控件的系统状态栏区域样式 + * 仅在应用设置为沉浸式状态栏样式下有效,非沉浸式状态栏样式下忽略此属性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjViewStatusbarStyles { + /** + * 系统状态栏区域背景颜色 + * 颜色值格式为"#RRGGBB",如"#FF0000"表示为红色背景,默认值为应用manifest.json中plus->statusbar->background属性配置的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + background?: string; +} + +/** + * View控件样式 + * 包括位置、大小等信息等,其中位置信息相对于父容器控件进行计算。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ +interface PlusNativeObjViewStyles { + /** + * 区域背景颜色 + * 可取值: + * #RRGGBB"格式字符串,如"#FF0000"表示绘制红色区域; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 默认值为"#FFFFFF"(白色)。 "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 默认值为"#FFFFFF"(白色)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + backgroundColor?: string; + /** + * View控件垂直向上的偏移量 + * 现对于父容器底部的距离,可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父容器的高度,如果没有父容器则相对于屏幕高度。 + * 当设置了top和height值时,忽略此属性值; + * 未设置height值时,可通过top和bottom属性值来确定View控件的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + bottom?: string; + /** + * View控件的停靠方式 + * 仅当View控件添加到Webview窗口对象中并且position属性值设置为"dock"时才生效,此时View控件挤压Webview窗口的大小。 + * 可取值: + * "top",控件停靠则页面顶部; + * "bottom",控件停靠在页面底部; + * "right",控件停靠在页面右侧; + * "left",控件停靠在页面左侧。 + * 默认值为"top"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + dock?: string; + /** + * 区域的高度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父容器的高度,如果没有父容器则相对于屏幕高度; + * 内容自适应,如"wrap_content",根据内容计算控件的高度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + height?: string; + /** + * 区域左上角的水平偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父控件的宽度; + * 自动计算,如"auto",根据width值自动计算,相对于父控件水平居中。 + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + left?: string; + /** + * View控件的不透明度 + * 取值范围为0-1,0为全透明,1为不透明,默认值为1,即不透明。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + opacity?: number; + /** + * View控件的排版方式 + * 仅当View控件添加到Webview窗口对象中时才生效。 + * 可取值: + * "static",View控件在页面中正常定位,如果页面存在滚动条则随窗口内容滚动; + * "absolute",Veiw控件在页面中绝对定位,如果页面存在滚动条不随窗口内容滚动; + * "dock",View控件在页面中停靠,停靠的位置由dock属性值决定。 + * 默认值为"absolute"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + position?: string; + /** + * View控件的状态栏样式 + * 仅在应用设置为沉浸式状态栏样式下有效,设置此属性后将自动保留系统状态栏区域不被View控件占用(即View控件非沉浸式样式显示)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + statusbar?: PlusNativeObjViewStatusbarStyles; + /** + * View控件左上角的垂直偏移量 + * 可取值:像素值,如"100px";百分比,如"10%",相对于父控件的高度;自动计算,如"auto",根据height值自动计算,相对于父控件垂直居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + top?: string; + /** + * 区域的宽度 + * 可取值:像素值,如"100px";百分比,如"10%",相对于父控件的宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeobj.html](http://www.html5plus.org/doc/zh_cn/nativeobj.html) + */ + width?: string; +} + +/** + * nativeUI管理系统原生界面,可用于弹出系统原生提示对话框窗口、时间日期选择对话框、等待对话框等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUI { + /** + * JSON对象,原生选择按钮框上按钮的样式参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + ActionButtonStyles?: PlusNativeUIActionButtonStyles; + /** + * JSON对象,原生选择按钮框的样式参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + ActionSheetStyles?: PlusNativeUIActionSheetStyles; + /** + * 确认对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + ConfirmOptions?: PlusNativeUIConfirmOptions; + /** + * JSON对象,图片预览的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + PreviewImageOptions?: PlusNativeUIPreviewImageOptions; + /** + * 日期选择对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + PickDateOption?: PlusNativeUIPickDateOption; + /** + * JSON对象,时间选择对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + PickTimeOption?: PlusNativeUIPickTimeOption; + /** + * 系统原生界面基类对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + NativeUIObj?: PlusNativeUINativeUIObj; + /** + * 系统等待对话框对象 + * 从NativeUIObj对象继承而来,通过plus.nativeUI.showWaiting方法创建时返回。 + * 用于控制系统样式等待对话框的操作,如关闭、设置标题内容等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + WaitingObj?: PlusNativeUIWaitingObj; + /** + * JSON对象,原生等待对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + WaitingOptions?: PlusNativeUIWaitingOptions; + /** + * JSON对象,原生等待对话框上loading图标自定义样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + WaitingLoadingOptions?: PlusNativeUIWaitingLoadingOptions; + /** + * JSON对象,系统提示消息框要设置的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + ToastOptions?: PlusNativeUIToastOptions; + /** + * 弹出系统选择按钮框 + * 从底部动画弹出系统样式选择按钮框,可设置选择框的标题、按钮文字等。 + * 弹出的提示框为非阻塞模式,用户点击选择框上的按钮后关闭,并通过actionsheetCallback回调函数通知用户选择的按钮。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + actionSheet(actionsheetStyle?: PlusNativeUIActionSheetStyles, actionsheetCallback?: (result: any) => void): PlusNativeUINativeUIObj; + /** + * 弹出系统提示对话框 + * 创建并显示系统样式提示对话框,可设置提示对话框的标题、内容、按钮文字等。 + * 弹出的提示对话框为非阻塞模式,用户点击提示对话框上的按钮后关闭,并通过alertCB回调函数通知对话框已关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + alert(message?: string, alertCB?: (result: any) => void, title?: string, buttonCapture?: string): void; + /** + * 弹出系统确认对话框 + * 创建并显示系统样式确认对话框,可设置确认对话框的标题、内容、按钮数目及其文字。 + * 弹出的确认对话框为非阻塞模式,用户点击确认对话框上的按钮后关闭,并通过confirmCB回调函数通知用户点击的按钮索引值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + confirm(message?: string, confirmCB?: (result: any) => void, options?: PlusNativeUIConfirmOptions, buttons?: any []): void; + /** + * 关闭系统等待对话框 + * 关闭已经显示的所有系统样式等待对话框,触发Waiting对象的onclose事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + closeWaiting(): void; + /** + * 关闭自动消失的提示消息 + * 关闭已经显示的所有自动消失的提示框。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + closeToast(): void; + /** + * 预览图片 + * 创建并显示全屏图片预览界面,用户点击图片或返回键退出预览界面。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + previewImage(urls?: any [], options?: PlusNativeUIPreviewImageOptions): void; + /** + * 显示系统等待对话框 + * 创建并显示系统样式等待对话框,并返回等待对话框对象Waiting,显示后需调用其close方法进行关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + showWaiting(title?: string, options?: PlusNativeUIWaitingOptions): PlusNativeUIWaitingObj; + /** + * 弹出系统日期选择对话框 + * 创建并显示系统样式日期选择对话框,可进行日期的选择。 + * 用户操作确认后通过successCB回调函数返回用户选择的日期,若用户取消选择则通过errorCB回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + pickDate(successCB?: (result: any) => void, errorCB?: (result: any) => void, options?: PlusNativeUIPickDateOption): void; + /** + * 弹出系统时间选择对话框 + * 创建并弹出系统样式时间选择对话框,可进行时间的选择。 + * 用户操作确认后通过successCB回调函数返回用户选择的时间,若用户取消选择则通过errorCB回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + pickTime(successCB?: (result: any) => void, errorCB?: (result: any) => void, options?: PlusNativeUIPickTimeOption): void; + /** + * 弹出系统输入对话框 + * 创建并显示系统样式输入对话框,可设置输入对话框的标题、内容、提示输入信息、按钮数目及其文字。 + * 弹出的输入对话框为非阻塞模式,其中包含编辑框供用户输入内容,用户点击输入对话框上的按钮后自动关闭,并通过promptCB回调函数返回用户点击的按钮及输入的内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + prompt(message?: string, promptCB?: (result: any) => void, title?: string, tip?: string, buttons?: any []): void; + /** + * 显示自动消失的提示消息 + * 创建并显示系统样式提示消息,弹出的提示消息为非阻塞模式,显示指定时间后自动消失。 + * 提示消息显示时间可通过options的duration属性控制,长时间提示消息显示时间约为3.5s,短时间提示消息显示时间约为2s。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + toast(message?: string, options?: PlusNativeUIToastOptions): void; +} + +/** + * JSON对象,原生选择按钮框上按钮的样式参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIActionButtonStyles { + /** + * 按钮上显示的文字颜色 + * 可取值: + * "#RRGGBB"格式字符串,如"#FF0000"表示文字颜色为红色; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + color?: string; + /** + * 按钮上显示的文字内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + title?: string; + /** + * 按钮的样式 + * 可取值: + * "destructive" - 表示警示按钮样式,默认文字颜色为红色; + * "default" - 表示默认按钮样式。 + * 默认值为"default"。 + * - destructive: + * 警示按钮样式。 + * + * - default: + * 默认按钮样式。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + style?: 'destructive' | 'default'; +} + +/** + * JSON对象,原生选择按钮框的样式参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIActionSheetStyles { + /** + * 选择按钮框的标题 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + title?: string; + /** + * 取消按钮上显示的文字内容 + * 不设置此属性,则不显示取消按钮。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + cancel?: string; + /** + * 选择框上的按钮,ActionButtonStyles对象数组 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + buttons?: PlusNativeUI []; +} + +/** + * 确认对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIConfirmOptions { + /** + * 确认对话框显示的标题 + * 如果不设置此属性值,则不显示标题。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + title?: string; + /** + * 确认对话框上显示的按钮 + * 字符串数组,每项对应在确认对话框上显示一个按钮,用户点击后通过confirmCB返回用户点击按钮的在数组中的索引值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + buttons?: any []; + /** + * 对话框在屏幕中的垂直分享对齐方式 + * 可取值: + * "top" - 表示垂直居顶对齐; + * "center" - 表示垂直居中对齐; + * "bottom" - 表示垂直居底对齐。 + * 默认值为"center"(垂直居中对齐)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + verticalAlign?: string; +} + +/** + * JSON对象,图片预览的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIPreviewImageOptions { + /** + * 图片预览的背景颜色 + * 颜色值格式为"#RRGGBB",如"#FF0000"表示为红色背景。 + * 默认值为黑色("#000000")。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + background?: string; + /** + * 默认显示图片的索引值 + * 索引值从0开始,默认值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + current?: number; + /** + * 图片指示器样式 + * 可取值: + * "default" - 默认指示器(底部圆点样式); + * "number" - 顶部数字指示器(顶部居中显示,文字为%当前图片索引值(从1开始)%/%图片总数%); + * "none" - 不显示指示器。 + * 默认值为"default"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + indicator?: string; + /** + * 是否可循环预览 + * 可取值: + * "true" - 支持循环预览; + * "false" - 不支持循环预览。 + * 默认值为"false"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + loop?: boolean; +} + +/** + * 日期选择对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIPickDateOption { + /** + * 日期选择对话框显示的标题 + * 如果未设置标题,则默认显示标题为当前选择的日期。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + title?: string; + /** + * 日期选择对话框默认显示的日期 + * 如果未设置默认显示的日期,则显示当前的日期。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + date?: Date; + /** + * 日期选择对话框可选择的最小日期 + * Date类型对象,如果未设置可选择的最小日期,则使用系统默认可选择的最小日期值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + minDate?: Date; + /** + * 日期选择对话框可选择的最大日期 + * Date类型对象,如果未设置可选择的最大日期,则使用系统默认可选择的最大日期值。 + * 其值必须大于minDate设置的值,否则使用系统默认可选择的最大日期值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + maxDate?: Date; + /** + * 时间选择对话框弹出指示区域 + * JSON类型对象,格式如{top:10;left:10;width:200;height:200;},所有值为像素值,其值为相对于容器Webview的位置。 + * 如未设置此值,默认在屏幕居中显示。仅在iPad上有效,其它设备忽略此值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + popover?: any; +} + +/** + * JSON对象,时间选择对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIPickTimeOption { + /** + * 时间选择对话框默认显示的时间 + * 如果未设置标题,则默认显示标题为当前选择的时间。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + time?: Date; + /** + * 时间选择对话框显示的标题 + * 如果未设置标题,则默认显示标题为当前选择的时间。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + title?: string; + /** + * 是否24小时制模式 + * true表示使用24小时制模式显示,fale表示使用12小时制模式显示,默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + is24Hour?: boolean; + /** + * 日期选择对话框弹出指示区域 + * JSON类型对象,格式如{top:10;left:10;width:200;height:200;},所有值为像素值,其值相对于容器webview的位置。 + * 如未设置此值,默认在屏幕居中显示。仅在iPad上有效,其它设备忽略此值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + popover?: any; +} + +/** + * 系统原生界面基类对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUINativeUIObj { + /** + * 关闭显示的系统原生界面 + * 调用plus.nativeUI.actionSheet方法创建并显示系统界面后,可通过其close方法将原生界面关闭。 + * 此情况下触发界面关闭回调函数参数的index属性值为-1。 + * 注意:一个系统原生界面只能关闭一次,多次调用将无任何作用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + close(): void; +} + +/** + * 系统等待对话框对象 + * 从NativeUIObj对象继承而来,通过plus.nativeUI.showWaiting方法创建时返回。 + * 用于控制系统样式等待对话框的操作,如关闭、设置标题内容等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIWaitingObj { + /** + * 等待对话框关闭事件 + * 等待框关闭时触发,当调用close方法或用户点击返回按钮导致等待框关闭时触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + onclose?: () => void; + /** + * 设置等待对话框上显示的文字内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + setTitle(title?: string): void; + /** + * 关闭显示的系统等待对话框 + * 调用plus.nativeUI.showWaiting方法创建并显示系统等待界后,可通过其close方法将原生等待控件关闭。 + * 一个系统等待对话框只能关闭一次,多次调用将无任何作用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + close(): void; +} + +/** + * JSON对象,原生等待对话框的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIWaitingOptions { + /** + * 等待框背景区域的宽度 + * 值支持像素值("500px")或百分比("50%"),百分比相对于屏幕的宽计算,如果不设置则根据内容自动计算合适的宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + width?: string; + /** + * 等待框背景区域的高度 + * 值支持像素绝对值("500px")或百分比("50%"),如果不设置则根据内容自动计算合适的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + height?: string; + /** + * 等待框中文字的颜色 + * 颜色值支持(参考CSS颜色规范):颜色名称(参考CSS Color Names)/十六进制值/rgb值/rgba值,默认值为白色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + color?: string; + /** + * 等待框中文字的字体大小 + * 如"14px"表示使用14像素高的文字,未设置则使用系统默认字体大小。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + size?: string; + /** + * 等待对话框中标题文字的水平对齐方式 + * 对齐方式可选值包括:"left":水平居左对齐显示,"center":水平居中对齐显示,"right":水平居右对齐显示。默认值为水平居中对齐显示,即"center"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + textalign?: string; + /** + * 等待对话框的内边距 + * 值支持像素值("10px")和百分比("5%"),百分比相对于屏幕的宽计算,默认值为"3%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + padding?: string; + /** + * 等待对话框显示区域的背景色 + * 背景色的值支持(参考CSS颜色规范):颜色名称(参考CSS Color Names)/十六进制值/rgb值/rgba值,默认值为rgba(0,0,0,0.8)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + background?: string; + /** + * 等待对话框样式 + * 可取值"black"、"white",black表示等待框为黑色雪花样式,通常在背景主色为浅色时使用;white表示等待框为白色雪花样式,通常在背景主色为深色时使用。 + * 仅在iOS平台有效,其它平台忽略此值,未设置时默认值为white。 + * - black: 黑色雪花样式,适合浅色界面使用 + * - white: 白色雪花样式,适合深色界面使用 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + style?: 'black' | 'white'; + /** + * 等待框是否模态显示 + * 模态显示时用户不可操作直到等待对话框关闭,否则用户在等待对话框显示时也可操作下面的内容,未设置时默认为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + modal?: boolean; + /** + * 等待框显示区域的圆角 + * 值支持像素值("10px"),未设置时使用默认值"10px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + round?: number; + /** + * 点击等待显示区域是否自动关闭 + * true表示点击等待对话框显示区域时自动关闭,false则不关闭,未设置时默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + padlock?: boolean; + /** + * 返回键处理方式 + * 可取值"none"表示截获处理返回键,但不做任何响应;"close"表示截获处理返回键并关闭等待框;"transmit"表示不截获返回键,向后传递给Webview窗口继续处理(与未显示等待框的情况一致)。 + * - none: 截获返回键,不做任何响应 + * - close: 截获返回键并关闭等待框 + * - transmit: 不截获返回键,继续传递给Webview窗口 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + back?: 'none' | 'close' | 'transmit'; + /** + * 自定义等待框上loading图标样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + loading?: PlusNativeUIWaitingLoadingOptions; +} + +/** + * JSON对象,原生等待对话框上loading图标自定义样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIWaitingLoadingOptions { + /** + * loading图标显示样式 + * 可取值: + * "block"表示图标与文字分开两行显示,上面显示loading图标,下面显示文字; + * "inline"表示loading图标与文字在同一行显示,左边显示loading图标,右边显示文字; + * "none"表示不显示loading图标; + * - block: + * loading图标与文字分开两行显示,上面显示loading图标,下面显示文字。 + * + * - inline: + * loading图标与文字在同一行显示,左边显示loading图标,右边显示文字。 + * + * - none: + * 不显示loading图标。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + display?: 'block' | 'inline' | 'none'; + /** + * loading图标高度 + * 设置loading图标的高度(宽度等比率缩放),取值类型:像素值,如"14px"表示14像素高。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + height?: string; + /** + * loading图标路径 + * 自定义loading图标的路径,png格式,并且必须是本地资源地址; + * loading图要求宽是高的整数倍,显示等待框时按照图片的高横向截取每帧刷新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + icon?: string; + /** + * loading图每帧刷新间隔 + * 单位为ms(毫秒),默认值为100ms。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + interval?: number; +} + +/** + * JSON对象,系统提示消息框要设置的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ +interface PlusNativeUIToastOptions { + /** + * 提示消息框在屏幕中的水平位置 + * 可选值为"left"、"center"、"right",分别为水平居左、居中、居右,未设置时默认值为"center"。 + * - left: 水平居左对齐 + * - center: 水平居中对齐 + * - right: 水平居左对齐 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + align?: 'left' | 'center' | 'right'; + /** + * 提示消息框显示的时间 + * 可选值为"long"、"short",值为"long"时显示时间约为3.5s,值为"short"时显示时间约为2s,未设置时默认值为"short"。 + * - long: 长显示时间 + * - short: 短显示时间 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + duration?: 'long' | 'short'; + /** + * 提示消息框上显示的图标 + * 仅支持本地图片路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + icon?: string; + /** + * 图标的宽度 + * 单位为px(逻辑像素值),默认值为图片的宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + iconWidth?: string; + /** + * 图标的高度 + * 单位为px(逻辑像素值),默认值为图片的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + iconHeight?: string; + /** + * 提示消息框上显示的样式 + * 可取值: + * "block"表示图标与文字分两行显示,上面显示图标,下面显示文字; + * "inline"表示图标与文字在同一行显示,左边显示图标,右边显示文字。 + * 默认值为"block"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + style?: string; + /** + * 提示消息框上显示的文本类型 + * 可取值: + * "text" - 显示的消息内容为文本字符串; + * "richtext" - 显示的消息内容为富文本内容。 + * 默认值为"text"。 + * 当type为"text"时,富文本使用html的部分标签,具体标签如下: + * 图片标签<img src="图片资源url地址" width="图片显示的宽度" height="图片显示的高度" onclick="console.log('clicked img')"></img>; + * 字体标签<font color="字体颜色"></font>,内容在一行显示不下时自动换行,行高默认为字体的1.2倍; + * 换行标签<br/>; + * 链接标签<a onclick="console.log('clicked a')">链接地址</a>。 + * 如示例“<img onclick="console.log('clicked img')" src="http://img-cdn-qiniu.dcloud.net.cn/icon2.png"/><a onclick="console.log(clicked a)">链接地址</a>”。 + * - text: 文本字符串 + * - richtext: 富文本内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + type?: 'text' | 'richtext'; + /** + * 富文本样式 + * 当type属性值为"richtext"时有效,用于定义富文本的样式,如其文本对齐方式、使用的字体等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + richTextStyle?: PlusNativeObjRichTextStyles; + /** + * 提示消息在屏幕中的垂直位置 + * 可选值为"top"、"center"、"bottom",分别为垂直居顶、居中、居底,未设置时默认值为"bottom"。 + * - top: 垂直居顶对齐 + * - center: 垂直居中对齐 + * - bottom: 垂直居底对齐 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/nativeui.html](http://www.html5plus.org/doc/zh_cn/nativeui.html) + */ + verticalAlign?: 'top' | 'center' | 'bottom'; +} + +/** + * navigator用于管理浏览器运行环境信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ +interface PlusNavigator { + /** + * 创建应用快捷方式要设置的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + ShortcutOptions?: PlusNavigatorShortcutOptions; + /** + * 更新应用启动界面要设置的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + SplashscreenOptions?: PlusNavigatorSplashscreenOptions; + /** + * 运行环境权限类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + PermissionNames?: PlusNavigatorPermissionNames; + /** + * 检查运行环境的权限 + * 向系统检查当前程序的权限状态,不触发权限相对应的功能API的调用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + checkPermission(permission?: PlusNavigatorPermissionNames): string; + /** + * 关闭应用启动界面 + * 很多情况下,应用启动后需要一段时间加载数据,为了避免界面显示空白内容,提高用户体验效果,这时可显示启动界面。 + * 等数据加载完成后再关闭启动界面进入应用,通常可在应用首界面加载数据完成并更新显示内容后调用此方法。 + * 注意:HBuilder7.1版本后启动界面不调用此方法超过6秒后会自动关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + closeSplashscreen(): void; + /** + * 查询设备是否为刘海屏 + * 刘海屏返回true,否则返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + hasNotchInScreen(): boolean; + /** + * 查询应用启动界面是否已关闭 + * 如果启动界面显示返回true,否则返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + hasSplashscreen(): boolean; + /** + * 更新程序启动界面 + * 可设置启动界面显示的图片(仅支持本地文件路径,如果是网络资源可先通过plus.downloader.*下载到本地), + * 更新启动界面后程序下次启动时生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + updateSplashscreen(options?: PlusNavigatorSplashscreenOptions): void; + /** + * 创建应用快捷方式 + * 在系统桌面创建应用的快捷方式,点击后可直接启动应用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + createShortcut(options?: PlusNavigatorShortcutOptions, successCallback?: (result: any) => void): void; + /** + * 查询是否存在应用快捷方式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + hasShortcut(options?: PlusNavigatorShortcutOptions, successCallback?: (result: any) => void): void; + /** + * 判断当前应用是否切换到后台 + * 在多应用运行环境(如流应用)中,启动一个新应用时,之前运行的应用将会自动切换到后台运行,此时plus.navigator.isBackground()返回状态只为true。 + * 注意:此状态不是5+应用切换到系统后台的状态,而是在同一apk中同时运行多个应用时被切换到后台的状态。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + isBackground(): boolean; + /** + * 判断应用当前是否全屏模式显示 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + isFullscreen(): boolean; + /** + * 判断应用当前是否输出日志 + * 日志包括应用原生层内部跟踪日志(ADB、LogCat工具可获取的日志)及JS层跟踪日志(console.log输出的日志)。 + * 开启日志在一定程度上会降低程序的性能,通常建议在正式发布时关闭日志输出,在调试时开启日志输出(此时可以通过工具ADB、LogCat获取分析日志)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + isLogs(): boolean; + /** + * 设置应用是否全屏显示 + * 设置应用在全屏模式显示时,将隐藏系统状态栏,通常游戏类应用才会设置为全屏模式显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + setFullscreen(fullscreen?: boolean): void; + /** + * 设置应用是否输出日志 + * 设置应用是否输出日志信息,默认关闭输出日志功能。 + * 日志包括应用原生层内部跟踪日志(ADB、LogCat工具可获取的日志)及JS层跟踪日志(console.log输出的日志)。 + * 开启日志在一定程度上会降低程序的性能,通常建议在正式发布时关闭日志输出,在调试时开启日志输出(此时可以通过工具ADB、LogCat获取分析日志)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + setLogs(log?: boolean): void; + /** + * 设置系统状态栏背景颜色 + * 设置应用在前台运行时系统状态栏的背景颜色,默认使用系统状态栏默认背景色(有系统状态栏样式决定)。 + * 注意:为了有更好的兼容性,避免设置接近白色或黑色的颜色值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + setStatusBarBackground(color?: string): void; + /** + * 获取系统状态栏背景颜色 + * 获取应用在前台运行时系统状态栏的背景颜色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + getStatusBarBackground(): string; + /** + * 设置系统状态栏样式 + * 设置应用在前台运行时系统状态栏的样式,默认值可通过manifest.json文件的plus->statusbar->style配置。 + * 注意:此操作是应用全局配置,调用的Webview窗口关闭后仍然生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + setStatusBarStyle(style?: string): void; + /** + * 获取系统状态栏样式 + * 获取应用运行时系统状态栏的样式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + getStatusBarStyle(): string; + /** + * 获取系统状态栏高度 + * 单位为像素(px),值为Webview中的逻辑高度单位,如果要获取真实高度则必须乘以plus.screen.scale。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + getStatusbarHeight(): number; + /** + * 判断当前是否为沉浸式状态栏模式 + * 如果当前应用采用沉浸式状态栏则返回true,否则返回false。 + * 注意:如果当前系统版本不支持沉浸式状态栏也返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + isImmersedStatusbar(): boolean; + /** + * 设置userAgent值 + * 设置应用通过navigator.userAgent获取的值,及所有发起Http请求时提交的userAgent值。 + * 如果要设置启动页面的userAgent值则需要在manifest.json中进行配置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + setUserAgent(useragent?: string, checkplus?: boolean): void; + /** + * 获取userAgent值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + getUserAgent(): string; + /** + * 设置Cookie值 + * 设置应用发起Http请求时提交的cookie值,调用此接口后所有的请求都生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + setCookie(url?: string, value?: string): void; + /** + * 获取Cookie值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + getCookie(url?: string): string; + /** + * 删除应用所有Cookie值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + removeAllCookie(): void; + /** + * 删除应用Cookie + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + removeCookie(url?: string): void; + /** + * 删除应用所有会话期Cookie值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + removeSessionCookie(): void; +} + +/** + * 创建应用快捷方式要设置的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ +interface PlusNavigatorShortcutOptions { + /** + * 快捷方式名称 + * 如果未设置则使用应用的名称,manifest.json中name属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + name?: string; + /** + * 快捷方式的图标 + * 如果未设置则优先使用应用中指定的图标(manifest.json中icon节点下对应分辨率的图标),如未区配则使用应用的图标(仅在独立打包时),否则使用runtime提供的默认图标。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + icon?: string; + /** + * 创建快捷方式后的提示信息 + * 快捷方式创建成功后显示,默认提示内容为“"XXXX"已创建桌面快捷方式”,其中"XXXX"为程序的名称,如果不需要提示则设置此值为空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + toast?: string; + /** + * 快捷方式的扩展参数 + * 其中key和value值都必须是字符串类型。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + extra?: any; + /** + * 要启动Activity类名 + * 通常情况下不需要指定此值,仅在5+SDK集成时自定义Activity才用到。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + classname?: string; + /** + * 是否需要强制创建快捷方式 + * true表示强制创建,false表示不强制创建,默认值为true。 + * 强制创建可能会导致在无法判断快捷方式是否存在的设备上重复创建,如果需要尽可能避免出现重复创建桌面快捷方式则应该设置force属性值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + force?: boolean; +} + +/** + * 更新应用启动界面要设置的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ +interface PlusNavigatorSplashscreenOptions { + /** + * 启动界面的图片路径 + * 仅支持本地文件路径,图片必须为png格式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + image?: string; + /** + * 是否自动关闭启动界面 + * true表示应用启动后自动关闭启动界面,false表示应用启动后不自动关闭启动界面,需要在应用调用plus.navigator.closeSplashscreen()方法关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + autoclose?: boolean; + /** + * 是否自动关闭启动界面(WAP2APP应用) + * 与autoclose属性值作用一致,仅在WAP2APP应用中有效。 + * 不推荐设置此值,如果未设置会自动使用autoclose属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + autoclose_w2a?: boolean; + /** + * 启动界面延时关闭时间 + * 仅在设置为自动关闭启动界面时有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + delay?: number; + /** + * 启动界面延时关闭时间(WAP2APP应用) + * 与delay属性值作用一致,仅在WAP2APP应用中有效。 + * 不推荐设置此值,如果未设置会自动使用delay属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + delay_w2a?: number; +} + +/** + * 运行环境权限类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ +interface PlusNavigatorPermissionNames { + /** + * 访问摄像头权限 + * 用于调用摄像头(plus.camera.*、plus.barcode.*)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + CAMERA?: string; + /** + * 访问系统联系人权限 + * 用于访问(读、写)系统通讯录(plus.gallery.*)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + CONTACTS?: string; + /** + * 访问系统相册权限 + * 用于访问(读、写)系统相册(plus.gallery.*)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + GALLERY?: string; + /** + * 定位权限 + * 用于获取当前用户位置信息(plus.geolocation.*)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + LOCATION?: string; + /** + * 消息通知权限 + * 用于接收系统消息通知(plus.push.*)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + NOTIFITION?: string; + /** + * 录音权限 + * 用于进行本地录音操作(plus.audio.AudioRecorder)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + RECORD?: string; + /** + * 创建桌面快捷方式权限 + * 用于在系统桌面创建快捷方式图标(plus.navigator.createShortcut)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/navigator.html](http://www.html5plus.org/doc/zh_cn/navigator.html) + */ + SHORTCUT?: string; +} + +/** + * Orientation模块管理设备的方向信息,包括alpha、beta、gamma三个方向信息,通过plus.orientation可获取设备方向管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ +interface PlusOrientation { + /** + * JSON对象,监听设备方向感应器参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + OrientationOption?: PlusOrientationOrientationOption; + /** + * JSON对象,设备方向信息数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + Rotation?: PlusOrientationRotation; + /** + * 获取当前设备的方向信息,包括alpha、beta、gamma三个方向信息 + * 方向信息是设备相对于水平初始方向分别以z、x、y轴为轴心旋转的角度,对应值为alpha、beta、gamma三个方向的信息。 方向信息可通过successCB回调函数返回。方向信息获取失败则调用回调函数errorCB + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + getCurrentOrientation(successCB?: (result: string) => void, errorCB?: (result: any) => void): void; + /** + * 监听设备方向信息的变化 + * 方向信息是设备相对于水平初始方向分别以z、x、y轴为轴心旋转的角度,对应值为alpha、beta、gamma三个方向的信息。watchOrientation每隔固定时间就获取一次设备的方向信息,通过successCB回调函数返回。可通过option的frequency参数设定获取设备方向信息的时间间隔。方向信息获取失败则调用回调函数errorCB。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + watchOrientation(successCB?: (result: string) => void, errorCB?: (result: any) => void, option?: PlusOrientationOrientationOption): number; + /** + * 关闭监听设备方向信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + clearWatch(watchId?: number): void; +} + +/** + * JSON对象,监听设备方向感应器参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ +interface PlusOrientationOrientationOption { + /** + * 更新方向信息的时间间隔 + * 数值类型,单位为ms,默认值为500ms。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + frequency?: number; +} + +/** + * JSON对象,设备方向信息数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ +interface PlusOrientationRotation { + /** + * 以z方向为轴心的旋转角度 + * 浮点数类型,只读属性,取值范围为0到360(不等于360)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + alpha?: number; + /** + * 以x方向为轴心的旋转角度 + * 浮点数类型,只读属性,取值范围为-180到180(不等于180)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + beta?: number; + /** + * 以y方向为轴心的旋转角度 + * 浮点数类型,只读属性,取值范围为-180到180(不等于180)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + gamma?: number; + /** + * 设备方向与地球磁场北极方向的角度 + * 浮点数类型,只读属性,取值范围为0到360(不等于360)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + magneticHeading?: number; + /** + * 设备方向与地球真实北极方向的角度 + * 浮点数类型,只读属性,取值范围为0到360(不等于360)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + trueHeading?: number; + /** + * 设备方向值的误差值 + * 浮点数类型,只读属性,取值范围为0到360(不等于360)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/orientation.html](http://www.html5plus.org/doc/zh_cn/orientation.html) + */ + headingAccuracy?: number; +} + +/** + * Proximity模块管理设备距离传感器,可获取当前设备的接近距离信息,通过plus.proximity可获取设备距离传感管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/proximity.html](http://www.html5plus.org/doc/zh_cn/proximity.html) + */ +interface PlusProximity { + /** + * 获取当前设备的接近距离信息 + * 获取当前接近设备的距离信息,距离值单位为厘米。如果感应器无法获取准确的距离值,则在接近设备时返回0,否则返回Infinity。 获取成功则调用successCB回调函数返接近回距离值。获取失败则调用errorCB回调函数错误信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/proximity.html](http://www.html5plus.org/doc/zh_cn/proximity.html) + */ + getCurrentProximity(successCB?: (result: number) => void, errorCB?: (result: any) => void): void; + /** + * 监听设备接近距离的变化 + * watchProximity将监听设备的接近距离信息变化事件,当接近距离发生变化时通过changeCB回调函数返回距离值。监听距离变化事件失败则通过errorCB回调函数返回错误信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/proximity.html](http://www.html5plus.org/doc/zh_cn/proximity.html) + */ + watchProximity(changeCB?: (result: number) => void, errorCB?: (result: any) => void): number; + /** + * 关闭监听设备接近距离变化 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/proximity.html](http://www.html5plus.org/doc/zh_cn/proximity.html) + */ + clearWatch(watchId?: number): void; +} + +/** + * Runtime模块管理运行环境,可用于获取当前运行环境信息、与其它程序进行通讯等。通过plus.runtime可获取运行环境管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ +interface PlusRuntime { + /** + * JSON对象,打开第三方程序参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + ApplicationInf?: PlusRuntimeApplicationInf; + /** + * JSON对象,应用角标显示需要的通知栏消息的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + BadgeOptions?: PlusRuntimeBadgeOptions; + /** + * JSON对象,打开文件参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + OpenFileOptions?: PlusRuntimeOpenFileOptions; + /** + * JSON对象,应用信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + WidgetInfo?: PlusRuntimeWidgetInfo; + /** + * JSON对象,应用安装参数 + * 可通过对象设置安装的应用是否进行appid校验、版本号校验等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + WidgetOptions?: PlusRuntimeWidgetOptions; + /** + * 当前应用的APPID + * 当前应用的APPID,字符串类型。注意,如果是在HBuilder真机运行获取的是固定值"HBuilder",需要提交App云端打包后运行才能获取真实的APPID值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + appid?: string; + /** + * 第三方程序调用时传递给程序的参数 + * 第三方程序传递过来的参数,字符串格式类型数据。 + * 不是由第三方程序调用启动,则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + arguments?: string; + /** + * 应用的市场推广渠道标识 + * "qihoo:browser"标识360浏览器流应用,"qihoo:appstore "表示360手机助手流应用,"dcloud:streamapps"表示DCloud流应用基座。 + * 注意:仅流应用环境中可用(如果没有特殊配置默认返回运行环境的包名),非流应用环境中返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + channel?: string; + /** + * 应用启动来源 + * 5+ APP启动类型,可取以下值: + * "default":默认启动方式,通常表示应用列表启动(360手助中搜索启动); + * "scheme":通过urlscheme方式触发启动; + * "push":通过点击系统通知方式触发启动; + * "stream":通过流应用api(plus.stream.open)启动; + * "shortcut":通过快捷方式启动,iOS平台表示通过3D Touch快捷方式,Android平台表示通过桌面快捷方式启动; + * "barcode":通过二维码扫描启动; + * "myapp":通过流应用"我的"应用列表或历史列表中触发启动; + * "favorite":通过流应用的"收藏"应用列表启动; + * "browser":通过流应用的内置浏览器导流启动的流应用(地址栏输入url启动应用、点击wap页面链接启动应用); + * "engines":通过流应用的浏览器界面作为搜索引擎启动; + * "search":通过流应用的应用搜索启动应用(如iOS平台的T9键盘搜索); + * "speech":通过流应用的语音识别启动应用; + * "miniProgram":通过微信小程序启动应用。 + * - default: + * 默认启动方式,通常表示从系统桌面图标启动 + * + * - scheme: + * 通过urlscheme方式触发启动 + * + * - push: + * 通过点击系统通知方式触发启动 + * + * - stream: + * 通过流应用api(plus.stream.open)启动 + * + * - shortcut: + * iOS平台表示通过3D Touch快捷方式,Android平台表示通过桌面快捷方式启动 + * + * - barcode: + * 通过二维码扫描启动 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + launcher?: 'default' | 'scheme' | 'push' | 'stream' | 'shortcut' | 'barcode'; + /** + * 应用安装来源 + * 5+应用安装来源,可取以下值: + * "default":默认安装来源,apk/ipa安装包内置安装; + * "stream":通过流应用api(plus.stream.open)安装,仅流应用环境下支持; + * "push":通过点击系统通知方式触发安装,仅流应用环境下支持; + * "scheme":通过urlscheme方式触发安装,仅流应用环境下支持; + * "barcode":通过二维码扫描触发安装,仅流应用环境下支持; + * "silent":通过后台静默方式安装,仅流应用环境下支持; + * "speech":通过语音识别方式触发安装,仅流应用环境下支持; + * "favorite":通过收藏界面启动触发安装,仅流应用环境下支持。 + * - default: + * 默认安装来源,apk/ipa安装包内置安装 + * + * - stream: + * 通过流应用api(plus.stream.open)安装 + * + * - push: + * 通过点击系统通知方式触发安装 + * + * - scheme: + * 通过urlscheme方式触发安装 + * + * - barcode: + * 通过二维码扫描触发安装 + * + * - silent: + * 通过后台静默方式安装 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + origin?: 'default' | 'stream' | 'push' | 'scheme' | 'barcode' | 'silent'; + /** + * 客户端的版本号 + * 字符串类型,在编译环境中设置的apk/ipa版本号。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + version?: string; + /** + * 客户端5+运行环境的版本号 + * 5+运行环境版本号,格式为:[主版本号].[次版本号].[修订版本号].[编译代号]。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + innerVersion?: string; + /** + * 获取当前应用首页加载的时间 + * 应用加载首页面的总时间,从开始加载首页面到首页面加载完成,单位为ms。 + * 注意,应用首页为网络地址则包括网络传输时间。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + launchLoadedTime?: number; + /** + * 获取当前应用的进程标识 + * 当前应用所属系统进程标识。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + processId?: string; + /** + * 获取当前应用的启动时间 + * 应用启动时间戳,距1970年1月1日之间的毫秒数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + startupTime?: number; + /** + * 获取指定APPID对应的应用信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + getProperty(appid?: string, getPropertyCB?: (result: PlusRuntimeWidgetInfo) => void): void; + /** + * 安装应用 + * 支持以下类型安装包: + * 1. 应用资源安装包(wgt),扩展名为'.wgt'; + * 2. 应用资源差量升级包(wgtu),扩展名为'.wgtu'; + * 3. 系统程序安装包(apk),要求使用当前平台支持的安装包格式。 + * 注意:仅支持本地地址,调用此方法前需把安装包从网络地址或其他位置放置到运行时环境可以访问的本地目录。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + install(filePath?: string, options?: PlusRuntimeWidgetOptions, installSuccessCB?: (result: PlusRuntimeWidgetInfo) => void, installErrorCB?: (result: any) => void): void; + /** + * 退出客户端程序 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + quit(): void; + /** + * 重启当前的应用 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + restart(): void; + /** + * 设置程序快捷方式图标上显示的角标数字 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + setBadgeNumber(number?: number, options?: PlusRuntimeBadgeOptions): void; + /** + * 调用第三方程序打开指定的URL + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + openURL(url?: string, errorCB?: (result: any) => void, identity?: string): void; + /** + * 使用内置Webview窗口打开URL + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + openWeb(url?: string): void; + /** + * 调用第三方程序打开指定的文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + openFile(filepath?: string, options?: PlusRuntimeOpenFileOptions, errorCB?: (result: any) => void): void; + /** + * 处理直达页面链接参数 + * 通过URL Scheme启动时,可以在?后面添加__direct_page参数自定义直达页面地址, + * 如“streamapp://m3w.cn/s/HelloH5?__direct_page=http%3a%2f%2fm.weibo.cn%2fu%2f3196963860”; + * 在流应用SDK集成时也可以通过direct_page参数(原生调用Intent)设置。 + * 注意:仅第一次调用此API时返回直达页面链接地址,再次调用将返回空字符串;如果应用重新被带直达页面链接参数的URL Scheme启动/激活时,可再次调用此方法获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + processDirectPage(): string; + /** + * 调用第三方程序 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + launchApplication(appInf?: PlusRuntimeApplicationInf, errorCB?: (result: any) => void): void; + /** + * 判断第三方程序是否已存在 + * 如果第三方程序已安装则返回true,未安装则返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + isApplicationExist(appInf?: PlusRuntimeApplicationInf): boolean; + /** + * 判断是否自定义应用启动页面加载地址 + * 通过URL Scheme启动时,可以在?后面添加__launch_path参数自定义应用启动首页加载的页面地址, + * 如“streamapp://m3w.cn/s/HelloH5?__launch_path=http%3a%2f%2fm.weibo.cn%2fu%2f3196963860”; + * 在流SDK集成时也可以通过launch_path参数(原生调用Intent)设置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + isCustomLaunchPath(): boolean; +} + +/** + * JSON对象,打开第三方程序参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ +interface PlusRuntimeApplicationInf { + /** + * 第三方程序包名 + * 仅Android平台支持,表示程序的包名,其它平台忽略此属性值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + pname?: string; + /** + * 程序的操作行为 + * Android平台上与系统的action值一致;iOS平台为要调用程序的URLScheme格式字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + action?: string; + /** + * 新任务模式标记 + * 可取值: + * true-使用新任务模式标记(FLAG_ACTIVITY_NEW_TASK)启动应用; + * false-不使用新任务模式标记(FLAG_ACTIVITY_NEW_TASK)启动应用。 + * 默认值为true。 + * 注意:由于5+应用配置的launchMode为singleTask,所以另一个5+应用通过plus.runtime.launchApplication启动时如果应用已经在后台运行则不会触发newintent事件,为了避免此问题需要将newTask参数值设置为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + newTask?: boolean; + /** + * 调用程序的参数 + * 仅Android平台支持,为JSON格式,用于传递给要调用程序的参数,如extra:{url:"http://www.html5plus.org"}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + extra?: any; +} + +/** + * JSON对象,应用角标显示需要的通知栏消息的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ +interface PlusRuntimeBadgeOptions { + /** + * 消息的标题 + * 默认值为应用的名称。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + title?: string; + /** + * 消息的内容 + * 默认值为“您有x条未读消息"”,其中x未设置的角标数字值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + content?: string; +} + +/** + * JSON对象,打开文件参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ +interface PlusRuntimeOpenFileOptions { + /** + * 优先使用的程序包名 + * 如果指定包名的程序已经安装,则调用其打开文件,若程序不支持打开文件则触发错误回调。 + * 如果指定包名的程序未安装,则弹出系统支持打开此文件的列表,由用户选择程序打开。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + pname?: string; + /** + * 弹出系统选择程序界面指示区域 + * JSON对象,格式如{top:10;left:10;width:200;height:200;},所有值为像素值,左上坐标相对于容器webview的位置。仅在iPad设备平台有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + popover?: any; +} + +/** + * JSON对象,应用信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ +interface PlusRuntimeWidgetInfo { + /** + * 应用的APPID + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + appid?: string; + /** + * 应用的版本号 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + version?: string; + /** + * 应用的名称 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + name?: string; + /** + * 应用描述信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + description?: string; + /** + * 应用描述信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + author?: string; + /** + * 开发者邮箱地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + email?: string; + /** + * 应用授权描述信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + license?: string; + /** + * 应用授权说明链接地址 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + licensehref?: string; + /** + * 应用许可特性列表 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + features?: string []; +} + +/** + * JSON对象,应用安装参数 + * 可通过对象设置安装的应用是否进行appid校验、版本号校验等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ +interface PlusRuntimeWidgetOptions { + /** + * 是否强制安装 + * true表示强制安装,不进行版本号的校验;false则需要版本号校验,如果将要安装应用的版本号不高于现有应用的版本号则终止安装,并返回安装失败。 + * 仅安装wgt和wgtu时生效,默认值 false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/runtime.html](http://www.html5plus.org/doc/zh_cn/runtime.html) + */ + force?: boolean; +} + +/** + * Storage模块管理应用本地数据存储区,用于应用数据的保存和读取。应用本地数据与localStorage、sessionStorage的区别在于数据有效域不同,前者可在应用内跨域操作,数据存储期是持久化的,并且没有容量限制。通过plus.storage可获取应用本地数据管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ +interface PlusStorage { + /** + * 获取应用存储区中保存的键值对的个数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ + getLength(): number; + /** + * 通过键(key)检索获取应用存储的值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ + getItem(key?: string): string; + /** + * 修改或添加键值(key-value)对数据到应用数据存储中 + * 如果设置的键在应用数据存储中已经存在,更新存储的键值。 + * 存储的键和值没有容量限制,但过多的数据量会导致效率降低,建议单个键值数据不要超过10Kb。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ + setItem(key?: string, value?: string): void; + /** + * 通过key值删除键值对存储的数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ + removeItem(key?: string): void; + /** + * 清除应用所有的键值对存储数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ + clear(): void; + /** + * 获取键值对中指定索引值的key值 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/storage.html](http://www.html5plus.org/doc/zh_cn/storage.html) + */ + key(index?: number): void; +} + +/** + * Stream模块操作流应用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ +interface PlusStream { + /** + * JSON对象,启动流应用参数 + * 指定要启动的流应用标识、名称、图标、参数等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + StreamOptions?: PlusStreamStreamOptions; + /** + * JSON对象,流应用恢复运行的参数 + * 设置流应用恢复运行时的参数、splash、首页等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + StreamRestoreOptions?: PlusStreamStreamRestoreOptions; + /** + * 流应用恢复运行时启动界面配置参数 + * 设置流应用恢复运行时启动界面,如是否自动关闭、延时关闭时间、超时时间等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + StreamRestoreSplashscreenOptions?: PlusStreamStreamRestoreSplashscreenOptions; + /** + * JSON对象,启动流应用的首页窗口属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + LaunchWebviewStyles?: PlusStreamLaunchWebviewStyles; + /** + * JSON对象,流应用信息 + * 流应用标识、图标、是否下载完成等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + StreamInfo?: PlusStreamStreamInfo; + /** + * JSON对象,免流量操作参数 + * 包含电话号码、验证码等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + FreetrafficOptions?: PlusStreamFreetrafficOptions; + /** + * 免流量状态变化事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + onfreetrafficStateChange?: any; + /** + * 启动流应用 + * 打开指定的流应用,在流应用中通过plus.runtime.launcher获取的值为"stream"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + open(options?: PlusStreamStreamOptions, successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 流应用激活统计 + * 提交统计数据到流应用服务器,表明业务系统激活成功。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + activate(): void; + /** + * 已下载流应用列表 + * 获取当前设备上已安装的所有流应用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + list(options?: any, successCallback?: any, errorCallback?: any): void; + /** + * 预加载流应用 + * 预加载指定的流应用资源,下载应用资源等,并不运行流应用。 + * 如果应用资源已经下载,则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + preload(appid?: string): void; + /** + * 删除流应用 + * 删除已下载的流应用,清空应用相关运行期保存的资源(如缓存、配置文件等)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + remove(appid?: string): void; + /** + * 设置流应用恢复运行的参数 + * 当流应用运行数目超过限制(通常最多运行2个流应用),会自动关闭之前切换到后台运行的应用。 + * 可通过此方法设置应用被自动关闭后再次被唤醒恢复运行时的参数,流应用恢复运行流程与第一次启动一致(差别是会使用StreamRestoreOptions中配置的参数)。 + * 如果没有调用setRestoreState方法,则恢复运行时使用启动时(调用plus.stream.open方法)传入的参数。 + * 注意:如果通过plus.stream.open方法启动应用,则忽略此方法设置的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + setRestoreState(options?: PlusStreamStreamRestoreOptions): void; + /** + * 请求免流量验证码 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + freetrafficRequest(options?: PlusStreamFreetrafficOptions, successCallback?: () => void, errorCallback?: (result: any) => void): void; + /** + * 免流量绑定手机号 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + freetrafficBind(options?: PlusStreamFreetrafficOptions, successCallback?: () => void, errorCallback?: (result: any) => void): void; + /** + * 解除免流量绑定 + * 解除当前设备绑定的手机号,如果设备未绑定则不执行操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + freetrafficRelease(): void; + /** + * 获取免流量状态信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + freetrafficInfo(successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 免流量是否生效 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + freetrafficIsValid(): boolean; +} + +/** + * JSON对象,启动流应用参数 + * 指定要启动的流应用标识、名称、图标、参数等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ +interface PlusStreamStreamOptions { + /** + * 流应用运行模式 + * 可取值:"test"表示测试版模式运行,其它值则为正式版本模式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + appmode?: string; + /** + * 流应用标识 + * 流应用唯一字符串标识。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + appid?: string; + /** + * 启动流应用的直达页面链接地址 + * 可在应用中通过plus.runtime.processDirectPage()方法获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + direct_page?: string; + /** + * 流应用运行参数 + * 启动流应用的扩展参数,可在流应用中通过plus.runtime.arguments获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + extras?: any; + /** + * 流应用图标 + * 流应用显示的图标路径(仅支持本地路径),在启动提示界面中显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + icon?: string; + /** + * 流应用启动类型 + * 流应用的启动类型,可在流应用中通过plus.runtime.launcher获取,默认值为“stream”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + launcher?: string; + /** + * 应用启动界面样式 + * 可取值: + * "auto":自动选择启动界面,如果splash图片已经下载则显示splash图片,否则使用默认加载流应用界面; + * "default":使用默认加载流应用界面(如在360浏览器环境中在标题栏下显示加载进度条)。 + * 默认值为"auto"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + splash?: string; + /** + * 流应用首页窗口对象样式 + * 如果流应用已经运行,从后台激活到前台时忽略此属性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + styles?: PlusStreamLaunchWebviewStyles; + /** + * 流应用名称 + * 流应用显示的标题,在启动提示界面中显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + title?: string; + /** + * 启动流应用的快捷方式逻辑 + * 可取值: + * "auto" - 检查并引导用户打开快捷方式权限,自动创建桌面快捷方式,在不支持快捷方式滤重的系统上仅创建一次; + * "force" - 检查并引导用户打开快捷方式权限,自动创建桌面快捷方式,在不支持快捷方式滤重的系统上每次都尝试创建; + * "none" - 不检查快捷方式权限,不创建桌面快捷方式(与从桌面快捷方式启动的流程一致); + * "query" - 弹出询问提示框(底部显示),用户点击确定后创建桌面快捷方式(检查并引导用户打开快捷方式权限); + * "tipOnce" - 业务逻辑与"auto"类似,差别是只会引导用户打开快捷方式权限一次、toast提示一次。 + * 默认值为"force"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + shortcut?: string; + /** + * 退出流应用的快捷方式逻辑 + * 可取值: + * "query" - 应用退出时检查是否创建桌面快捷方式,如果查询到没有创建则弹出询问框,用户点击确定后创建桌面快捷方式(检查并引导用户打开快捷方式权限); + * "queryOnce" - 仅应用第一次退出检查,检查逻辑同query; + * "none" - 应用退出时不检查是否创建桌面快捷方式。 + * 默认值为"none"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + shortcutQuit?: string; +} + +/** + * JSON对象,流应用恢复运行的参数 + * 设置流应用恢复运行时的参数、splash、首页等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ +interface PlusStreamStreamRestoreOptions { + /** + * 流应用运行参数 + * 启动流应用的扩展参数,可在流应用中通过plus.runtime.arguments获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + extras?: any; + /** + * 应用启动界面样式 + * 可取值: + * "auto":自动选择启动界面,如果流应用自动关闭时截图成功则使用截图,如果splash图片已经下载则显示splash图片,否则使用默认加载流应用界面; + * "default":使用默认加载流应用界面(如在360浏览器环境中在标题栏下显示加载进度条)。 + * 默认值为"auto"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + splash?: string; + /** + * 流应用首页窗口对象样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + styles?: PlusStreamLaunchWebviewStyles; + /** + * 流应用恢复运行时启动界面配置参数 + * 用于流应用自动关闭后恢复运行时调整启动界面配置参数,如将自动关闭splash调整为手动关闭,以便恢复上次运行状态后再进入应用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + splashscreen?: PlusStreamStreamRestoreSplashscreenOptions; +} + +/** + * 流应用恢复运行时启动界面配置参数 + * 设置流应用恢复运行时启动界面,如是否自动关闭、延时关闭时间、超时时间等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ +interface PlusStreamStreamRestoreSplashscreenOptions { + /** + * 是否自动关闭启动界面 + * true表示应用启动后自动关闭启动界面,false表示应用启动后不自动关闭启动界面,需要在应用调用plus.navigator.closeSplashscreen()方法关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + autoclose?: boolean; + /** + * 启动界面超时时间 + * 单位为毫秒(ms),当启动界面超过此时间仍然未关闭时(不管autoclose值设置true还是false),应用将自动关闭启动界面。 + * 默认值为6000(即6秒)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + timeout?: number; +} + +/** + * JSON对象,启动流应用的首页窗口属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ +interface PlusStreamLaunchWebviewStyles { + /** + * 流应用首页是否阻塞网络图片的加载 + * true表示阻塞网络图片的加载,false表示不阻塞网络图片的加载。默认值为false。 + * 设置后可通过Webview窗口对象的setBlockNetworkImage(false)方法修改设置来继续加载网络图片。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + blockNetworkImage?: boolean; + /** + * 指定流应用首页地址 + * 可使用网络地址(http://或https://开头),也可使用本地地址(相对应用资源路径)。 + * 也可使用特定地址: + * about:blank - 使用空白首页,仅加载内置注入的脚本(如all.js、wap2app.js、config.js等)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + launch_path?: string; + /** + * 指定首页Webview的id + * 如果未指定id,则使用应用的appid作为首页Webview的id。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + id?: string; + /** + * 流应用首页是否显示 + * true表示显示,false表示不显示。默认值为true。 + * 注意:流应用首页隐藏后,需要调用首页的setVisible方法显示,如plus.webview.getLaunchWebview().setVisible(true)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + visible?: boolean; +} + +/** + * JSON对象,流应用信息 + * 流应用标识、图标、是否下载完成等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ +interface PlusStreamStreamInfo { + /** + * 流应用标识 + * 流应用唯一字符串标识。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + id?: string; + /** + * 流应用的图标 + * 流应用下载的图标路径(本地路径),如果未下载完成则返回空。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + icon?: string; + /** + * 流应用是否下载完成 + * true表示流应用下载完成,false表示流应用未下载完成。 + * 注意,流应用未下载完成以让可以正常启动运行,启动后会自动下载。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + complete?: boolean; +} + +/** + * JSON对象,免流量操作参数 + * 包含电话号码、验证码等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ +interface PlusStreamFreetrafficOptions { + /** + * 电话号码 + * 免流量请求验证码、绑定设备使用的电话号码。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + phone?: string; + /** + * 验证码 + * 免流量绑定设备使用的验证码。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/stream.html](http://www.html5plus.org/doc/zh_cn/stream.html) + */ + code?: string; +} + +/** + * Uploader模块管理网络上传任务,用于从本地上传各种文件到服务器,并支持跨域访问操作。通过plus.uploader可获取上传管理对象。Uploader上传使用HTTP的POST方式提交数据,数据格式符合Multipart/form-data规范,即rfc1867(Form-based File Upload in HTML)协议。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ +interface PlusUploader { + /** + * Upload对象管理一个上传任务 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + Upload?: PlusUploaderUpload; + /** + * 上传任务事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + UploadEvent?: PlusUploaderUploadEvent; + /** + * 上传任务的状态,Number类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + UploadState?: PlusUploaderUploadState; + /** + * JSON对象,创建上传任务的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + UploadOptions?: PlusUploaderUploadOptions; + /** + * JSON对象,添加上传文件的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + UploadFileOptions?: PlusUploaderUploadFileOptions; + /** + * 新建上传任务 + * 请求上传管理创建新的上传任务,创建成功则返回Upload对象,用于管理上传任务。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + createUpload(url?: string, options?: PlusUploaderUploadOptions, completedCB?: (result0: PlusUploaderUpload, result1: number) => void): PlusUploaderUpload; + /** + * 枚举上传任务 + * 枚举指定状态的上传任务列表,通过enumCB回调函数返回结果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + enumerate(enumCB?: (result: PlusUploader []) => void, state?: PlusUploaderUploadState): void; + /** + * 清除上传任务 + * 清除指定状态的上传任务。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + clear(state?: PlusUploaderUploadState): void; + /** + * 开始所有上传任务 + * 开始所有处于未开始调度或暂停状态的上传任务。 + * 若上传任务数超过可并发处理的总数,超出的任务处于调度状态(等待上传),当有任务完成时根据调度状态任务的优先级选择任务开始上传。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + startAll(): void; +} + +/** + * Upload对象管理一个上传任务 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ +interface PlusUploaderUpload { + /** + * 上传任务的标识 + * 在创建任务时系统自动分配,用于标识上传任务的唯一性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + id?: string; + /** + * 上传文件的服务器地址 + * 调用plus.uploader.createUpload()方法创建上传任务时设置的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + url?: string; + /** + * 任务的状态 + * 上传任务的状态,参考UploadState,在UploadCompleteCallback事件和UploadStateChangedCallback事件触发时更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + state?: number; + /** + * 上传任务的参数 + * 上传任务配置的参数,参考UploadOptions。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + options?: PlusUploaderUploadOptions; + /** + * 上传任务完成后服务器返回的数据 + * 表示当前上传任务的状态,可通过addEventListener()方法监听statechanged事件监听任务状态的变化。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + responseText?: string; + /** + * 已完成上传数据的大小) + * 整数类型,单位为字节(byte),上传任务开始传输数据时,每次触发statechanged事件或上传任务完成更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + uploadedSize?: number; + /** + * 上传数据的总大小 + * 整数类型,单位为字节(byte),上传任务开始传输数据时更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + totalSize?: number; + /** + * 添加上传文件 + * 向上传任务中添加文件,必须在任务开始上传前调用。 + * 以下情况会导致添加上传文件失败: + * 1. options参数中指定的key在任务中已经存在,则添加失败返回false; + * 2. path参数指定的文件路径不合法或文件不存在,则添加失败返回false; + * 3. 上传任务已经开始调度,调用此方法则添加失败返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + addFile(path?: string, options?: PlusUploaderUploadFileOptions): boolean; + /** + * 添加上传数据 + * 向上传任务中添加数据,必须在任务开始上传前调用。 + * 以下情况会导致添加上传文件失败: + * 1. key参数中指定的键名在任务中已经存在,则添加失败返回false; + * 2. 上传任务已经开始调度,调用此方法则添加失败返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + addData(key?: string, value?: string): boolean; + /** + * 开始上传任务 + * 开始调度上传任务,如果任务已经处于开始状态则无任何响应。 + * 在创建任务或任务上传失败后调用可重新开始上传。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + start(): void; + /** + * 暂停上传任务 + * 暂停上传任务,如果任务已经处于初始状态或暂停状态则无任何响应。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + pause(): void; + /** + * 恢复暂停的上传任务 + * 继续暂停的上传任务,如果任务处于非暂停状态则无任何响应。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + resume(): void; + /** + * 取消上传任务 + * 如果任务未完成,则终止上传,并从任务列表中删除。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + abort(): void; + /** + * 添加上传任务事件监听器 + * 上传任务添加事件监听器后,当监听的事件发生时触发listener回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + addEventListener(type?: string, listener?: (result0: PlusUploaderUpload, result1: number) => void, capture?: boolean): void; + /** + * 获取上传请求HTTP响应头部信息 + * HTTP响应头部全部内容作为未解析的字符串返回,如果没有接收到这个HTTP响应头数据或者上传请求未完成则为空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + getAllResponseHeaders(): string; + /** + * 获取上传请求指定的HTTP响应头部的值 + * 其参数是要返回的HTTP响应头部的名称,可以使用任何大小写来制定这个头部名字,和响应头部的比较是不区分大小写的。 + * 如果没有接收到这个头部或者伤处请求未完成则为空字符串;如果接收到多个有指定名称的头部,这个头部的值被连接起来并返回,使用逗号和空格分隔开各个头部的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + getResponseHeader(headerName?: string): string; + /** + * 设置上传请求的HTTP头数据 + * Http的Header应该包含在通过后续start()调用而发起的请求中,此方法必需在调用start()之前设置才能生效。 + * 如果带有指定名称的头部已经被指定了,这个头部的新值就是:之前指定的值,加上逗号、以及这个调用指定的值(形成一个数组)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + setRequestHeader(headerName?: string, headerValue?: string): void; +} + +/** + * 上传任务事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ +interface PlusUploaderUploadEvent { + /** + * 上传任务状态变化事件 + * 当上传任务状态发生变化时触发此事件,事件原型参考UploadStateChangedCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + statechanged?: string; +} + +/** + * 上传任务的状态,Number类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ +type PlusUploaderUploadState = undefined | 0 | 1 | 2 | 3 | 4 | 5 | -1; + +/** + * JSON对象,创建上传任务的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ +interface PlusUploaderUploadOptions { + /** + * 网络请求类型 + * 仅支持http协议的“POST”请求。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + method?: string; + /** + * 上传任务每次上传的文件块大小(仅在支持断点续传的服务有效) + * 数值类型,单位为Byte(字节),默认值为102400,若设置值小于等于0则表示不分块上传。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + blocksize?: number; + /** + * 上传任务的优先级 + * 数值类型,数值越大优先级越高,默认优先级值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + priority?: number; + /** + * 上传任务超时时间 + * 数值类型,单位为s(秒),默认值为120s。 + * 超时时间为服务器响应请求的时间(不是上传任务完成的总时间),如果设置为0则表示永远不超时。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + timeout?: number; + /** + * 上传任务重试次数 + * 数值类型,默认为重试3次。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + retry?: number; + /** + * 上传任务重试间隔时间 + * 数值类型,单位为s(秒),默认值为30s。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + retryInterval?: number; +} + +/** + * JSON对象,添加上传文件的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ +interface PlusUploaderUploadFileOptions { + /** + * 文件键名 + * 上传文件在上传任务中的键名,默认值为为文件名称。 + * 上传任务中如果已经存在相同key的上传文件或数据将导致添加文件失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + key?: string; + /** + * 文件名称 + * 上传文件的名称,默认值为上传文件路径中的名称。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + name?: string; + /** + * 文件类型 + * 上传文件的类型(如图片文件为“image/jpeg”),默认值自动根据文件后缀名称生成。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/uploader.html](http://www.html5plus.org/doc/zh_cn/uploader.html) + */ + mime?: string; +} + +/** + * Video模块管理多媒体视频相关能力,可用创建视频播放控件,直播推流控件等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ +interface PlusVideo { + /** + * 视频播放控件对象 + * VideoPlayer对象表示视频播放控件对象,在窗口中播放视频,可支持本地视频(mp4/flv),网络视频地址(mp4/flv/m3u8)及流媒体(rtmp/hls/rtsp)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + VideoPlayer?: PlusVideoVideoPlayer; + /** + * 视频播放控件参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + VideoPlayerStyles?: PlusVideoVideoPlayerStyles; + /** + * 视频播放控件事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + VideoPlayerEvents?: PlusVideoVideoPlayerEvents; + /** + * 直播推流控件对象 + * LivePusher对象表示直播推流控件对象,在窗口中显示捕获视频,实时推送到流媒体(RTMP)服务器。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + LivePusher?: PlusVideoLivePusher; + /** + * 直播推流控件配置选项 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + LivePusherStyles?: PlusVideoLivePusherStyles; + /** + * 直播推流控件事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + LivePusherEvents?: PlusVideoLivePusherEvents; + /** + * 创建VideoPlayer对象 + * 调用此方法创建后并不会显示,需要调用Webview窗口的append方法将其添加到Webview窗口后才能显示。 + * 注意:此时需要通过styles参数的top/left/width/height属性设置控件的位置及大小。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + createVideoPlayer(id?: string, styles?: PlusVideoVideoPlayerStyles): PlusVideoVideoPlayer; + /** + * 创建LivePusher对象 + * 调用此方法创建后并不会显示,需要调用Webview窗口的append方法将其添加到Webview窗口后才能显示。 + * 注意:此时需要通过styles参数的top/left/width/height属性设置控件的位置及大小。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + createLivePusher(id?: string, styles?: PlusVideoLivePusherStyles): PlusVideoLivePusher; + /** + * 查找已经创建的VideoPlayer对象 + * 查找指定id的VideoPlayer对象,如果不存在则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + getVideoPlayerById(id?: string): PlusVideoVideoPlayer; + /** + * 查找已经创建的LivePusher对象 + * 查找指定id的LivePusher对象,如果不存在则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + getLivePusherById(id?: string): PlusVideoLivePusher; +} + +/** + * 视频播放控件对象 + * VideoPlayer对象表示视频播放控件对象,在窗口中播放视频,可支持本地视频(mp4/flv),网络视频地址(mp4/flv/m3u8)及流媒体(rtmp/hls/rtsp)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ +interface PlusVideoVideoPlayer { + /** + * 监听视频播放控件事件 + * 向视频播放控件添加事件监听器,当指定的事件发生时,将触发listener函数的执行。 + * 可多次调用此方法向视频播放控件添加多个监听器,当监听的事件发生时,将按照添加的先后顺序执行。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + addEventListener(event?: PlusVideoVideoPlayerEvents, listener?: (result: any) => void, capture?: boolean): void; + /** + * 设置视频播放控件参数 + * 用于动态更新视频播放控件的配置参数。 + * 注意:有些选项无法动态更新,只能创建时进行设置,详情参考VideoPlayerStyles。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + setStyles(styles?: PlusVideoVideoPlayerStyles): void; + /** + * 设置视频播放控件参数(将废弃,使用setStyles) + * 用于动态更新视频播放控件的配置选项。 + * 注意:有些选项无法动态更新,只能创建时进行设置,详情参考VideoPlayerStyles。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + setOptions(options?: PlusVideoVideoPlayerStyles): void; + /** + * 播放视频 + * 如果视频已经处于播放状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + play(): void; + /** + * 暂停视频 + * 如果视频未处于播放状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + pause(): void; + /** + * 跳转到指定位置 + * 如果视频未处于播放状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + seek(position?: number): void; + /** + * 切换到全屏 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + requestFullScreen(direction?: number): void; + /** + * 退出全屏 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + exitFullScreen(): void; + /** + * 停止播放视频 + * 如果视频未处于播放或暂停状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + stop(): void; + /** + * 隐藏视频播放控件 + * 隐藏只是控件不可见,控件依然存在并且不改变播放状态。 + * 如果控件已经隐藏,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + hide(): void; + /** + * 显示视频播放控件 + * 将隐藏的控件显示出来(回复到隐藏前的状态)。 + * 如果控件已经显示,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + show(): void; + /** + * 关闭视频播放控件 + * 关闭操作将释放控件所有资源,不再可用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + close(): void; + /** + * 发送弹幕 + * 如果视频未处于播放状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + sendDanmu(danmu?: any): void; + /** + * 设置倍速播放 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + playbackRate(rate?: number): void; +} + +/** + * 视频播放控件参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ +interface PlusVideoVideoPlayerStyles { + /** + * 视频资源地址 + * 支持本地地址,也支持网络地址及直播流(RTMP)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + src?: string; + /** + * 视频初始播放位置 + * 单位为秒(s)。 + * 注意:仅在视频开始播放前设置有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'initial-time'?: number; + /** + * 视频长度 + * 单位为秒(s)。 + * 注意:仅在视频开始播放前设置有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + duration?: number; + /** + * 是否显示默认播放控件 + * 默认值为true。 + * 包括播放/暂停按钮、播放进度、时间等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + controls?: boolean; + /** + * 弹幕列表 + * 弹幕JSON对象包括属性:text(String类型,弹幕文本类容),color(String类型,弹幕颜色,格式为#RRGGBB),time(Number类型,弹幕出现的时间,单位为秒)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'danmu-list'?: any []; + /** + * 是否显示弹幕按钮 + * 默认值为false。 + * 注意:仅在控件构造时设置有效,不能动态更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'danmu-btn'?: boolean; + /** + * 是否展示弹幕 + * 默认值为false。 + * 注意:仅在控件构造时设置有效,不能动态更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'enable-danmu'?: boolean; + /** + * 是否自动播放 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + autoplay?: boolean; + /** + * 是否循环播放 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + loop?: boolean; + /** + * 是否静音播放 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + muted?: boolean; + /** + * 设置全屏时视频的方向 + * 不指定则根据宽高比自动判断。 + * 有效值为: 0(正常竖向), 90(屏幕逆时针90度), -90(屏幕顺时针90度)。 + * 默认值为-90。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + direction?: number; + /** + * 是否显示播放进度 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'show-progress'?: boolean; + /** + * 是否显示全屏按钮 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'show-fullscreen-btn'?: boolean; + /** + * 是否显示视频底部控制栏的播放按钮 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'show-play-btn'?: boolean; + /** + * 是否显示视频中间的播放按钮 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'show-center-play-btn'?: boolean; + /** + * 是否开启控制进度的手势 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'enable-progress-gesture'?: boolean; + /** + * 当视频大小与 video 容器大小不一致时,视频的表现形式 + * 有效值为:contain(包含),fill(填充),cover(覆盖)。 + * 默认值为contain。 + * 仅Android平台支持。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + objectFit?: string; + /** + * 视频封面的图片网络资源地址 + * 如果 controls 属性值为 false 则设置 poster 无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + poster?: string; + /** + * VideoPlayer控件左上角的垂直偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度; + * 自动计算,如"auto",根据height值自动计算,相对于父Webview窗口垂直居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + top?: string; + /** + * VideoPlayer控件左上角的水平偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度; + * 自动计算,如"auto",根据width值自动计算,相对于父Webview窗口水平居中。 + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + left?: string; + /** + * VideoPlayer控件的宽度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + width?: string; + /** + * VideoPlayer控件的高度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + height?: string; + /** + * VideoPlayer控件在Webview窗口的布局模式 + * 可取值: + * "static" - 静态布局模式,如果页面存在滚动条则随窗口内容滚动; + * "absolute" - 绝对布局模式,如果页面存在滚动条不随窗口内容滚动; + * 默认值为"static"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + position?: string; +} + +/** + * 视频播放控件事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ +interface PlusVideoVideoPlayerEvents { + /** + * 视频播放事件 + * 当视频开始/继续播放时触发。 + * 无事件回调函数参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + play?: string; + /** + * 视频暂停事件 + * 当视频暂停播放时触发。 + * 无事件回调函数参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + pause?: string; + /** + * 视频结束事件 + * 当视频播放到末尾时触发。 + * 无事件回调函数参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + ended?: string; + /** + * 视频播放进度更新事件 + * 当视频播放进度变化时触发,触发频率250ms一次。 + * 事件回调函数参数event.detail = {currentTime:"Number类型,当前播放时间(单位为秒)",duration:"Number类型,视频总长度(单位为秒)"}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + timeupdate?: string; + /** + * 视频播放全屏播放状态变化事件 + * 当视频播放进入或退出全屏时触发。 + * 事件回调函数参数event.detail = {fullScreen:"Boolean类型,当前状态是否为全屏", direction:"String类型,vertical或horizontal"}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + fullscreenchange?: string; + /** + * 视频缓冲事件 + * 当视频播放出现缓冲时触发。 + * 无事件回调函数参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + waiting?: string; + /** + * 视频错误事件 + * 当视频播放出错时触发。 + * 无事件回调函数参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + error?: string; +} + +/** + * 直播推流控件对象 + * LivePusher对象表示直播推流控件对象,在窗口中显示捕获视频,实时推送到流媒体(RTMP)服务器。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ +interface PlusVideoLivePusher { + /** + * 监听直播推流控件事件 + * 向直播推流控件添加事件监听器,当指定的事件发生时,将触发listener函数的执行。 + * 可多次调用此方法向直播推流控件添加多个监听器,当监听的事件发生时,将按照添加的先后顺序执行。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + addEventListener(event?: PlusVideoLivePusherEvents, listener?: (result: any) => void, capture?: boolean): void; + /** + * 设置直播推流控件参数 + * 用于动态更新直播推流控件的配置参数。 + * 注意:有些选项无法动态更新,只能创建时进行设置,详情参考LivePusherStyles。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + setStyles(styles?: PlusVideoLivePusherStyles): void; + /** + * 设置直播推流控件参数(将废弃,使用setStyles) + * 用于动态更新直播推流控件的配置选项。 + * 注意:有些选项无法动态更新,只能创建时进行设置,详情参考LivePusherStyles。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + setOptions(options?: PlusVideoLivePusherStyles): void; + /** + * 预览摄像头采集数据 + * 调用摄像头采集图像数据,并在推流控件中预览(此时不会向服务器推流,需调用start方法才开始推流)。 + * 注意:为了确保预览窗口大小正确,应该在创建控件后延时一定的时间(如500ms)进行预览。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + preview(): void; + /** + * 开始推流 + * 如果已经处于推流状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + start(successCB?: () => void, errorCB?: () => void): void; + /** + * 停止推流 + * 如果未处于推流状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + stop(options?: any): void; + /** + * 暂停推流 + * 如果未处于推流状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + pause(): void; + /** + * 恢复推流 + * 如果未处于暂停状态,则操作无效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + resume(): void; + /** + * 切换前后摄像头 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + switchCamera(): void; + /** + * 快照 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + snapshot(successCB?: () => void, errorCB?: () => void): void; + /** + * 关闭直播推流控件 + * 关闭操作将释放控件所有资源,不再可用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + close(): void; +} + +/** + * 直播推流控件配置选项 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ +interface PlusVideoLivePusherStyles { + /** + * 推流地址 + * 支持RTMP协议。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + url?: string; + /** + * 推流视频模式 + * 可取值:SD(标清), HD(高清), FHD(超清)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + mode?: string; + /** + * 是否静音 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + muted?: boolean; + /** + * 开启摄像头 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'enable-camera'?: boolean; + /** + * 自动聚集 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + 'auto-focus'?: boolean; + /** + * 是否美颜 + * 可取值0、1,其中0表示不使用美颜,1表示不使用美颜。 + * 默认值为0(不使用美颜)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + beauty?: number; + /** + * 是否美白 + * 可取值0、1、2、3、4、5,其中0表示不使用美白,其余值分别表示美白的程度,值越大美白程度越大。 + * 默认值为0(不使用美白)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + whiteness?: number; + /** + * 宽高比 + * 可取值:3:4, 9:16。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + aspect?: string; + /** + * LivePusher控件左上角的垂直偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度; + * 自动计算,如"auto",根据height值自动计算,相对于父Webview窗口垂直居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + top?: string; + /** + * LivePusher控件左上角的水平偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度; + * 自动计算,如"auto",根据width值自动计算,相对于父Webview窗口水平居中。 + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + left?: string; + /** + * LivePusher控件的宽度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + width?: string; + /** + * LivePusher控件的高度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + height?: string; + /** + * LivePusher控件在Webview窗口的布局模式 + * 可取值: + * "static" - 静态布局模式,如果页面存在滚动条则随窗口内容滚动; + * "absolute" - 绝对布局模式,如果页面存在滚动条不随窗口内容滚动; + * 默认值为"static"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + position?: string; +} + +/** + * 直播推流控件事件类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ +interface PlusVideoLivePusherEvents { + /** + * 状态变化事件 + * 当推流连接服务器状态变化时触发。 + * 事件回调函数参数event={type:"事件类型,此时为statechange",target:"触发此事件的直播推流控件对象",detail:{code:"状态码,参考后面状态码说明",message:"描述信息"}}。 + * 其中code状态码: + * 1001 - 已经连接推流服务器; + * 1002 - 已经与服务器握手完毕,开始推流; + * 1003 - 打开摄像头成功; + * 1004 - 录屏启动成功; + * 1005 - 推流动态调整分辨率; + * 1006 - 推流动态调整码率; + * 1007 - 首帧画面采集完成; + * 1008 - 编码器启动; + * -1301 - 打开摄像头失败; + * -1302 - 打开麦克风失败; + * -1303 - 视频编码失败; + * -1304 - 音频编码失败; + * -1305 - 不支持的视频分辨率; + * -1306 - 不支持的音频采样率; + * -1307 - 网络断连,且经多次重连抢救无效,更多重试请自行重启推流; + * -1308 - 开始录屏失败,可能是被用户拒绝; + * -1309 - 录屏失败,不支持的Android系统版本,需要5.0以上的系统; + * -1310 - 录屏被其他应用打断了; + * -1311 - Android Mic打开成功,但是录不到音频数据; + * -1312 - 录屏动态切横竖屏失败; + * 1101 - 网络状况不佳:上行带宽太小,上传数据受阻; + * 1102 - 网络断连, 已启动自动重连; + * 1103 - 硬编码启动失败,采用软编码; + * 1104 - 视频编码失败; + * 1105 - 新美颜软编码启动失败,采用老的软编码; + * 1106 - 新美颜软编码启动失败,采用老的软编码; + * 3001 - RTMP -DNS解析失败; + * 3002 - RTMP服务器连接失败; + * 3003 - RTMP服务器握手失败; + * 3004 - RTMP服务器主动断开,请检查推流地址的合法性或防盗链有效期; + * 3005 - RTMP 读/写失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + statechange?: string; + /** + * 网络状态通知事件 + * 当推流的网络状态发生变化时触发。 + * 事件回调函数参数event={type:"事件类型,此时为netstatus",target:"触发此事件的直播推流控件对象",detail:{videoBitrate:"视频码率",audioBitrate:"音频码率",videoFPS:"视频帧率",netSpeed:"推流网速",videoWidth:"视频宽度",videoHeight:"视频高度"}}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + netstatus?: string; + /** + * 渲染错误事件 + * 当推流发生错误是触发。 + * 事件回调函数参数event={type:"事件类型,此时为error",target:"触发此事件的直播推流控件对象",detail:{code:"错误编码,参考后面错误码说明",message:"描述信息"}}。 + * 其中code错误码: + * 1001 - 用户禁止使用摄像头; + * 1002 - 用户禁止使用录音。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/video.html](http://www.html5plus.org/doc/zh_cn/video.html) + */ + error?: string; +} + +/** + * Webview模块管理应用窗口界面,实现多窗口的逻辑控制管理操作。通过plus.webview可获取应用界面管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebview { + /** + * 一组用于定义页面或控件显示动画效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + AnimationTypeShow?: PlusWebviewAnimationTypeShow; + /** + * 一组用于定义页面或控件关闭的动画效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + AnimationTypeClose?: PlusWebviewAnimationTypeClose; + /** + * Webview窗口对象,用于操作加载HTML页面的窗口 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewObject?: PlusWebviewWebviewObject; + /** + * Webview窗口动画参数 + * 用于指定动画目标窗口,起始位置、目标位置等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewAnimationOptions?: PlusWebviewWebviewAnimationOptions; + /** + * Webview窗口动画样式 + * 用于指定动画窗口的起始位置、目标位置等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewAnimationStyles?: PlusWebviewWebviewAnimationStyles; + /** + * Webview窗口回弹样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewBounceStyle?: PlusWebviewWebviewBounceStyle; + /** + * Webview窗口内容动画参数 + * 指定动画的类型、持续时间等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewContentAnimationOptions?: PlusWebviewWebviewContentAnimationOptions; + /** + * 原生控件在窗口中停靠的方式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewDock?: PlusWebviewWebviewDock; + /** + * Webview窗口滑动事件数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewDragEvent?: PlusWebviewWebviewDragEvent; + /** + * 窗口手势操作参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewDragOptions?: PlusWebviewWebviewDragOptions; + /** + * 手势操作关联对象参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewDragOtherViewOptions?: PlusWebviewWebviewDragOtherViewOptions; + /** + * 截屏绘制操作参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewDrawOptions?: PlusWebviewWebviewDrawOptions; + /** + * 窗口收藏参数 + * 在流应用环境中调用收藏功能时使用的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewFavoriteOptions?: PlusWebviewWebviewFavoriteOptions; + /** + * 创建加载HTML数据参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewLoadDataOptions?: PlusWebviewWebviewLoadDataOptions; + /** + * 窗口的分享参数 + * 在流应用环境中调用分享功能时使用的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewShareOptions?: PlusWebviewWebviewShareOptions; + /** + * 窗口原生子View控件样式 + * 可设置原生控件的标识、大小、位置以及绘制的内容等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewSubNViewStyles?: PlusWebviewWebviewSubNViewStyles; + /** + * 窗口标题栏控件样式 + * 标题栏控件固定高度为44px,可通过Webview窗口对象的getTitleNView方法获取标题栏原生控件对象动态绘制内容。 + * 可以通过WebviewObject对象的getTitleNView()获取标题栏的NView对象,然后调用其setStyle方法更新样式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewTitleNViewStyles?: PlusWebviewWebviewTitleNViewStyles; + /** + * 窗口标题栏自定义按钮样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewTitleNViewButtonStyles?: PlusWebviewWebviewTitleNViewButtonStyles; + /** + * 标题栏控件的进度条样式 + * 显示在标题栏控件底部。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewProgressStyles?: PlusWebviewWebviewProgressStyles; + /** + * 窗口标题栏控件的分割线样式 + * 显示在标题栏控件底部。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewSplitLineStyles?: PlusWebviewWebviewSplitLineStyles; + /** + * Webview窗口事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewEvent?: PlusWebviewWebviewEvent; + /** + * JSON对象,原生窗口扩展参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewExtraOptions?: PlusWebviewWebviewExtraOptions; + /** + * 原生控件在窗口中显示的位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewPosition?: PlusWebviewWebviewPosition; + /** + * Webview窗口下拉刷新样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewPullToRefreshStyles?: PlusWebviewWebviewPullToRefreshStyles; + /** + * Webview窗口rendered事件参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewRenderedEventOptions?: PlusWebviewWebviewRenderedEventOptions; + /** + * 替换H5标准API配置信息 + * 目前仅支持替换H5标准定位接口 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewReplaceWebApiOptions?: PlusWebviewWebviewReplaceWebApiOptions; + /** + * JSON对象,Webview窗口的系统状态栏区域样式 + * 仅在应用设置为沉浸式状态栏样式下有效,非沉浸式状态栏样式下忽略此属性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewStatusbarStyles?: PlusWebviewWebviewStatusbarStyles; + /** + * JSON对象,Webview窗口对象的样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewStyles?: PlusWebviewWebviewStyles; + /** + * 一组用于定义页面或控件变形的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewTransform?: PlusWebviewWebviewTransform; + /** + * 一组用于定义页面或控件转换效果的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewTransition?: PlusWebviewWebviewTransition; + /** + * 拦截Webview窗口资源请求的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewOverrideResourceOptions?: PlusWebviewWebviewOverrideResourceOptions; + /** + * 拦截Webview窗口URL请求的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewOverrideUrlOptions?: PlusWebviewWebviewOverrideUrlOptions; + /** + * 监听Webview窗口资源加载的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + WebviewListenResourceOptions?: PlusWebviewWebviewListenResourceOptions; + /** + * 获取所有Webview窗口 + * 获取应用中已创建的所有Webview窗口,包括所有未显示的Webview窗口。 + * 返回WebviewObject对象在数组中按创建的先后顺序排列,即数组中第一个WebviewObject对象用是加载应用的入口页面。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + all(): PlusWebview []; + /** + * 关闭Webview窗口 + * 关闭已经打开的Webview窗口,需先获取窗口对象或窗口id,并可指定关闭窗口的动画及动画持续时间。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + close(id_wvobj?: string, aniClose?: string, duration?: number, extras?: PlusWebviewWebviewExtraOptions): void; + /** + * 创建新的Webview窗口 + * 创建Webview窗口,用于加载新的HTML页面,可通过styles设置Webview窗口的样式,创建完成后需要调用show方法才能将Webview窗口显示出来。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + create(url?: string, id?: string, styles?: PlusWebviewWebviewStyles, extras?: any): PlusWebviewWebviewObject; + /** + * 获取当前窗口的WebviewObject对象 + * 获取当前页面所属的Webview窗口对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + currentWebview(): PlusWebviewWebviewObject; + /** + * 获取屏幕所有可视的Webview窗口 + * 仅在屏幕区域显示的Webview窗口,如果Webview窗口显示了但被其它Webview窗口盖住则认为不可视。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getDisplayWebview(): PlusWebview []; + /** + * 查找指定标识的WebviewObject窗口 + * 在已创建的窗口列表中查找指定标识的Webview窗口并返回。 + * 若没有查找到指定标识的窗口则返回null,若存在多个相同标识的Webview窗口,则返回第一个创建的Webview窗口。 + * 如果要获取应用入口页面所属的Webview窗口,其标识为应用的%APPID%,可通过plus.runtime.appid获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getWebviewById(id?: string): PlusWebviewWebviewObject; + /** + * 获取应用首页WebviewObject窗口对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getLaunchWebview(): PlusWebviewWebviewObject; + /** + * 获取应用第二个首页WebviewObject窗口对象 + * 在双首页模式下(在manifest.json的plus->secondwebview节点下配置),应用会自动创建两个首页Webview,通过getLaunchWebview()可获取第一个首页窗口对象,通过getSecondWebview()可获取第二个首页窗口对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getSecondWebview(): PlusWebviewWebviewObject; + /** + * 获取应用显示栈顶的WebviewObject窗口对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getTopWebview(): PlusWebviewWebviewObject; + /** + * 隐藏Webview窗口 + * 根据指定的WebviewObject对象或id隐藏Webview窗口,使得窗口不可见。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + hide(id_wvobj?: string, aniHide?: string, duration?: number, extras?: PlusWebviewWebviewExtraOptions): void; + /** + * 创建并打开Webview窗口 + * 创建并显示Webview窗口,用于加载新的HTML页面,可通过styles设置Webview窗口的样式,创建完成后自动将Webview窗口显示出来。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + open(url?: string, id?: string, styles?: PlusWebviewWebviewStyles, aniShow?: string, duration?: number, showedCB?: () => void): PlusWebviewWebviewObject; + /** + * 预载网络页面 + * 预载网络页面会向服务器发起http/https请求获取html页面内容, + * 待Webview窗口加载此url页面时会则根据缓存机制优先使用预载的页面内容(加快页面显示速度)。 + * 注意:预载网络页面仅在运行期生效,为了节省内存仅保留最后5个预载页面数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + prefetchURL(url?: string): void; + /** + * 预载网络页面(多个地址) + * 预载网络页面会向服务器发起http/https请求获取html页面内容, + * 待Webview窗口加载此url页面时会则根据缓存机制优先使用预载的页面内容(加快页面显示速度)。 + * 注意:预载网络页面仅在运行期生效,为了节省内存仅保留最后5个预载页面数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + prefetchURLs(urls?: any []): void; + /** + * 显示Webview窗口 + * 显示已创建或隐藏的Webview窗口,需先获取窗口对象或窗口id,并可指定显示窗口的动画及动画持续时间。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + show(id_wvobj?: string, aniShow?: string, duration?: number, showedCB?: () => void, extras?: PlusWebviewWebviewExtraOptions): PlusWebviewWebviewObject; + /** + * Webview窗口组合动画 + * 同步组合两个Webview窗口动画,动画完成后窗口的位置会发生变化,一次需要在动画属性参数中设置动画起始位置、结束位置等。 + * 注意:此动画操作会改变窗口位置(如left值等),再次调用show方法时需要确保其位置是否在可视区域,如果不在可视区域则需要调用窗口的setStyle方法设置其位置到可视区域内,如setStyle({left:'0px'});。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + startAnimation(options?: PlusWebviewWebviewAnimationOptions, otherOptions?: PlusWebviewWebviewAnimationOptions, callback?: (result: any) => void): void; + /** + * 获取Webview默认是否开启硬件加速 + * 由于不同设备对硬件加速的支持情况存在差异,开启硬件加速能加速HTML页面的渲染,但也会消耗更多的系统资源,从而导致在部分设备上可能出现闪屏、发虚、分块渲染等问题, 因此5+ Runtime会根据设备实际支持情况自动选择是否开启硬件加速。 + * 关闭硬件加速则可能会导致Webview页面无法支持Video标签播放视频等问题,如果在特定情况下需要调整修改默认开启硬件加速的行为,则可通过plus.webview.defaultHardwareAccelerated()方法获取当前设备默认是否开启硬件加速状态,从而决定是否需要显式开启或关闭指定Webview的硬件加速功能(通过WebviewStyles的hardwareAccelerated属性设置)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + defaultHardwareAccelerated(): boolean; +} + +/** + * 一组用于定义页面或控件显示动画效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewAnimationTypeShow { + /** + * 自动选择动画效果 + * 自动选择动画效果,使用上次显示窗口设置的动画效果,如果是第一次显示则默认动画效果“none”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + auto?: string; + /** + * 无动画效果 + * 立即显示页面,无任何动画效果,页面显示默认的动画效果。 + * 此效果忽略动画时间参数,立即显示。 + * 对应关闭动画"none"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + none?: string; + /** + * 从右侧横向滑动效果 + * 页面从屏幕右侧外向内横向滑动显示。 + * 对应关闭动画"slide-out-right"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-in-right'?: string; + /** + * 从左侧横向滑动效果 + * 页面从屏幕左侧向右横向滑动显示。 + * 对应关闭动画"slide-out-left"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-in-left'?: string; + /** + * 从上侧竖向滑动效果 + * 页面从屏幕上侧向下竖向滑动显示。 + * 对应关闭动画"slide-out-top"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-in-top'?: string; + /** + * 从下侧竖向滑动效果 + * 页面从屏幕下侧向上竖向滑动显示。 + * 对应关闭动画"slide-out-bottom"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-in-bottom'?: string; + /** + * 从透明到不透明逐渐显示效果 + * 页面从完全透明到不透明逐渐显示。 + * 对应关闭动画"fade-out"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'fade-in'?: string; + /** + * 从小到大逐渐放大显示效果 + * 页面在屏幕中间从小到大逐渐放大显示。 + * 对应关闭动画"zoom-in"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'zoom-out'?: string; + /** + * 从小到大逐渐放大并且从透明到不透明逐渐显示效果 + * 页面在屏幕中间从小到大逐渐放大并且从透明到不透明逐渐显示。 + * 对应关闭动画"zoom-fade-in"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'zoom-fade-out'?: string; + /** + * 从右侧平移入栈动画效果 + * 页面从屏幕右侧滑入显示,同时上一个页面带阴影效果从屏幕左侧滑出隐藏。 + * 对应关闭动画"pop-out"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'pop-in'?: string; +} + +/** + * 一组用于定义页面或控件关闭的动画效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewAnimationTypeClose { + /** + * 自动选择动画效果 + * 自动选择显示窗口相对于的动画效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + auto?: string; + /** + * 无动画 + * 立即关闭页面,无任何动画效果。 + * 此效果忽略动画时间参数,立即关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + none?: string; + /** + * 横向向右侧滑出屏幕动画 + * 页面从屏幕中横向向右侧滑动到屏幕外关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-out-right'?: string; + /** + * 横向向左侧滑出屏幕动画 + * 页面从屏幕中横向向左侧滑动到屏幕外关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-out-left'?: string; + /** + * 竖向向上侧滑出屏幕动画 + * 页面从屏幕中竖向向上侧滑动到屏幕外关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-out-top'?: string; + /** + * 竖向向下侧滑出屏幕动画 + * 页面从屏幕中竖向向下侧滑动到屏幕外关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'slide-out-bottom'?: string; + /** + * 从不透明到透明逐渐隐藏动画 + * 页面从不透明到透明逐渐隐藏关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'fade-out'?: string; + /** + * 从大逐渐缩小关闭动画 + * 页面逐渐向页面中心缩小关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'zoom-in'?: string; + /** + * 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画 + * 页面逐渐向页面中心缩小并且从不透明到透明逐渐隐藏关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'zoom-fade-in'?: string; + /** + * 从右侧平移出栈动画效果 + * 页面从屏幕右侧滑出消失,同时上一个页面带阴影效果从屏幕左侧滑入显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'pop-out'?: string; +} + +/** + * Webview窗口对象,用于操作加载HTML页面的窗口 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewObject { + /** + * Webview窗口的标识 + * 在打开或创建Webview窗口时设置,如果没有设置窗口标识,此属性值为undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + id?: string; + /** + * Webview窗口关闭事件 + * 当Webview窗口关闭时触发此事件,类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + onclose?: (result: any) => void; + /** + * Webview窗口错误事件 + * 当Webview窗口加载错误时触发此事件,类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + onerror?: PlusWebviewWebviewEvent; + /** + * Webview窗口页面加载完成事件 + * 当Webview窗口页面加载完成时触发此事件,类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + onloaded?: PlusWebviewWebviewEvent; + /** + * Webview窗口页面开始加载事件 + * 当Webview窗口开始加载新页面时触发此事件,类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + onloading?: PlusWebviewWebviewEvent; + /** + * 添加事件监听器 + * 向Webview窗口添加事件监听器,当指定的事件发生时,将触发listener函数的执行。 + * 可多次调用此方法向Webview添加多个监听器,当监听的事件发生时,将按照添加的先后顺序执行。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + addEventListener(event?: PlusWebviewWebviewEvent, listener?: (result: any) => void, capture?: boolean): void; + /** + * 在Webview窗口中添加子窗口 + * 将另一个Webview窗口作为子窗口添加到当前Webview窗口中,添加后其所有权归父Webview窗口,当父窗口关闭时子窗口自动关闭。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + append(webview?: PlusNativeObjView): void; + /** + * 添加Webview窗口预加载js文件 + * 对于一些网络HTML页面,在无法修改HTML页面时可通过此方法自动加载本地js文件。 + * 当Webview窗口跳转到新页面时也会自动加载指定的js执行,添加多个js文件将按照添加的先后顺序执行。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + appendJsFile(file?: string): void; + /** + * Webview窗口内容动画 + * 动画后可能会导致Webview窗口显示内容改变,可通过调用restore方法恢复。 + * 当Webview窗口内容动画引起内容不可见(透明),将显示此窗口后面的内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + animate(options?: PlusWebviewWebviewContentAnimationOptions, callback?: () => void): void; + /** + * 后退到上次加载的页面 + * Webview窗口历史记录操作,后退到窗口上次加载的HTML页面。 + * 如果窗口历史记录中没有可后退的页面则不触发任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + back(): void; + /** + * 开始Webview窗口的下拉刷新 + * 开始触发下拉刷新效果,与用户操作下拉刷新行为一致(有动画效果)。 + * 触发setPullTorefresh方法设置的下拉刷新事件回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + beginPullToRefresh(): void; + /** + * 查询Webview窗口是否可后退 + * Webview窗口历史记录查询操作,获取Webview是否可后退到历史加载的页面,结果通过queryCallback回调方法返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + canBack(queryCallback?: (result: any) => void): void; + /** + * 查询Webview窗口是否可前进 + * Webview窗口历史记录查询操作,获取Webview是否可前进到历史加载的页面,结果通过queryCallback回调方法返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + canForward(queryCallback?: (result: any) => void): void; + /** + * 检测Webview窗口是否渲染完成 + * 检测方式为判断的Webview窗口内容是否为白屏,如果非白屏则认为渲染完成,否则认为渲染未完成。 + * 通过successCallback回调函数返回结果,如果检测过程中发生错误则触发errorCallback回调函数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + checkRenderedContent(options?: PlusWebviewWebviewRenderedEventOptions, successCallback?: () => void, errorCallback?: (result: any) => void): void; + /** + * 获取Webview窗口的所有子Webview窗口 + * 获取添加到Webview窗口中的所有子Webview窗口,如果没有子Webview窗口则返回空数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + children(): PlusWebview []; + /** + * 清空原生Webview窗口加载的内容 + * 清除原生窗口的内容,用于重置原生窗口加载的内容,清除其加载的历史记录等内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + clear(): void; + /** + * 关闭Webview窗口 + * 关闭并销毁Webview窗口,可设置关闭动画和动画持续时间。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + close(aniClose?: PlusWebviewAnimationTypeClose, duration?: number, extras?: PlusWebviewWebviewExtraOptions): void; + /** + * 设置Webview窗口的滑屏操作手势 + * 将Webview窗口的左右滑动手势关联到其它Webview窗口,可实现滑动切换显示Webview的动画效果(如Tab页面切换效果)。 + * 注意:滑屏操作会改变窗口位置(如left值等),如果不在可视区域则需要调用窗口的setStyle方法设置其位置到可视区域内,如setStyle({left:'0px'});。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + drag(options?: PlusWebviewWebviewDragOptions, otherView?: PlusWebviewWebviewDragOtherViewOptions, callback?: (result: PlusWebviewWebviewDragEvent) => void): void; + /** + * 截屏绘制 + * 将Webview窗口的可视区域截屏并绘制到Bitmap图片对象中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + draw(bitmap?: PlusNativeObjBitmap, successCallback?: () => void, errorCallback?: (result: any) => void, options?: PlusWebviewWebviewDrawOptions): void; + /** + * 结束Webview窗口的下拉刷新 + * 关闭下拉刷新效果,恢复到开始下拉刷新之前的效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + endPullToRefresh(): void; + /** + * 在Webview窗口中执行JS脚本 + * 将JS脚本发送到Webview窗口中运行,可用于实现Webview窗口间的数据通讯。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + evalJS(js?: string): void; + /** + * 前进到上次加载的页面 + * Webview窗口历史记录操作,前进到窗口上次加载的HTML页面。 + * 如果窗口历史记录中没有可前进的页面则不触发任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + forward(): void; + /** + * 获取Webview窗口的收藏参数 + * 获取Webview窗口的收藏参数,如收藏页面的标题、图标、地址等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getFavoriteOptions(): PlusWebviewWebviewFavoriteOptions; + /** + * 获取Webview窗口的分享参数 + * 获取Webview窗口的分享参数,如分享的标题、图标、链接地址等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getShareOptions(): PlusWebviewWebviewShareOptions; + /** + * 获取Webview窗口的样式 + * 获取Webview窗口的样式属性,如窗口位置、大小等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getStyle(): PlusWebviewWebviewStyles; + /** + * 获取Webview窗口的原生子View控件对象 + * 创建Webview窗口的所有原生子View控件。 + * 可以在创建窗口时设置其subNViews属性自动创建(应用首页可通过manfest.json中的plus->launchwebview->subNNViews节点配置创建); + * 也可以通过Webview窗口的append方法将已经创建的原生View控件添加为其子。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getSubNViews(): any []; + /** + * 获取Webview窗口加载HTML页面的标题 + * 标题为HTML页面head节点下title节点中的文本内容,当窗口内容发生页面内跳转时可通过窗口触发的“loaded”事件中调用此方法来获取跳转后页面的标题。 + * 如果HTML页面没有使用title节点来设置标题,则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getTitle(): string; + /** + * 获取Webview窗口的标题栏控件对象 + * 创建Webview窗口时设置其titleNView属性时则自动创建标题栏控件,应用首页可通过manfest.json中的plus->launchwebview->titleNView节点配置创建标题栏控件。 + * 可通过此方法获取Webview窗口创建的标题栏控件,对象类型为plus.nativeObj.View,可通过调用其drawBitmap/drawRect/drawText方法绘制更新内容来实现自定义样式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getTitleNView(): PlusNativeObjView; + /** + * 获取Webview窗口加载HTML页面的地址 + * 当窗口内容发生页面内跳转时可通过窗口触发的“loaded”事件中调用此方法来获取跳转后页面的地址。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + getURL(): string; + /** + * 隐藏Webview窗口 + * 隐藏Webview窗口可保存已加载HTML页面的上下文数据,能降低应用使用的系统资源,通过show方法可将隐藏的Webview窗口显示出来。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + hide(aniHide?: PlusWebviewAnimationTypeClose, duration?: number, extras?: PlusWebviewWebviewExtraOptions): void; + /** + * 隐藏标题栏上按钮的红点 + * 仅在窗口使用原生标题栏(titleNView)时生效,未显示原生标题栏时操作此接口无任何效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + hideTitleNViewButtonRedDot(index?: number): void; + /** + * 是否拦截Webview窗口的触屏事件 + * 拦截后触屏事件不再传递,否则传递给View控件下的其它窗口处理。 + * Webview窗口默认拦截所有触屏事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + interceptTouchEvent(intercept?: boolean): void; + /** + * 查询Webview窗口是否开启硬件加速 + * 若Webview窗口已经开启硬件加速则返回true,否则返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + isHardwareAccelerated(): boolean; + /** + * 查询Webview窗口是否可见 + * 若Webview窗口已经显示(调用过show方法,即使被其它窗口挡住了也认为已显示)则返回true,若Webview窗口被隐藏则返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + isVisible(): boolean; + /** + * 监听页面开始加载资源 + * Webview加载资源时,如果满足options参数中定义的条件,则触发callback回调。 + * 此方法仅触发回调事件,不会阻止资源的加载。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + listenResourceLoading(options?: PlusWebviewWebviewListenResourceOptions, callback?: (result: any) => void): void; + /** + * 加载新HTML数据 + * 触发Webview窗口加载HTML页面数据,如果HTML数据无效将导致页面加载失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + loadData(data?: string, options?: PlusWebviewWebviewLoadDataOptions): void; + /** + * 加载新URL页面 + * 触发Webview窗口从新的URL地址加载页面,如果url地址无效将导致页面显示失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + loadURL(url?: string, additionalHttpHeaders?: any): void; + /** + * 获取Webview窗口对象的原生(Native.JS)实例对象 + * Android平台返回Webview窗口对象的android.webkit.Webview实例对象, + * iOS平台返回Webview窗口对象的UIWebview实例对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + nativeInstanceObject(): PlusAndroidInstanceObject | PlusIosInstanceObject; + /** + * 获取在当前Webview窗口中创建的所有窗口 + * 返回从当前Webview中调用plus.webview.open或plus.webview.create创建的所有Webview窗口数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + opened(): PlusWebview []; + /** + * 获取当前Webview窗口的创建者 + * 创建者为调用plus.webview.open或plus.webview.create方法创建当前窗口的Webview窗口。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + opener(): PlusWebviewWebviewObject; + /** + * 拦截Webview窗口的资源加载 + * 根据区配规则拦截Webview窗口加载资源的URL地址,重定向到其它资源地址(暂仅支持本地地址)。 + * 注意:多次调用overrideResourceRequest时仅以最后一次调用设置的参数值生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + overrideResourceRequest(options?: PlusWebview []): void; + /** + * 拦截Webview窗口的URL请求 + * 拦截URL请求后,Webview窗口将不会跳转到新的URL地址,此时将通过callback回调方法返回拦截的URL地址(可新开Webview窗口加载URL页面等)。 + * 此方法只能拦截窗口的网络超链接跳转(包括调用loadURL方法触发的跳转),不可拦截页面请求资源请求(如加载css/js/png等资源的请求)。 + * 注意:多次调用overrideUrlLoading时仅以最后一次调用设置的参数值生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + overrideUrlLoading(options?: PlusWebviewWebviewOverrideUrlOptions, callback?: (result: any) => void): void; + /** + * 获取当前Webview窗口的父窗口 + * Webview窗口作为子窗口添加(Webview.append)到其它Webview窗口中时有效,这时其它Webview窗口为父窗口。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + parent(): PlusWebviewWebviewObject; + /** + * 重新加载Webview窗口显示的HTML页面 + * 触发Webview窗口重新加载当前显示的页面内容。 + * 如果当前HTML页面未加载完则停止并重新加载,如果当前Webview窗口没有加载任何页面则无响应。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + reload(force?: boolean): void; + /** + * 重置Webview窗口的回弹位置 + * 开启窗口回弹效果后,当窗口中展现的内容滚动到头(顶部或底部)时,再拖拽时窗口整体内容将跟随移动,松开后自动回弹到停靠位置。 + * 这时需要调用此方法来重置窗口的回弹位置,窗口将采用动画方式回弹到其初始显示的位置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + resetBounce(): void; + /** + * 恢复Webview控件显示内容 + * 恢复调用animate方法改变Webview控件的内容,更新至动画前显示的内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + restore(): void; + /** + * 移除子Webview窗口 + * 从当前Webview窗口移除指定的子Webview窗口,若指定的webview对象不是当前窗口的子窗口则无任何作用。 + * 移除后子Webview窗口不会关闭,需要调用其close方法才能真正关闭并销毁。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + remove(webview?: PlusNativeObjView): void; + /** + * 移除Webview窗口事件监听器 + * 从Webview窗口移除通过addEventListener方法添加的事件监听器,若没有查找到对应的事件监听器,则无任何作用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + removeEventListener(event?: PlusWebviewWebviewEvent, listener?: (result: any) => void): void; + /** + * 从父窗口中移除 + * 从所属的父Webview窗口移除,如果没有父窗口,则无任何作用。 + * 从父窗口中移除后子Webview窗口不会关闭,需要调用其close方法才能真正关闭并销毁。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + removeFromParent(): void; + /** + * 移除标题栏上按钮的角标 + * 仅在窗口使用原生标题栏(titleNView)时生效,未显示原生标题栏时操作此接口无任何效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + removeTitleNViewButtonBadge(index?: number): void; + /** + * 设置Webview窗口的回弹效果 + * 开启窗口回弹效果后,当窗口中展现的内容滚动到头(顶部或底部)时,再拖拽时窗口整体内容将跟随移动,松开后自动回弹到停靠位置(可通过style设置)。 + * 拖拽窗口内容时页面显示Webview窗口的背景色,默认为透明,此时显示Webview下面的内容,利用这个特点可以实现自定下拉刷新特效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setBounce(style?: PlusWebviewWebviewBounceStyle): void; + /** + * 设置Webview窗口是否阻塞加载页面中使用的网络图片 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setBlockNetworkImage(block?: boolean): void; + /** + * 设置HTML内容是否可见 + * 设置HTML内容不可见后,将显示Webview窗口的背景色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setContentVisible(visible?: boolean): void; + /** + * 设置预加载的CSS文件 + * 预加载CSS文件不需要在HTML页面中显式引用,在Webview窗口加载HTML页面时自动加载,在页面跳转时也会自动加载。 + * 设置新的CSS文件后将清空之前设置的值(包括调用setCssText设置的值)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setCssFile(file?: string): void; + /** + * 设置预加载的CSS内容 + * 预加载CSS内容不需要在HTML页面中显式引用,在Webview窗口加载HTML页面时自动加载,在页面跳转时也会自动加载。 + * 设置新的CSS内容后将清空之前设置的值(包括调用setCssFile设置的值)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setCssText(text?: string): void; + /** + * 设置Webview窗口的收藏参数 + * 仅在流应用环境(流应用/5+浏览器)中有效:用户点击流应用环境的收藏按钮时使用的参数,如设置收藏页面标题,图标、页面地址等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setFavoriteOptions(options?: PlusWebviewWebviewFavoriteOptions): void; + /** + * 设置Webview窗口底部修复区域高度 + * 如果Webview加载页面中存在底部停靠区域(如“蘑菇街”WAP页面的底部Tab栏),在页面滚动时动态改变Webview高度可能会出现底部停靠区域抖动的现象(如360浏览器中向上滑顶部标题栏自动消失引起Webview变高)。 + * 此时可以调用此方法来指定底部停靠区域(通常是底部Tab栏)进行优化修复抖动效果,高度值为底部停靠区域的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setFixBottom(height?: number): void; + /** + * 设置预加载的JS文件 + * 预加载JS文件不需要在HTML页面中显式引用,在Webview窗口加载HTML页面时自动加载,在页面跳转时也会自动加载。 + * 设置新的JS文件后将清空之前设置的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setJsFile(file?: string): void; + /** + * 设置Webview窗口的下拉刷新效果 + * 开启Webview窗口的下拉刷新功能,显示窗口内置的下拉刷新控件样式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setPullToRefresh(style?: PlusWebviewWebviewPullToRefreshStyles, refreshCB?: () => void): void; + /** + * 设置Webview窗口rendered事件参数 + * 可设置页面渲染完成的判断标准,如判断页面顶部区域、中间区域、或底部区域。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setRenderedEventOptions(options?: PlusWebviewWebviewRenderedEventOptions): void; + /** + * 设置Webview窗口的样式 + * 更新Webview窗口的样式,如窗口位置、大小、背景色等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setStyle(styles?: PlusWebviewWebviewStyles): void; + /** + * 设置Webview窗口的分享参数 + * 仅在流应用环境(流应用/5+浏览器)中有效:用户点击流应用环境的分享按钮时使用的参数,如设置分享的标题、链接地址等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setShareOptions(options?: PlusWebviewWebviewShareOptions): void; + /** + * 设置标题栏上按钮的角标 + * 仅在窗口使用原生标题栏(titleNView)时生效,未显示原生标题栏时操作此接口无任何效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setTitleNViewButtonBadge(index?: number, text?: string): void; + /** + * 设置Webview窗口是否可见 + * 修改窗口是否可见并不影响窗口的显示栈顺序,窗口显示与隐藏也不会有动画效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + setVisible(visible?: boolean): void; + /** + * 显示Webview窗口 + * 当调用plus.webview.create方法创建Webview窗口后,需要调用其show方法才能显示,并可设置窗口显示动画及动画时间。 + * Webview窗口被隐藏后也可调用此方法来重新显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + show(aniShow?: PlusWebviewAnimationTypeShow, duration?: number, showedCB?: () => void, extras?: PlusWebviewWebviewExtraOptions): void; + /** + * 在指定Webview窗口后显示 + * 当调用plus.webview.create方法创建Webview窗口后,可调用其showBehind方法显示在指定Webview窗口之后。 + * 这种显示方式不会出现动画效果,当指定的Webview窗口关闭后,则自身窗口自动显示出来。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + showBehind(webview?: PlusWebviewWebviewObject): void; + /** + * 设置标题栏上按钮的红点 + * 仅在窗口使用原生标题栏(titleNView)时生效,未显示原生标题栏时操作此接口无任何效果。 + * 注意:设置显示按钮的角标后红点不显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + showTitleNViewButtonRedDot(index?: number): void; + /** + * 停止加载HTML页面内容 + * 触发Webview窗口停止加载页面内容,如果已经加载部分内容则显示部分内容,如果加载完成则显示全部内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + stop(): void; + /** + * 更新Webview窗口的原生子View控件对象 + * 通过WebviewSubNViewStyles中的id属性值匹配子View控件更新绘制内容,如果没有查找到对应id的子View控件则忽略。 + * 此操作仅更新子View控件上绘制的内容,不会添加或删除原生子View控件对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + updateSubNViews(styles?: PlusWebview []): void; +} + +/** + * Webview窗口动画参数 + * 用于指定动画目标窗口,起始位置、目标位置等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewAnimationOptions { + /** + * 执行动画的窗口对象 + * 可取值Webview窗口对象、Webview窗口的id(String类型)、原生View窗口对象(plus.nativeObj.View)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + view?: PlusWebviewWebviewObject; + /** + * 动画样式 + * 用于指定动画窗口的起始位置,目标位置等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + styles?: PlusWebviewWebviewAnimationStyles; + /** + * 窗口动画完成后的行为 + * 可取值: + * "none" - 动画完成后不做任何操作; + * "hide" - 动画完成后隐藏窗口; + * "close" - 动画完成后关闭窗口。 + * 默认值为"none"。 + * - none: 动画完成后不做任何操作 + * - hide: 动画完成后隐藏窗口 + * - close: 动画完成后关闭窗口 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + action?: 'none' | 'hide' | 'close'; +} + +/** + * Webview窗口动画样式 + * 用于指定动画窗口的起始位置、目标位置等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewAnimationStyles { + /** + * 画窗口的起始左侧位置 + * 支持百分比、像素值,默认值为当前窗口的位置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + fromLeft?: string; + /** + * 画窗口的目标左侧位置 + * 持百分比、像素值。 + * 注意:如果设置的位置与起始位置一直,则无动画效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + toLeft?: string; +} + +/** + * Webview窗口回弹样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewBounceStyle { + /** + * Webview窗口支持回弹效果的方向 + * 可通过此参数设置开启Webview哪个方向支持回弹效果。 + * 支持以下属性: + * top:表示窗口顶部支持回弹效果; + * left:表示窗口左侧支持回弹效果; + * right:表示窗口右侧支持回弹效果; + * bottom:表示窗口底部支持回弹效果。 + * **目前仅支持top属性** + * 属性值:用于指定可拖拽的范围,可取百分比,如"10%";像素值,如"100px";自动计算值,如"auto";无回弹效果值,如"none"; + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + position?: any; + /** + * Webview窗口回弹时停靠的位置 + * 开启窗口回弹效果后,当窗口中展现的内容滚动到头(顶部或底部)时,再拖拽时窗口整体内容将跟随移动,拖拽过程中将触发"dragBounce"事件,松开后自动回弹到停靠位置。 + * 支持以下属性: + * top:表示窗口顶部回弹时停靠的位置。 + * 属性值:用于指定窗口回弹的位置,可取百分比,如"5%";像素值,如"100px";自动计算值,如"auto",默认为可拖拽的范围值的一半; + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + changeoffset?: any; + /** + * Webview窗口侧滑时停靠的位置 + * 开启窗口回弹效果后,当窗口中展现的内容滚动到头(左侧或右侧)时,在拖拽时窗口整体内容将跟随移动,松开后自动停靠的侧滑位置,并触发"slideBounce"事件。 + * 支持以下属性: + * left:表示窗口左侧侧滑的位置; + * right:表示窗口右侧侧滑的位置。 + * 属性值:用于指定滑动后停靠的距离,可取百分比(left/right相对于窗口的宽度,top/bottom相对于窗口的高度),如"30%";像素值,如"100px";自动计算值,为可拖拽范围,如"auto"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + slideoffset?: any; + /** + * Webview窗口拖拽偏移的位置 + * 开启窗口回弹效果后,可以通过此属性值来主动设置拖拽的偏移位置,与手动操作拖拽至此偏移位置松开后的逻辑一致。 + * 支持以下属性: + * top:表示窗口顶部偏移的位置; + * left:表示窗口左侧偏移的位置; + * right:表示窗口右侧偏移的位置; + * bottom:表示窗口底部偏移的位置。 + * 属性值:用于指定偏移的位置,可取百分比,如"5%";像素值,如"100px";有效值范围为0到position属性定义的位置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + offset?: any; + /** + * Webview窗口是否阻止touch事件传递给DOM元素 + * 设置为true表示阻止touch事件,设置为false表示不阻止touch事件。当开启侧滑功能(左侧滑和右侧滑)时默认值为true,否则为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + preventTouchEvent?: boolean; +} + +/** + * Webview窗口内容动画参数 + * 指定动画的类型、持续时间等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewContentAnimationOptions { + /** + * 动画类型 + * 可取值:"shrink" - 从上到下分块收缩清除窗口动画。 + * - shrink: 从上到下分块清除动画 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + type?: 'shrink'; + /** + * 动画持续时间 + * 单位为毫秒,默认值为200ms。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + duration?: number; + /** + * 动画帧数 + * 必须为大于0的整数,默认值为12。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + frames?: number; + /** + * 动画作用区域 + * 支持以下属性: + * top - 区域距离控件顶部的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的高度),默认值为'0px'; + * bottom - 区域距离控件底部的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的高度),默认值为'0px'; + * left - 区域距离控件左侧的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的宽度),默认值为'0px'; + * right - 区域距离控件右侧的偏移量,属性值可取像素值(如"100px"),百分比(如"10%",相对于控件的宽度),默认值为'0px'。 + * 如“{top:'44px',bottom:'48px'}”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + region?: any; +} + +/** + * 原生控件在窗口中停靠的方式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewDock { + /** + * 控件停靠则页面顶部 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + top?: string; + /** + * 控件停靠在页面底部 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + bottom?: string; + /** + * 控件停靠在页面右侧 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + right?: string; + /** + * 控件停靠在页面左侧 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + left?: string; +} + +/** + * Webview窗口滑动事件数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewDragEvent { + /** + * 手势类型 + * 可取值: + * "rtl" - 从右向左滑动手势; + * "left" - 向左滑动手势,与rtl一致; + * "ltr" - 从左向右滑动手势; + * "right" - 向右滑动手势,与ltr一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + direction?: string; + /** + * 窗口滑动类型 + * 可取值: + * "start" - 表示开始滑动操作; + * "move" - 表示正在滑动; + * "end" - 表示滑动操作结束。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + type?: string; + /** + * 窗口滑动结果 + * 可取值: + * "true" - 表示滑动操作成功; + * "false" - 表示滑动操作失败(恢复到滑动前的状态); + * "undefined" - 无状态值(当type值为"end"时返回此值)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + result?: string; + /** + * 当前操作窗口标识 + * 当type值为"start"/"move"时,保存当前操作窗口(或View控件)的标识; + * 当type值为"end"时保存滑动操作后显示窗口(或View控件)的标识(即result值为"true"则认为关联窗口显示,result值为false则认为主窗口显示)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + id?: string; + /** + * 关联窗口标识 + * 滑动操作关联窗口(或View控件)的标识。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + otherId?: string; + /** + * 主窗口标识 + * 滑动操作主窗口(或View控件)的标识。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + targetId?: string; + /** + * 滑动进度 + * 滑动进度位置信息,取值范围为0-100,如20表示滑动了总距离的20%: + * 当type值为"start"时progress值为0; + * 当type值为"end"时如果result为true则progress值为0,如果result为false则progress值为100; + * 当type值为"move"时,保存当前滑动的进度信息(注:多次触发move事件)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + progress?: number; +} + +/** + * 窗口手势操作参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewDragOptions { + /** + * 滑屏操作回调事件触发步长 + * 用于设置滑屏回调事件触发频率,取值范围为1-100,值越小触发频率越高,值越大触发频率越小,默认值为20。 + * 如设置值为20,则表示滑屏操作移动距离超过可移动范围的20%则触发一次回调事件,可通过回调函数参数(WebviewDragEvent)的progress属性获取。 + * 注意:触发频率过大会影响效率,开发者需谨慎设置此值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + callbackStep?: number; + /** + * 设置的手势类型 + * 可取值: + * 可取值: + * "rtl" - 从右向左滑动手势; + * "left" - 向左滑动手势,与rtl一致; + * "ltr" - 从左向右滑动手势; + * "right" - 向右滑动手势,与ltr一致。 + * - rtl: 从右向左滑动手势 + * - left: 向左滑动手势,与rtl一致 + * - ltr: 从左向右滑动手势 + * - right: 向右滑动手势,与ltr一致 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + direction?: 'rtl' | 'left' | 'ltr' | 'right'; + /** + * 滑动手势模式 + * 可取值: + * "followFinger" - 当前Webview窗口跟随手指滑动; + * "silent" - 当前Webview窗口不跟随手指滑动; + * "bounce" - 当前Webview窗口自动回弹(松手后窗口恢复到拖动前的位置),通常可通过设置此模式来实现Tab项无法继续滑动切换自动回弹效果。 + * - followFinger: 当前Webview窗口跟随手指滑动 + * - silent: 当前Webview窗口不跟随手指滑动 + * - bounce: 当前Webview窗口自动回弹 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + moveMode?: 'followFinger' | 'silent' | 'bounce'; +} + +/** + * 手势操作关联对象参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewDragOtherViewOptions { + /** + * 手势关联对象 + * 可取值Webview窗口的id(String类型)、Webview窗口对象、原生View窗口对象(plus.nativeObj.View)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + view?: string; + /** + * 滑动模式 + * 可取值: + * "follow" - 同步跟随主Webview窗口滑动; + * "silent" - 不跟随主Webview窗口滑动。 + * - follow: 同步跟随主Webview窗口滑动 + * - silent: 不跟随主Webview窗口滑动 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + moveMode?: 'follow' | 'silent'; +} + +/** + * 截屏绘制操作参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewDrawOptions { + /** + * 截屏图片的位深 + * 可取值: + * "RGB565" - RGB565彩色模式,一个像素占两个字节; + * "ARGB" - ARGB彩色模式,保存透明度信息。 + * - RGB565: + * RGB565彩色模式,一个像素占两个字节。 + * + * - ARGB: + * ARGB彩色模式,保存透明度信息。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + bit?: 'RGB565' | 'ARGB'; + /** + * 是否检测截屏图片是否为空白 + * 可取值: + * true - 表示检测到截屏到空白图片时认为操作失败(触发错误回调函数); + * false - 表示不检测,即使为空白图片仍然返回成功。 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + check?: boolean; + /** + * 设置截屏区域 + * 相对于Webview窗口的区域信息,默认值为{top:'0px',left:'0px',width:'100%',height:'100%'}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + clip?: PlusNativeObj; + /** + * 是否检测当前是否弹出软键盘 + * 可取值: + * true - 表示检测到弹出软键盘是认为截屏操作失败(触发错误回调函数); + * false - 表示不检测软键盘状态,直接截屏。 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + checkKeyboard?: boolean; +} + +/** + * 窗口收藏参数 + * 在流应用环境中调用收藏功能时使用的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewFavoriteOptions { + /** + * 收藏时显示的图标 + * 在收藏列表中显示的图标,默认使用应用图标。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + icon?: string; + /** + * 收藏时显示的标题 + * 在收藏列表中显示的标题字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + title?: string; + /** + * 收藏的页面地址 + * 必须是网络地址。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + href?: string; +} + +/** + * 创建加载HTML数据参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewLoadDataOptions { + /** + * 页面的Base URL + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + baseURL?: string; + /** + * HTML数据的数据类型 + * 默认值为"text/html"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + mimeType?: string; + /** + * HTML数据的编码类型 + * 默认值为"utf-8"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + encoding?: string; +} + +/** + * 窗口的分享参数 + * 在流应用环境中调用分享功能时使用的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewShareOptions { + /** + * 分享时使用的图标 + * 默认使用应用图标。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + icon?: string; + /** + * 分享时使用的标题 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + title?: string; + /** + * 分享时使用的链接地址 + * 必须是网络地址。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + href?: string; +} + +/** + * 窗口原生子View控件样式 + * 可设置原生控件的标识、大小、位置以及绘制的内容等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewSubNViewStyles { + /** + * 原生子View控件的标识 + * 可通过plus.nativeObj.View.getViewById(id)方法传入此标识来获取子View控件对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + id?: string; + /** + * 原生子View控件类型 + * 可取值: + * "NView" - 原生子View控件(plus.nativeObj.NView); + * "ImageSlider" - 原生图片轮播控件(plus.nativeObj.ImageSlider)。 + * 默认值为"NView"。 + * - NView: + * 原生子View控件(plus.nativeObj.NView) + * + * - ImageSlider: + * 原生图片轮播控件(plus.nativeObj.ImageSlider) + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + type?: 'NView' | 'ImageSlider'; + /** + * 原生子View控件的样式 + * 可设置原生控件的位置、大小等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + styles?: PlusNativeObjViewStyles; + /** + * 原生子View控件初始绘制内容 + * 可设置绘制图片、矩形区域、文本等内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + tags?: any []; +} + +/** + * 窗口标题栏控件样式 + * 标题栏控件固定高度为44px,可通过Webview窗口对象的getTitleNView方法获取标题栏原生控件对象动态绘制内容。 + * 可以通过WebviewObject对象的getTitleNView()获取标题栏的NView对象,然后调用其setStyle方法更新样式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewTitleNViewStyles { + /** + * 标题栏控件是否显示左侧返回按钮 + * 可取值: + * "true" - 显示返回按钮; + * "false" - 不显示返回按钮。 + * 默认值为"false"。 + * 返回按钮的颜色为窗口标题文字颜色,按下时颜色自动调整透明度为0.3。 + * 点击返回按钮的逻辑与按下系统返回键逻辑一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + autoBackButton?: boolean; + /** + * 标题栏控件的背景颜色 + * 颜色值格式为"#RRGGBB",如"#FF0000"表示为红色背景,默认值为"#F7F7F7"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + backgroundColor?: string; + /** + * 标题栏上的自定义按钮 + * 创建的自定义按钮数目不限制,实际应用中建议最多设置4个按钮(包括左侧返回按钮)。 + * 注意:此属性不支持动态修改,仅在创建titleNView时设置有效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + buttons?: PlusWebview []; + /** + * 标题栏控件变化作用范围 + * 仅在type值为transparent时有效,页面滚动时标题栏背景透明度将发生变化。 + * 当页面滚动到指定偏移量时标题栏背景变为完全不透明。 + * 支持百分比、像素值,默认为'132px'。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + coverage?: string; + /** + * 标题栏控件是否显示Home按钮 + * 可取值: + * "true" - 显示Home按钮; + * "false" - 不显示Home按钮。 + * 默认值为"false"。 + * Home按钮的颜色为窗口标题文字颜色,按下时颜色自动调整透明度为0.3。 + * 点击Home按钮的逻辑为关闭所有非首页窗口,显示首页窗口。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + homeButton?: boolean; + /** + * 内边距 + * 标题栏左右的内边距,单位为px(逻辑像素值),如"10px"表示10逻辑像素值。 + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + padding?: string; + /** + * 右内边距 + * 标题栏右侧内边距,单位为px(逻辑像素值),如"10px"表示10逻辑像素值。 + * 默认值为"0px",优先级padding-right > padding。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'padding-right'?: string; + /** + * 左内边距 + * 标题栏左侧内边距,单位为px(逻辑像素值),如"10px"表示10逻辑像素值。 + * 默认值为"0px",优先级padding-left > padding。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + 'padding-left'?: string; + /** + * 标题栏控件的进度条样式 + * 设置此属性则在标题栏控件的底部显示进度条,可配置进度条颜色值即高度。 + * 设置此属性值为undefined或null则隐藏进度条。 + * 默认不显示底部进度条。 + * 注意:此属性将废弃,推荐使用WebviewStyles的progress。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + progress?: PlusWebviewWebviewProgressStyles; + /** + * 标题栏控件的底部分割线 + * 设置此属性则在标题栏控件的底部显示分割线,可配置颜色值及高度。 + * 设置此属性值为undefined或null则隐藏分割线。 + * 默认不显示底部分割线。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + splitLine?: PlusWebviewWebviewSplitLineStyles; + /** + * 标题栏上初始自定义绘制内容 + * 可用于设置自定义绘制图片、矩形区域、文本等内容。 + * 注意:此属性不支持动态修改,仅在创建titleNView时设置有效,如果需要更新绘制内容可根据tags的id调用draw方法操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + tags?: any []; + /** + * 标题栏控件的标题文字颜色 + * 颜色值格式为"#RRGGBB",如"#FF0000"表示标题文字颜色为红色,默认值为"#000000"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + titleColor?: string; + /** + * 标题栏控件的标题文字超出显示区域时处理方式 + * 可取值: + * "clip" - 超出显示区域时内容裁剪; + * "ellipsis" - 超出显示区域时尾部显示省略标记(...)。 + * 默认值为"ellipsis"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + titleOverflow?: string; + /** + * 标题栏控件的标题文字内容 + * 在标题栏控件居中(水平和垂直)显示,左右边距为88px,如果文本过长则尾部裁剪(加三个点"...")显示。 + * 当不设置titleText属性或属性值为undefined/null时,使用当前Webview窗口加载页面的标题,并自动同步更新页面的标题。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + titleText?: string; + /** + * 标题栏控件的标题文字字体大小 + * 字体大小单位为像素,如"20px"表示字体大小为20像素,默认值为17像素。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + titleSize?: string; + /** + * 标题栏控件样式 + * 可取值: + * "default" - 默认样式,顶部停靠显示,挤压Webview页面内容显示区域; + * "transparent" - 透明样式,顶部沉浸式显示覆盖Webview页面内容,标题栏上内容(除按钮外)全部透明,当页面滚动时透明度逐渐变化,直到不透明显示。 + * 默认值为"default"。 + * 注意:此属性不支持动态更新。 + * - default: + * 默认样式,顶部停靠显示,挤压Webview页面内容显示区域 + * + * - transparent: + * 透明样式,顶部沉浸式显示覆盖Webview页面内容,标题栏上内容(除按钮外)全部透明,当页面滚动时透明度逐渐变化,直到不透明显示 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + type?: 'default' | 'transparent'; +} + +/** + * 窗口标题栏自定义按钮样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewTitleNViewButtonStyles { + /** + * 按钮样式 + * 运行环境中内置按钮样式直接使用,内置样式忽略fontSrc和text属性。 + * 可取值: + * "forward" - 前进按钮; + * "back" - 后退按钮; + * "share" - 分享按钮; + * "favorite" - 收藏按钮; + * "home" - 主页按钮; + * "menu" - 菜单按钮; + * "close" - 关闭按钮; + * "none" - 无样式。 + * 默认值为无样式("none"),需通过text属性设置按钮上显示的内容、通过fontSrc属性设置使用的字体库。 + * - forward: 前进按钮 + * - back: 后退按钮 + * - share: 分享按钮 + * - favorite: 收藏按钮 + * - home: 主页按钮 + * - menu: 菜单按钮 + * - close: 关闭按钮 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + type?: 'forward' | 'back' | 'share' | 'favorite' | 'home' | 'menu' | 'close'; + /** + * 按钮的背景颜色 + * 仅在标题栏type=transparent时生效,当标题栏透明时按钮显示的背景颜色。 + * 可取值#RRGGBB和rgba格式颜色字符串,默认值为灰色半透明。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + background?: string; + /** + * 按钮上显示的角标文本 + * 最多显示3个字符,超过则显示为...。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + badgeText?: string; + /** + * 按钮上文字颜色 + * 可取值: "#RRGGBB"格式字符串,如"#FF0000"表示绘制红色返回键; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为窗口标题栏控件的标题文字颜色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + color?: string; + /** + * 按下状态按钮文字颜色 + * 可取值: "#RRGGBB"格式字符串,如"#FF0000"表示绘制红色返回键; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为color属性值自动调整透明度为0.3。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + colorPressed?: string; + /** + * 按钮在标题栏上的显示位置 + * 可取值: + * "right" - 在标题栏中靠右排列显示; + * "left" - 在标题栏中靠左侧排列显示(在返回键后)。 + * 默认值为"right"。 + * - right: + * 在标题栏中靠右排列显示 + * + * - left: + * 在标题栏中靠左侧排列显示(在返回键后) + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + float?: 'right' | 'left'; + /** + * 按钮上文字的粗细 + * 可取值: + * "normal" - 标准字体; + * "bold" - 加粗字体。 + * 默认值为"normal"。 + * - normal: + * 标准字体 + * + * - bold: + * 加粗字体 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + fontWeight?: 'normal' | 'bold'; + /** + * 按钮上文字大小 + * 可取值:字体高度像素值,数字加"px"格式字符串,如"22px"。 + * 窗口标题栏为透明样式(type="transparent")时,默认值为"22px"; + * 窗口标题栏为默认样式(type="default")时,默认值为"27px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + fontSize?: string; + /** + * 按钮上文字使用的字体文件路径 + * 字体文件路径支持以下类型: + * 相对路径 - 相对于当前页面的host位置,如"a.ttf",注意当前页面为网络地址则不支持; + * 绝对路径 - 系统绝对路径,如Android平台"/sdcard/a.ttf",此类路径通常通过其它5+ API获取的; + * 扩展相对路径URL(RelativeURL) - 以"_"开头的相对路径,如"_www/a.ttf"; + * 本地路径URL - 以“file://”开头,后面跟随系统绝对路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + fontSrc?: string; + /** + * 按钮点击后触发的回调函数 + * 回调函数中将返回此JSON对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + onclick?: (result: any) => void; + /** + * 按钮上是否显示红点 + * 设置为true则显示红点,false则不显示红点。默认值为false。 + * 注意:当设置了角标文本时红点不显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + redDot?: boolean; + /** + * 是否显示选择指示图标 + * 设置为true则显示选择指示图标(向下箭头),颜色与文字颜色一致; + * false则不显示。默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + select?: boolean; + /** + * 按钮上显示的文字 + * 推荐使用一个字符,超过一个字符可能无法正常显示,使用字体图标时unicode字符表示必须'\u'开头,如"\ue123"(注意不能写成"\e123")。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + text?: string; + /** + * 按钮的宽度 + * 可取值: + * "*px" - 逻辑像素值,如"10px"表示10逻辑像素值,按钮的内容居中显示; + * "auto" - 自定计算宽度,根据内容自动调整按钮宽度。 + * 默认值为"44px"(适合字体图标)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + width?: string; +} + +/** + * 标题栏控件的进度条样式 + * 显示在标题栏控件底部。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewProgressStyles { + /** + * 进度条颜色 + * 可取值: "#RRGGBB"格式字符串,如"#FF0000"表示绘制红色分割线; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为"#00FF00"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + color?: string; + /** + * 进度条高度 + * 可取值:像素值(逻辑像素),支持小数点,如"1px"表示1像素高;百分比,如"1%",相对于标题栏控件的高度。 + * 默认值为"2px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + height?: string; +} + +/** + * 窗口标题栏控件的分割线样式 + * 显示在标题栏控件底部。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewSplitLineStyles { + /** + * 底部分割线颜色 + * 可取值: "#RRGGBB"格式字符串,如"#FF0000"表示绘制红色分割线; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为"#CCCCCC"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + color?: string; + /** + * 底部分割线高度 + * 可取值:像素值(逻辑像素),支持小数点,如"1px"表示1像素高;百分比,如"1%",相对于标题栏控件的高度。 + * 默认值为"1px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + height?: string; +} + +/** + * Webview窗口事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewEvent { + /** + * Webview窗口关闭事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口关闭时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + close?: string; + /** + * Webview窗口回弹事件 + * 通过WebviewObject对象的setBounce方法开启回弹效果设置顶部下拉回弹changeoffset属性后,当用户向下拖拽窗口时触发发此事件,回调函数类型为BounceEventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + dragBounce?: string; + /** + * Webview窗口回弹事件 + * 通过WebviewObject对象的setBounce方法开启回弹效果设置左右侧侧滑slideoffset属性后,当用户向左右侧拖拽窗口侧滑时触发发此事件,回调函数类型为BounceEventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + slideBounce?: string; + /** + * Webview窗口加载错误事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口加载错误时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + error?: string; + /** + * Webview窗口隐藏事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口隐藏(窗口动画完成后)时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + hide?: string; + /** + * Webview窗口页面开始加载事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口开始加载新页面时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + loading?: string; + /** + * Webview窗口页面加载完成事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口页面加载完成时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + loaded?: string; + /** + * Webview窗口显示遮罩层时点击事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口通过mask属性设置显示遮罩层并且点击时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + maskClick?: string; + /** + * Webview窗口开始渲染事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口开始渲染内容时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + rendering?: string; + /** + * Webview窗口渲染完成事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口渲染完成时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + rendered?: string; + /** + * Webview窗口显示事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口显示(窗口动画完成后)时触发此事件,回调函数类型为EventCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + show?: string; + /** + * Webview加载页面标题更新事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口加载新页面更新标题时触发此事件,回调函数类型为SuccessCallback。 + * 注意:此事件会先于loaded事件触发,通常在加载网络页面时通过此事件可更快获取到页面的标题。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + titleUpdate?: string; + /** + * Webview窗口接收到触屏事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当用户操作按下到Webview窗口时触发此事件,回调函数类型为SuccessCallback。 + * 注意:每按下屏幕触发一次此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + touchstart?: string; + /** + * Webview窗口侧滑返回事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口侧滑返回时触发此事件,回调函数类型为PopGestureCallback。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + popGesture?: string; + /** + * Webview窗口加载进度变化事件 + * 通过WebviewObject对象的addEventListener方法添加事件监听函数,当Webview窗口加载页面进度变化时触发此事件。 + * 回调函数原型为void PorgressCandedCallback(Event e),可通过e.progress获取窗口加载进度,取值范围为0-100。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + progressChanged?: string; + /** + * Webview窗口下拉刷新事件 + * Webview窗口打开下拉刷新功能后,用户操作下拉刷新时或调用beginPullToRefresh方法时触发,用于通知业务逻辑可以开始执行刷新操作。 + * 更新操作完成后调用窗口的endPullToRefresh方法结束下拉刷新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + pullToRefresh?: string; +} + +/** + * JSON对象,原生窗口扩展参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewExtraOptions { + /** + * 窗口动画加速 + * 开启窗口动画加速功能可优化窗口动画效果,提升动画流程度,可避免部分设备上打开(关闭)窗口闪屏的问题。 + * 可取值: + * "auto" - 自动优化窗口动画; + * "none" - 关闭窗口动画加速功能; + * "capture" - 使用截屏方式加速窗口动画。 + * 默认值为"auto"。 + * - auto: + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + acceleration?: 'auto'; + /** + * 窗口动画加速时使用的图片 + * 当使用截屏方式加速窗口动画时,可设置已经创建好的截屏图片,此时不会进行实时截屏操作,加速窗口动画响应时间,提升用户体验。 + * 如果未指定截屏图片,则实时截取当前Webview窗口对象的图片进行动画操作。 + * 如果窗口未使用截屏方式加速动画,则忽略此参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + capture?: PlusNativeObjBitmap; + /** + * 关联窗口动画使用的图片 + * 当使用截屏方式加速窗口动画时,可设置已经创建好的截屏图片,此时不会进行实时截屏操作,加速关联窗口动画响应时间,提升用户体验。 + * 如果未指定截屏图片,则实时截取关联Webview窗口对象的图片进行动画操作。 + * 如果窗口未使用截屏方式加速动画,则忽略此参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + otherCapture?: PlusNativeObjBitmap; +} + +/** + * 原生控件在窗口中显示的位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewPosition { + /** + * 控件在页面中正常定位,如果页面存在滚动条则随窗口内容滚动 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + static?: string; + /** + * 控件在页面中绝对定位,如果页面存在滚动条不随窗口内容滚动 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + absolute?: string; + /** + * 控件在页面中停靠,停靠的位置通过dock属性进行定义 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + dock?: string; +} + +/** + * Webview窗口下拉刷新样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewPullToRefreshStyles { + /** + * 是否开启Webview窗口的下拉刷新功能 + * true表示开启窗口的下拉刷新功能; + * false表示关闭窗口的下拉刷新功能。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + support?: boolean; + /** + * 下拉刷新控件颜色 + * 颜色值格式为"#RRGGBB",如"#FF0000"为设置下拉属性控件为红色,默认值为"#2BD009"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + color?: string; + /** + * 下拉刷新样式 + * 用于定义下拉刷新风格样式,可取值: + * "default" - 经典下拉刷新样式(下拉拖动时页面内容跟随); + * "circle" - 圆圈样式下拉刷新控件样式(下拉拖动时仅刷新控件跟随)。 + * 默认值为"default"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + style?: string; + /** + * 窗口的下拉刷新控件进入刷新状态的拉拽高度 + * 支持百分比,如"10%";像素值,如"50px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + height?: string; + /** + * 窗口可下拉拖拽的范围 + * 支持百分比,如"10%";像素值,如"50px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + range?: string; + /** + * 下拉刷新控件的起始位置 + * 仅对"circle"样式下拉刷新控件有效,用于定义刷新控件下拉时的起始位置。 + * 相对于Webview的顶部偏移量,支持百分比,如"10%";像素值,如"50px"。 + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + offset?: string; + /** + * 在下拉可刷新状态时显示的内容 + * 支持以下属性: + * caption:在下拉可刷新状态时下拉刷新控件上显示的标题内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + contentdown?: any; + /** + * 在释放可刷新状态时显示的内容 + * 支持以下属性: + * caption:在释放可刷新状态时下拉刷新控件上显示的标题内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + contentover?: any; + /** + * 在正在刷新状态时显示的内容 + * 支持以下属性: + * caption:在正在刷新状态时下拉刷新控件上显示的标题内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + contentrefresh?: any; +} + +/** + * Webview窗口rendered事件参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewRenderedEventOptions { + /** + * 判断窗口渲染完成类型 + * 可取值: + * "top"-从顶部向下偏移22px横线截屏检测渲染是否完成; + * "bottom"-从底部向上偏移25px横线检测渲染是否完成; + * "center"-从中间横线检测渲染是否完成; + * "auto"为全屏检测(左、中、右三条竖线)。 + * 默认值为"auto"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + type?: string; + /** + * 判断窗口渲染完成间隔时间 + * 单位为ms(毫秒),默认值为150ms。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + interval?: number; +} + +/** + * 替换H5标准API配置信息 + * 目前仅支持替换H5标准定位接口 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewReplaceWebApiOptions { + /** + * 替换H5标准定位接口(navigator.geolocation.*) + * 由于网络原因,在部分手机上可能无法调用标准H5定位接口(navigator.geolocation.*)获取定位数据,此时可以通过此属性配置使用原生定位模块替换标准H5定位接口,可取值: + * "alldevice" - 在所有设备上替换标准H5定位接口(navigator.geolocation.*); + * "auto" - 自动替换H5标准定位接口,仅在调用标准H5定位接口无法获取数据的设备上替换; + * "none" - 不替换H5标准定位接口(navigator.geolocation.*)。 + * 默认值为"none"。 + * 注意:替换H5标准定位接口,会导致页面加载速度延迟100ms左右,推荐使用"auto"模式。 + * - alldevice: + * 强制替换H5标准定位接口(navigator.geolocation.*) + * + * - auto: + * 自动替换标准H5定位接口,仅在调用标准H5定位接口无法获取数据的设备上替换 + * + * - none: + * 不替换标准H5定位接口(navigator.geolocation.*) + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + geolocation?: 'alldevice' | 'auto' | 'none'; +} + +/** + * JSON对象,Webview窗口的系统状态栏区域样式 + * 仅在应用设置为沉浸式状态栏样式下有效,非沉浸式状态栏样式下忽略此属性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewStatusbarStyles { + /** + * 系统状态栏区域背景颜色 + * 颜色值格式为"#RRGGBB",如"#FF0000"表示为红色背景。 + * 默认值为应用manifest.json中plus->statusbar->background属性配置的值,如果未配置此属性值,则使用系统默认状态栏的背景颜色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + background?: string; +} + +/** + * JSON对象,Webview窗口对象的样式 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewStyles { + /** + * 窗口加载页面时额外添加的HTTP请求头数据 + * 仅在Webview窗口第一次加载页面时使用,如用户点击的触发的链接跳转则不再添加此额外请求头数据。 + * 如果Webview窗口非第一次加载页面时也需要额外添加HTTP请求头数据,可通过loadURL()方法的参数设置。 + * 如果HTTP请求头中已经包含需要额外添加的头数据,则添加的请求数据覆盖默认值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + additionalHttpHeaders?: any; + /** + * 窗口动画优化方式 + * 可取值: + * "auto" - 如果窗口中存在titleNView或subNViews,窗口动画时真实Webview控件从动画窗口中移除加速(避免真实Webview渲染影响动画效率); + * "none" - 窗口动画不使用优化。 + * 默认值为"auto"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + animationOptimization?: string; + /** + * 窗口的缓存模式 + * 可取值: + * "default" - 根据cache-control决定是否使用缓存数据,如果存在缓存并且没有过期则使用本地缓存资源,否则从网络获取; + * "cacheElseNetwork" - 只要存在缓存(即使过期)数据则使用,否则从网络获取; + * "noCache" - 不使用缓存数据,全部从网络获取; + * "cacheOnly" - 仅使用缓存数据,不从网络获取(注:如果没有缓存数据则会导致加载失败)。 + * 默认使用"default"。 + * - default: + * 根据cache-control决定是否使用缓存数据,如果存在缓存并且没有过期则使用本地缓存资源,否则从网络获取。 + * + * - cacheElseNetwork: + * 只要存在缓存(即使过期)数据则使用,否则从网络获取。 + * + * - noCache: + * 不使用缓存数据,全部从网络获取。 + * + * - cacheOnly: + * 仅使用缓存数据,不从网络获取(注:如果没有缓存数据则会导致加载失败)。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + cachemode?: 'default' | 'cacheElseNetwork' | 'noCache' | 'cacheOnly'; + /** + * Webview窗口自动处理返回键逻辑 + * 当Webview窗口在显示栈顶,并且Webview窗口中没有调用JS监听返回键(plus.key.addEventListener('backbutton',...))时按下返回键响应行为。 + * 可取值: + * "hide" - 隐藏Webview窗口,隐藏动画与上一次调用显示时设置的动画类型相对应(如“slide-in-right”对应的关闭动画为“slid-out-right”); + * "close" - 关闭Webview窗口,关闭动画与上一次调用显示时设置的动画类型相对应(如“slide-in-right”对应的关闭动画为“slid-out-right”) ; + * "none" - 不做操作,将返回键传递给下一Webview窗口处理; + * "quit" - 退出应用。 + * - hide: + * 隐藏Webview窗口,隐藏动画与上一次调用显示时设置的动画类型相对应(如“slide-in-right”对应的关闭动画为“slid-out-right”)。 + * + * - close: + * 关闭Webview窗口,关闭动画与上一次调用显示时设置的动画类型相对应(如“slide-in-right”对应的关闭动画为“slid-out-right”)。 + * + * - none: + * 不做操作,将返回键传递给下一Webview窗口处理。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + backButtonAutoControl?: 'hide' | 'close' | 'none'; + /** + * 窗口的背景颜色 + * 窗口空白区域的背景模式,设置background为颜色值(参考CSS Color Names,可取值/十六进制值/rgb值/rgba值),窗口为独占模式显示(占整个屏幕区域); + * 设置background为“transparent”,则表示窗口背景透明,为非独占模式。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + background?: string; + /** + * 窗口顶部背景颜色值 + * 窗口内容滚动到顶部下拉时可见。 + * 可取值: + * "#RRGGBB"格式字符串,如"#FF0000"表示红色; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为透明。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + backgroundColorTop?: string; + /** + * 窗口底部背景颜色 + * 窗口内容滚动到底部上拉时可见。 + * 可取值: + * "#RRGGBB"格式字符串,如"#FF0000"表示红色; + * "rgba(R,G,B,A)",其中R/G/B分别代表红色值/绿色值/蓝色值,正整数类型,取值范围为0-255,A为透明度,浮点数类型,取值范围为0-1(0为全透明,1为不透明),如"rgba(255,0,0,0.5)",表示红色半透明。 + * 默认值为透明。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + backgroundColorBottom?: string; + /** + * 是否阻塞网络图片的加载 + * 布尔类型,true表示阻塞,false表示不阻塞,默认值为false。 + * 阻塞后Webview窗口将不加载页面中使用的所有网络图片,可通过Webview窗口对象的setBlockNetWorkImage()方法动态修改此状态。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + blockNetworkImage?: boolean; + /** + * 窗口垂直向上的偏移量 + * 支持百分比、像素值,默认值无值(根据top和height属性值来自动计算)。 + * 当同时设置了top和height值时,忽略此属性值; + * 当未设置height值时,可通过top和bottom属性值来确定窗口的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + bottom?: string; + /** + * 窗口遇到边框是否有反弹效果 + * 可取值: + * "none" - 表示没有反弹效果; + * "vertical" - 表示垂直方向有反弹效果; + * "horizontal" - 表示水平方向有反弹效果; + * "all" - 表示垂直和水平方向都有反弹效果。 + * 默认值为"none"。 + * - none: 没有反弹效果 + * - vertical: 垂直方向有反弹效果 + * - horizontal: 水平方向有反弹效果 + * - all: 垂直和水平方向都有反弹效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + bounce?: 'none' | 'vertical' | 'horizontal' | 'all'; + /** + * 窗口回弹效果区域的背景 + * 窗口回弹效果区域背景可支持颜色值或图片: + * 颜色值格式为"#RRGGBB",如"#FFFFFF"为设置白色背景; + * 背景图为"url(%image path%)",如"url(./icon.png)"为设置icon.png为背景图,图片采用平铺模式绘制。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + bounceBackground?: string; + /** + * 窗口内容停止滑动的减速度 + * 当Webview加载的内容超过其高度时,可以拖拽滑动内容,decelerationRate属性控制手指松开后页面滑动的速度。 + * 设置值越大手指松开后的滑动速度越快(滑动距离越长),其值域范围为0.0-1.0,默认值为0.989。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + decelerationRate?: number; + /** + * 窗口的停靠方式 + * 当Webview窗口添加到另外一个窗口中时,停靠方式才会生效,采用停靠方式添加会导致原Webview窗口自动调整其大小避免其内容被子窗口盖住。 + * 可取值:"top",控件停靠则页面顶部;"bottom",控件停靠在页面底部;"right",控件停靠在页面右侧;"left",控件停靠在页面左侧。 + * 默认值为"bottom"。 + * - top: 控件停靠则页面顶部 + * - bottom: 控件停靠在页面底部 + * - right: 控件停靠在页面右侧 + * - left: 控件停靠在页面左侧 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + dock?: 'top' | 'bottom' | 'right' | 'left'; + /** + * 窗口加载错误时跳转的页面地址 + * 当Webview窗口无法加载指定的url地址时(如本地页面不存在,或者无法访问的网络地址),此时会自动跳转到指定的错误页面地址(仅支持本地页面地址)。 + * 设置为“none”则关闭跳转到错误页面功能,此时页面显示Webview默认的错误页面内容。默认使用5+ Runtime内置的错误页面。 + * - none: 关闭加载页面错误自动跳转功能 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + errorPage?: 'none'; + /** + * 替换H5标准API + * 用于解决在部分设备上调用H5标准定位接口可能无法获取定位数据的问题。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + replacewebapi?: PlusWebviewWebviewReplaceWebApiOptions; + /** + * 窗口是否开启硬件加速 + * 布尔类型,true表示开启硬件加速,false表示不开启硬件加速,默认情况5+ Runtime会根据设备实际支持情况自动选择是否开启硬件加速,可以通过plus.webview.defaultHardwareAccelerated()方法获取默认Webview是否开启硬件加速。 + * 由于不同设备对硬件加速的支持情况存在差异,开启硬件加速能加速HTML页面的渲染,但也会消耗更多的系统资源,从而导致在部分设备上可能出现闪屏、发虚、分块渲染等问题,因此在特定设备的特定页面如果出现以上问题需要手动设置关闭硬件加速来避免。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + hardwareAccelerated?: boolean; + /** + * 窗口的高度 + * 支持百分比、像素值,默认为100%。 + * 当未设置height属性值时,优先通过top和bottom属性值来计算窗口的高度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + height?: string; + /** + * 窗口使用的内核 + * 可取值: + * "WKWebview" - 在iOS8.0及以上系统使用WKWebview内核,低版本下仍然使用UIWebview内核; + * "UIWebview" - 在所有版本上都使用UIWebview内核。 + * 默认值为"UIWebview"。 + * WKWebview内核的优势是: + * 1. 滚动时懒加载的图片也可以实时渲染,UIWebview在滚动停止后才能渲染; + * 2. WKWebview的video支持AirPlay。 + * 但WKWebview也有些限制和不足,目前已知的问题有: + * 1. 不支持跨域设置cookie,即plus.navigator.setCookie()API无法使用; + * 2. 本地的HTML页面中的XHR不支持跨域访问,需使用plus.net.XMLHttpRequest来替换; + * 3. 不支持使用WebSQL,需使用indexDB来替换; + * 4. 不支持js原生混淆功能,需使用前端js混淆来替换; + * 5. 内存不足时会白屏。 + * 首页的Webview的kernel在manifest中配置(plus->kernel->ios)。 + * - WKWebview: + * 使用"WKWebview"内核。 + * + * - UIWebview: + * 使用"UIWebview"内核。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + kernel?: 'WKWebview' | 'UIWebview'; + /** + * 窗口水平向右的偏移量 + * 支持百分比、像素值,默认值为0px。 + * 未设置left属性值时,优先通过right和width属性值来计算窗口的left位置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + left?: string; + /** + * 窗口的边距 + * 用于定位窗口的位置,支持auto,auto表示居中。若设置了left、right、top、bottom则对应的边距值失效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + margin?: string; + /** + * 窗口的遮罩 + * 用于设置Webview窗口的遮罩层样式,遮罩层会覆盖Webview中所有内容,包括子webview,并且截获webview的所有触屏事件,此时Webview窗口的点击操作会触发maskClick事件。 + * 字符串类型,可取值: + * rgba格式字符串,定义纯色遮罩层样式,如"rgba(0,0,0,0.5)",表示黑色半透明; + * "none",表示不使用遮罩层; + * 默认值为"none",即无遮罩层。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + mask?: string; + /** + * 窗口的不透明度 + * 0为全透明,1为不透明,默认值为1,即不透明。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + opacity?: number; + /** + * 控制Webview注入5+ API时机 + * 可取值: + * "ahead" - 尽量提前,拦截页面中网络js请求实现提前注入,如果没有拦截到js请求则在页面loaded时注入; + * "normal" - 页面loaded时注入; + * "later" - 较晚在注入,在loaded事件发生后2s再注入,plusready事件同样延迟; + * "none" - 不注入,页面无法调用5+ API,不触发plusready事件。 + * 默认值为"normal"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + plusrequire?: string; + /** + * 窗口的进度条样式 + * 设置此属性则在Webview窗口的顶部显示进度条,可配置进度条颜色及高度。 + * 设置此属性值为undefined或null则隐藏进度条。 + * 默认不显示进度条。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + progress?: PlusWebviewWebviewProgressStyles; + /** + * 窗口的侧滑返回功能 + * 可取值: + * "none"-无侧滑返回功能; + * "close"-侧滑返回关闭Webview窗口; + * "hide"-侧滑返回隐藏webview窗口。 + * - none: 无侧滑返回功能 + * - close: 侧滑返回关闭Webview窗口 + * - hide: 侧滑返回隐藏webview窗口 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + popGesture?: 'none' | 'close' | 'hide'; + /** + * 窗口下拉刷新配置 + * 设置窗口是否开启下拉刷新功能及样式。 + * 开启下拉刷新后可通过监听窗口的"pullToRefresh"事件处理下拉刷新业务逻辑,更新操作完成后调用窗口的endPullToRefresh方法结束下拉刷新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + pullToRefresh?: PlusWebviewWebviewPullToRefreshStyles; + /** + * 窗口渲染模式 + * 支持以下属性值: + * "onscreen" - Webview窗口在屏幕区可见时渲染,不可见时不进行渲染,此时能减少内存使用量; + * "always" - Webview在任何时候都渲染,在内存较大的设备上使用,被遮挡的窗口在此中模式下显示的时候会有更流畅的效果。 + * 默认值为"onscreen"。 + * 仅Android平台支持。 + * - onscreen: Webview窗口在屏幕区可见时渲染,不可见时不进行渲染,此时能减少内存使用量 + * - always: Webview在任何时候都渲染,在内存较大的设备上使用,被遮挡的窗口在此中模式下显示的时候会有更流畅的效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + render?: 'onscreen' | 'always'; + /** + * 窗口水平向左的偏移量 + * 支持百分比、像素值,默认无值(根据left和width属性值来自动计算)。 + * 当设置了left和width值时,忽略此属性值; + * 当未设置width值时,可通过left和bottom属性值来确定窗口的宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + right?: string; + /** + * 窗口是否可缩放 + * 窗口设置为可缩放(scalable:true)时,用户可通过双指操作放大或缩小页面,此时html页面可通过meta节点设置“name="viewport" content="user-scalable=no"”来限制页面不可缩放。 + * 窗口设置为不可缩放(scalable:false)时,用户不可通过双指操作放大或缩小页面,即使页面中的meta节点也无法开启可缩放功能。 + * 默认值为false,即不可缩放。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + scalable?: boolean; + /** + * 窗口是否显示滚动条 + * 用于控制窗口滚动条样式,可取值: + * "all":垂直和水平滚动条都显示; + * "vertical":仅显示垂直滚动条; + * "horizontal":仅显示水平滚动条; + * "none":垂直和水平滚动条都不显示。 + * 默认值为"all",即垂直和水平滚动条都显示。 + * 注意:显示滚动条的前提条件是窗口中的内容超过窗口显示的宽或高。 + * - all: 垂直和水平滚动条都显示 + * - vertical: 仅显示垂直滚动条 + * - horizontal: 仅显示水平滚动条 + * - none: 垂直和水平滚动条都不显示 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + scrollIndicator?: 'all' | 'vertical' | 'horizontal' | 'none'; + /** + * 点击设备的状态栏时是否滚动返回至顶部 + * true表示点击设备的状态栏可以滚动返回至顶部,false表示点击设备的状态栏不可以,默认值为true。 + * 此功能仅iOS平台支持,在iPhone上有且只有一个Webview窗口的scrollsToTop属性值为true时才生效,所以在显示和关闭Webview窗口时需动态更新所有Webview的scrollsToTop值,已确保此功能生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + scrollsToTop?: boolean; + /** + * 是否可分享窗口加载的链接地址 + * 在流应用环境(流应用/5+浏览器)中可通过分享按钮分享页面链接地址, + * 可取值: + * true - 可分享窗口加载页面链接地址; + * false - 不可分享窗口加载的页面链接地址,此时分享的是应用。 + * 默认值值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + shareable?: boolean; + /** + * 弹出系统软键盘模式 + * 可选值:“adjustPan”- 弹出软键盘时Webview窗口自动上移,以保证当前输入框可见;“adjustResize”- 自动调整Webview窗口大小(屏幕区域减去软键盘区域),同时自动滚动Webview保证输入框可见。 + * 默认值为“adjustPan”。 + * - adjustPan: 弹出软键盘时Webview窗口自动上移,以保证当前输入框可见 + * - adjustResize: 自动调整Webview窗口大小(屏幕区域减去软键盘区域),同时自动滚动Webview保证输入框可见 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + softinputMode?: 'adjustPan' | 'adjustResize'; + /** + * 窗口状态栏样式 + * 仅在应用设置为沉浸式状态栏样式下有效,设置此属性后将自动保留系统状态栏区域不被Webview窗口占用(即Webview窗口非沉浸式样式显示)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + statusbar?: PlusWebviewWebviewStatusbarStyles; + /** + * 定义窗口的原生子View控件 + * 数组类型,可通过配置项设置原生子View控件,每个配置项对应添加一个原生子View控件。 + * 通过Webview窗口的getSubNViews()方法可获取原生子View控件对象数组。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + subNViews?: PlusWebview []; + /** + * 定义窗口的标题栏控件样式 + * 设置此属性值则表明创建Webview窗口的标题栏控件,并可通过其属性值设置背景颜色、文本内容、文本颜色等。 + * 通过Webview窗口的getTitleNView()方法可获取标题栏控件对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + titleNView?: PlusWebviewWebviewTitleNViewStyles; + /** + * 窗口垂直向下的偏移量 + * 支持百分比、像素值,默认值为0px。 + * 未设置top属性值时,优先通过bottom和height属性值来计算窗口的top位置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + top?: string; + /** + * 窗口定义窗口变换的动画效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + transition?: PlusWebviewWebviewTransition; + /** + * 窗口定义窗口变形效果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + transform?: PlusWebviewWebviewTransform; + /** + * Webview窗口的排版位置 + * 当Webview窗口添加到另外一个窗口中时,排版位置才会生效,排版位置决定子窗口在父窗口中的定位方式。 + * 可取值:"static",控件在页面中正常定位,如果页面存在滚动条则随窗口内容滚动;"absolute",控件在页面中绝对定位,如果页面存在滚动条不随窗口内容滚动;"dock",控件在页面中停靠,停靠的位置由dock属性值决定。 + * 默认值为"absolute"。 + * - static: 控件在页面中正常定位,如果页面存在滚动条则随窗口内容滚动 + * - absolute: 控件在页面中绝对定位,如果页面存在滚动条不随窗口内容滚动 + * - dock: 控件在页面中停靠,停靠的位置由dock属性值决定 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + position?: 'static' | 'absolute' | 'dock'; + /** + * 用户是否可选择内容 + * 可取值: + * true - 表示可选择内容,用户可通过长按来选择页面内容,如文本内容选择后可以弹出系统复制粘贴菜单; + * false - 表示不可选择内容,用户不可通过长按来选择页面内容。 + * 默认值为true。 + * 注意:在Web页面中可通过CSS的user-select对单个页面元素进行控制,前提是Webview对象的userSelect设置为true,否则CSS设置的user-select失效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + userSelect?: boolean; + /** + * 视频全屏播放时的显示方向 + * 可取值: + * "auto": 自动适配,如果当前页面竖屏,则竖屏显示;如果当前页面横盘显示,则横屏;如果当前页面自动感应,则自动感应横竖屏切换。 + * "portrait-primary": 竖屏正方向; + * "portrait-secondary": 竖屏反方向,屏幕正方向按顺时针旋转180°; + * "landscape-primary": 横屏正方向,屏幕正方向按顺时针旋转90°; + * "landscape-secondary": 横屏方向,屏幕正方向按顺时针旋转270°; + * "landscape": 横屏正方向或反方向,根据设备重力感应器自动调整; + * 默认值为“auto”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + videoFullscreen?: string; + /** + * 窗口的宽度 + * 支持百分比、像素值,默认为100%。未设置width属性值时,可同时设置left和right属性值改变窗口的默认宽度。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + width?: string; + /** + * 窗口的堆叠顺序值 + * 拥有更高堆叠顺序的窗口总是会处于堆叠顺序较低的窗口的前面,拥有相同堆叠顺序的窗口后调用show方法则在前面。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + zindex?: number; +} + +/** + * 一组用于定义页面或控件变形的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewTransform { + /** + * 暂不支持 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + rotate?: string; + /** + * 暂不支持 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + translate?: string; + /** + * 暂不支持 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + scale?: string; + /** + * 暂不支持 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + skew?: string; + /** + * 暂不支持 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + matrix?: string; +} + +/** + * 一组用于定义页面或控件转换效果的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewTransition { + /** + * 产生变换效果的属性 + * 默认值为"all",暂不支持其它值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + property?: string; + /** + * 变换持续的时间 + * 默认值为0,即无动画效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + duration?: string; + /** + * 窗口变换效果 + * 可取值: + * "linear":匀速变化,匀速动画效果; + * "ease-in":匀加速变化,逐渐变快的动画效果; + * "ease-out":匀减速变化,逐渐变慢的动画效果; + * "ease-in-out":先加速后减速变化,先变快后变慢的动画效果。 + * 默认值为"ease-in-out"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + timingfunction?: string; +} + +/** + * 拦截Webview窗口资源请求的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewOverrideResourceOptions { + /** + * 区配需要拦截请求资源的URL地址 + * 支持正则表达式,默认值为空字符串(即不拦截)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + match?: string; + /** + * 拦截重定向的资源地址 + * 仅支持本地资源地址,如"_www"、"_doc"、"_downloads"、"_documents"等开头的路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + redirect?: string; + /** + * 重定向的资源数据类型 + * RFC2045/RFC2046/RFC2047/RFC2048/RFC2049规范中定义的数据类型。 + * 如普通文本(text/plain)、PNG图像(image/png)、GIF图形(image/gif)、JPEG图形(image/jpeg)。 + * 如果未指定mime类型,则根据重定向资源路径自动区配。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + mime?: string; + /** + * 重定向的资源数据编码 + * 如未设置,则使用默认值"UTF-8"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + encoding?: string; + /** + * 设置重定向资源数据的http头数据 + * 可设置标注http头数据(如Content-type),也可设置自定义数据。 + * 通常可通过此属性来设置拦截资源的缓存策略(如Cache-control)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + header?: any; +} + +/** + * 拦截Webview窗口URL请求的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewOverrideUrlOptions { + /** + * 拦截URL请求生效时机 + * 可取值: + * "instant" - 表示立即生效,即调用overrideUrlLoading方法后立即生效; + * "touchstart" - 表示用户操作Webview窗口(触发touchstart事件)后生效,如果用户没有操作Webview窗口则不对URL请求操作进行拦截处理。 + * 默认值为"instant"。 + * - instant: + * 立即生效,即调用overrideUrlLoading方法后立即生效。 + * + * - : + * 表示用户操作Webview窗口(触发touchstart事件)后生效。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + effect?: 'instant' | ''; + /** + * 拦截模式 + * 可取值: + * "allow"表示满足match属性定义的条件时不拦截url继续加载,不满足match属性定义的条件时拦截url跳转并触发callback回调; + * "reject"表示满足match属性定义的提交时拦截url跳转并触发callback回调,不满足match属性定义的条件时不拦截url继续加载。 + * 默认值为"reject"。 + * - allow: + * 满足match属性定义的条件时不拦截url继续加载,不满足match属性定义的条件时拦截url跳转并触发callback回调。 + * + * - reject: + * 满足match属性定义的提交时拦截url跳转并触发callback回调,不满足match属性定义的条件时不拦截url继续加载。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + mode?: 'allow' | 'reject'; + /** + * 区配是否需要处理的URL请求 + * 支持正则表达式,默认值为对所有URL地址生效(相当于正则表达式“.*”)。 + * 如果mode值为"allow"则允许区配的URL请求跳转,mode值为"reject"则拦截区配的URL请求。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + match?: string; + /** + * 排除拦截处理请求类型 + * 不拦截处理指定类型的URL请求,直接使用系统默认处理逻辑。 + * 可取值: + * "none"表示不排除任何URL请求(即拦截处理所有URL请求); + * "redirect"表示排除拦截处理301/302跳转的请求(谨慎使用,非a标签的href触发的URL请求可能会误判断为302跳转)。 + * 默认值为"none"。 + * - none: + * 不排除任何URL请求(即拦截处理所有URL请求)。 + * + * - redirect: + * 排除拦截处理301/302跳转的请求(谨慎使用,非a标签的href触发的URL请求可能会误判断为302跳转)。 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + exclude?: 'none' | 'redirect'; +} + +/** + * 监听Webview窗口资源加载的属性 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ +interface PlusWebviewWebviewListenResourceOptions { + /** + * 区配是否需要处理的URL资源 + * 支持正则表达式,默认值为对所有URL资源请求生效(相当于正则表达式“.*”)。 + * 如果Webview加载的资源区配条件,则触发回调事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/webview.html](http://www.html5plus.org/doc/zh_cn/webview.html) + */ + match?: string; +} + +/** + * XMLHttpRequest模块管理网络请求,与标准HTML中的XMLHttpRequest用途一致,差别在于前者可以进行跨域访问。通过plus.net可获取网络请求管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ +interface PlusNet { + /** + * 跨域网络请求对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + XMLHttpRequest?: PlusNetXMLHttpRequest; + /** + * HTTP请求进度事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + ProgressEvent?: PlusNetProgressEvent; +} + +/** + * 跨域网络请求对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ +interface PlusNetXMLHttpRequest { + /** + * HTTP 请求的状态 + * 当一个 XMLHttpRequest 初次创建时,这个属性的值从 0 开始,直到接收到完整的 HTTP 响应,这个值增加到 4。 + * 5 个状态中每一个都有一个相关联的非正式的名称,下表列出了状态、名称和含义: + * 0 Uninitialized,未初始化状态。XMLHttpRequest对象已创建或已被abort()方法重置。 + * 1 Open,open()方法已调用,但是send()方法未调用。请求还没有被发送。 + * 2 Sent,send()方法已调用,HTTP 请求已发送到Web服务器。未接收到响应。 + * 3 Receiving,所有响应头部都已经接收到。响应体开始接收但未完成。 + * 4 Loaded,HTTP响应已经完全接收。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + readyState?: number; + /** + * 请求从服务器接收到的响应数据 + * 如果没有从服务器接收到数据,则为null; + * 否则根据responseType类型决定: + * 如果responseType设置为空字符串或"text",则返回空字符串; + * 如果responseType设置为"document",则返回Document对象; + * 如果responseType设置为"json",则返回JSON对象; + * 若服务器返回的数据与设置的responseType类型不区配,则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + response?: string; + /** + * 请求从服务器接收到的响应数据(字符串数据) + * 如果还没有接收到数据的话,此属性值为空字符串; + * 如果readyState小于3,此属性值为空字符串; + * 如果readyState为3,此属性值返回目前已经接收的HTTP响应部分数据值; + * 如果readyState为4,此属性值保存了完整的HTTP响应数据体。 + * 如果HTTP请求返回的数据头中包含了Content-Type值中指定字符编码,就使用该编码,否则,使用UTF-8字符集。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + responseText?: string; + /** + * 请求响应数据response的类型 + * 默认值为空字符串,即reponse为String,类型可设置:"document"表示Document对象,"json"表示JSON对象,"text"表示字符串。 + * 此值必须在调用send方法之前设置,否则设置的值不生效,仍使用之前设置的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + responseType?: string; + /** + * 请求响应的Document对象 + * 对请求的响应,解析为 XML 并作为 Document 对象返回。 + * 如果请求未成功,或响应的数据无法被解析为XML,则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + responseXML?: string; + /** + * 服务器返回的HTTP状态代码 + * 服务器返回的HTTP状态代码,如200表示成功,而404表示"Not Found"错误; + * 当readyState小于3的时候此属性值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + status?: number; + /** + * 服务器返回的HTTP状态描述 + * 此属性值用名称而不是数字指定了请求的HTTP的状态代码。 + * 也就是说,当状态为200的时候它是"OK";当状态为404的时候它是"Not Found"。 + * 和status属性类似,当readyState小于3的时候读取这一属性会返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + statusText?: string; + /** + * 请求服务器的超时时间,单位为毫秒(ms) + * 数值类型,单位为ms,其默认值为120秒。 + * 超时时间为服务器响应请求的时间(不是Http请求完成的总时间),如果设置为0则表示永远不超时。 + * 必须在请求发起前设置,否则当前请求将不生效,在当前请求完成后重新发起新请求时生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + timeout?: number; + /** + * 是否支持跨域请求 + * 此对象创建的HTTP请求都支持跨域,所以永远返回true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + withCredentials?: boolean; + /** + * 网络请求状态发生变化事件 + * 网络请求状态发生变化时触发,通常在函数中判断对象的state属性值来获取当前请求的状态。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + onreadystatechange?: () => void; + /** + * 网络请求开始事件 + * 通常在调用send方法开始发起HTTP请求时触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + onloadstart?: (result: PlusNetProgressEvent) => void; + /** + * 网络请求传输数据事件 + * 通常在HTTP请求链接已经建立,开始传输数据时触发,在数据传输的过程中可能多次触发,此事件与onreadystatechange事件触发状态3类似。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + onprogress?: (result: PlusNetProgressEvent) => void; + /** + * 网络请求取消事件 + * 通常在调用abort方法取消HTTP请求时触发。 + * 此事件在onreadystatechange事件触发状态4事件之后。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + onabort?: (result: PlusNetProgressEvent) => void; + /** + * 网络请求错误事件 + * 通常在HTTP请求发生错误时触发,如无法连接到服务器等各种错误都触发此事件。 + * 此事件在onreadystatechange事件触发状态4事件之后。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + onerror?: (result: PlusNetProgressEvent) => void; + /** + * 网络请求成功事件 + * 通常在HTTP请求成功完成时触发,如果HTTP请求发生错误则不触发此事件。 + * 此事件在onreadystatechange事件触发状态4事件之后。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + onload?: (result: PlusNetProgressEvent) => void; + /** + * 网络请求超时事件 + * 通常在HTTP请求超时时触发,此时不会触发onerror事件。 + * 此事件在onreadystatechange事件触发状态4事件之后。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + ontimeout?: (result: PlusNetProgressEvent) => void; + /** + * 网络请求结束事件 + * 通常在HTTP请求结束时触发,不管是HTTP请求失败、成功、或超时之后都会触发此事件。 + * 此事件在onreadystatechange事件触发状态4事件之后。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + onloadend?: (result: PlusNetProgressEvent) => void; + /** + * 取消当前响应,关闭连接并且结束任何未决的网络活动 + * 此方法把XMLHttpRequest对象重置为readyState为0的状态,并且取消所有未决的网络活动。 + * 调用此方法后将停止触发XMLHttpRequest对象的所有事件。 + * 例如,如果请求用了太长时间,而且响应不再必要的时候,可以调用这个方法。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + abort(): void; + /** + * 获取HTTP响应头部信息 + * 把HTTP响应头部作为未解析的字符串返回。 如果readyState小于3,这个方法返回null。 + * 否则,它返回服务器发送的所有 HTTP 响应的头部。头部作为单个的字符串返回,一行一个头部。每行用换行符"\r\n"隔开。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + getAllResponseHeaders(): string; + /** + * 获取指定的HTTP响应头部的值 + * 其参数是要返回的 HTTP 响应头部的名称。可以使用任何大小写来制定这个头部名字,和响应头部的比较是不区分大小写的。 + * 该方法的返回值是指定的 HTTP 响应头部的值,如果没有接收到这个头部或者readyState小于3则为空字符串。 + * 如果接收到多个有指定名称的头部,这个头部的值被连接起来并返回,使用逗号和空格分隔开各个头部的值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + getResponseHeader(headerName?: string): string; + /** + * 初始化HTTP请求参数,例如URL和HTTP方法,但是并不发送请求 + * 这个方法初始化请求参数以供 send() 方法稍后使用。它把readyState设置为1,删除之前指定的所有请求头部,以及之前接收的所有响应头部,并且把responseText、responseXML、status 以及 statusText 参数设置为它们的默认值。 + * 当readyState为0的时候(当XMLHttpRequest对象刚创建或者abort()方法调用后)以及当readyState为4时(已经接收响应时),调用这个方法是安全的。 + * 当针对任何其他状态调用的时候,open()方法的行为是为指定的。 + * 除了保存供send()方法使用的请求参数,以及重置 XMLHttpRequest 对象以便复用,open()方法没有其他的行为。 + * 要特别注意,当这个方法调用的时候,实现通常不会打开一个到Web服务器的网络连接。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + open(method?: string, url?: string, username?: string, password?: string): void; + /** + * 重写服务器返回的MIME类型 + * 此方法覆盖HTTP请求返回数据头"Content-Type"字段值中包含的IMIE类型,如果设置的MIME类型无效则继续使用"Content-Type"字段值中包含的IMIE类型。 + * 如果MIME类型中指定了字符集类型(charset),则需按照指定的字符集类型对接收到的数据体(respose)进行处理,否则默认为UTF-8字符集。 + * 注意:此方法需在send方法前调用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + overrideMimeType(mime?: string): void; + /** + * 发送HTTP请求 + * 此方法触发HTTP请求发送,如果之前没有调用open(),或者更具体地说,如果readyState不是1,send()抛出一个异常。否则,将发送HTTP请求,该请求由以下几部分组成: + * 之前调用open()时指定的HTTP方法、URL; + * 之前调用setRequestHeader()时指定的请求头部(如果有的话); + * 传递给这个方法的body参数。 + * 一旦请求发送了,send()把readyState设置为2,并触发onreadystatechange事件; + * 如果服务器响应带有一个HTTP重定向,send()方法在后台线程自动遵从重定向; + * 当所有的HTTP响应头部已经接收,send()或后台线程把readyState设置为3并触发onreadystatechange事件; + * 如果响应较长,send()或后台线程可能在状态3中触发多次onreadystatechange事件; + * 最后,当响应完成,send()或后台线程把readyState设置为4,并最后一次触发onreadystatechange事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + send(body?: string): void; + /** + * 指定一个HTTP请求的Header + * Http的Header应该包含在通过后续send()调用而发起的请求中。 + * 此方法只有当readyState为1的时候才能调用,例如,在调用了open()之后,但在调用send()之前。 + * 如果带有指定名称的头部已经被指定了,这个头部的新值就是:之前指定的值,加上逗号、以及这个调用指定的值(形成一个数组)。 + * 如果Web服务器已经保存了和传递给open()的URL相关联的cookie,适当的Cookie或Cookie2头部也自动地包含到请求中,可以通过调用setRequestHeader()来把这些cookie添加到头部。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + setRequestHeader(headerName?: string, headerValue?: string): void; +} + +/** + * HTTP请求进度事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ +interface PlusNetProgressEvent { + /** + * 事件的目标对象 + * 通知HTTP请求进度事件的XMLHttpRequest对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + target?: PlusNetXMLHttpRequest; + /** + * 进度信息是否可计算 + * HTTP请求进度信息是否有效,如果HTTP请求头中包含Content-Length头信息则为true,否则为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + lengthComputable?: number; + /** + * 当前已经接收到的数据长度 + * HTTP请求接收到的数据长度,单位为字节。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + loaded?: number; + /** + * 总数据长度 + * HTTP请求返回的总数据长度,单位为字节。 + * 如果无法获取则设置为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/net.html](http://www.html5plus.org/doc/zh_cn/net.html) + */ + total?: number; +} + +/** + * Zip模块管理文件压缩和解压,通过plus.zip可获取压缩管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ +interface PlusZip { + /** + * JSON对象,配置图片压缩转换的参数 + * 设置width/height属性则表示需对图片进行缩放转换操作; + * 设置rotate属性则表示需对图片进行旋转转换操作; + * 设置clip属性则表示需对图片进行裁剪转换操作; + * 如同时设置了多个转换操作,则按缩放、旋转、裁剪顺序进行操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + CompressImageOptions?: PlusZipCompressImageOptions; + /** + * JSON对象,图片裁剪区域的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + ClipImageOptions?: PlusZipClipImageOptions; + /** + * 压缩生成Zip文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + compress(src?: string, zipfile?: string, successCB?: () => void, errorCB?: (result: any) => void): void; + /** + * 解压缩Zip文件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + decompress(zipfile?: string, target?: string, successCB?: () => void, errorCB?: (result: any) => void): void; + /** + * 图片压缩转换 + * 可用于图片的质量压缩、大小缩放、方向旋转、区域裁剪、格式转换等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + compressImage(options?: PlusZipCompressImageOptions, successCB?: (result: any) => void, errorCB?: (result: any) => void): void; +} + +/** + * JSON对象,配置图片压缩转换的参数 + * 设置width/height属性则表示需对图片进行缩放转换操作; + * 设置rotate属性则表示需对图片进行旋转转换操作; + * 设置clip属性则表示需对图片进行裁剪转换操作; + * 如同时设置了多个转换操作,则按缩放、旋转、裁剪顺序进行操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ +interface PlusZipCompressImageOptions { + /** + * 压缩转换原始图片的路径 + * 支持以下图片路径: + * 相对路径 - 相对于当前页面的host位置,如"a.jpg",注意当前页面为网络地址则不支持; + * 绝对路径 - 系统绝对路径,如Android平台"/storage/sdcard0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/www/a.jpg",iOS平台"/var/mobile/Containers/Data/Application/757966CF-345C-4348-B07F-EEF83CF9A369/Library/Pandora/apps/HBuilder/www/a.png"; + * 相对路径URL(RelativeURL) - 以"_"开头的相对路径,如"_www/a.jpg"、"_doc/b.jpg"、"_documents/c.jpg"、"_downloads/d.jpg"; + * 本地路径URL - 以“file://”开头,后面跟随系统绝对路径。 + * - _www/: 应用资源目录 + * - _doc/: 应用私有文档目录 + * - _documents/: 共享文档目录 + * - _downloads/: 共享下载目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + src?: '_www/' | '_doc/' | '_documents/' | '_downloads/'; + /** + * 压缩转换目标图片的路径 + * 支持以下图片路径: + * 绝对路径 - 系统绝对路径,如Android平台"/storage/sdcard0/Android/data/io.dcloud.HBuilder/.HBuilder/apps/HBuilder/doc/a.jpg",iOS平台"/var/mobile/Containers/Data/Application/757966CF-345C-4348-B07F-EEF83CF9A369/Library/Pandora/apps/HBuilder/doc/a.png"; + * 相对路径URL(RelativeURL) - 以"_"开头的相对路径,如"_doc/b.jpg"、"_documents/c.jpg"、"_downloads/d.jpg",注意不支持"_www"开头的路径; + * 本地路径URL - 以“file://”开头,后面跟随系统绝对路径。 + * 注意:如果设置的路径无权限访问,则返回失败。 + * - _doc/: 应用私有文档目录 + * - _documents/: 共享文档目录 + * - _downloads/: 共享下载目录 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + dst?: '_doc/' | '_documents/' | '_downloads/'; + /** + * 覆盖生成新文件 + * 仅在dst制定的路径文件存在时有效: + * true表示覆盖存在的文件; + * false表示不覆盖,如果文件存在,则返回失败。 + * 默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + overwrite?: boolean; + /** + * 压缩转换后的图片格式 + * 支持"jpg"、"png",如果未指定则使用源图片的格式。 + * - jpg: JPG格式图片 + * - png: PNG格式图片 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + format?: 'jpg' | 'png'; + /** + * 压缩图片的质量 + * 取值范围为1-100,1表示使用最低的图片质量(转换后的图片文件最小)、100表示使用最高的图片质量(转换后的图片文件最大); + * 默认值为50。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + quality?: number; + /** + * 缩放图片的宽度 + * 支持像素值(如"100px")、百分比(如"50%")、自动计算(如"auto",即根据height与源图高的缩放比例计算,若未设置height则使用源图高度); + * 默认值为"auto"。 + * 注意:若设置了width属性值不合法(如"0px"),则不对图片进行缩放操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + width?: string; + /** + * 缩放图片的高度 + * 支持像素值(如"100px")、百分比(如"50%")、自动计算(如"auto",即根据width与源图宽的缩放比例计算,若未设置width则使用源图高度); + * 默认值为"auto"。 + * 注意:若设置了height属性值不合法(如"0px"),则不对图片进行缩放操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + height?: string; + /** + * 旋转图片的角度 + * 支持值:90-表示旋转90度;180-表示旋转180度;270-表示旋转270度。 + * 注意:若设置rotate属性值不合法,则不对图片进行旋转操作。 + * - 90: 旋转90度 + * - 180: 旋转180度 + * - 270: 旋转270度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + rotate?: '90' | '180' | '270'; + /** + * 裁剪图片的区域 + * 值参考ClipImageOptions定义,若设置clip属性值不合法,则不对图片进行裁剪操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + clip?: PlusZipClipImageOptions; +} + +/** + * JSON对象,图片裁剪区域的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ +interface PlusZipClipImageOptions { + /** + * 图片裁剪区域与原图片上边界的偏移距离 + * 支持像素值(如"10px")、百分比(如"10%");默认值为"0px"。 + * 注意:如果top值超出原图片高度,则图片裁剪失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + top?: string; + /** + * 图片裁剪区域与原图片左边界的偏移距离 + * 支持像素值(如"10px")、百分比(如"10%");默认值为"0px"。 + * 注意:如果left值超出原图片宽度,则图片裁剪失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + left?: string; + /** + * 图片裁剪区域的宽度 + * 支持像素值(如"100px")、百分比(如"50%")、自动计算(如"auto",即从left位置到图片右边界的宽度);默认值为"auto"。 + * 注意:如果left值加width值超出原图片宽度,则使用"auto"值进行裁剪。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + width?: string; + /** + * 图片裁剪区域的高度 + * 支持像素值(如"100px")、百分比(如"50%")、自动计算(如"auto",即从top位置到图片下边界的高度);默认值为"auto"。 + * 注意:如果top值加height值超出原图片高度,则使用"auto"值进行裁剪。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/zip.html](http://www.html5plus.org/doc/zh_cn/zip.html) + */ + height?: string; +} + +/** + * Barcode模块管理条码扫描,支持常见的条码(一维码及二维码)的扫描识别功能。可调用设备的摄像头对条码图片扫描进行数据输入,解码后返回码数据及码类型。通过plus.barcode可获取条码码管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ +interface PlusBarcode { + /** + * Barcode扫码控件对象 + * Barcode对象表示条码识别控件对象,在窗口中显示条码识别控件,使用此对象可自定义条码识别界面。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + Barcode?: PlusBarcodeBarcode; + /** + * Barcode扫码控件样式 + * 设置Barcode扫码控件的样式,如扫码框、扫码条的颜色等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + BarcodeStyles?: PlusBarcodeBarcodeStyles; + /** + * 条码识别控件扫描参数 + * 设置Barcode扫码控件的扫码识别参数,如是否保存扫码功时的截图等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + BarcodeOptions?: PlusBarcodeBarcodeOptions; + /** + * QR二维码,数值为0 + * 1994年由日本Denso-Wave公司发明,QR来自英文Quick Response的缩写,即快速反应的意思,源自发明者希望QR码可让其内容快速被解码。 + * 目前使用最广泛的二维码。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + QR?: number; + /** + * EAN条形码标准版,数值为1 + * 国际物品编码协会在全球推广应用的商品条码,是由13位数字组成。 + * 目前使用最广泛的一维条形码。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + EAN13?: number; + /** + * ENA条形码简版,数值为2 + * 国际物品编码协会在全球推广应用的商品条码,是由8位数字组成。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + EAN8?: number; + /** + * Aztec二维码,数值为3 + * Andrew Longacre发明于1995年,该代码是用于国际出版。最小的Aztec码符号编码13个数字或12个英文字母。最大的Aztec码符号编码3832数字或3067英文字母或1914字节的数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + AZTEC?: number; + /** + * Data Matrix二维码,数值为4 + * Data Matrix原名Data code,由美国国际资料公司(International Data Matrix, 简称IDMatrix)于1989年发明。可编码字元集包括全部的ASCII字元及扩充ASCII字元,容量可包含2235个英文数字资料、1556个8位元资料,3116个数字资料。由于Data Matrix二维条码只需要读取资料的20%即可精确辨读,因此很适合应用在条码容易受损的场所。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + DATAMATRIX?: number; + /** + * UPC条形码标准版,数值为5 + * UPC码是美国统一代码委员会制定的一种商品用条码,主要用于美国和加拿大地区,常在美国进口的商品上可以看到。UPC码标准版由12位数字构成,故其字码集为数字0~9。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + UPCA?: number; + /** + * UPC条形码缩短版,数值为6 + * UPC码是美国统一代码委员会制定的一种商品用条码,主要用于美国和加拿大地区,常在美国进口的商品上可以看到。UPC码缩短版由8位数字构成,故其字码集为数字0~9。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + UPCE?: number; + /** + * Codabar条形码,数值为7 + * Codabar码最初是为零售价格标签系统而研制开发的。1975年,National Retail Merchants Association(NRMA)选择了其它符号类型作为标准后,Codabar开始在多个方面用于非零售应用领域,如图书馆、货运和医药业。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + CODABAR?: number; + /** + * Code39条形码,数值为8 + * Code 39码是Intermec公司于1975年推出的一维条码, 39码是一种可供使用者双向扫瞄的分散式条码,也就是说相临两资料码之间,39码必须包含一个不具任何意义的空白(或细白,其逻辑值为0),且 39码具有支援文数字的能力,编码规则简单、误码率低、所能表示字符个数多等特点,39码在各个领域有着极为广泛的应用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + CODE39?: number; + /** + * Code93条形码,数值为9 + * Code 93码的条码符号是由Intermec公司于1982年设计的 提供更高的密度和数据安全增强code39 。它是一个字母,长度可变符号。代码93主要用于由加拿大邮政编码补充提供的资料。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + CODE93?: number; + /** + * Code128条形码,数值为10 + * CODE128码是1981年引入的一种高密度条码,CODE128 码可表示从 ASCII 0 到ASCII 127 共128个字符,故称128码。CODE128码是广泛应用在企业内部管理、生产流程、物流控制系统方面的条码码制,由于其优良的特性在管理信息系统的设计中被广泛使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + CODE128?: number; + /** + * ITF条形码,数值为11 + * ITF条码,又称交叉二五条码,由14位数字字符代表组成。主要用于运输包装,是印刷条件较差,不允许印刷EAN-13和UPC-A条码时应选用的一种条码。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + ITF?: number; + /** + * MaxiCode二维码,数值为12 + * 1996年时,美国自动辨识协会(AIMUSA)制定统一的符号规格,称为Maxicode二维条码,也有人称USS-Maxicode二维条码(Uniform Symbology Specification-Maxicode)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + MAXICODE?: number; + /** + * PDF 417二维条码,数值为13 + * PDF417条码是由美国SYMBOL公司发明的,PDF(Portable Data File)意思是“便携数据文件”。组成条码的每一个条码字符由4个条和4个空共17个模块构成,故称为PDF417条码。PDF417条码最大的优势在于其庞大的数据容量和极强的纠错能力。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + PDF417?: number; + /** + * RSS 14条形组合码,数值为14 + * RSS条码是有国际物品编码协会EAN和美国统一代码委员会UCC开发的RSS(Reduced Space Symbology)条码符号。它是一种一维码和二维码的组合码。和其它线性条码相比,RSS系列码制具有更高的密度,因为它可以表示更多的字符。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + RSS14?: number; + /** + * 扩展式RSS条形组合码,数值为15 + * RSS条码是有国际物品编码协会EAN和美国统一代码委员会UCC开发的RSS(Reduced Space Symbology)条码符号。它是一种一维码和二维码的组合码。和其它线性条码相比,RSS系列码制具有更高的密度,因为它可以表示更多的字符。扩展式RSS码是长度可以变化的线性码制,能够对74个数字字符或41个字母字符的AI单元数据传数据进行编码。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + RSSEXPANDED?: number; + /** + * 通过图片扫码识别 + * 直接输入图片扫码识别,成功扫描到条码数据后通过successCallback回调返回,失败则通过errorCallback回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + scan(path?: string, successCB?: (result0: number, result1: string, result2: string) => void, errorCB?: (result: any) => void, filters?: any []): void; + /** + * 创建Barcode对象 + * 调用此方法创建后并不会显示,需要调用Webview窗口的append方法将其添加到Webview窗口后才能显示。 + * 注意:此时需要通过styles参数的top/left/width/height属性设置控件的位置及大小。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + create(id?: string, filters?: any [], styles?: PlusBarcodeBarcodeStyles): PlusBarcodeBarcode; + /** + * 查找已经创建的Barcode对象 + * 调用此方法查找指定id的Barcode对象,如果不存在则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + getBarcodeById(id?: string): PlusBarcodeBarcode; +} + +/** + * Barcode扫码控件对象 + * Barcode对象表示条码识别控件对象,在窗口中显示条码识别控件,使用此对象可自定义条码识别界面。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ +interface PlusBarcodeBarcode { + /** + * 条码识别成功事件 + * Barcode扫码控件识别到有效的条码数据时触发的成功事件,并返回扫码结果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + onmarked?: (result0: number, result1: string, result2: string) => void; + /** + * 条码识别错误事件 + * 描控件识别过程中发生错误时触发的失败事件,并返回错误信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + onerror?: (result: any) => void; + /** + * 开始条码识别 + * 开始调用系统摄像头获取图片数据进行扫码识别,当识别出条码数据时通过onmarked回调函数返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + start(optons?: PlusBarcodeBarcodeOptions): void; + /** + * 结束条码识别 + * 结束对摄像头获取图片数据进行条码识别操作,同时关闭摄像头的视频捕获。 + * 结束后可调用start方法重新开始识别。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + cancel(): void; + /** + * 关闭条码识别控件 + * 释放控件占用系统资源,调用close方法后控件对象将不可使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + close(): void; + /** + * 是否开启闪光灯 + * 设置Barcode扫码控件在扫码时是否开启摄像头的闪光灯,默认值为不开启闪光灯。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + setFlash(open?: boolean): void; + /** + * 设置Barcode扫码控件的配置参数 + * 用于动态更新Barcode扫码控件的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + setStyles(styles?: PlusBarcodeBarcodeStyles): void; +} + +/** + * Barcode扫码控件样式 + * 设置Barcode扫码控件的样式,如扫码框、扫码条的颜色等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ +interface PlusBarcodeBarcodeStyles { + /** + * 条码识别控件背景颜色 + * 颜色值支持(参考CSS颜色规范):颜色名称(参考CSS Color Names)/十六进制值/rgb值,默认值为红色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + background?: string; + /** + * 扫码框颜色 + * 颜色值支持(参考CSS颜色规范):颜色名称(参考CSS Color Names)/十六进制值/rgb值/rgba值,默认值为红色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + frameColor?: string; + /** + * 扫码条颜色 + * 颜色值支持(参考CSS颜色规范):颜色名称(参考CSS Color Names)/十六进制值/rgb值/rgba值,默认值为红色。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + scanbarColor?: string; + /** + * Barcode扫码控件左上角的垂直偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度; + * 自动计算,如"auto",根据height值自动计算,相对于父Webview窗口垂直居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + top?: string; + /** + * Barcode扫码控件左上角的水平偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度; + * 自动计算,如"auto",根据width值自动计算,相对于父Webview窗口水平居中。 + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + left?: string; + /** + * Barcode扫码控件的宽度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + width?: string; + /** + * Barcode扫码控件的高度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + height?: string; + /** + * Barcode扫码控件在Webview窗口的布局模式 + * 可取值: + * "static" - 静态布局模式,如果页面存在滚动条则随窗口内容滚动; + * "absolute" - 绝对布局模式,如果页面存在滚动条不随窗口内容滚动; + * 默认值为"static"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + position?: string; +} + +/** + * 条码识别控件扫描参数 + * 设置Barcode扫码控件的扫码识别参数,如是否保存扫码功时的截图等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ +interface PlusBarcodeBarcodeOptions { + /** + * 是否保存扫码成功时的截图 + * 如果设置为true则在扫码成功时将图片保存,并通过onmarked回调函数的file参数返回保存文件的路径。 + * 默认值为false,不保存截图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + conserve?: boolean; + /** + * 保存扫码成功时图片保存路径 + * 可通过此参数设置保存截图的路径和名称,如果设置图片文件名称则必须指定文件的后缀名(必须是.png),否则认为是指定目录,文件名称则自动生成。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + filename?: string; + /** + * 扫码成功时是否需要震动提醒 + * 如果设置为true则在扫码成功时震动设备,false则不震动。 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + vibrate?: boolean; + /** + * 扫码成功时播放的提示音 + * 可取值: + * "none" - 不播放提示音; + * "default" - 播放默认提示音(5+引擎内置)。 + * 默认值为"default"。 + * - none: 扫码成功时不播放提示音 + * - default: 扫码成功时播放默认提示音 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/barcode.html](http://www.html5plus.org/doc/zh_cn/barcode.html) + */ + sound?: 'none' | 'default'; +} + +/** + * Maps模块管理地图控件,用于在web页面中显示地图控件,提供各种接口操作地图控件,如添加标点、路线等。通过plus.maps可获取地图管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMaps { + /** + * 地图控件对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Map?: PlusMapsMap; + /** + * 地图控件对象的参数 + * 设置地图对象显示时使用的参数,如地图的中心位置、缩放级别等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + MapStyles?: PlusMapsMapStyles; + /** + * 地理编码转换的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + GeocodeOptions?: PlusMapsGeocodeOptions; + /** + * 地图坐标转换的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + CoordinateConvertOptions?: PlusMapsCoordinateConvertOptions; + /** + * Point对象用于表示地图元素的坐标 + * 常用语对地图上元素进行定位时使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Point?: PlusMapsPoint; + /** + * 地理区域 + * 有西南及东北坐标点数据组成的矩形区域。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Bounds?: PlusMapsBounds; + /** + * 地图视图类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + MapType?: PlusMapsMapType; + /** + * 地图覆盖物基类对象 + * Overlay是地图上显示元素的基类,用于抽象地图元素,不用于实例化。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Overlay?: PlusMapsOverlay; + /** + * 地图上显示的标点对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Marker?: PlusMapsMarker; + /** + * 地图上显示的气泡对象 + * 此对象不能直接添加到地图上显示,只可关联到地图标点覆盖物上,用户点击标点时弹出显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Bubble?: PlusMapsBubble; + /** + * 地图上显示的圆圈对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Circle?: PlusMapsCircle; + /** + * 地图上显示的折线对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Polyline?: PlusMapsPolyline; + /** + * 地图上显示的多边形对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Polygon?: PlusMapsPolygon; + /** + * 地图检索对象 + * Search对象用于管理地图上的检索功能,包括位置检索、周边检索和范围检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Search?: PlusMapsSearch; + /** + * 检索策略类型 + * 在线路检索时设置检索策略时使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + SearchPolicy?: PlusMapsSearchPolicy; + /** + * 保存位置检索、周边检索和范围检索返回的结果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + SearchPoiResult?: PlusMapsSearchPoiResult; + /** + * 保存位置检索、周边检索和范围检索返回的结果 + * 不可通过new操作符创建SearchRouteResult对象,在触发onRouteSearchComplete()时自动创建。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + SearchRouteResult?: PlusMapsSearchRouteResult; + /** + * 检索结果的位置点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Position?: PlusMapsPosition; + /** + * 地图中的路线对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + Route?: PlusMapsRoute; + /** + * 调用系统第三方程序进行导航 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + openSysMap(dst?: PlusMapsPoint, des?: string, src?: PlusMapsPoint): void; + /** + * 创建Map对象 + * 调用此方法创建后并不会显示,需要调用Webview窗口的append方法将其添加到Webview窗口后才能显示。 + * 注意:此时需要通过styles参数的top/left/width/height属性设置控件的位置及大小。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + create(id?: string, styles?: PlusMapsMapStyles): PlusMapsMap; + /** + * 查找已经创建的Map对象 + * 调用此方法查找指定id的Map对象,如果不存在则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getMapById(id?: string): PlusMapsMap; +} + +/** + * 地图控件对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsMap { + /** + * 用户点击地图事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + onclick?: (result: PlusMapsPoint) => void; + /** + * 地图状态改变事件 + * 用户拖动、缩放地图等操作完成后触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + onstatuschanged?: (result: any) => void; + /** + * 静态方法,计算面积 + * 计算指定地理区域的面积,单位为平方米。 + * 注:此功能仅百度地图支持,高德地图暂不支持此功能。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + calculateArea(bounds?: PlusMapsBounds, successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 静态方法,计算距离 + * 计算从pointStart坐标点到pointEnd坐标的实际直线距离,单位为米(m)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + calculateDistance(pointStart?: PlusMapsPoint, pointEnd?: PlusMapsPoint, successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 静态方法,坐标转换 + * 将第三方坐标系坐标转换成当前地图的坐标系坐标。 + * 转换成功通过successCallback返回,转换失败则通过errorCallback返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + convertCoordinates(point?: PlusMapsPoint, options?: PlusMapsCoordinateConvertOptions, successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 静态方法,地理编码 + * 将地理位置信息转换为坐标点。 + * 转换成功通过successCallback返回,转换失败则通过errorCallback返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + geocode(address?: string, options?: PlusMapsGeocodeOptions, successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 静态方法,反向地理编码 + * 将坐标点转换为地理位置信息。 + * 转换成功通过successCallback返回,转换失败则通过errorCallback返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + reverseGeocode(point?: PlusMapsPoint, options?: PlusMapsGeocodeOptions, successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 向地图中添加覆盖物 + * 此方法用于向地图中添加覆盖物。 + * 支持各种从maps.Overlay对象继承的各种覆盖物对象; + * 如果添加不支持的对象则直接返回false; + * 同一覆盖物对象只能添加到地图中一次,已在地图中的覆盖物再次添加时则返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + addOverlay(overlay?: PlusMapsOverlay): boolean; + /** + * 设置地图初始中心点和缩放级别 + * 用于设置地图的初始中心点和缩放级别,通常在创建地图后立即调用。 + * 默认中心点为天安门,默认缩放级别为12; + * 该方法设置的中心点和缩放级别可通过reset()方法恢复; + * 如果在地图显示后调用将改变地图的中心点和缩放级别并立即更新,并将初始值更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + centerAndZoom(center?: PlusMapsPoint, zoom?: number): void; + /** + * 清除地图中所有覆盖物对象 + * 此方法用于清除地图中所有覆盖物对象。 + * 清除地图中的覆盖物对象后会自动更新地图视图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + clearOverlays(): void; + /** + * 关闭地图控件 + * 关闭地图控件将会销毁地图使用的资源,不可再使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + close(): void; + /** + * 获取当前地图可视范围的地理区域 + * 当旋转或俯视时,是当前地图可视范围的最大外接矩形地理区域。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getBounds(): PlusMapsBounds; + /** + * 获取地图中心点位置 + * 此方法用于获取设置的地图中心点位置(centerAndZoom/setCenter)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getCenter(): PlusMapsPoint; + /** + * 获取当前地图显示的地图中心点位置 + * 此方法用于获取当前地图显示的地图中心点位置,获取成功后通过callback回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getCurrentCenter(callback?: (result0: number, result1: PlusMapsPoint) => void): boolean; + /** + * 获取地图的显示类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getMapType(): PlusMapsMapType; + /** + * 获取用户的当前位置信息 + * 此方法用于获取用户的当前位置信息,获取成功后通过callback回调返回。 + * 获取用户当前位置信息将打开定位设备。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getUserLocation(callback?: (result0: number, result1: PlusMapsPoint) => void): boolean; + /** + * 获取地图的缩放级别 + * 此方法用于设置地图的缩放级别,用于切换当前显示地图缩放级别。 + * 该方法改变缩放级别后地图显示内容将立即更新; + * 该方法不会改变地图显示区域,以当前地图显示的中心点位置来缩放地图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getZoom(): number; + /** + * 隐藏地图控件 + * 此方法用于隐藏地图控件,通常在显示后调用此方法来隐藏。 + * 如果地图已经隐藏再调用此方法将无效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + hide(): void; + /** + * 获取是否显示用户位置 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + isShowUserLocation(): boolean; + /** + * 获取是否显示地图内置缩放控件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + isShowZoomControls(): boolean; + /** + * 获取是否打开地图交通信息图层 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + isTraffic(): boolean; + /** + * 从地图中删除覆盖物对象 + * 此方法用于从地图中删除覆盖物对象。 + * 支持各种从maps.Overlay对象继承的各种覆盖物对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + removeOverlay(overlay?: PlusMapsOverlay): void; + /** + * 重置地图 + * 此方法用于重新设置地图,恢复地图的初始化时的中心点和缩放级别。 + * 该方法将导致显示内容将立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + reset(): void; + /** + * 重设地图控件大小 + * 此方法用于重新计算地图控件大小,保持与构造时传入DOM元素的大小及位置一致。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + resize(): void; + /** + * 设置地图的中心点 + * 此方法用于设置地图的中心点,用于切换当前显示地图位置。 + * 该方法改变中心点后地图显示内容将立即更新; + * 该方法不会改变地图显示的缩放级别。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setCenter(center?: PlusMapsPoint): void; + /** + * 设置地图的视图类型 + * 此方法用于设置地图类型,默认为普通街道视图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setMapType(type?: PlusMapsMapType): void; + /** + * 设置地图控件的配置参数 + * 用于动态更新地图控件的参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setStyles(styles?: PlusMapsMapStyles): void; + /** + * 是否打开地图交通信息图层 + * 此方法用于设置是否打开地图交通信息图层,默认不显示。 + * 该方法改变是否显示交通图层后地图显示内容将立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setTraffic(traffic?: boolean): void; + /** + * 设置地图的缩放级别 + * 此方法用于设置地图的缩放级别,用于切换当前显示地图缩放级别。 + * 该方法改变缩放级别后地图显示内容将立即更新; + * 该方法不会改变地图显示区域,以当前地图显示的中心点位置来缩放地图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setZoom(zoom?: number): void; + /** + * 显示地图控件 + * 此方法用于显示地图控件,通常在隐藏后调用此方法来显示。 + * 如果地图已经显示再调用此方法将无效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + show(): void; + /** + * 显示用户位置 + * 此方法将在地图上显示用户位置信息。 + * 显示用户位置将打开定位设备。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + showUserLocation(display?: boolean): void; + /** + * 设置是否显示地图内置缩放控件 + * 此方法将在地图上显示内置缩放控件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + showZoomControls(display?: boolean): void; +} + +/** + * 地图控件对象的参数 + * 设置地图对象显示时使用的参数,如地图的中心位置、缩放级别等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsMapStyles { + /** + * 地图的中心位置 + * 未设置则使用地图的默认中心点(由地图供应商确定)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + center?: PlusMapsPoint; + /** + * 地图的缩放级别 + * 有效范围为1-22,默认值为12,设置无效的值则使用默认值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + zoom?: number; + /** + * 地图的视图类型 + * 可设置普通街道视图、卫星视图,默认值为普通街道视图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + type?: PlusMapsMapType; + /** + * 地图的是否显示交通信息 + * true表示显示地图的交通信息图层,false则不显示,默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + traffic?: boolean; + /** + * 是否显示地图的内置缩放控件 + * true表示显示地图的内置缩放控件,false则不显示,默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + zoomControls?: boolean; + /** + * 地图控件左上角的垂直偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度; + * 自动计算,如"auto",根据height值自动计算,相对于父Webview窗口垂直居中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + top?: string; + /** + * 地图控件左上角的水平偏移量 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度; + * 自动计算,如"auto",根据width值自动计算,相对于父Webview窗口水平居中。 + * 默认值为"0px"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + left?: string; + /** + * 地图控件的宽度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的宽度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + width?: string; + /** + * 地图控件的高度 + * 可取值: + * 像素值,如"100px"; + * 百分比,如"10%",相对于父Webview窗口的高度。 + * 默认值为"100%"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + height?: string; + /** + * 地图控件在Webview窗口的布局模式 + * 可取值: + * "static" - 静态布局模式,如果页面存在滚动条则随窗口内容滚动; + * "absolute" - 绝对布局模式,如果页面存在滚动条不随窗口内容滚动; + * 默认值为"static"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + position?: string; +} + +/** + * 地理编码转换的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsGeocodeOptions { + /** + * 源数据的坐标系类型 + * 仅在反向地理编码转换时生效。 + * “wgs84”:表示WGS-84坐标系; “gcj02”:表示国测局经纬度坐标系; “bd09”:表示百度墨卡托坐标系; “bd09ll”:表示百度经纬度坐标系; + * 默认使用wgs84坐标系。 + * - wgs84: WGS-84坐标系,即GPS设备采集的原始GPS坐标 + * - gcj02: 国测局经纬度坐标系,soso地图、aliyun地图、mapabc地图和amap地图所用的坐标系 + * - bd09: 百度墨卡托坐标系 + * - bd09ll: 百度经纬度坐标系 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + coordType?: 'wgs84' | 'gcj02' | 'bd09' | 'bd09ll'; + /** + * 源地址所属的城市 + * 仅在地理编码转换时生效,如果不指定则在全国范围内区配转换。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + city?: string; +} + +/** + * 地图坐标转换的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsCoordinateConvertOptions { + /** + * 源数据的坐标系类型 + * “wgs84”:表示WGS-84坐标系; “gcj02”:表示国测局经纬度坐标系; “bd09”:表示百度墨卡托坐标系; “bd09ll”:表示百度经纬度坐标系; + * 默认使用wgs84坐标系。 + * - wgs84: WGS-84坐标系,即GPS设备采集的原始GPS坐标 + * - gcj02: 国测局经纬度坐标系,soso地图、aliyun地图、mapabc地图和amap地图所用的坐标系 + * - bd09: 百度墨卡托坐标系 + * - bd09ll: 百度经纬度坐标系 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + coordType?: 'wgs84' | 'gcj02' | 'bd09' | 'bd09ll'; +} + +/** + * Point对象用于表示地图元素的坐标 + * 常用语对地图上元素进行定位时使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsPoint { + /** + * 设置坐标点的经度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setLng(lng?: number): void; + /** + * 获取坐标的经度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getLng(): number; + /** + * 设置坐标的纬度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setLat(): void; + /** + * 获取坐标的纬度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getLat(): number; + /** + * 判断两个坐标点是否相等 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + equals(pt?: PlusMapsPoint): boolean; +} + +/** + * 地理区域 + * 有西南及东北坐标点数据组成的矩形区域。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsBounds { + /** + * 设置地理区域的东北坐标点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setNorthEase(point?: PlusMapsPoint): void; + /** + * 地理区域的东北坐标点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getNorthEase(): PlusMapsPoint; + /** + * 设置地理区域的西南坐标点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setSouthWest(point?: PlusMapsPoint): void; + /** + * 地理区域的西南坐标点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getSouthWest(): PlusMapsPoint; + /** + * 判断制定的坐标是否在地理区域中 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + contains(point?: PlusMapsPoint): boolean; + /** + * 判断两个地理区域是否相等 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + equals(bounds?: PlusMapsBounds): boolean; + /** + * 获取地理区域的中心点坐标 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getCenter(): PlusMapsPoint; +} + +/** + * 地图视图类型 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsMapType { + /** + * 普通街道视图类型 + * 地图视图类型常量,普通街道视图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + MAPTYPE_NORMAL?: number; + /** + * 卫星视图 + * 地图视图类型常量,卫星视图。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + MAPTYPE_SATELLITE?: number; +} + +/** + * 地图覆盖物基类对象 + * Overlay是地图上显示元素的基类,用于抽象地图元素,不用于实例化。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsOverlay { + /** + * 判断地图覆盖物是否可见 + * 地图覆盖物对象默认为可见;地图覆盖物对象是否可见由其自身状态决定,不管其是否被添加到地图层中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + isVisible(): boolean; + /** + * 显示地图上的覆盖物 + * 常用于地图覆盖物在隐藏后调用此方法来显示。 + * 只有添加到地图上的覆盖物才能看到效果; + * 如果覆盖物对象已经在地图上显示再调用此方法将无效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + show(): void; + /** + * 隐藏地图上的覆盖物 + * 常用于地图覆盖物在显示后调用此方法来隐藏。 + * 只有添加到地图上的覆盖物才能看到效果; + * 如果覆盖物对象已经在地图上隐藏再调用此方法将无效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + hide(): void; +} + +/** + * 地图上显示的标点对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsMarker { + /** + * 用户点击地图标点事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + onclick?: (result: PlusMapsOverlay) => void; + /** + * 用户拖拽标点事件 + * 可调用标点对象的markObj.setDraggable(true)方法设置标点允许拖拽,当用户拖拽标点对象时触发此事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + onDrag?: (result: any) => void; + /** + * 覆盖物显示到最上层 + * 常用于覆盖物相互覆盖时调整覆盖物的显示顺序。 + * 只有添加到地图上的覆盖物才能看到效果; + * 如果覆盖物对象已经在地图上隐藏再调用此方法将无效果。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + bringToTop(): void; + /** + * 设置标点对象的坐标 + * 标点在设置新坐标后将在地图上立即更新标点位置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setPoint(point?: PlusMapsPoint): void; + /** + * 获取标点的坐标 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getPoint(): PlusMapsPoint; + /** + * 设置标点上显示的图标 + * 若未设置则显示默认标点图标,已添加的标点在设置新值后将在地图上立即更新标点内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setIcon(icon?: string): void; + /** + * 设置标点上显示的图标数组 + * 设置图标数组后则按照指定的间隔时间轮播数组中图标。 + * 设置图标数组后将忽略setIcon方法设置的图标,未设置则显示setIcon设置的图标。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setIcons(icons?: any []): void; + /** + * 设置标点上显示的文本标注 + * 若未设置则不显示标注(默认为空字符串),已添加的标点在设置新值后将在地图上立即更新标点内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setLabel(label?: string): void; + /** + * 获取标点上显示的文本标注 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getLabel(): string; + /** + * 设置标点的气泡内容 + * 设置气泡内容后,用户点击标点时弹出则弹出气泡。 + * 注意:用户点击标点时先弹出标点关联的气泡,再响应标点的onclick事件。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setBubble(buuble?: PlusMapsBubble, pop?: boolean): void; + /** + * 获取标点上显示的文本标注 + * 如果没有设置关联的气泡对象则返回null。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getBubble(): PlusMapsBubble; + /** + * 隐藏标点上显示的气泡 + * 如果没有设置关联的气泡对象或者气泡对象没有弹出显示,则不做任何操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + hideBubble(): void; + /** + * 设置标点的是否允许拖拽 + * 设置标点可拖拽后,用户按住标点后拖动,标点会跟随手的拖拽而移动。 + * 拖拽后会更新标点的坐标信息。 + * 注:拖动前需要先在标点上长按。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setDraggable(draggable?: boolean): void; + /** + * 获取标点是否允许拖拽 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + isDraggable(): boolean; +} + +/** + * 地图上显示的气泡对象 + * 此对象不能直接添加到地图上显示,只可关联到地图标点覆盖物上,用户点击标点时弹出显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsBubble { + /** + * 用户点击气泡事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + onclick?: (result: PlusMapsOverlay) => void; + /** + * 设置气泡上显示的图标 + * 若为设置则无默认图标,已添加的显示的气泡在设置新值后将在地图上立即更新内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setIcon(icon?: string): void; + /** + * 设置气泡上显示的文字内容 + * 若未设置则不显示文字(默认为空字符串),已添加的显示的气泡在设置新值后将在地图上立即更新内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setLabel(label?: string): void; + /** + * 获取气泡上显示的文字内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getLabel(): string; + /** + * 获取气泡所属的标点对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + belongMarker(): PlusMapsMarker; + /** + * 从图片加载气泡显示的内容 + * 通过加载图片来自定义气泡显示的内容,加载图片后将清空气泡使用的图标及文字内容。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + loadImage(path?: string): void; + /** + * 从图片数据加载气泡显示的内容 + * 通过加载图片数据来自定义气泡显示的内容,加载图片后将清空气泡使用的图标及文字内容。 + * 图片数据可通过Canvas自定义绘制后调用toDataURL来获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + loadImageDataURL(data?: string): void; +} + +/** + * 地图上显示的圆圈对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsCircle { + /** + * 设置圆圈中心点的经纬度坐标 + * 该方法设置将导致地图中的圆圈立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setCenter(point?: PlusMapsPoint): void; + /** + * 获取圆圈中心点的坐标 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getCenter(): PlusMapsPoint; + /** + * 设置圆圈的半径,单位为米 + * 该方法设置将导致地图中的圆圈立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setRadius(radius?: number): void; + /** + * 获取圆圈的半径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getRadius(): number; + /** + * 设置圆圈的边框颜色 + * 圆圈默认的圆圈边框颜色为黑色"#000000",该方法设置将导致地图中的圆圈立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setStrokeColor(color?: string): void; + /** + * 获取圆圈的边框颜色 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getStrokeColor(): string; + /** + * 设置圆圈的边框颜色 + * 圆圈默认值为不透明。 + * 如果设置的值不合法则保持原有的透明度;该方法设置将导致地图中的圆圈立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setStrokeOpacity(opacity?: number): void; + /** + * 获取圆圈边框的透明度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getStrokeOpacity(): number; + /** + * 设置圆圈的填充颜色 + * 圆圈默认的圆圈填充颜色为无色,该方法设置将导致地图中的圆圈立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setFillColor(color?: string): void; + /** + * 获取圆圈的填充颜色 + * 如果填充颜色为无色,则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getFillColor(): string; + /** + * 设置圆圈填充颜色的透明度 + * 圆圈默认值为不透明。 + * 如果设置的值不合法则保持原有的透明度;该方法设置将导致地图中的圆圈立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setFillOpacity(opacity?: number): void; + /** + * 获取圆圈填充色的透明度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getFillOpacity(): number; + /** + * 设置圆圈边框的线条宽度 + * 圆圈边框的默认值为5。 + * 如果设置的值不合法则保持原有的宽度;该方法设置将导致地图中的圆圈立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setLineWidth(width?: number): void; + /** + * 获取圆圈边框的线条宽度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getLineWidth(): number; +} + +/** + * 地图上显示的折线对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsPolyline { + /** + * 设置折线的顶点坐标 + * 该方法设置将导致地图中的折线立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setPath(points?: any []): void; + /** + * 获取折线的顶点坐标 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getPath(): any []; + /** + * 设置折线的颜色 + * 折线默认的颜色为黑色"#000000",该方法设置将导致地图中的折线立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setStrokeColor(color?: string): void; + /** + * 获取折线的颜色 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getStrokeColor(): string; + /** + * 设设置折线的透明度 + * 折线默认值为不透明。 + * 如果设置的值不合法则保持原有的透明度;该方法设置将导致地图中的折线立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setStrokeOpacity(opacity?: number): void; + /** + * 获取折线的透明度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getStrokeOpacity(): number; + /** + * 设置折线的线条宽度 + * 折线线条的宽度默认值为5。 + * 如果设置的值不合法则保持原有的宽度;该方法设置将导致地图中的折线立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setLineWidth(width?: number): void; + /** + * 获取折线的线条宽度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getLineWidth(): number; +} + +/** + * 地图上显示的多边形对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsPolygon { + /** + * 设置多边形的顶点坐标 + * 该方法设置将导致地图中的多边形立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setPath(points?: any []): void; + /** + * 获取多边形的顶点坐标 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getPath(): any []; + /** + * 设置多边形的颜色 + * 多边形边框默认的颜色为黑色"#000000",该方法设置将导致地图中的多边形立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setStrokeColor(color?: string): void; + /** + * 获取多边形边框的颜色 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getStrokeColor(): string; + /** + * 设置多边形的透明度 + * 多边形边框默认值为不透明。 + * 如果设置的值不合法则保持原有的透明度;该方法设置将导致地图中的多边形立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setStrokeOpacity(opacity?: number): void; + /** + * 获取多边形边框的透明度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getStrokeOpacity(): number; + /** + * 设置多边形的填充颜色 + * 多边形默认填充颜色为无色,该方法设置将导致地图中的多边形立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setFillColor(color?: string): void; + /** + * 获取多边形的填充色 + * 如果填充色为无色,则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getFillColor(): string; + /** + * 设置多边形填充色的透明度 + * 多边形填充色默认值为不透明。 + * 如果设置的值不合法则保持原有的透明度;该方法设置将导致地图中的多边形立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setFillOpacity(opacity?: number): void; + /** + * 获取多边形填充色的透明度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getFillOpacity(): number; + /** + * 设置多边形的边框宽度 + * 多边形边框的宽度默认值为5。 + * 如果设置的值不合法则保持原有的宽度;该方法设置将导致地图中的多边形立即更新。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setLineWidth(width?: number): void; + /** + * 获取多边形边框的宽度 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getLineWidth(): number; +} + +/** + * 地图检索对象 + * Search对象用于管理地图上的检索功能,包括位置检索、周边检索和范围检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsSearch { + /** + * 兴趣点检索完成事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + onPoiSearchComplete?: (result0: number, result1: PlusMapsSearchPoiResult) => void; + /** + * 线路检索完成事件 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + onRouteSearchComplete?: (result0: number, result1: PlusMapsSearchRouteResult) => void; + /** + * 设置检索返回结果每页的信息数目 + * 地图检索结果是按页返回的,默认检索每页返回10条信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setPageCapacity(capacity?: number): void; + /** + * 获取检索返回结果每页的信息数目 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getPageCapacity(): number; + /** + * 城市兴趣点检索 + * 检索结果将通过onPoiSearchComplete事件返回。 + * 如果调用此方法时已经处于POI检索操作中,则终止上次检索操作,重新开始新的检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + poiSearchInCity(city?: string, key?: string, index?: number): boolean; + /** + * 周边检索 + * 周边检索根据中心点、半径与检索词进行检索,检索完成后触发onPoiSearchComplete()事件。 + * 若调用此方法时对象处于POI检索操作中,则终止上次检索操作,重新开始新的检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + poiSearchNearBy(key?: string, pt?: PlusMapsPoint, radius?: number, index?: number): boolean; + /** + * 指定范围检索 + * 根据范围和检索词进行检索,检索完成后触发onPoiSearchComplete()事件。 + * 若调用此方法时对象处于POI检索操作中,则终止上次检索操作,重新开始新的检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + poiSearchInbounds(): boolean; + /** + * 设置公交路线检索策略 + * 默认采用maps.SearchPolicy.TRANSIT_TIME_FIRST策略。 + * 需在调用transitSearch()方法前设置的策略才生效; + * 如果设置非法值则认为设置失败,采用上次设置的检索策略并返回false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setTransitPolicy(policy?: PlusMapsSearchPolicy): boolean; + /** + * 公交路线检索 + * 检索完成后触发onRouteSearchComplete()事件。 + * 若调用此方法时对象处于检索操作中,则终止上次检索操作,重新开始新的检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + transitSearch(start?: string, end?: string, city?: string): boolean; + /** + * 设置驾车路线检索策略 + * 设置驾车路线检索策略,默认采用maps.SearchPolicy.DRIVING_TIME_FIRST策略。 + * 如果设置非法值则认为设置失败,采用上次设置的检索策略并返回false;需在调用drivingSearch()方法前设置的策略才生效。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + setDrivingPolicy(policy?: PlusMapsSearchPolicy): boolean; + /** + * 驾车路线检索 + * 用于驾车路线检索,检索完成后触发onRouteSearchComplete()事件。 + * 调用此方法时对象处于检索操作中,则终止上次检索操作,重新开始新的检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + drivingSearch(start?: string, startCity?: string, end?: string, endCity?: string): boolean; + /** + * 步行路线检索 + * 用于步行路线检索,检索完成后触发onRouteSearchComplete()事件。 + * 调用此方法时对象处于检索操作中,则终止上次检索操作,重新开始新的检索。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + walkingSearch(start?: string, startCity?: string, end?: string, endCity?: string): boolean; +} + +/** + * 检索策略类型 + * 在线路检索时设置检索策略时使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsSearchPolicy { + /** + * 时间优先 + * 检索策略类型常量,用于公交检索策略 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + TRANSIT_TIME_FIRST?: number; + /** + * 最少换乘优先 + * 检索策略类型常量,用于公交检索策略 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + TRANSIT_TRANSFER_FIRST?: number; + /** + * 最少步行距离优先 + * 检索策略类型常量,用于公交检索策略 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + TRANSIT_WALK_FIRST?: number; + /** + * 选择车票花销最少优先 + * 检索策略类型常量,用于公交检索策略 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + TRANSIT_FEE_FIRST?: number; + /** + * 最短距离优先 + * 检索策略类型常量,用于驾车检索策略 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + DRIVING_DIS_FIRST?: number; + /** + * 无高速公路线路 + * 检索策略类型常量,用于驾车检索策略 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + DRIVING_NO_EXPRESSWAY?: number; + /** + * 最少费用优先 + * 检索策略类型常量,用于驾车检索策略 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + DRIVING_FEE_FIRST?: number; +} + +/** + * 保存位置检索、周边检索和范围检索返回的结果 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsSearchPoiResult { + /** + * POI检索总结果数 + * POI检索总结果数,若没有检索到则返回0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + totalNumber?: number; + /** + * 当前页的POI检索结果数 + * 当前页POI检索结果数,若没有检索到则返回0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + currentNumber?: number; + /** + * 本次POI检索的总页数 + * 本次POI检索的总页数,若没有检索到则返回0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + pageNumber?: number; + /** + * 获取当前页的索引 + * 当前页的索引值,从0开始,即0表示第一页。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + pageIndex?: number; + /** + * 本次POI检索结果数组 + * POI检索结果数组,Array数组对象,数组内容为Position对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + poiList?: any []; + /** + * 获取指定索引的检索结果 + * 如果index值超出范围则返回null对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getPosition(): PlusMapsPosition; +} + +/** + * 保存位置检索、周边检索和范围检索返回的结果 + * 不可通过new操作符创建SearchRouteResult对象,在触发onRouteSearchComplete()时自动创建。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsSearchRouteResult { + /** + * 线路的起点位置 + * 线路检索结果的起始位置点对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + startPosition?: PlusMapsPosition; + /** + * 线路的终点位置 + * 线路检索结果的终点位置点对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + endPosition?: PlusMapsPosition; + /** + * 本次线路检索的总方案数 + * 线路检索结果的方案数目,若未检索到有效结果则返回0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + routeNumber?: number; + /** + * 线路检索结果数组 + * 线路检索结果数组,Array数组对象,数组内容为Route对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + routeList?: any []; + /** + * 获取指定索引的线路方案 + * 如果index值超出范围则返回null对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + getRoute(index?: number): PlusMapsRoute; +} + +/** + * 检索结果的位置点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsPosition { + /** + * 位置点的经纬度坐标 + * 如果没有经纬度坐标信息(如果公交、地铁路线数据等),则其值为undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + point?: PlusMapsPoint; + /** + * 位置点的地址信息 + * 如果没有位置点的地址信息则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + address?: string; + /** + * 位置点的所属城市信息 + * 如果没有位置点的所属城市信息则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + city?: string; + /** + * 位置点的名称 + * 如果没有位置点的名称则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + name?: string; + /** + * 位置点的电话信息 + * 如果没有位置点的电话信息则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + phone?: string; + /** + * 位置点的邮编信息 + * 如果没有位置点的邮编信息则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + postcode?: string; +} + +/** + * 地图中的路线对象 + * 从Overlay对象继承而来,可通过Map对象的addOverlay()方法将对象添加地图中。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ +interface PlusMapsRoute { + /** + * 路线起点地理坐标点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + startPoint?: PlusMapsPoint; + /** + * 路线终点地理坐标点 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + endPoint?: PlusMapsPoint; + /** + * 路线坐标点段数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + pointCount?: PlusMapsPoint; + /** + * 路线的地理坐标点数组 + * 路线的地理坐标点数组,数组中保存Point对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + pointList?: any []; + /** + * 路线总距离 + * 路线从起始点到终点的距离,单位为米。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + distance?: number; + /** + * 线路的提示信息 + * 线路提示信息,没有提示信息则返回空字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/maps.html](http://www.html5plus.org/doc/zh_cn/maps.html) + */ + routeTip?: string; +} + +/** + * OAuth模块管理客户端的用户登录授权验证功能,允许应用访问第三方平台的资源。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ +interface PlusOauth { + /** + * 登录授权认证服务对象 + * AuthService对象用于表示登录授权认证服务,在JS中为对象,用于向系统进行登录授权认证操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + AuthService?: PlusOauthAuthService; + /** + * JSON对象,授权认证参数选项 + * 此对象支持的属性值由登录授权认证服务定义。 + * 例如“微信”,则可配置以下参数: + * scope - 应用授权作用域; + * state - 用于保持请求和回调的状态参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + AuthOptions?: PlusOauthAuthOptions; + /** + * 登录授权认证信息 + * 此对象仅定义标准属性,登录授权认证服务可扩展自定义数据。 + * 例如“微信”登录授权服务,则包括以下数据: + * unionid - 用户统一标识,针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + AuthInfo?: PlusOauthAuthInfo; + /** + * 登录授权用户信息 + * 用于保存登录授权用户的信息。 + * 此对象仅定义标准属性,登录授权认证服务可扩展自定义数据。 + * 例如“微信”登录授权服务,可能包括以下自定义数据: + * privilege - 用户特权信息,json数组,如微信沃卡用户为(chinaunicom); + * unionid - 用户统一标识,针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + UserInfo?: PlusOauthUserInfo; + /** + * 获取登录授权认证服务列表 + * 获取终端支持的权登录认证服务列表,可用于提示用户进行登录平台的选择。获取登录授权认证服务成功后通过successCB回调返回支持的所有服务列表,获取服务失败则通过errorCB回调返回失败信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + getServices(successCB?: (result: PlusOauth []) => void, errorCB?: (result: any) => void): void; +} + +/** + * 登录授权认证服务对象 + * AuthService对象用于表示登录授权认证服务,在JS中为对象,用于向系统进行登录授权认证操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ +interface PlusOauthAuthService { + /** + * 登录授权认证服务标识 + * 用于表示登录授权认证服务标识: + * "weixin" - 表示微信登录授权; + * "qq" - 表示QQ登录授权; + * "sinaweibo" - 表示新浪微博登录授权; + * "qihoo" - 表示360账号登录(仅360手助流应用环境下支持)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + id?: string; + /** + * 登录授权认证服务描述 + * 用于描述登录授权认证服务的信息: + * "微信" - 表示微信登录授权; + * "QQ" - 表示QQ登录授权; + * "新浪微博" - 表示新浪微博登录授权; + * "360账号" - 表示360账号登录(仅360手助流应用环境下支持)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + description?: string; + /** + * 授权认证结果数据 + * 用于保存登录授权认证获取的认证信息,如果值为"undefined"则表示未进行授权认证或者是授权认证失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + authResult?: PlusOauthAuthInfo; + /** + * 登录授权认证用户信息 + * 用于保存登录授权认证获取的用户信息,如果值为"undefined"则表示未获取过用户信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + userInfo?: PlusOauthUserInfo; + /** + * 登录授权认证扩展信息 + * 用于保存登录授权认证服务返回的扩展信息,具体内容由各登录平台决定,如果没有扩展信息则为undefined。 + * 例如“微信”,则可保存以下数据: + * state - 用于保持请求和回调的状态参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + extra?: any; + /** + * 请求授权认证 + * 向开放平台请求进行授权认证,需提供授权域(scope),用户在终端确认后通过成功回调返回授权临时票据(code)。 + * 开发者可以将授权临时票据(code)提交到业务服务器,又业务服务器从微信开放平台获取授权登录等相关信息,避免将appsecret等信息保存在客户端可能引起泄露的问题。 + * 注意:目前仅微信平台支持请求授权认证,其它平台调用此方法将返回错误回调。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + authorize(successCallback?: (result: any) => void, errorCallback?: (result: any) => void, options?: PlusOauthAuthOptions): void; + /** + * 请求登录授权认证操作 + * 对指定的登录授权认证服务进行登录认证操作,在登录前可通过对象的authResult属性判断是否已经登录认证过,通常只需要对没有进行过登录认证的服务进行登录认证操作。 + * 授权认证操作成功后通过successCB回调函数通知,失败则通过errorCB回调函数通知。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + login(successCallback?: (result: any) => void, errorCallback?: (result: any) => void, options?: PlusOauthAuthOptions): void; + /** + * 注销登录授权认证 + * 对指定的登录授权认证服务注销登录认证操作,注销授权认证后,再次操作时需重新进行登录认证操作。 + * 如果第三方平台不需要注销操作,则情况保存的相关登录认证等信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + logout(successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 获取登录授权用户信息 + * 获取登录授权认证的用户信息,在获取前可通过对象的userInfo属性判断是否已经获取过,通常只需要对没有获取过用户信息的服务进行操作。 + * 获取用户信息操作成功后通过successCallback回调函数通知,失败则通过errorCallback回调函数通知。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + getUserInfo(successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; + /** + * 添加用户手机号信息 + * 打开登录授权服务的添加用户手机号界面进行操作,添加用户手机号操作成功后通过successCallback回调函数通知,否则通过errorCallback回调函数通知。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + addPhoneNumber(successCallback?: (result: any) => void, errorCallback?: (result: any) => void): void; +} + +/** + * JSON对象,授权认证参数选项 + * 此对象支持的属性值由登录授权认证服务定义。 + * 例如“微信”,则可配置以下参数: + * scope - 应用授权作用域; + * state - 用于保持请求和回调的状态参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ +interface PlusOauthAuthOptions { + /** + * 申请的权限作用范围 + * 如果存在多个权限,则以","符号分割。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + scope?: string; + /** + * 客户端的当前状态,可以指定任意值,登录认证后原封不动的返回保存到AuthService对象的extra中 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + state?: string; + /** + * 登录授权认证服务平台申请的appid + * 动态设置登录授权服务中需要使用的appid,仅需要此参数的登录授权服务(如“微信登录”、“QQ登录”)支持。 + * 如果未设置则使用运行环境中内置的appid值(如在HBuilder中可在manifest.json的SDK配置项中进行设置)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + appid?: string; + /** + * 登录授权认证服务平台申请的appkey + * 动态设置登录授权服务中需要使用的appkey,仅需要此参数的登录授权服务(如“新浪微博登录”、“360登录”)支持。 + * 如果未设置则使用运行环境中内置的appkey值(如在HBuilder中可在manifest.json的SDK配置项中进行设置)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + appkey?: string; + /** + * 登录授权认证服务平台申请的appsecret + * 动态设置登录授权服务中需要使用的appsecret,仅需要此参数的登录授权服务(如“微信登录”、“新浪微博登录”)支持。 + * 如果未设置则使用运行环境中内置的appkey值(如在HBuilder中可在manifest.json的SDK配置项中进行设置);当开放平台申请的appsecret值涉及到安全问题时,可在应用运行时从服务器获取,然后通过此api动态设置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + appsecret?: string; + /** + * 登录授权认证服务平台申请的redirect_url + * 动态设置登录授权服务中需要使用的redirect_url,仅需要此参数的登录授权服务(如“新浪微博登录”)支持。 + * 如果未设置则使用运行环境中内置的redirect_url值(如在HBuilder中可在manifest.json的SDK配置项中进行设置)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + redirect_url?: string; +} + +/** + * 登录授权认证信息 + * 此对象仅定义标准属性,登录授权认证服务可扩展自定义数据。 + * 例如“微信”登录授权服务,则包括以下数据: + * unionid - 用户统一标识,针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ +interface PlusOauthAuthInfo { + /** + * 登录授权的访问令牌 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + access_token?: string; + /** + * 登录授权用户的唯一标识 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + openid?: string; + /** + * 登录授权访问令牌过期时间 + * 单位为秒,如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + expires_in?: string; + /** + * 登录授权的更新令牌 + * 用来获取下一次的访问令牌,如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + refresh_token?: string; + /** + * 登录授权的权限范围 + * 如果存在多个权限,则以","符号分割。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + scope?: string; +} + +/** + * 登录授权用户信息 + * 用于保存登录授权用户的信息。 + * 此对象仅定义标准属性,登录授权认证服务可扩展自定义数据。 + * 例如“微信”登录授权服务,可能包括以下自定义数据: + * privilege - 用户特权信息,json数组,如微信沃卡用户为(chinaunicom); + * unionid - 用户统一标识,针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ +interface PlusOauthUserInfo { + /** + * 登录授权用户的唯一标识 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + openid?: string; + /** + * 登录授权用户的头像图片地址 + * 要求为"http://"或"https://"开头的地址,如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + headimgurl?: string; + /** + * 登录授权用户的昵称 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + nickname?: string; + /** + * 登录授权用户的邮箱地址 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + email?: string; + /** + * 登录授权用户的电话号码 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + phonenumber?: string; + /** + * 登录授权用户的性别 + * 1为男性,2为女性。 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + sex?: string; + /** + * 登录授权用户注册的省份信息 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + province?: string; + /** + * 登录授权用户注册的城市信息 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + city?: string; + /** + * 登录授权用户注册的国家信息 + * 如果登录授权服务不支持此属性,则返回"undefined"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/oauth.html](http://www.html5plus.org/doc/zh_cn/oauth.html) + */ + country?: string; +} + +/** + * Payment模块管理支付功能,用于提供网页安全支付能力,支持通过Web接口进行支付操作。通过plus.payment可获取支付管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ +interface PlusPayment { + /** + * 支付通道对象 + * PaymentChannel对象表示特定的支付通道,用于向系统请求支付操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + PaymentChannel?: PlusPaymentPaymentChannel; + /** + * IAP订单数据对象 + * 描述IAP商品订单信息,如标识、数量等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + OrderStatementIAP?: PlusPaymentOrderStatementIAP; + /** + * 支付操作结果对象 + * PaymentResult对象表示支付操作返回结果,用于确认支付操作成功。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + PaymentResult?: PlusPaymentPaymentResult; + /** + * IAP商品对象 + * 描述IAP商品详细信息,如标识、价格、标题、描述信息等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + IAPProduct?: PlusPaymentIAPProduct; + /** + * 购买IAP商品对象 + * 描述购买的IAP商品详细信息,如标识、数量等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + IAPProductInfo?: PlusPaymentIAPProductInfo; + /** + * 购买IAP商品交易信息对象 + * 描述购买的IAP商品交易详细信息,如购买商品信息、交易日期、订单标识等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + IAPTransaction?: PlusPaymentIAPTransaction; + /** + * 获取支付通道 + * 在进行支付操作前需获取终端支持的支付通道列表,用于提示用户进行选择。 + * 获取支付通道成功后通过successCB回调返回支持的所有通道列表,获取支付通道列表失败则通过errorCB回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + getChannels(successCB?: (result: PlusPayment []) => void, errorCB?: (result: any) => void): void; + /** + * 请求支付操作 + * 调用指定的支付通道进行支付操作,其中statement包含支付操作的相关信息,支付模块将弹出支付界面供用户进行支付信息的输入确认操作。 + * 用户支付操作成功后通过successCB回调返回支付操作结果,支付操作失败则通过errorCB回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + request(channel?: PlusPaymentPaymentChannel, statement?: string, successCB?: (result: PlusPaymentPaymentResult) => void, errorCB?: (result: any) => void): void; +} + +/** + * 支付通道对象 + * PaymentChannel对象表示特定的支付通道,用于向系统请求支付操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ +interface PlusPaymentPaymentChannel { + /** + * 支付通道标识 + * 用于标识支付通道: + * "alipay" - 表示支付宝; + * "wxpay" - 表示微信支付; + * "appleiap" - 表示苹果应用内支付; + * "qhpay" - 表示360聚合支付(仅360手助流应用环境下支持)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + id?: string; + /** + * 支付通道描述 + * 支付通道的描述信息,如“支付宝”、“微信”、“In-App Purchase”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + description?: string; + /** + * 支付通道服务是否安装 + * 通常特定的支付通道依赖系统安装相关的服务,此属性用于标识其服务是否安装,如果没有安装则为false,否则为true。 + * 若系统环境中没有安装相关的服务,则可能导致调用支付操作失败,这时可以调用installService方法进行安装。 + * 注意:如果支付通道不需要依赖系统安装服务,则永远返回true。例如支付宝,如果设备上未安装支付宝客户端则调用Wap页面进行支付,因此值固定返回true; + * 而微信支付则依赖微信客户端,如果设备上未安装微信客户端则serviceReady值为false,此时应该提示用户安装微信客户端才能进行支付操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + serviceReady?: boolean; + /** + * 安装支付通道依赖的服务 + * 对于某些支付通道,通常特定的支付通道依赖系统安装相关的服务,调用此方法将安装其依赖的支付服务。 + * 如支付宝,则在系统中安装支付宝客户端程序。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + installService(): void; + /** + * 向IAP服务器请求支付订单 + * IAP支付在调用plus.payment.request方法支付前须先向服务器请求获取商品的详细信息,否则会支付失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + requestOrder(ids?: any [], successCB?: (result: PlusPayment []) => void, errorCB?: (result: any) => void): void; + /** + * 向IAP服务器请求已经购买的非消耗性商品和订阅商品 + * 注意:不能获取已购买的消耗性商品。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + restoreComplateRequest(options?: any, successCB?: (result: PlusPayment []) => void): void; +} + +/** + * IAP订单数据对象 + * 描述IAP商品订单信息,如标识、数量等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ +interface PlusPaymentOrderStatementIAP { + /** + * 商品的标识 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + productid?: string; + /** + * 购买用户名称 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + username?: string; + /** + * 商品数量 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + quantity?: string; +} + +/** + * 支付操作结果对象 + * PaymentResult对象表示支付操作返回结果,用于确认支付操作成功。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ +interface PlusPaymentPaymentResult { + /** + * 支付通道对象 + * 用于发起支付操作的支付通道对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + channel?: PlusPaymentPaymentChannel; + /** + * 交易编号信息 + * 如果支付平台不支持此数据则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + tradeno?: string; + /** + * 交易描述信息 + * 如果支付平台不支持此数据则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + description?: boolean; + /** + * 查找支付交易信息地址 + * 用于向支付平台查询交易信息,如果支付平台不支持此数据则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + url?: boolean; + /** + * 支付操作指纹信息 + * 用于向支付平台查询支付订单信息,如果支付平台不支持此数据则返回undefined。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + signature?: string; + /** + * 支付平台返回的原始数据 + * 如果支付平台返回key-value类型字符串,则组合成符合JSON格式的字符串。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + rawdata?: string; +} + +/** + * IAP商品对象 + * 描述IAP商品详细信息,如标识、价格、标题、描述信息等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ +interface PlusPaymentIAPProduct { + /** + * 商品的标识 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + productid?: string; + /** + * 商品的价格 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + price?: string; + /** + * 商品标题 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + title?: string; + /** + * 商品的描述信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + description?: string; +} + +/** + * 购买IAP商品对象 + * 描述购买的IAP商品详细信息,如标识、数量等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ +interface PlusPaymentIAPProductInfo { + /** + * 商品的标识 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + productIdentifier?: string; + /** + * 商品的数量 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + quantity?: string; +} + +/** + * 购买IAP商品交易信息对象 + * 描述购买的IAP商品交易详细信息,如购买商品信息、交易日期、订单标识等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ +interface PlusPaymentIAPTransaction { + /** + * 购买商品的信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + payment?: string; + /** + * 购买商品的交易日期 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + transactionDate?: string; + /** + * 购买商品的交易订单标识 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + transactionIdentifier?: string; + /** + * 购买商品的交易收据 + * base64编码格式字符串数据。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + transactionReceipt?: string; + /** + * 购买商品的交易状态 + * 可取值:"1"为支付成功;"2"为支付失败;"3"为支付已恢复。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/payment.html](http://www.html5plus.org/doc/zh_cn/payment.html) + */ + transactionState?: string; +} + +/** + * Push模块管理推送消息功能,可以实现在线、离线的消息推送,通过plus.push可获取推送消息管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ +interface PlusPush { + /** + * JSON对象,获取的客户端标识信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + ClientInfo?: PlusPushClientInfo; + /** + * JSON对象,推送消息对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + PushMessage?: PlusPushPushMessage; + /** + * JSON对象,获客户端创建本地消息的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + MessageOptions?: PlusPushMessageOptions; + /** + * 添加推送消息事件监听器 + * 添加推送消息事件监听器,当指定推送事件发出时触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + addEventListener(type?: string, listener?: (result: string) => void, capture?: boolean): void; + /** + * 清空所有推送消息 + * 清空系统消息中心所有的推送消息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + clear(): void; + /** + * 创建本地消息 + * 在本地直接创建推送消息,并添加到系统消息中心。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + createMessage(content?: string, payload?: string, options?: PlusPushMessageOptions): void; + /** + * 获取所有推送消息 + * 获取客户端接收到的所有推送消息。 + * 仅包括在系统消息中心显示的推送消息,不包括调用setAutoNotification(false)方法设置不显示推送消息后接收到的消息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + getAllMessage(): PlusPushPushMessage; + /** + * 获取客户端推送标识信息 + * 客户端标识信息用于业务服务器下发推送消息时提交给推送服务器的数据,用于说明下发推送消息的接收者(客户端)。需要客户端在第一次运行时提交到业务服务器保存。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + getClientInfo(): PlusPushClientInfo; + /** + * 设置程序是否将消息显示在系统消息中心 + * 默认情况下程序在接收到推送消息后将会在系统消息中心显示,通过此方法可关闭默认行为,接收到推送消息后不在系统消息中心显示,通过addEventListener方法的“receive”事件监听处理接收到的消息。 + * 在这种模式下可通过createMessage方法创建在系统消息中心显示的消息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + setAutoNotification(notify?: boolean): void; + /** + * 删除推送消息 + * 删除系统消息中心指定的推送消息,可通过getAllMessage方法获取所有的消息后进行操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + remove(message?: PlusPushPushMessage): void; +} + +/** + * JSON对象,获取的客户端标识信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ +interface PlusPushClientInfo { + /** + * 设备令牌(iOS设备唯一标识),用于APNS服务推送中标识设备的身份 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + token?: string; + /** + * 推送服务令牌(设备唯一标识),用于标识推送信息接收者身份 + * 第三方推送服务器管理的设备唯一标识,在iOS平台此值通常与token不同;在其它平台此值通常与token值一致。 + * 此值与设备及应用都相关,即不同的apk/ipa安装到同一台设备上的值都不相同。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + clientid?: string; + /** + * 第三方推送服务的应用标识 + * 第三方推送服务器管理的应用标识,通常需要在第三方推送服务器平台进行注册获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + appid?: string; + /** + * 第三方推送服务器的应用键值 + * 第三方推送服务器管理的应用键值,通常需要在第三方推送服务器平台进行注册获取。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + appkey?: string; +} + +/** + * JSON对象,推送消息对象 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ +interface PlusPushPushMessage { + /** + * 推送消息显示的标题 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + title?: string; + /** + * 推送消息显示的内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + content?: string; + /** + * 推送消息承载的数据 + * 如果推送消息中传输的数据不符合JSON格式,则作为String类型数据保存。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + payload?: any; + /** + * Apple APNS推送协议数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + aps?: any; +} + +/** + * JSON对象,获客户端创建本地消息的参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ +interface PlusPushMessageOptions { + /** + * 要启动流应用的appid + * 默认值为当前流应用的appid。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + appid?: string; + /** + * 是否覆盖上一次提示的消息 + * 可取值true或false,true为覆盖,false不覆盖,默认为permission中设置的cover值。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + cover?: boolean; + /** + * 提示消息延迟显示的时间 + * 当设备接收到推送消息后,可不立即显示,而是延迟一段时间显示,延迟时间单位为s,默认为0s,立即显示。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + delay?: number; + /** + * 推送消息的图标 + * 本地图片地址,相对路径 - 相对于当前页面的host位置,如"a.jpg",注意当前页面为网络地址则不支持; 绝对路径 - 系统绝对路径,如Android平台"/sdcard/logo.png",此类路径通常通过其它5+ API获取的; 扩展相对路径URL(RelativeURL) - 以"_"开头的相对路径,如"_www/a.jpg"; 本地路径URL - 以“file://”开头,后面跟随系统绝对路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + icon?: string; + /** + * 推送消息的提示音 + * 显示消息时的播放的提示音,可取值: + * “system”-表示使用系统通知提示音; + * “none”-表示不使用提示音; + * 默认值为“system”。 + * - system: 使用系统通知提示音 + * - none: 不使用提示音 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + sound?: 'system' | 'none'; + /** + * 推送消息的标题 + * 在系统消息中心显示的通知消息标题,默认值为程序的名称。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + title?: string; + /** + * 消息上显示的提示时间 + * 默认为当前时间,如果延迟显示则使用延时后显示消息的时间。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/push.html](http://www.html5plus.org/doc/zh_cn/push.html) + */ + when?: Date; +} + +/** + * Share模块管理客户端的社交分享功能,提供调用终端社交软件的分享能力。通过plus.share可获取社交分享管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShare { + /** + * JSON对象,分享授权认证参数选项 + * 此对象支持的属性值由分享服务的授权认证模块定义。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + AuthOptions?: PlusShareAuthOptions; + /** + * 分享授权控件对象 + * Authorize对象表示分享控件对象,用于在窗口中显示分享控件,使用此对象可自定义分享授权界面。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + Authorize?: PlusShareAuthorize; + /** + * JSON对象,用户位置信息 + * GeoPosition对象用于表示用户分享消息时的位置信息。用于标识分享操作时用户的位置信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + GeoPosition?: PlusShareGeoPosition; + /** + * 分享服务对象 + * ShareService对象用于表示分享服务,在JS中为对象,用于向系统请求分享操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + ShareService?: PlusShareShareService; + /** + * 分享服务标识 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + ShareServerIdentity?: PlusShareShareServerIdentity; + /** + * JSON对象,分享消息对象 + * ShareMessage对象用于表示分享消息内容,在JS中为JSON对象,用于向系统发送分享信息操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + ShareMessage?: PlusShareShareMessage; + /** + * JSON对象,保存分享消息扩展信息 + * ShareMessageExtra对象用于保存各分享平台扩展的参数,用于自定义分享功能。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + ShareMessageExtra?: PlusShareShareMessageExtra; + /** + * JSON对象,微信小程序信息 + * 用于配置分享小程序的参数,如小程序标识、页面路径等。 + * 注意:分享的小程序需要在微信开放平台关联的开发者账号下,否则会分享失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + WeixinMiniProgramOptions?: PlusShareWeixinMiniProgramOptions; + /** + * 获取分享服务 + * 获取终端支持的分享通道列表,可用于提示用户进行分享服务器的选择。获取分享服务成功后通过successCB回调返回支持的所有服务列表,获取服务失败则通过errorCB回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + getServices(successCB?: (result: PlusShare []) => void, errorCB?: (result: any) => void): void; + /** + * 使用系统组件发送分享 + * 调用系统分享组件分享消息,通过msg参数设置分享内容。 + * 发送成功后通过successCB回调函数通知操作完成,发送失败则通过errorCB回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + sendWithSystem(msg?: PlusShareShareMessage, successCB?: () => void, errorCB?: (result: any) => void): void; +} + +/** + * JSON对象,分享授权认证参数选项 + * 此对象支持的属性值由分享服务的授权认证模块定义。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareAuthOptions { + /** + * 分享服务平台申请的appid + * 动态设置分享服务授权认证时需要使用的appid,仅需要此参数的分享服务(如“微信”、“QQ”)支持。 + * 如果未设置则使用运行环境中内置的appid值(如在HBuilder中可在manifest.json的“SDK配置”项中进行设置)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + appid?: string; + /** + * 分享服务平台申请的appkey + * 动态设置分享服务授权认证时需要使用的appkey,仅需要此参数的分享服务(如“新浪微博”)支持。 + * 如果未设置则使用运行环境中内置的appkey值(如在HBuilder中可在manifest.json的“SDK配置”项中进行设置)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + appkey?: string; + /** + * 分享服务平台申请的appsecret + * 动态设置分享服务中需要使用的appsecret,仅需要此参数的分享服务(如“微信”、“新浪微博”)支持。 + * 如果未设置则使用运行环境中内置的appsecret值(如在HBuilder中可在manifest.json的“SDK配置”项中进行设置);当开放平台申请的appsecret值涉及到安全问题时,可在应用运行时从服务器获取,然后通过此api动态设置。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + appsecret?: string; + /** + * 分享服务平台申请的redirect_url + * 动态设置分享服务中需要使用的redirect_url,仅需要此参数的登录授权服务(如“新浪微博登录”)支持。 + * 如果未设置则使用运行环境中内置的redirect_url值(如在HBuilder中可在manifest.json的SDK配置项中进行设置)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + redirect_url?: string; +} + +/** + * 分享授权控件对象 + * Authorize对象表示分享控件对象,用于在窗口中显示分享控件,使用此对象可自定义分享授权界面。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareAuthorize { + /** + * 分享控件加载完成事件 + * 分享授权控件内容加载完成事件,通过调用load方法加载分享授权控件内容,当内容加载完成时触发。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + onloaded?: (result: any) => void; + /** + * 分享授权认证成功事件 + * 用户在分享授权控件上输入操作授权成功时触发,事件方法格式参考ShareSuccessCallback回调函数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + onauthenticated?: () => void; + /** + * 分享授权认证失败事件 + * 用户在分享授权控件上输入操作授权认证错误时触发,事件方法格式参考ShareErrorCallback回调函数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + onerror?: (result: any) => void; + /** + * 加载分享授权页面 + * 创建分享授权页面后,需要调用此方法指定分享服务标识来加载授权页面数据,此标识可使用ShareService对象的id属性。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + load(id?: string): void; + /** + * 设置分享授权控件是否可见 + * 创建分享授权页面后,调用此方法设置分享授权控件在页面中是否可见。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + setVisible(visible?: boolean): void; +} + +/** + * JSON对象,用户位置信息 + * GeoPosition对象用于表示用户分享消息时的位置信息。用于标识分享操作时用户的位置信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareGeoPosition { + /** + * 用户位置的纬度坐标信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + latitude?: number; + /** + * 用户位置的经度坐标信息 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + longitude?: number; +} + +/** + * 分享服务对象 + * ShareService对象用于表示分享服务,在JS中为对象,用于向系统请求分享操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareShareService { + /** + * 分享服务标识 + * 用于表示分享服务标识: + * "sinaweibo" - 表示新浪微博; + * "tencentweibo" - 表示腾讯微博; + * "weixin" - 表示微信; + * "qq" - 表示腾讯QQ。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + id?: PlusShareShareServerIdentity; + /** + * 分享服务描述 + * 用于描述分享服务的信息: + * 如“新浪微博”、“腾讯微博”、“微信”、“QQ”。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + description?: string; + /** + * 是否授权认证 + * 用于标识此分享是否已经授权认证过,true表示已完成授权认证;false表示未完成授权认证。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + authenticated?: boolean; + /** + * 授权认证信息 + * 仅在authenticated为true时有效,标识客户认证标识信息,用于发送分享信息。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + accessToken?: string; + /** + * 是否存在对应的分享客户端 + * 对于某些分享服务,可直接调用本地客户端程序进行授权认证,此属性即可提供此相关信息,若没有安装本地客户端则可能调用其它方式进行分享操作,如WAP方式等。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + nativeClient?: boolean; + /** + * 授权认证操作 + * 对指定的分享服务进行授权认证操作,在授权前可通过ShareService.authenticated属性判断是否已经授权过,通常只需要对没有进行过授权认证的服务进行授权认证操作。 + * 授权认证操作成功后通过successCB回调函数通知操作完成,操作失败则通过errorCB回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + authorize(successCallback?: (result: PlusShareShareService) => void, errorCallback?: (result: any) => void, options?: PlusShareAuthOptions): void; + /** + * 取消授权认证 + * 对指定的分享服务取消授权认证操作,取消授权认证后,再次分享时需重新进行授权操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + forbid(): void; + /** + * 发送分享 + * 发送分享消息,分享消息的内容通过msg设置。 + * 发送成功后通过successCB回调函数通知操作完成,发送失败则通过errorCB回调返回。若分享服务没有进行授权认证或授权认证失效则触发失败回调函数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + send(msg?: PlusShareShareMessage, successCB?: () => void, errorCB?: (result: any) => void): void; + /** + * 调用微信小程序 + * 注意:需在微信开放平台将应用关联小程序才能正常调用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + launchMiniProgram(options?: PlusShareWeixinMiniProgramOptions): void; +} + +/** + * 分享服务标识 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareShareServerIdentity { + /** + * 新浪微博 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + sinaweibo?: string; + /** + * 腾讯微博 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + tencentweibo?: string; + /** + * 微信 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + weixin?: string; +} + +/** + * JSON对象,分享消息对象 + * ShareMessage对象用于表示分享消息内容,在JS中为JSON对象,用于向系统发送分享信息操作。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareShareMessage { + /** + * 分享消息的类型 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + type?: string; + /** + * 分享消息的文字内容 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + content?: string; + /** + * 分享消息的图片 + * 分享消息中包含的图片路径,仅支持本地路径。 + * 若分享平台仅支持提交一张图片,传入多张图片则仅提交第一张图片。 + * 如果未指定type类型,优先级顺序为:pictures>content(即设置了pictures则认为分享图片类型)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + pictures?: any []; + /** + * 分享消息的缩略图 + * 分享消息中包含的缩略图路径,支持本地路径及网络路径。 + * 若分享平台仅支持提交一张图片,传入多张图片则仅提交第一张图片。 + * 如果分享平台的信息不支持缩略图,若没有设置消息的图片(pictures)则使用缩略图,否则忽略其属性值。 + * 注意:图片有大小限制,推荐图片小于20Kb。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + thumbs?: any []; + /** + * 分享的多媒体资源 + * 分享的多媒体资源地址,当type值为"music"、"video"时有效。 + * 注意: + * 微信分享平台支持音乐、视频类型,仅支持网络地址(以http://或https://开头); + * QQ分享平台支持音乐类型,仅支持网络路径(以http://或https://开头); + * 新浪微博分享平台支持视频类型,仅支持本地文件路径。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + media?: string; + /** + * 分享独立的链接 + * 分享资源地址,仅支持网络地址(以http://或https://开头)。 + * 如果未指定type类型,优先级顺序为:href>pictures>content(即设置了href则认为分享网页类型)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + href?: string; + /** + * 分享消息的标题 + * 仅微信分享网页、音频、视频、小程序类型时支持。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + title?: string; + /** + * 分享消息中包含的用户地理信息数据 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + geo?: PlusShareGeoPosition; + /** + * 分享消息扩展参数 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + extra?: PlusShareShareMessageExtra; + /** + * 分享微信小程序参数 + * 仅微信分享小程序类型时支持。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + miniProgram?: PlusShareWeixinMiniProgramOptions; + /** + * 分享消息的模式 + * 可取值: + * "auto" - 自动选择,如果已经安装微博客户端则采用编辑界面进行分享,否则采用无界面分享; + * "slient" - 静默分享,采用无界面模式进行分享; + * "editable" - 进入编辑界面,用户确认分享内容后发送,如果当前未安装微博客户端则触发错误回调。 + * 默认值为"auto"。 + * (仅新浪微博分享时生效) + * - auto: + * 自动选择,如果已经安装微博客户端则采用编辑界面进行分享,否则采用无界面分享 + * + * - slient: + * 静默分享,采用无界面模式进行分享 + * + * - editable: + * 进入编辑界面,用户确认分享内容后发送,如果当前未安装微博客户端则触发错误回调 + * + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + interface?: 'auto' | 'slient' | 'editable'; +} + +/** + * JSON对象,保存分享消息扩展信息 + * ShareMessageExtra对象用于保存各分享平台扩展的参数,用于自定义分享功能。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareShareMessageExtra { + /** + * 微信分享场景,仅微信分享平台有效 + * 可取值: + * "WXSceneSession"分享到微信的“我的好友”; + * "WXSceneTimeline"分享到微信的“朋友圈”中; + * "WXSceneFavorite"分享到微信的“我的收藏”中。 + * 默认值为"WXSceneSession"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + scene?: string; +} + +/** + * JSON对象,微信小程序信息 + * 用于配置分享小程序的参数,如小程序标识、页面路径等。 + * 注意:分享的小程序需要在微信开放平台关联的开发者账号下,否则会分享失败。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ +interface PlusShareWeixinMiniProgramOptions { + /** + * 微信小程序ID + * 注意:是微信小程序的原始ID("g_"开头的字符串)。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + id?: string; + /** + * 微信小程序打开的页面路径 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + path?: string; + /** + * 微信小程序版本类型 + * 可取值: + * 0-正式版; + * 1-测试版; + * 2-体验版。 + * 默认值为0。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + type?: number; + /** + * 兼容低版本的网页链接 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/share.html](http://www.html5plus.org/doc/zh_cn/share.html) + */ + webUrl?: string; +} + +/** + * Speech模块管理语音输入功能,提供语音识别功能,可支持用户通过麦克风设备进行语音输入内容。通过plus.speech可获取语音输入管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ +interface PlusSpeech { + /** + * JSON对象,语音识别参数 + * 控制语音识别引擎内部参数,在JS中为JSON对象,在启动语音识别时使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + SpeechRecognizeOptions?: PlusSpeechSpeechRecognizeOptions; + /** + * 语音识别事件类型 + * 描述语音过程的触发事件列表,可以通过调用plus.sppech.addEventListener方法进行注册监听。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + SpeechRecoginzeEvents?: PlusSpeechSpeechRecoginzeEvents; + /** + * 启动语音识别 + * 启动语音识别时调用,当语音识别成功后通过successCallback回调返回识别出文本内容,调用语音识别失败则通过errorCallback回调返回。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + startRecognize(options?: PlusSpeechSpeechRecognizeOptions, successCB?: (result: string) => void, errorCB?: (result: any) => void): void; + /** + * 停止语音识别 + * 当语音识别完成时或用户取消语音识别时调用,调用此方法将导致errorCallback回调函数的调用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + stopRecognize(): void; + /** + * 监听语音识别事件 + * 向语音识别模块添加事件监听器,当指定的事件发生时,将触发listener函数的执行。 + * 可多次调用此方法添加多个监听器,当监听的事件发生时,将按照添加的先后顺序触发执行。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + addEventListener(event?: PlusSpeechSpeechRecoginzeEvents, listener?: (result: any) => void, capture?: boolean): void; +} + +/** + * JSON对象,语音识别参数 + * 控制语音识别引擎内部参数,在JS中为JSON对象,在启动语音识别时使用。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ +interface PlusSpeechSpeechRecognizeOptions { + /** + * 语音识别是否采用持续模式 + * 设置为true表示语音引擎不会根据语音输入自动结束,识别到文本内容将多次调用successCallback函数返回,如果需要结束语音识别则必须调用stopRecognize接口,默认值为false。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + continue?: boolean; + /** + * 语音识别引擎标识 + * 用于兼容多语音识别引擎的浏览器,使用语音识别厂商的产品名称,如未设置或设置不正确则使用运行环境默认的语音识别引擎。 + * 支持以下语音识别引擎: + * "baidu"-百度语音识别; + * "iFly"-讯飞语音识别。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + engine?: string; + /** + * 语音识别引擎的语言 + * 用于定义语音识别引擎的语言,其取值需符合W3C的Language codes规范。 + * 目前讯飞语音支持以下语言: + * "zh-cn"-中文,普通话; + * "en-us"-英语; + * "zh-cantonese"-中文,粤语; + * "zh-henanese"-中文,河南话(百度语音识别不支持此语言)。 + * 默认值为"zh-cn"。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + lang?: string; + /** + * 指定识别结果识别包括多候选结果 + * 用于指定识别结果识别包括多候选结果。如nbest:3,识别返回3个候选结果,默认值为1。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + nbest?: number; + /** + * 识别结果中是否包含标点符号 + * true表示识别结果文本中包含标点符号,false表示识别结果文本中不包含标点符号。 + * 默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + punctuation?: boolean; + /** + * 语音识别超时时间 + * 语音识别超时的时间,单位为ms,默认值为1000(即10秒)。 + * 注:百度语音识别不支持此参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + timeout?: number; + /** + * 识别时是否显示用户界面 + * 用于指定识别时是否显示用户界面,设置为true表示显示浏览器内置语音识别界面;设置为false表示不显示浏览器内置语音识别界面。默认值为true。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + userInterface?: boolean; + /** + * 语音识别开始事件(已废弃,使用start事件) + * 事件函数,语音识别开始启动,在调用startRecognize方法后触发,与onend事件成对触发。 + * 注:iOS平台未支持 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + onstart?: (result: any) => void; + /** + * 语音识别结束事件(已废弃,使用end事件) + * 事件函数,语音识别结束,在调用stopRecognize方法后触发,或者在引擎内部自动完成语音识别后触发,与onstart事件成对触发。 + * 注:iOS平台未支持 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + onend?: (result: any) => void; +} + +/** + * 语音识别事件类型 + * 描述语音过程的触发事件列表,可以通过调用plus.sppech.addEventListener方法进行注册监听。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ +interface PlusSpeechSpeechRecoginzeEvents { + /** + * 开始语音识别 + * 调用plus.speech.startRecognize方法开始语音识别时触发。 + * 无回调函数参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + start?: string; + /** + * 音量变化 + * 开始语音识别后,麦克风录制到的语音音量变化时触发。 + * 回调函数参数event={volume:"Number类型,取值范围0-1"}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + volumeChange?: string; + /** + * 临时语音识别结果 + * 返回临时语音识别结果时触发。 + * 回调函数参数event={partialResult:"String类型,临时识别结果"}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + recognizing?: string; + /** + * 最终语音识别 + * 返回最终语音识别结果。 + * 回调函数参数event={result:"String类型,最佳识别结果",results:"String数组类型,所有候选结果"}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + recognition?: string; + /** + * 结束语音识别 + * 调用plus.speech.stopRecognize方法结束语音识别或语音识别完成后自动结束时触发。 + * 无回调函数参数。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + end?: string; + /** + * 语音识别错误 + * 语音识别发生错误时触发。 + * 回调函数参数event={code:"Number类型,错误编码",message:"String类型,错误描述信息"}。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/speech.html](http://www.html5plus.org/doc/zh_cn/speech.html) + */ + error?: string; +} + +/** + * Statistic模块管理统计功能,用于提供应用内统计的能力,支持统计和分析用户属性和用户行为数据。通过plus.statistic可获取统计管理对象。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/statistic.html](http://www.html5plus.org/doc/zh_cn/statistic.html) + */ +interface PlusStatistic { + /** + * 触发事件 + * 触发指定的统计事件,触发的事件必须要先在统计网站上注册事件ID。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/statistic.html](http://www.html5plus.org/doc/zh_cn/statistic.html) + */ + eventTrig(id?: string, value?: any): void; + /** + * 精确持续事件 + * 精确时长的持续事件统计,触发的事件必须要先在统计网站上注册事件ID。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/statistic.html](http://www.html5plus.org/doc/zh_cn/statistic.html) + */ + eventDuration(id?: string, duration?: number, value?: any): void; + /** + * 开始持续事件(过期API,不推荐使用) + * 开始指定的持续事件统计,当事件结束时调用eventEnd方法,,触发的事件必须要先在统计网站上注册事件ID。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/statistic.html](http://www.html5plus.org/doc/zh_cn/statistic.html) + */ + eventStart(id?: string, value?: string): void; + /** + * 结束持续事件(过期API,不推荐使用) + * 结束指定的持续事件统计,需先调用eventStart方法开始持续事件统计,触发的事件必须要先在统计网站上注册事件ID。 + * + * 参考: [http://www.html5plus.org/doc/zh_cn/statistic.html](http://www.html5plus.org/doc/zh_cn/statistic.html) + */ + eventEnd(id?: string, label?: string): void; +} diff --git a/types/chokidar/tsconfig.json b/types/html5plus/tsconfig.json similarity index 94% rename from types/chokidar/tsconfig.json rename to types/html5plus/tsconfig.json index 77a34a3964..634c3eb205 100644 --- a/types/chokidar/tsconfig.json +++ b/types/html5plus/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "chokidar-tests.ts" + "html5plus-tests.ts" ] } \ No newline at end of file diff --git a/types/html5plus/tslint.json b/types/html5plus/tslint.json new file mode 100644 index 0000000000..661e47a018 --- /dev/null +++ b/types/html5plus/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": false, + "no-trailing-whitespace": false + } +} \ No newline at end of file diff --git a/types/http-proxy/index.d.ts b/types/http-proxy/index.d.ts index 2560b0a38d..80e09de68f 100644 --- a/types/http-proxy/index.d.ts +++ b/types/http-proxy/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for node-http-proxy 1.16 +// Type definitions for node-http-proxy 1.17 // Project: https://github.com/nodejitsu/node-http-proxy // Definitions by: Maxime LUCE // Florian Oellerich // Daniel Schmidt +// Jordan Abreu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -165,8 +166,6 @@ declare class Server extends events.EventEmitter { declare namespace Server { interface ServerOptions { - /** Buffer */ - buffer?: stream.Stream; /** URL string to be parsed with the url module. */ target?: ProxyTargetUrl; /** URL string to be parsed with the url module. */ @@ -203,12 +202,20 @@ declare namespace Server { protocolRewrite?: string; /** rewrites domain of set-cookie headers. */ cookieDomainRewrite?: false | string | {[oldDomain: string]: string}; + /** rewrites path of set-cookie headers. Default: false */ + cookiePathRewrite?: false | string | {[oldPath: string]: string}; /** object with extra headers to be added to target requests. */ headers?: {[header: string]: string}; /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */ proxyTimeout?: number; + /** Timeout (in milliseconds) for incoming requests */ + timeout?: number; + /** Specify whether you want to follow redirects. Default: false */ + followRedirects?: boolean; /** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */ selfHandleResponse?: boolean; + /** Buffer */ + buffer?: stream.Stream; } } diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts index 656c492df6..b0f465719a 100644 --- a/types/hubot/index.d.ts +++ b/types/hubot/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/hubotio/hubot // Definitions by: Dirk Gadsden // Kees C. Bakker +// Emil Marklund // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Hubot { @@ -40,6 +41,8 @@ declare namespace Hubot { readonly adapter: A; constructor(adapterPath: string, adapter: string, httpd: boolean, name: string, alias?: string); + catchAll(callback: ListenerCallback): void; + catchAll(options: any, callback: ListenerCallback): void; hear(regex: RegExp, callback: ListenerCallback): void; hear(regex: RegExp, options: any, callback: ListenerCallback): void; helpCommands(): string[]; diff --git a/types/humanize-ms/humanize-ms-tests.ts b/types/humanize-ms/humanize-ms-tests.ts new file mode 100644 index 0000000000..bd329751f3 --- /dev/null +++ b/types/humanize-ms/humanize-ms-tests.ts @@ -0,0 +1,5 @@ +import HumanizeMs = require("humanize-ms"); + +HumanizeMs('1s'); + +HumanizeMs(1000); diff --git a/types/humanize-ms/index.d.ts b/types/humanize-ms/index.d.ts new file mode 100644 index 0000000000..40462c5782 --- /dev/null +++ b/types/humanize-ms/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for humanize-ms 1.2 +// Project: https://github.com/node-modules/humanize-ms +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function HumanizeMS(input: string|number): number; + +export = HumanizeMS; diff --git a/types/humanize-ms/tsconfig.json b/types/humanize-ms/tsconfig.json new file mode 100644 index 0000000000..2e451381a9 --- /dev/null +++ b/types/humanize-ms/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "humanize-ms-tests.ts" + ] +} diff --git a/types/humanize-ms/tslint.json b/types/humanize-ms/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/humanize-ms/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/is-integer/index.d.ts b/types/is-integer/index.d.ts new file mode 100644 index 0000000000..46708e5068 --- /dev/null +++ b/types/is-integer/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for is-integer 1.0 +// Project: https://github.com/parshap/js-is-integer#readme +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isInteger(val: any): boolean; + +export = isInteger; diff --git a/types/is-integer/is-integer-tests.ts b/types/is-integer/is-integer-tests.ts new file mode 100644 index 0000000000..f414281fc6 --- /dev/null +++ b/types/is-integer/is-integer-tests.ts @@ -0,0 +1,16 @@ +import isInteger = require("is-integer"); + +// $ExpectType boolean +isInteger("hello"); + +// $ExpectType boolean +isInteger(4); + +// $ExpectType boolean +isInteger(4.0); + +// $ExpectType boolean +isInteger(4.1); + +// $ExpectType boolean +isInteger({}); diff --git a/types/on-change/tsconfig.json b/types/is-integer/tsconfig.json similarity index 93% rename from types/on-change/tsconfig.json rename to types/is-integer/tsconfig.json index 433629ab82..7b4310e320 100644 --- a/types/on-change/tsconfig.json +++ b/types/is-integer/tsconfig.json @@ -6,8 +6,8 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "on-change-tests.ts" + "is-integer-tests.ts" ] } diff --git a/types/is-online/tslint.json b/types/is-integer/tslint.json similarity index 100% rename from types/is-online/tslint.json rename to types/is-integer/tslint.json diff --git a/types/is-online/index.d.ts b/types/is-online/index.d.ts deleted file mode 100644 index 04fa123c44..0000000000 --- a/types/is-online/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for is-online 8.0 -// Project: https://github.com/sindresorhus/is-online#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = isOnline; - -/** - * Check if the internet connection is up. - * - * The following checks are run in parallel: - * - Retrieve [icanhazip.com](https://github.com/major/icanhaz) via HTTPS - * - Query `myip.opendns.com` on OpenDNS (Node.js only) - * - Retrieve Apple's Captive Portal test page (Node.js only) - * - * When the first check succeeds, the returned Promise is resolved to `true`. - */ -declare function isOnline(options?: isOnline.Options): Promise; - -declare namespace isOnline { - interface Options { - /** - * Milliseconds to wait for a server to respond. - * @default 5000 - */ - timeout?: number; - /** - * Internet Protocol version to use. This is an advanced option that is usually not necessary to be set, - * but it can prove useful to specifically assert IPv6 connectivity. - * @default 'v4' - */ - version?: 'v4' | 'v6'; - } -} diff --git a/types/is-online/is-online-tests.ts b/types/is-online/is-online-tests.ts deleted file mode 100644 index 74dbda5efa..0000000000 --- a/types/is-online/is-online-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -import isOnline = require('is-online'); - -isOnline(); // $ExpectType Promise -isOnline({ timeout: 10 }); // $ExpectType Promise -isOnline({ version: 'v4' }); // $ExpectType Promise -isOnline({ version: 'v6' }); // $ExpectType Promise diff --git a/types/jasmine-data_driven_tests/index.d.ts b/types/jasmine-data_driven_tests/index.d.ts index 553987ef60..fe786aa735 100644 --- a/types/jasmine-data_driven_tests/index.d.ts +++ b/types/jasmine-data_driven_tests/index.d.ts @@ -6,6 +6,8 @@ declare var all: JasmineDataDrivenTest; declare var xall: JasmineDataDrivenTest; +declare var using: JasmineDataDrivenTest; +declare var xusing: JasmineDataDrivenTest; interface JasmineDataDrivenTest { ( diff --git a/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts b/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts index 0523a28af0..1e354702c9 100644 --- a/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts +++ b/types/jasmine-data_driven_tests/jasmine-data_driven_tests-tests.ts @@ -1,5 +1,44 @@ /// +using("A suite", + [ + [1, 2, 3], + [2, 4, 6] + ], + (a, b, c) => { + it("can be data driven", () => { + expect(c).toBe(a + b); + }); + } +); + +xusing("A data driven suite", + [ + [1, 2, 3], + [2, 4, 6] + ], + (a, b, c) => { + it("can be pending", () => { + expect(c).toBe(a + b); + }); + } +); + +using("A data driven suite", + [ 'a', 'b', 'c' ], + lhs => { + beforeEach(() => { + console.log(`lhs = ${lhs}`); + }); + all("can contain data driven tests", + [ 'd', 'e', 'f' ], + rhs => { + expect(lhs).not.toBe(rhs); + } + ); + } +); + all("A data driven test is a suite with multiple specs", ['a', 'b', 'c'], value => { diff --git a/types/jest-in-case/jest-in-case-tests.ts b/types/jest-in-case/jest-in-case-tests.ts index b38ccff0bc..2e3631efab 100644 --- a/types/jest-in-case/jest-in-case-tests.ts +++ b/types/jest-in-case/jest-in-case-tests.ts @@ -25,7 +25,7 @@ afterEach(() => { test('array', () => { const title = 'add(augend, addend)'; - const tester = jest.fn(opts => { + const tester = jest.fn((opts, cb) => { expect(add(opts.augend, opts.addend)).toBe(opts.total); }); @@ -59,7 +59,7 @@ test('object', () => { const title = 'add(augend, addend)'; - const tester = jest.fn(opts => { + const tester = jest.fn((opts, cb) => { expect(subtract(opts.minuend, opts.subtrahend)).toBe(opts.difference); }); diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index da84c876af..86a627c61d 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Jest 24.0 -// Project: http://facebook.github.io/jest/ +// Project: https://jestjs.io // Definitions by: Asana // Ivo Stratev // jwbay @@ -154,6 +154,11 @@ declare namespace jest { * useful to isolate modules where local state might conflict between tests. */ function resetModules(): typeof jest; + /** + * Creates a sandbox registry for the modules that are loaded inside the callback function.. + * This is useful to isolate specific modules for every test so that local module state doesn't conflict between tests. + */ + function isolateModules(fn: () => void): typeof jest; /** * Runs failed tests n-times until they pass or until the max number of retries is exhausted. * This only works with jest-circus! @@ -264,7 +269,23 @@ declare namespace jest { } interface Each { - (cases: any[]): (name: string, fn: (...args: any[]) => any, timeout?: number) => void; + // Exclusively arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T) => any, + timeout?: number + ) => void; + // Not arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T[]) => any, + timeout?: number + ) => void; + (cases: ReadonlyArray>): ( + name: string, + fn: (...args: any[]) => any, + timeout?: number + ) => void; (strings: TemplateStringsArray, ...placeholders: any[]): ( name: string, fn: (arg: any) => any, diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 039d996f5c..b3356f044d 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -267,6 +267,7 @@ jest .mock("moduleName", jest.fn(), { virtual: true }) .resetModuleRegistry() .resetModules() + .isolateModules(() => {}) .retryTimes(3) .runAllImmediates() .runAllTicks() diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index d1c3aeee5f..9ab87a022a 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -4,7 +4,8 @@ // Daniel Heim , // Brice BERNARD , // Veli-Pekka Kestilä , -// Daniel Parker +// Daniel Parker , +// Kjell Dießel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -17,9 +18,9 @@ export class JsonWebTokenError extends Error { } export class TokenExpiredError extends JsonWebTokenError { - expiredAt: number; + expiredAt: Date; - constructor(message: string, expiredAt: number); + constructor(message: string, expiredAt: Date); } export class NotBeforeError extends JsonWebTokenError { @@ -59,7 +60,7 @@ export interface SignOptions { export interface VerifyOptions { algorithms?: string[]; - audience?: string | string[]; + audience?: string | RegExp | Array; clockTimestamp?: number; clockTolerance?: number; issuer?: string | string[]; diff --git a/types/jsonwebtoken/jsonwebtoken-tests.ts b/types/jsonwebtoken/jsonwebtoken-tests.ts index 5884ff6d63..924f95e2d4 100644 --- a/types/jsonwebtoken/jsonwebtoken-tests.ts +++ b/types/jsonwebtoken/jsonwebtoken-tests.ts @@ -101,6 +101,12 @@ cert = fs.readFileSync("public.pem"); // get public key jwt.verify(token, cert, { audience: "urn:foo" }, (err, decoded) => { // if audience mismatch, err == invalid audience }); +jwt.verify(token, cert, { audience: /urn:f[o]{2}/ }, (err, decoded) => { + // if audience mismatch, err == invalid audience +}); +jwt.verify(token, cert, { audience: [/urn:f[o]{2}/, "urn:bar"] }, (err, decoded) => { + // if audience mismatch, err == invalid audience +}); // verify issuer cert = fs.readFileSync("public.pem"); // get public key diff --git a/types/kafkajs/index.d.ts b/types/kafkajs/index.d.ts index a28377e369..c416a07063 100644 --- a/types/kafkajs/index.d.ts +++ b/types/kafkajs/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for kafkajs 1.4 -// Project: https://github.com/tulios/kafkajs +// Project: https://github.com/tulios/kafkajs, https://kafka.js.org // Definitions by: Michal Kaminski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 7ea79365ee..17c186697e 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -1883,7 +1883,9 @@ declare namespace kendo.ui { navigateToPast(): void; navigateUp(): void; selectDates(): void; - selectDates(): void; + selectDates(datesToSelect : any): void; + //somehow the same interface got implemented twice which are the same + //kendo-ui supports date selection(https://docs.telerik.com/kendo-ui/knowledge-base/calendar-select-range-of-dates) value(): Date; value(value: Date): void; value(value: string): void; diff --git a/types/keytar/index.d.ts b/types/keytar/index.d.ts index cf6a16e4f7..f5e8e7367a 100644 --- a/types/keytar/index.d.ts +++ b/types/keytar/index.d.ts @@ -1,6 +1,9 @@ -// Type definitions for keytar 4.0.2 +// Type definitions for keytar 4.4.1 // Project: http://atom.github.io/node-keytar/ -// Definitions by: Milan Burda , Brendan Forster , Hari Juturu +// Definitions by: Milan Burda +// Brendan Forster +// Hari Juturu +// Queenie Ma // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -15,7 +18,7 @@ export declare function getPassword(service: string, account: string): Promise; /** - * Add the password for the service and account to the keychain. + * Save the password for the service and account to the keychain. Adds a new entry if necessary, or updates an existing entry if one exists. * * @param service The string service name. * @param account The string account name. @@ -36,7 +39,16 @@ export declare function setPassword(service: string, account: string, password: export declare function deletePassword(service: string, account: string): Promise; /** - * Find a password for the service in the keychain. + * Find all accounts and password for the service in the keychain. + * + * @param service The string service name. + * + * @returns A promise for the credentials array. + */ +export declare function findCredentials(service: string): Promise>; + +/** + * Find a password for the service in the keychain. This is ideal for scenarios where an account is not required. * * @param service The string service name. * diff --git a/types/keytar/keytar-tests.ts b/types/keytar/keytar-tests.ts index f6873838c2..18a7423450 100644 --- a/types/keytar/keytar-tests.ts +++ b/types/keytar/keytar-tests.ts @@ -8,6 +8,8 @@ let success: Promise; success = keytar.deletePassword('keytar-tests', 'username'); let password: Promise; - password = keytar.findPassword('keytar-tests'); password = keytar.getPassword('keytar-tests', 'username'); + +let credentials: Promise>; +credentials = keytar.findCredentials('keytar-tests'); diff --git a/types/koa-hbs/package.json b/types/koa-hbs/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/koa-hbs/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/koa-helmet/koa-helmet-tests.ts b/types/koa-helmet/koa-helmet-tests.ts index 2290ab07fa..34bca1958a 100644 --- a/types/koa-helmet/koa-helmet-tests.ts +++ b/types/koa-helmet/koa-helmet-tests.ts @@ -95,13 +95,13 @@ function hpkpTest() { app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: false + includeSubDomains: false })); app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hpkp({ @@ -137,7 +137,7 @@ function hstsTest() { app.use(helmet.hsts({ maxAge: 7776000000, - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hsts({ diff --git a/types/koa-log4/index.d.ts b/types/koa-log4/index.d.ts new file mode 100644 index 0000000000..e47cfc4e07 --- /dev/null +++ b/types/koa-log4/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for koa-log4 2.3 +// Project: https://github.com/dominhhai/koa-log4js#readme +// Definitions by: Cr. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import * as Koa from 'koa'; +import * as Log4js from 'log4js'; + +export function koaLogger(logger4js: Log4js.Logger, optionsOrFormat?: Options | string): Koa.Middleware; + +export interface Options { + format?: string; + level?: Log4js.Level; +} + +export * from 'log4js'; diff --git a/types/koa-log4/koa-log4-tests.ts b/types/koa-log4/koa-log4-tests.ts new file mode 100644 index 0000000000..cb8d377eb8 --- /dev/null +++ b/types/koa-log4/koa-log4-tests.ts @@ -0,0 +1,18 @@ +import Koa = require('koa'); +import KoaLog4 = require('koa-log4'); + +const DEFAULT_FORMAT = ':remote-addr - -' + + ' ":method :url HTTP/:http-version"' + + ' :status :content-length ":referrer"' + + ' ":user-agent"'; + +const DEFAULT_OPTIONS: KoaLog4.Options = { + format: DEFAULT_FORMAT, + level: KoaLog4.levels.INFO +}; + +const koaLog4Mid = KoaLog4.koaLogger(KoaLog4.getLogger(), DEFAULT_OPTIONS); + +const app = new Koa(); +app.use(koaLog4Mid); +app.listen(80); diff --git a/types/koa-log4/package.json b/types/koa-log4/package.json new file mode 100644 index 0000000000..5c070feace --- /dev/null +++ b/types/koa-log4/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "log4js": "^3.0.0" + } +} \ No newline at end of file diff --git a/types/koa-log4/tsconfig.json b/types/koa-log4/tsconfig.json new file mode 100644 index 0000000000..71abbe0755 --- /dev/null +++ b/types/koa-log4/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes":false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-log4-tests.ts" + ] +} diff --git a/types/log-update/tslint.json b/types/koa-log4/tslint.json similarity index 100% rename from types/log-update/tslint.json rename to types/koa-log4/tslint.json diff --git a/types/koa-send/index.d.ts b/types/koa-send/index.d.ts index a4b090e1ea..bf6ddae297 100644 --- a/types/koa-send/index.d.ts +++ b/types/koa-send/index.d.ts @@ -6,17 +6,17 @@ // TypeScript Version: 2.3 import { - Context, + ParameterizedContext, } from "koa"; import { Stats, } from "fs"; -declare function send(ctx: Context, path: string, opts?: send.SendOptions): Promise; +declare function send(ctx: ParameterizedContext, path: string, opts?: send.SendOptions): Promise; declare namespace send { - type SetHeaders = (res: Context["res"], path: string, stats: Stats) => any; + type SetHeaders = (res: ParameterizedContext["res"], path: string, stats: Stats) => any; interface SendOptions { /** Browser cache max-age in milliseconds. (defaults to 0) */ diff --git a/types/lodash-es/index.d.ts b/types/lodash-es/index.d.ts index 61eb6016ee..3e9fcfa69c 100644 --- a/types/lodash-es/index.d.ts +++ b/types/lodash-es/index.d.ts @@ -2,7 +2,7 @@ // Project: http://lodash.com/, https://lodash.com/custom-builds // Definitions by: Stephen Lautier , e-cloud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 export { default as add } from "./add"; export { default as after } from "./after"; diff --git a/types/lodash.add/index.d.ts b/types/lodash.add/index.d.ts index 742a2fc000..baddebd61a 100644 --- a/types/lodash.add/index.d.ts +++ b/types/lodash.add/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.after/index.d.ts b/types/lodash.after/index.d.ts index 48adaf8994..fc56217da5 100644 --- a/types/lodash.after/index.d.ts +++ b/types/lodash.after/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.ary/index.d.ts b/types/lodash.ary/index.d.ts index d442d3ad4d..1d44bac65a 100644 --- a/types/lodash.ary/index.d.ts +++ b/types/lodash.ary/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.assign/index.d.ts b/types/lodash.assign/index.d.ts index 549fb7af74..439ca018b5 100644 --- a/types/lodash.assign/index.d.ts +++ b/types/lodash.assign/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.assignin/index.d.ts b/types/lodash.assignin/index.d.ts index 34e644c6b9..33c31dbc31 100644 --- a/types/lodash.assignin/index.d.ts +++ b/types/lodash.assignin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.assigninwith/index.d.ts b/types/lodash.assigninwith/index.d.ts index ba48574c0d..17d76a4304 100644 --- a/types/lodash.assigninwith/index.d.ts +++ b/types/lodash.assigninwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.assignwith/index.d.ts b/types/lodash.assignwith/index.d.ts index b88032631e..d95702fd18 100644 --- a/types/lodash.assignwith/index.d.ts +++ b/types/lodash.assignwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.at/index.d.ts b/types/lodash.at/index.d.ts index a307f84553..278854bab6 100644 --- a/types/lodash.at/index.d.ts +++ b/types/lodash.at/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.attempt/index.d.ts b/types/lodash.attempt/index.d.ts index 71b89a092f..9db30b6fd0 100644 --- a/types/lodash.attempt/index.d.ts +++ b/types/lodash.attempt/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.before/index.d.ts b/types/lodash.before/index.d.ts index f19139a5ee..482c458fd4 100644 --- a/types/lodash.before/index.d.ts +++ b/types/lodash.before/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.bind/index.d.ts b/types/lodash.bind/index.d.ts index e90ebaa4c1..bf22c45a09 100644 --- a/types/lodash.bind/index.d.ts +++ b/types/lodash.bind/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.bindall/index.d.ts b/types/lodash.bindall/index.d.ts index 4a4cb0de76..135c532028 100644 --- a/types/lodash.bindall/index.d.ts +++ b/types/lodash.bindall/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.bindkey/index.d.ts b/types/lodash.bindkey/index.d.ts index 86c9c13672..12553e21b8 100644 --- a/types/lodash.bindkey/index.d.ts +++ b/types/lodash.bindkey/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.camelcase/index.d.ts b/types/lodash.camelcase/index.d.ts index 6fbedc08d6..8f01a3bf38 100644 --- a/types/lodash.camelcase/index.d.ts +++ b/types/lodash.camelcase/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.capitalize/index.d.ts b/types/lodash.capitalize/index.d.ts index fbe1b177ee..5e0ffdced3 100644 --- a/types/lodash.capitalize/index.d.ts +++ b/types/lodash.capitalize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.castarray/index.d.ts b/types/lodash.castarray/index.d.ts index 41e53aecff..f27ca127a6 100644 --- a/types/lodash.castarray/index.d.ts +++ b/types/lodash.castarray/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.ceil/index.d.ts b/types/lodash.ceil/index.d.ts index d6e055af91..f49a415e20 100644 --- a/types/lodash.ceil/index.d.ts +++ b/types/lodash.ceil/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.chunk/index.d.ts b/types/lodash.chunk/index.d.ts index c85c5c988c..0591152d32 100644 --- a/types/lodash.chunk/index.d.ts +++ b/types/lodash.chunk/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.clamp/index.d.ts b/types/lodash.clamp/index.d.ts index 7bc75b42e9..38624c2214 100644 --- a/types/lodash.clamp/index.d.ts +++ b/types/lodash.clamp/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.clone/index.d.ts b/types/lodash.clone/index.d.ts index 62da74b22d..333915a404 100644 --- a/types/lodash.clone/index.d.ts +++ b/types/lodash.clone/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.clonedeep/index.d.ts b/types/lodash.clonedeep/index.d.ts index 5f25f0cfa7..369942bf05 100644 --- a/types/lodash.clonedeep/index.d.ts +++ b/types/lodash.clonedeep/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.clonedeepwith/index.d.ts b/types/lodash.clonedeepwith/index.d.ts index 9725303ac2..9d37cbea6d 100644 --- a/types/lodash.clonedeepwith/index.d.ts +++ b/types/lodash.clonedeepwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.clonewith/index.d.ts b/types/lodash.clonewith/index.d.ts index b02127620c..0a099fd494 100644 --- a/types/lodash.clonewith/index.d.ts +++ b/types/lodash.clonewith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.compact/index.d.ts b/types/lodash.compact/index.d.ts index 48b4bbd7e1..553668fcb3 100644 --- a/types/lodash.compact/index.d.ts +++ b/types/lodash.compact/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.concat/index.d.ts b/types/lodash.concat/index.d.ts index 576dd6aa6b..f96ec742b9 100644 --- a/types/lodash.concat/index.d.ts +++ b/types/lodash.concat/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.cond/index.d.ts b/types/lodash.cond/index.d.ts index 633e40809e..83fa5ef27a 100644 --- a/types/lodash.cond/index.d.ts +++ b/types/lodash.cond/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.constant/index.d.ts b/types/lodash.constant/index.d.ts index 5122739117..03c2713bdf 100644 --- a/types/lodash.constant/index.d.ts +++ b/types/lodash.constant/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.countby/index.d.ts b/types/lodash.countby/index.d.ts index 1f569be971..24b895f079 100644 --- a/types/lodash.countby/index.d.ts +++ b/types/lodash.countby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.create/index.d.ts b/types/lodash.create/index.d.ts index 173f439a2f..dca4287417 100644 --- a/types/lodash.create/index.d.ts +++ b/types/lodash.create/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.curry/index.d.ts b/types/lodash.curry/index.d.ts index d569ccb852..f24b40caed 100644 --- a/types/lodash.curry/index.d.ts +++ b/types/lodash.curry/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.curryright/index.d.ts b/types/lodash.curryright/index.d.ts index 0d13c7d705..b10ea20902 100644 --- a/types/lodash.curryright/index.d.ts +++ b/types/lodash.curryright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.debounce/index.d.ts b/types/lodash.debounce/index.d.ts index 4babb92e45..02f0bfc874 100644 --- a/types/lodash.debounce/index.d.ts +++ b/types/lodash.debounce/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.deburr/index.d.ts b/types/lodash.deburr/index.d.ts index 103ae6f0b9..f1c22579cc 100644 --- a/types/lodash.deburr/index.d.ts +++ b/types/lodash.deburr/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.defaults/index.d.ts b/types/lodash.defaults/index.d.ts index 9d92dd3021..b369cbbed2 100644 --- a/types/lodash.defaults/index.d.ts +++ b/types/lodash.defaults/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.defaultsdeep/index.d.ts b/types/lodash.defaultsdeep/index.d.ts index d1f1e1aa4e..4cafcffe76 100644 --- a/types/lodash.defaultsdeep/index.d.ts +++ b/types/lodash.defaultsdeep/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.defer/index.d.ts b/types/lodash.defer/index.d.ts index 12247d6273..9a015ee473 100644 --- a/types/lodash.defer/index.d.ts +++ b/types/lodash.defer/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.delay/index.d.ts b/types/lodash.delay/index.d.ts index 2ad1ff79d3..9fb968dc1f 100644 --- a/types/lodash.delay/index.d.ts +++ b/types/lodash.delay/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.difference/index.d.ts b/types/lodash.difference/index.d.ts index 9843b97496..53d2f688e0 100644 --- a/types/lodash.difference/index.d.ts +++ b/types/lodash.difference/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.differenceby/index.d.ts b/types/lodash.differenceby/index.d.ts index 24d95da85a..11b877c8bd 100644 --- a/types/lodash.differenceby/index.d.ts +++ b/types/lodash.differenceby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.differencewith/index.d.ts b/types/lodash.differencewith/index.d.ts index 32f51678ab..7bcaf0e374 100644 --- a/types/lodash.differencewith/index.d.ts +++ b/types/lodash.differencewith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.divide/index.d.ts b/types/lodash.divide/index.d.ts index 7abbafd7bd..87b705f72b 100644 --- a/types/lodash.divide/index.d.ts +++ b/types/lodash.divide/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.drop/index.d.ts b/types/lodash.drop/index.d.ts index 9eaf528d73..0bdebee18c 100644 --- a/types/lodash.drop/index.d.ts +++ b/types/lodash.drop/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.dropright/index.d.ts b/types/lodash.dropright/index.d.ts index 73056b73a4..305d9185ad 100644 --- a/types/lodash.dropright/index.d.ts +++ b/types/lodash.dropright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.droprightwhile/index.d.ts b/types/lodash.droprightwhile/index.d.ts index a145e956ee..f93a0e2bf8 100644 --- a/types/lodash.droprightwhile/index.d.ts +++ b/types/lodash.droprightwhile/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.dropwhile/index.d.ts b/types/lodash.dropwhile/index.d.ts index 7be29abfc4..c319c28cad 100644 --- a/types/lodash.dropwhile/index.d.ts +++ b/types/lodash.dropwhile/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.endswith/index.d.ts b/types/lodash.endswith/index.d.ts index d27aea64c5..08da3f984e 100644 --- a/types/lodash.endswith/index.d.ts +++ b/types/lodash.endswith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.eq/index.d.ts b/types/lodash.eq/index.d.ts index 1e577a2dac..2108d43241 100644 --- a/types/lodash.eq/index.d.ts +++ b/types/lodash.eq/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.escape/index.d.ts b/types/lodash.escape/index.d.ts index 3b9b0845ad..7fc4195d57 100644 --- a/types/lodash.escape/index.d.ts +++ b/types/lodash.escape/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.escaperegexp/index.d.ts b/types/lodash.escaperegexp/index.d.ts index 5d508bf40f..790be82ef5 100644 --- a/types/lodash.escaperegexp/index.d.ts +++ b/types/lodash.escaperegexp/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.every/index.d.ts b/types/lodash.every/index.d.ts index d4443355a4..c1daeeaf8b 100644 --- a/types/lodash.every/index.d.ts +++ b/types/lodash.every/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.fill/index.d.ts b/types/lodash.fill/index.d.ts index 21eca6cb70..b80b6f3766 100644 --- a/types/lodash.fill/index.d.ts +++ b/types/lodash.fill/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.filter/index.d.ts b/types/lodash.filter/index.d.ts index b7eaf4d001..620b5afa5f 100644 --- a/types/lodash.filter/index.d.ts +++ b/types/lodash.filter/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.find/index.d.ts b/types/lodash.find/index.d.ts index a4723afa63..2e872ac18f 100644 --- a/types/lodash.find/index.d.ts +++ b/types/lodash.find/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.findindex/index.d.ts b/types/lodash.findindex/index.d.ts index 04045617e0..d809dc25c1 100644 --- a/types/lodash.findindex/index.d.ts +++ b/types/lodash.findindex/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.findkey/index.d.ts b/types/lodash.findkey/index.d.ts index 151b5e28d8..d3d190c961 100644 --- a/types/lodash.findkey/index.d.ts +++ b/types/lodash.findkey/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.findlast/index.d.ts b/types/lodash.findlast/index.d.ts index e06477e488..82c796b516 100644 --- a/types/lodash.findlast/index.d.ts +++ b/types/lodash.findlast/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.findlastindex/index.d.ts b/types/lodash.findlastindex/index.d.ts index 982b1d3880..07fcecb2aa 100644 --- a/types/lodash.findlastindex/index.d.ts +++ b/types/lodash.findlastindex/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.findlastkey/index.d.ts b/types/lodash.findlastkey/index.d.ts index 7ce6837eb7..538349029a 100644 --- a/types/lodash.findlastkey/index.d.ts +++ b/types/lodash.findlastkey/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.first/index.d.ts b/types/lodash.first/index.d.ts index cd48bdc4bf..c4e173b32e 100644 --- a/types/lodash.first/index.d.ts +++ b/types/lodash.first/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flatmap/index.d.ts b/types/lodash.flatmap/index.d.ts index 11cd11337b..376fa4dde5 100644 --- a/types/lodash.flatmap/index.d.ts +++ b/types/lodash.flatmap/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flatmapdeep/index.d.ts b/types/lodash.flatmapdeep/index.d.ts index d4f10edf3e..b6173e3aa4 100644 --- a/types/lodash.flatmapdeep/index.d.ts +++ b/types/lodash.flatmapdeep/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flatmapdepth/index.d.ts b/types/lodash.flatmapdepth/index.d.ts index 91fb6bd576..748e76f598 100644 --- a/types/lodash.flatmapdepth/index.d.ts +++ b/types/lodash.flatmapdepth/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flatten/index.d.ts b/types/lodash.flatten/index.d.ts index 3689f19e15..7ce8c0b8b6 100644 --- a/types/lodash.flatten/index.d.ts +++ b/types/lodash.flatten/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flattendeep/index.d.ts b/types/lodash.flattendeep/index.d.ts index 791f2b384f..aeff806101 100644 --- a/types/lodash.flattendeep/index.d.ts +++ b/types/lodash.flattendeep/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flattendepth/index.d.ts b/types/lodash.flattendepth/index.d.ts index 443cdc0cd0..439b417f7d 100644 --- a/types/lodash.flattendepth/index.d.ts +++ b/types/lodash.flattendepth/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flip/index.d.ts b/types/lodash.flip/index.d.ts index 6adfc21057..bd2c9ab212 100644 --- a/types/lodash.flip/index.d.ts +++ b/types/lodash.flip/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.floor/index.d.ts b/types/lodash.floor/index.d.ts index 27cfda6f21..1824957522 100644 --- a/types/lodash.floor/index.d.ts +++ b/types/lodash.floor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flow/index.d.ts b/types/lodash.flow/index.d.ts index e6be4df9cc..7423e07409 100644 --- a/types/lodash.flow/index.d.ts +++ b/types/lodash.flow/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.flowright/index.d.ts b/types/lodash.flowright/index.d.ts index aa53e08fff..b81ad62b46 100644 --- a/types/lodash.flowright/index.d.ts +++ b/types/lodash.flowright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.foreach/index.d.ts b/types/lodash.foreach/index.d.ts index 464cb0e867..cc2b19c167 100644 --- a/types/lodash.foreach/index.d.ts +++ b/types/lodash.foreach/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.foreachright/index.d.ts b/types/lodash.foreachright/index.d.ts index 9ad225ae54..7508ed4471 100644 --- a/types/lodash.foreachright/index.d.ts +++ b/types/lodash.foreachright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.forin/index.d.ts b/types/lodash.forin/index.d.ts index 54669de7f9..c84824f65b 100644 --- a/types/lodash.forin/index.d.ts +++ b/types/lodash.forin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.forinright/index.d.ts b/types/lodash.forinright/index.d.ts index cfa0a1843a..62ff91a3e4 100644 --- a/types/lodash.forinright/index.d.ts +++ b/types/lodash.forinright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.forown/index.d.ts b/types/lodash.forown/index.d.ts index e1df00c22a..15623c7360 100644 --- a/types/lodash.forown/index.d.ts +++ b/types/lodash.forown/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.forownright/index.d.ts b/types/lodash.forownright/index.d.ts index 1a349592fd..13e34be0dd 100644 --- a/types/lodash.forownright/index.d.ts +++ b/types/lodash.forownright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.frompairs/index.d.ts b/types/lodash.frompairs/index.d.ts index f73cb2b9dd..580e3182a8 100644 --- a/types/lodash.frompairs/index.d.ts +++ b/types/lodash.frompairs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.functions/index.d.ts b/types/lodash.functions/index.d.ts index 40abae2872..cf107f3212 100644 --- a/types/lodash.functions/index.d.ts +++ b/types/lodash.functions/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.functionsin/index.d.ts b/types/lodash.functionsin/index.d.ts index 17cca60180..c3cb89d7cd 100644 --- a/types/lodash.functionsin/index.d.ts +++ b/types/lodash.functionsin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.get/index.d.ts b/types/lodash.get/index.d.ts index 7ad640da93..991f9fee99 100644 --- a/types/lodash.get/index.d.ts +++ b/types/lodash.get/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.groupby/index.d.ts b/types/lodash.groupby/index.d.ts index 9363e47b41..1e784cc320 100644 --- a/types/lodash.groupby/index.d.ts +++ b/types/lodash.groupby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.gt/index.d.ts b/types/lodash.gt/index.d.ts index 6a973547b0..ca969f2462 100644 --- a/types/lodash.gt/index.d.ts +++ b/types/lodash.gt/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.gte/index.d.ts b/types/lodash.gte/index.d.ts index f968e8bb20..2f6a589c46 100644 --- a/types/lodash.gte/index.d.ts +++ b/types/lodash.gte/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.has/index.d.ts b/types/lodash.has/index.d.ts index 4f917d5187..4fc7c51bec 100644 --- a/types/lodash.has/index.d.ts +++ b/types/lodash.has/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.hasin/index.d.ts b/types/lodash.hasin/index.d.ts index ca286c6cd9..3789cda6fa 100644 --- a/types/lodash.hasin/index.d.ts +++ b/types/lodash.hasin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.head/index.d.ts b/types/lodash.head/index.d.ts index e26f114bf0..3a9f3883c1 100644 --- a/types/lodash.head/index.d.ts +++ b/types/lodash.head/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.identity/index.d.ts b/types/lodash.identity/index.d.ts index 986c039d2e..66b66ab307 100644 --- a/types/lodash.identity/index.d.ts +++ b/types/lodash.identity/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.includes/index.d.ts b/types/lodash.includes/index.d.ts index 1b490f7aed..34096d9006 100644 --- a/types/lodash.includes/index.d.ts +++ b/types/lodash.includes/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.indexof/index.d.ts b/types/lodash.indexof/index.d.ts index 8102c6a697..64ac787a5d 100644 --- a/types/lodash.indexof/index.d.ts +++ b/types/lodash.indexof/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.initial/index.d.ts b/types/lodash.initial/index.d.ts index 9fa9218416..49c86bb7c9 100644 --- a/types/lodash.initial/index.d.ts +++ b/types/lodash.initial/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.inrange/index.d.ts b/types/lodash.inrange/index.d.ts index 3a817d9d2d..1f3c456d3a 100644 --- a/types/lodash.inrange/index.d.ts +++ b/types/lodash.inrange/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.intersection/index.d.ts b/types/lodash.intersection/index.d.ts index 044cd6949d..b79e8b9050 100644 --- a/types/lodash.intersection/index.d.ts +++ b/types/lodash.intersection/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.intersectionby/index.d.ts b/types/lodash.intersectionby/index.d.ts index a1d01a7c5d..e57c36bfa4 100644 --- a/types/lodash.intersectionby/index.d.ts +++ b/types/lodash.intersectionby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.intersectionwith/index.d.ts b/types/lodash.intersectionwith/index.d.ts index ff7cba542d..561a2ad538 100644 --- a/types/lodash.intersectionwith/index.d.ts +++ b/types/lodash.intersectionwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.invert/index.d.ts b/types/lodash.invert/index.d.ts index 112bbee8e6..905632930b 100644 --- a/types/lodash.invert/index.d.ts +++ b/types/lodash.invert/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.invertby/index.d.ts b/types/lodash.invertby/index.d.ts index f7c8ef8ee7..181970a286 100644 --- a/types/lodash.invertby/index.d.ts +++ b/types/lodash.invertby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.invoke/index.d.ts b/types/lodash.invoke/index.d.ts index fb979c2079..82ddb56083 100644 --- a/types/lodash.invoke/index.d.ts +++ b/types/lodash.invoke/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.invokemap/index.d.ts b/types/lodash.invokemap/index.d.ts index 7cefb18454..28ed42e42b 100644 --- a/types/lodash.invokemap/index.d.ts +++ b/types/lodash.invokemap/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isarguments/index.d.ts b/types/lodash.isarguments/index.d.ts index 9f8704e327..1f9b59f548 100644 --- a/types/lodash.isarguments/index.d.ts +++ b/types/lodash.isarguments/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isarray/index.d.ts b/types/lodash.isarray/index.d.ts index 60299a147c..96a64836d4 100644 --- a/types/lodash.isarray/index.d.ts +++ b/types/lodash.isarray/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isarraybuffer/index.d.ts b/types/lodash.isarraybuffer/index.d.ts index ddeee837b6..3c44819f19 100644 --- a/types/lodash.isarraybuffer/index.d.ts +++ b/types/lodash.isarraybuffer/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isarraylike/index.d.ts b/types/lodash.isarraylike/index.d.ts index 761e226f3d..a56d9bbfa6 100644 --- a/types/lodash.isarraylike/index.d.ts +++ b/types/lodash.isarraylike/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isarraylikeobject/index.d.ts b/types/lodash.isarraylikeobject/index.d.ts index 8a3562ef04..545d6a3519 100644 --- a/types/lodash.isarraylikeobject/index.d.ts +++ b/types/lodash.isarraylikeobject/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isboolean/index.d.ts b/types/lodash.isboolean/index.d.ts index 60d3b863a8..cf84173cd1 100644 --- a/types/lodash.isboolean/index.d.ts +++ b/types/lodash.isboolean/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isbuffer/index.d.ts b/types/lodash.isbuffer/index.d.ts index e39e927ff1..34b164cfa3 100644 --- a/types/lodash.isbuffer/index.d.ts +++ b/types/lodash.isbuffer/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isdate/index.d.ts b/types/lodash.isdate/index.d.ts index cba12e469a..3023be1957 100644 --- a/types/lodash.isdate/index.d.ts +++ b/types/lodash.isdate/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.iselement/index.d.ts b/types/lodash.iselement/index.d.ts index 751b675421..9e83bcacc3 100644 --- a/types/lodash.iselement/index.d.ts +++ b/types/lodash.iselement/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isempty/index.d.ts b/types/lodash.isempty/index.d.ts index 92bf9b2168..b0516dca34 100644 --- a/types/lodash.isempty/index.d.ts +++ b/types/lodash.isempty/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isequal/index.d.ts b/types/lodash.isequal/index.d.ts index 0a00fb83ce..0bae99d588 100644 --- a/types/lodash.isequal/index.d.ts +++ b/types/lodash.isequal/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isequalwith/index.d.ts b/types/lodash.isequalwith/index.d.ts index 05eaecdbd0..2c00d66f7c 100644 --- a/types/lodash.isequalwith/index.d.ts +++ b/types/lodash.isequalwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.iserror/index.d.ts b/types/lodash.iserror/index.d.ts index 5e31aa33de..ae18901b11 100644 --- a/types/lodash.iserror/index.d.ts +++ b/types/lodash.iserror/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isfinite/index.d.ts b/types/lodash.isfinite/index.d.ts index 7d4874cd4a..398f037e5b 100644 --- a/types/lodash.isfinite/index.d.ts +++ b/types/lodash.isfinite/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isfunction/index.d.ts b/types/lodash.isfunction/index.d.ts index b0876bfe82..4dd84dbde7 100644 --- a/types/lodash.isfunction/index.d.ts +++ b/types/lodash.isfunction/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isinteger/index.d.ts b/types/lodash.isinteger/index.d.ts index e42d7bb1ac..8ea23c1c00 100644 --- a/types/lodash.isinteger/index.d.ts +++ b/types/lodash.isinteger/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.islength/index.d.ts b/types/lodash.islength/index.d.ts index 86c63fd45b..1567bba3f5 100644 --- a/types/lodash.islength/index.d.ts +++ b/types/lodash.islength/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.ismap/index.d.ts b/types/lodash.ismap/index.d.ts index 10ebdf8fe4..bebdcf2c6b 100644 --- a/types/lodash.ismap/index.d.ts +++ b/types/lodash.ismap/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.ismatch/index.d.ts b/types/lodash.ismatch/index.d.ts index 6439efb285..64f40ce6a9 100644 --- a/types/lodash.ismatch/index.d.ts +++ b/types/lodash.ismatch/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.ismatchwith/index.d.ts b/types/lodash.ismatchwith/index.d.ts index 322b329308..382c6d6253 100644 --- a/types/lodash.ismatchwith/index.d.ts +++ b/types/lodash.ismatchwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isnan/index.d.ts b/types/lodash.isnan/index.d.ts index 3f2067314f..9e5c35cce4 100644 --- a/types/lodash.isnan/index.d.ts +++ b/types/lodash.isnan/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isnative/index.d.ts b/types/lodash.isnative/index.d.ts index eb00733bee..e374f644c2 100644 --- a/types/lodash.isnative/index.d.ts +++ b/types/lodash.isnative/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isnil/index.d.ts b/types/lodash.isnil/index.d.ts index fed4d9b833..6120f80ea6 100644 --- a/types/lodash.isnil/index.d.ts +++ b/types/lodash.isnil/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isnull/index.d.ts b/types/lodash.isnull/index.d.ts index 73ebb73e1b..4c42cf8e06 100644 --- a/types/lodash.isnull/index.d.ts +++ b/types/lodash.isnull/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isnumber/index.d.ts b/types/lodash.isnumber/index.d.ts index 28132eb6a9..722da3ade2 100644 --- a/types/lodash.isnumber/index.d.ts +++ b/types/lodash.isnumber/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isobject/index.d.ts b/types/lodash.isobject/index.d.ts index e1e05723b8..3490c30643 100644 --- a/types/lodash.isobject/index.d.ts +++ b/types/lodash.isobject/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isobjectlike/index.d.ts b/types/lodash.isobjectlike/index.d.ts index 6ad791127f..a475ce9b0e 100644 --- a/types/lodash.isobjectlike/index.d.ts +++ b/types/lodash.isobjectlike/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isplainobject/index.d.ts b/types/lodash.isplainobject/index.d.ts index c76bc92a64..087f9aeba9 100644 --- a/types/lodash.isplainobject/index.d.ts +++ b/types/lodash.isplainobject/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isregexp/index.d.ts b/types/lodash.isregexp/index.d.ts index 65669eed68..1ffd065e36 100644 --- a/types/lodash.isregexp/index.d.ts +++ b/types/lodash.isregexp/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.issafeinteger/index.d.ts b/types/lodash.issafeinteger/index.d.ts index 62bf5880c3..f3f5fe9c3a 100644 --- a/types/lodash.issafeinteger/index.d.ts +++ b/types/lodash.issafeinteger/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isset/index.d.ts b/types/lodash.isset/index.d.ts index 76a6789d52..a39e705480 100644 --- a/types/lodash.isset/index.d.ts +++ b/types/lodash.isset/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isstring/index.d.ts b/types/lodash.isstring/index.d.ts index 81bcc8236a..bc54bf85ea 100644 --- a/types/lodash.isstring/index.d.ts +++ b/types/lodash.isstring/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.issymbol/index.d.ts b/types/lodash.issymbol/index.d.ts index 51a1313671..b59db2a3ef 100644 --- a/types/lodash.issymbol/index.d.ts +++ b/types/lodash.issymbol/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.istypedarray/index.d.ts b/types/lodash.istypedarray/index.d.ts index 5721a94c58..76ca43e3b0 100644 --- a/types/lodash.istypedarray/index.d.ts +++ b/types/lodash.istypedarray/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isundefined/index.d.ts b/types/lodash.isundefined/index.d.ts index a0f2f068fc..e893f5c4da 100644 --- a/types/lodash.isundefined/index.d.ts +++ b/types/lodash.isundefined/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isweakmap/index.d.ts b/types/lodash.isweakmap/index.d.ts index 28dc1febf5..651c976447 100644 --- a/types/lodash.isweakmap/index.d.ts +++ b/types/lodash.isweakmap/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.isweakset/index.d.ts b/types/lodash.isweakset/index.d.ts index 72465044fd..bf5ed2716e 100644 --- a/types/lodash.isweakset/index.d.ts +++ b/types/lodash.isweakset/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.iteratee/index.d.ts b/types/lodash.iteratee/index.d.ts index 29e1cc29fd..cecd754bf7 100644 --- a/types/lodash.iteratee/index.d.ts +++ b/types/lodash.iteratee/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.join/index.d.ts b/types/lodash.join/index.d.ts index 7769af5a06..357d8d151c 100644 --- a/types/lodash.join/index.d.ts +++ b/types/lodash.join/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.kebabcase/index.d.ts b/types/lodash.kebabcase/index.d.ts index 70ca258fe0..307f821ce9 100644 --- a/types/lodash.kebabcase/index.d.ts +++ b/types/lodash.kebabcase/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.keyby/index.d.ts b/types/lodash.keyby/index.d.ts index e02a4dd3f5..93626ab4d2 100644 --- a/types/lodash.keyby/index.d.ts +++ b/types/lodash.keyby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.keys/index.d.ts b/types/lodash.keys/index.d.ts index 177620ea0c..3db0980f97 100644 --- a/types/lodash.keys/index.d.ts +++ b/types/lodash.keys/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.keysin/index.d.ts b/types/lodash.keysin/index.d.ts index 98dd57b500..1e3f0bbcfa 100644 --- a/types/lodash.keysin/index.d.ts +++ b/types/lodash.keysin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.last/index.d.ts b/types/lodash.last/index.d.ts index dc2fadedb3..8403d5af99 100644 --- a/types/lodash.last/index.d.ts +++ b/types/lodash.last/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.lastindexof/index.d.ts b/types/lodash.lastindexof/index.d.ts index 891d2ca084..e991ef92b6 100644 --- a/types/lodash.lastindexof/index.d.ts +++ b/types/lodash.lastindexof/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.lowercase/index.d.ts b/types/lodash.lowercase/index.d.ts index 05a5a0a20e..dc349eeb90 100644 --- a/types/lodash.lowercase/index.d.ts +++ b/types/lodash.lowercase/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.lowerfirst/index.d.ts b/types/lodash.lowerfirst/index.d.ts index 05f3e6d760..6bd7aa96ff 100644 --- a/types/lodash.lowerfirst/index.d.ts +++ b/types/lodash.lowerfirst/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.lt/index.d.ts b/types/lodash.lt/index.d.ts index c9ef9da1b9..b4ccae8b22 100644 --- a/types/lodash.lt/index.d.ts +++ b/types/lodash.lt/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.lte/index.d.ts b/types/lodash.lte/index.d.ts index 7361ef610e..e3a61cfaa0 100644 --- a/types/lodash.lte/index.d.ts +++ b/types/lodash.lte/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.mapkeys/index.d.ts b/types/lodash.mapkeys/index.d.ts index 145fe41b89..c5b4cae952 100644 --- a/types/lodash.mapkeys/index.d.ts +++ b/types/lodash.mapkeys/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.mapvalues/index.d.ts b/types/lodash.mapvalues/index.d.ts index 86fb63ed4d..a6c2eaac45 100644 --- a/types/lodash.mapvalues/index.d.ts +++ b/types/lodash.mapvalues/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.matches/index.d.ts b/types/lodash.matches/index.d.ts index ebdc90e017..415a6d2738 100644 --- a/types/lodash.matches/index.d.ts +++ b/types/lodash.matches/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.matchesproperty/index.d.ts b/types/lodash.matchesproperty/index.d.ts index 533656be56..3e84c8decb 100644 --- a/types/lodash.matchesproperty/index.d.ts +++ b/types/lodash.matchesproperty/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.max/index.d.ts b/types/lodash.max/index.d.ts index 99aa8e2ffc..5957bcde74 100644 --- a/types/lodash.max/index.d.ts +++ b/types/lodash.max/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.maxby/index.d.ts b/types/lodash.maxby/index.d.ts index 9362902bf4..a7a06208c4 100644 --- a/types/lodash.maxby/index.d.ts +++ b/types/lodash.maxby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.mean/index.d.ts b/types/lodash.mean/index.d.ts index 2edd6adb1b..59c53c0dde 100644 --- a/types/lodash.mean/index.d.ts +++ b/types/lodash.mean/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.meanby/index.d.ts b/types/lodash.meanby/index.d.ts index a4305a0560..b0374e7d20 100644 --- a/types/lodash.meanby/index.d.ts +++ b/types/lodash.meanby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.memoize/index.d.ts b/types/lodash.memoize/index.d.ts index 869ae4ba7d..efe1a8b04b 100644 --- a/types/lodash.memoize/index.d.ts +++ b/types/lodash.memoize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.merge/index.d.ts b/types/lodash.merge/index.d.ts index a757f0694e..898750eb58 100644 --- a/types/lodash.merge/index.d.ts +++ b/types/lodash.merge/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.mergewith/index.d.ts b/types/lodash.mergewith/index.d.ts index ea3ceda237..e35006bc36 100644 --- a/types/lodash.mergewith/index.d.ts +++ b/types/lodash.mergewith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.method/index.d.ts b/types/lodash.method/index.d.ts index 6d36760961..8168f96211 100644 --- a/types/lodash.method/index.d.ts +++ b/types/lodash.method/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.methodof/index.d.ts b/types/lodash.methodof/index.d.ts index 057ef55108..ba2dfb7012 100644 --- a/types/lodash.methodof/index.d.ts +++ b/types/lodash.methodof/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.min/index.d.ts b/types/lodash.min/index.d.ts index e8a613f17f..b5b52fe095 100644 --- a/types/lodash.min/index.d.ts +++ b/types/lodash.min/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.minby/index.d.ts b/types/lodash.minby/index.d.ts index d9b6a58bfe..8c3d8dfcdb 100644 --- a/types/lodash.minby/index.d.ts +++ b/types/lodash.minby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.mixin/index.d.ts b/types/lodash.mixin/index.d.ts index ff0a8975da..fd9e480f31 100644 --- a/types/lodash.mixin/index.d.ts +++ b/types/lodash.mixin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.negate/index.d.ts b/types/lodash.negate/index.d.ts index 3043694532..d771f63eb4 100644 --- a/types/lodash.negate/index.d.ts +++ b/types/lodash.negate/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.noop/index.d.ts b/types/lodash.noop/index.d.ts index 30a76c63ce..963f951c93 100644 --- a/types/lodash.noop/index.d.ts +++ b/types/lodash.noop/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.now/index.d.ts b/types/lodash.now/index.d.ts index 1cb3ed1cea..508d07e777 100644 --- a/types/lodash.now/index.d.ts +++ b/types/lodash.now/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.nth/index.d.ts b/types/lodash.nth/index.d.ts index 5368fd7dee..66cda782a2 100644 --- a/types/lodash.nth/index.d.ts +++ b/types/lodash.nth/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.ntharg/index.d.ts b/types/lodash.ntharg/index.d.ts index d444e2cbee..e7bd831879 100644 --- a/types/lodash.ntharg/index.d.ts +++ b/types/lodash.ntharg/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.omit/index.d.ts b/types/lodash.omit/index.d.ts index 38d60f8538..7e15b2f9f9 100644 --- a/types/lodash.omit/index.d.ts +++ b/types/lodash.omit/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.omitby/index.d.ts b/types/lodash.omitby/index.d.ts index 5946e410ac..209ff398bf 100644 --- a/types/lodash.omitby/index.d.ts +++ b/types/lodash.omitby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.once/index.d.ts b/types/lodash.once/index.d.ts index fbe506150b..4dc4c566ae 100644 --- a/types/lodash.once/index.d.ts +++ b/types/lodash.once/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.orderby/index.d.ts b/types/lodash.orderby/index.d.ts index 2e8c5c5da4..485075ca90 100644 --- a/types/lodash.orderby/index.d.ts +++ b/types/lodash.orderby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.over/index.d.ts b/types/lodash.over/index.d.ts index 2d078c4853..0e4d238680 100644 --- a/types/lodash.over/index.d.ts +++ b/types/lodash.over/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.overargs/index.d.ts b/types/lodash.overargs/index.d.ts index 18b7024397..bcaa606780 100644 --- a/types/lodash.overargs/index.d.ts +++ b/types/lodash.overargs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.overevery/index.d.ts b/types/lodash.overevery/index.d.ts index 7ca277f428..85c5b82167 100644 --- a/types/lodash.overevery/index.d.ts +++ b/types/lodash.overevery/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.oversome/index.d.ts b/types/lodash.oversome/index.d.ts index abf71cb967..b0ccb5950d 100644 --- a/types/lodash.oversome/index.d.ts +++ b/types/lodash.oversome/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pad/index.d.ts b/types/lodash.pad/index.d.ts index 516d851dec..cd276e2958 100644 --- a/types/lodash.pad/index.d.ts +++ b/types/lodash.pad/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.padend/index.d.ts b/types/lodash.padend/index.d.ts index fdaf51da25..d2729c4daf 100644 --- a/types/lodash.padend/index.d.ts +++ b/types/lodash.padend/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.padstart/index.d.ts b/types/lodash.padstart/index.d.ts index a91cd5339e..6a6d76247a 100644 --- a/types/lodash.padstart/index.d.ts +++ b/types/lodash.padstart/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.parseint/index.d.ts b/types/lodash.parseint/index.d.ts index 727c8d66c7..f47f64bf23 100644 --- a/types/lodash.parseint/index.d.ts +++ b/types/lodash.parseint/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.partial/index.d.ts b/types/lodash.partial/index.d.ts index 18d68aa00a..102f0e9f63 100644 --- a/types/lodash.partial/index.d.ts +++ b/types/lodash.partial/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.partialright/index.d.ts b/types/lodash.partialright/index.d.ts index b005408404..0c340fcd04 100644 --- a/types/lodash.partialright/index.d.ts +++ b/types/lodash.partialright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.partition/index.d.ts b/types/lodash.partition/index.d.ts index 8abce2b57f..6c825236ee 100644 --- a/types/lodash.partition/index.d.ts +++ b/types/lodash.partition/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pick/index.d.ts b/types/lodash.pick/index.d.ts index e2f2df3d30..50b68a2861 100644 --- a/types/lodash.pick/index.d.ts +++ b/types/lodash.pick/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pickby/index.d.ts b/types/lodash.pickby/index.d.ts index fdf61e9468..611f6236fc 100644 --- a/types/lodash.pickby/index.d.ts +++ b/types/lodash.pickby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.property/index.d.ts b/types/lodash.property/index.d.ts index 0701c0ef8b..f1a42f651b 100644 --- a/types/lodash.property/index.d.ts +++ b/types/lodash.property/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.propertyof/index.d.ts b/types/lodash.propertyof/index.d.ts index 5c22792ce8..2124d0d9a3 100644 --- a/types/lodash.propertyof/index.d.ts +++ b/types/lodash.propertyof/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pull/index.d.ts b/types/lodash.pull/index.d.ts index c9f543ff15..e39449666f 100644 --- a/types/lodash.pull/index.d.ts +++ b/types/lodash.pull/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pullall/index.d.ts b/types/lodash.pullall/index.d.ts index 7cce80257d..b7bff17877 100644 --- a/types/lodash.pullall/index.d.ts +++ b/types/lodash.pullall/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pullallby/index.d.ts b/types/lodash.pullallby/index.d.ts index 77adee2864..3a565c123a 100644 --- a/types/lodash.pullallby/index.d.ts +++ b/types/lodash.pullallby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pullallwith/index.d.ts b/types/lodash.pullallwith/index.d.ts index f11192ffbe..8199b47fd9 100644 --- a/types/lodash.pullallwith/index.d.ts +++ b/types/lodash.pullallwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.pullat/index.d.ts b/types/lodash.pullat/index.d.ts index 4b04d54fac..de603648e1 100644 --- a/types/lodash.pullat/index.d.ts +++ b/types/lodash.pullat/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.random/index.d.ts b/types/lodash.random/index.d.ts index 48147b1b5a..f30cdd73cc 100644 --- a/types/lodash.random/index.d.ts +++ b/types/lodash.random/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.range/index.d.ts b/types/lodash.range/index.d.ts index 9ca85ee30c..2faa2e0de0 100644 --- a/types/lodash.range/index.d.ts +++ b/types/lodash.range/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.rangeright/index.d.ts b/types/lodash.rangeright/index.d.ts index f17168e479..eb21ac069a 100644 --- a/types/lodash.rangeright/index.d.ts +++ b/types/lodash.rangeright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.rearg/index.d.ts b/types/lodash.rearg/index.d.ts index bdde2bd4af..8c1c349117 100644 --- a/types/lodash.rearg/index.d.ts +++ b/types/lodash.rearg/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.reduce/index.d.ts b/types/lodash.reduce/index.d.ts index f7f58198eb..3e87301a13 100644 --- a/types/lodash.reduce/index.d.ts +++ b/types/lodash.reduce/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.reduceright/index.d.ts b/types/lodash.reduceright/index.d.ts index 4fc2a4d54a..7143b8545a 100644 --- a/types/lodash.reduceright/index.d.ts +++ b/types/lodash.reduceright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.reject/index.d.ts b/types/lodash.reject/index.d.ts index b183695eec..fcf24925ee 100644 --- a/types/lodash.reject/index.d.ts +++ b/types/lodash.reject/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.remove/index.d.ts b/types/lodash.remove/index.d.ts index 449e9d62de..9e1c0e7cff 100644 --- a/types/lodash.remove/index.d.ts +++ b/types/lodash.remove/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.repeat/index.d.ts b/types/lodash.repeat/index.d.ts index fcd29d00f0..c594a58bdf 100644 --- a/types/lodash.repeat/index.d.ts +++ b/types/lodash.repeat/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.replace/index.d.ts b/types/lodash.replace/index.d.ts index b3421ff41a..1a41363950 100644 --- a/types/lodash.replace/index.d.ts +++ b/types/lodash.replace/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.rest/index.d.ts b/types/lodash.rest/index.d.ts index bcc5c5e083..1313395b60 100644 --- a/types/lodash.rest/index.d.ts +++ b/types/lodash.rest/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.result/index.d.ts b/types/lodash.result/index.d.ts index 684c213eea..aba9c14ee5 100644 --- a/types/lodash.result/index.d.ts +++ b/types/lodash.result/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.reverse/index.d.ts b/types/lodash.reverse/index.d.ts index 72dbe9e2fe..738afb06bd 100644 --- a/types/lodash.reverse/index.d.ts +++ b/types/lodash.reverse/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.round/index.d.ts b/types/lodash.round/index.d.ts index 7311d157ce..d105a69013 100644 --- a/types/lodash.round/index.d.ts +++ b/types/lodash.round/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sample/index.d.ts b/types/lodash.sample/index.d.ts index 2eb8119f0e..9bd7983185 100644 --- a/types/lodash.sample/index.d.ts +++ b/types/lodash.sample/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.samplesize/index.d.ts b/types/lodash.samplesize/index.d.ts index 1df16efad5..8046278ed6 100644 --- a/types/lodash.samplesize/index.d.ts +++ b/types/lodash.samplesize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.set/index.d.ts b/types/lodash.set/index.d.ts index 686e1588bc..d2628e2f35 100644 --- a/types/lodash.set/index.d.ts +++ b/types/lodash.set/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.setwith/index.d.ts b/types/lodash.setwith/index.d.ts index b61d8ae119..3c4aa25a69 100644 --- a/types/lodash.setwith/index.d.ts +++ b/types/lodash.setwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.shuffle/index.d.ts b/types/lodash.shuffle/index.d.ts index d9374b5072..1961d9f44c 100644 --- a/types/lodash.shuffle/index.d.ts +++ b/types/lodash.shuffle/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.size/index.d.ts b/types/lodash.size/index.d.ts index 18c18eeced..84aedf70cb 100644 --- a/types/lodash.size/index.d.ts +++ b/types/lodash.size/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.slice/index.d.ts b/types/lodash.slice/index.d.ts index c2381806b5..e17a0e5c62 100644 --- a/types/lodash.slice/index.d.ts +++ b/types/lodash.slice/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.snakecase/index.d.ts b/types/lodash.snakecase/index.d.ts index 7b468103ae..5276593906 100644 --- a/types/lodash.snakecase/index.d.ts +++ b/types/lodash.snakecase/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.some/index.d.ts b/types/lodash.some/index.d.ts index 9fb21515a8..cad1fb59df 100644 --- a/types/lodash.some/index.d.ts +++ b/types/lodash.some/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sortby/index.d.ts b/types/lodash.sortby/index.d.ts index 14de9ae556..5cef6f1b8f 100644 --- a/types/lodash.sortby/index.d.ts +++ b/types/lodash.sortby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sortedindex/index.d.ts b/types/lodash.sortedindex/index.d.ts index 23a331e64a..4ca2706774 100644 --- a/types/lodash.sortedindex/index.d.ts +++ b/types/lodash.sortedindex/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sortedindexby/index.d.ts b/types/lodash.sortedindexby/index.d.ts index 6fa690eb63..42abb67d25 100644 --- a/types/lodash.sortedindexby/index.d.ts +++ b/types/lodash.sortedindexby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sortedindexof/index.d.ts b/types/lodash.sortedindexof/index.d.ts index 1905dc923c..194731d861 100644 --- a/types/lodash.sortedindexof/index.d.ts +++ b/types/lodash.sortedindexof/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sortedlastindex/index.d.ts b/types/lodash.sortedlastindex/index.d.ts index 8759590288..f7781aaa66 100644 --- a/types/lodash.sortedlastindex/index.d.ts +++ b/types/lodash.sortedlastindex/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sortedlastindexby/index.d.ts b/types/lodash.sortedlastindexby/index.d.ts index d513d18674..08fdf6553b 100644 --- a/types/lodash.sortedlastindexby/index.d.ts +++ b/types/lodash.sortedlastindexby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sortedlastindexof/index.d.ts b/types/lodash.sortedlastindexof/index.d.ts index 14d5656d62..6032e69d64 100644 --- a/types/lodash.sortedlastindexof/index.d.ts +++ b/types/lodash.sortedlastindexof/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sorteduniq/index.d.ts b/types/lodash.sorteduniq/index.d.ts index 04af0325a0..692a046d7c 100644 --- a/types/lodash.sorteduniq/index.d.ts +++ b/types/lodash.sorteduniq/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sorteduniqby/index.d.ts b/types/lodash.sorteduniqby/index.d.ts index 26c838a01d..d986fe8827 100644 --- a/types/lodash.sorteduniqby/index.d.ts +++ b/types/lodash.sorteduniqby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.split/index.d.ts b/types/lodash.split/index.d.ts index 5400e2345a..361aa0e316 100644 --- a/types/lodash.split/index.d.ts +++ b/types/lodash.split/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.spread/index.d.ts b/types/lodash.spread/index.d.ts index d96b12d1ba..7cc9d2ca08 100644 --- a/types/lodash.spread/index.d.ts +++ b/types/lodash.spread/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.startcase/index.d.ts b/types/lodash.startcase/index.d.ts index 2c00230290..39c5dba0ba 100644 --- a/types/lodash.startcase/index.d.ts +++ b/types/lodash.startcase/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.startswith/index.d.ts b/types/lodash.startswith/index.d.ts index fbd92b4c40..8604081e3c 100644 --- a/types/lodash.startswith/index.d.ts +++ b/types/lodash.startswith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.subtract/index.d.ts b/types/lodash.subtract/index.d.ts index 676efb6f17..ca4600978b 100644 --- a/types/lodash.subtract/index.d.ts +++ b/types/lodash.subtract/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sum/index.d.ts b/types/lodash.sum/index.d.ts index b19d67a4ce..072c2250e3 100644 --- a/types/lodash.sum/index.d.ts +++ b/types/lodash.sum/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.sumby/index.d.ts b/types/lodash.sumby/index.d.ts index a5f6ac015a..d6acf8b452 100644 --- a/types/lodash.sumby/index.d.ts +++ b/types/lodash.sumby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tail/index.d.ts b/types/lodash.tail/index.d.ts index 51c89ef6b9..424d68fc32 100644 --- a/types/lodash.tail/index.d.ts +++ b/types/lodash.tail/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.take/index.d.ts b/types/lodash.take/index.d.ts index dffe621124..6b2449057e 100644 --- a/types/lodash.take/index.d.ts +++ b/types/lodash.take/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.takeright/index.d.ts b/types/lodash.takeright/index.d.ts index 637926a744..dffd09a240 100644 --- a/types/lodash.takeright/index.d.ts +++ b/types/lodash.takeright/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.takerightwhile/index.d.ts b/types/lodash.takerightwhile/index.d.ts index 376124310a..1cd4db0751 100644 --- a/types/lodash.takerightwhile/index.d.ts +++ b/types/lodash.takerightwhile/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.takewhile/index.d.ts b/types/lodash.takewhile/index.d.ts index 8e5e2958b5..ce92968a1d 100644 --- a/types/lodash.takewhile/index.d.ts +++ b/types/lodash.takewhile/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.template/index.d.ts b/types/lodash.template/index.d.ts index 9060d5e979..0506d0c968 100644 --- a/types/lodash.template/index.d.ts +++ b/types/lodash.template/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.throttle/index.d.ts b/types/lodash.throttle/index.d.ts index 0e5e2c3d79..260ec7a7c5 100644 --- a/types/lodash.throttle/index.d.ts +++ b/types/lodash.throttle/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.times/index.d.ts b/types/lodash.times/index.d.ts index dfbfcb0425..1811ac4ae2 100644 --- a/types/lodash.times/index.d.ts +++ b/types/lodash.times/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.toarray/index.d.ts b/types/lodash.toarray/index.d.ts index ea13431aa1..2f48f2ffde 100644 --- a/types/lodash.toarray/index.d.ts +++ b/types/lodash.toarray/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tofinite/index.d.ts b/types/lodash.tofinite/index.d.ts index 5639c9ba0f..86cbf6e544 100644 --- a/types/lodash.tofinite/index.d.ts +++ b/types/lodash.tofinite/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tointeger/index.d.ts b/types/lodash.tointeger/index.d.ts index d662ff0695..b1cabaecdd 100644 --- a/types/lodash.tointeger/index.d.ts +++ b/types/lodash.tointeger/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tolength/index.d.ts b/types/lodash.tolength/index.d.ts index a198d6cb5f..5e6277f4f2 100644 --- a/types/lodash.tolength/index.d.ts +++ b/types/lodash.tolength/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tolower/index.d.ts b/types/lodash.tolower/index.d.ts index a056bef4ae..d31706fdc7 100644 --- a/types/lodash.tolower/index.d.ts +++ b/types/lodash.tolower/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tonumber/index.d.ts b/types/lodash.tonumber/index.d.ts index 85587a3563..5898db9932 100644 --- a/types/lodash.tonumber/index.d.ts +++ b/types/lodash.tonumber/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.topairs/index.d.ts b/types/lodash.topairs/index.d.ts index dec1a83e18..940e3107ca 100644 --- a/types/lodash.topairs/index.d.ts +++ b/types/lodash.topairs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.topairsin/index.d.ts b/types/lodash.topairsin/index.d.ts index 580cd15f14..f5a79e3da6 100644 --- a/types/lodash.topairsin/index.d.ts +++ b/types/lodash.topairsin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.topath/index.d.ts b/types/lodash.topath/index.d.ts index 5778b4a5a8..c66f4ed4aa 100644 --- a/types/lodash.topath/index.d.ts +++ b/types/lodash.topath/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.toplainobject/index.d.ts b/types/lodash.toplainobject/index.d.ts index 26f7eb62b3..b716e2cfa4 100644 --- a/types/lodash.toplainobject/index.d.ts +++ b/types/lodash.toplainobject/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tosafeinteger/index.d.ts b/types/lodash.tosafeinteger/index.d.ts index 5429fe3a24..7f8fb0b640 100644 --- a/types/lodash.tosafeinteger/index.d.ts +++ b/types/lodash.tosafeinteger/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.tostring/index.d.ts b/types/lodash.tostring/index.d.ts index d7aec37cf9..0bb36b6600 100644 --- a/types/lodash.tostring/index.d.ts +++ b/types/lodash.tostring/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.toupper/index.d.ts b/types/lodash.toupper/index.d.ts index a19a7f2293..46bc736e52 100644 --- a/types/lodash.toupper/index.d.ts +++ b/types/lodash.toupper/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.transform/index.d.ts b/types/lodash.transform/index.d.ts index 524dcce29d..0a0cfbfb55 100644 --- a/types/lodash.transform/index.d.ts +++ b/types/lodash.transform/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.trim/index.d.ts b/types/lodash.trim/index.d.ts index 634b4f5843..84c1772922 100644 --- a/types/lodash.trim/index.d.ts +++ b/types/lodash.trim/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.trimend/index.d.ts b/types/lodash.trimend/index.d.ts index 5931c425c1..f788678328 100644 --- a/types/lodash.trimend/index.d.ts +++ b/types/lodash.trimend/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.trimstart/index.d.ts b/types/lodash.trimstart/index.d.ts index 6e9ff19aae..d80dfde5ee 100644 --- a/types/lodash.trimstart/index.d.ts +++ b/types/lodash.trimstart/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.truncate/index.d.ts b/types/lodash.truncate/index.d.ts index 640143ae7d..49ed223a34 100644 --- a/types/lodash.truncate/index.d.ts +++ b/types/lodash.truncate/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.unary/index.d.ts b/types/lodash.unary/index.d.ts index c1cab16bf4..2b5956b22f 100644 --- a/types/lodash.unary/index.d.ts +++ b/types/lodash.unary/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.unescape/index.d.ts b/types/lodash.unescape/index.d.ts index 1a6c126529..9dd615040f 100644 --- a/types/lodash.unescape/index.d.ts +++ b/types/lodash.unescape/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.union/index.d.ts b/types/lodash.union/index.d.ts index f8e1c3982b..1e5de3029e 100644 --- a/types/lodash.union/index.d.ts +++ b/types/lodash.union/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.unionby/index.d.ts b/types/lodash.unionby/index.d.ts index ec59f1b5c6..97c57d7820 100644 --- a/types/lodash.unionby/index.d.ts +++ b/types/lodash.unionby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.unionwith/index.d.ts b/types/lodash.unionwith/index.d.ts index a724b6ed00..0951988b75 100644 --- a/types/lodash.unionwith/index.d.ts +++ b/types/lodash.unionwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.uniq/index.d.ts b/types/lodash.uniq/index.d.ts index d3fcc99bf8..a000cdc57e 100644 --- a/types/lodash.uniq/index.d.ts +++ b/types/lodash.uniq/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.uniqby/index.d.ts b/types/lodash.uniqby/index.d.ts index fdf318f2cc..430cc78f6b 100644 --- a/types/lodash.uniqby/index.d.ts +++ b/types/lodash.uniqby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.uniqueid/index.d.ts b/types/lodash.uniqueid/index.d.ts index f0b38f23ed..13ce1ddaf5 100644 --- a/types/lodash.uniqueid/index.d.ts +++ b/types/lodash.uniqueid/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.uniqwith/index.d.ts b/types/lodash.uniqwith/index.d.ts index 65f00cc772..852bd06e8e 100644 --- a/types/lodash.uniqwith/index.d.ts +++ b/types/lodash.uniqwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.unset/index.d.ts b/types/lodash.unset/index.d.ts index 4308337560..778cba5f35 100644 --- a/types/lodash.unset/index.d.ts +++ b/types/lodash.unset/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.unzip/index.d.ts b/types/lodash.unzip/index.d.ts index a0d6e933c1..c82e6e4240 100644 --- a/types/lodash.unzip/index.d.ts +++ b/types/lodash.unzip/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.unzipwith/index.d.ts b/types/lodash.unzipwith/index.d.ts index 0f95c0377f..de997d4c80 100644 --- a/types/lodash.unzipwith/index.d.ts +++ b/types/lodash.unzipwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.update/index.d.ts b/types/lodash.update/index.d.ts index 165804f25f..a9dc9ae88e 100644 --- a/types/lodash.update/index.d.ts +++ b/types/lodash.update/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.updatewith/index.d.ts b/types/lodash.updatewith/index.d.ts index 3ae0594188..578de0a19b 100644 --- a/types/lodash.updatewith/index.d.ts +++ b/types/lodash.updatewith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.uppercase/index.d.ts b/types/lodash.uppercase/index.d.ts index fb25f87be6..0433e10190 100644 --- a/types/lodash.uppercase/index.d.ts +++ b/types/lodash.uppercase/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.upperfirst/index.d.ts b/types/lodash.upperfirst/index.d.ts index f58a6853f3..a95e6a2325 100644 --- a/types/lodash.upperfirst/index.d.ts +++ b/types/lodash.upperfirst/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.values/index.d.ts b/types/lodash.values/index.d.ts index 9bba06f1a2..5712010b17 100644 --- a/types/lodash.values/index.d.ts +++ b/types/lodash.values/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.valuesin/index.d.ts b/types/lodash.valuesin/index.d.ts index 3da65eabb7..0168a046d0 100644 --- a/types/lodash.valuesin/index.d.ts +++ b/types/lodash.valuesin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.without/index.d.ts b/types/lodash.without/index.d.ts index 624fdd8918..72cb11a8d8 100644 --- a/types/lodash.without/index.d.ts +++ b/types/lodash.without/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.words/index.d.ts b/types/lodash.words/index.d.ts index 304f7c3145..d635b02bbe 100644 --- a/types/lodash.words/index.d.ts +++ b/types/lodash.words/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.wrap/index.d.ts b/types/lodash.wrap/index.d.ts index 410c955027..52d0eb754e 100644 --- a/types/lodash.wrap/index.d.ts +++ b/types/lodash.wrap/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.xor/index.d.ts b/types/lodash.xor/index.d.ts index 0426670d24..ce8257b1be 100644 --- a/types/lodash.xor/index.d.ts +++ b/types/lodash.xor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.xorby/index.d.ts b/types/lodash.xorby/index.d.ts index d1ebbbd9fa..3d15668d8a 100644 --- a/types/lodash.xorby/index.d.ts +++ b/types/lodash.xorby/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.xorwith/index.d.ts b/types/lodash.xorwith/index.d.ts index 6adaa16d35..8120a73dea 100644 --- a/types/lodash.xorwith/index.d.ts +++ b/types/lodash.xorwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.zip/index.d.ts b/types/lodash.zip/index.d.ts index 3ad6804c4f..3aca9880f9 100644 --- a/types/lodash.zip/index.d.ts +++ b/types/lodash.zip/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.zipobject/index.d.ts b/types/lodash.zipobject/index.d.ts index a4c0d0e444..b76f341e3e 100644 --- a/types/lodash.zipobject/index.d.ts +++ b/types/lodash.zipobject/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.zipobjectdeep/index.d.ts b/types/lodash.zipobjectdeep/index.d.ts index b942a3e4c6..b2b3a82dd2 100644 --- a/types/lodash.zipobjectdeep/index.d.ts +++ b/types/lodash.zipobjectdeep/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash.zipwith/index.d.ts b/types/lodash.zipwith/index.d.ts index 39c39005d7..fe58ffb360 100644 --- a/types/lodash.zipwith/index.d.ts +++ b/types/lodash.zipwith/index.d.ts @@ -2,7 +2,7 @@ // Project: https://lodash.com // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/lodash/common/object.d.ts b/types/lodash/common/object.d.ts index b136e9469b..2342a18a06 100644 --- a/types/lodash/common/object.d.ts +++ b/types/lodash/common/object.d.ts @@ -1686,7 +1686,7 @@ declare module "../index" { object: TObject | null | undefined, path: TKey | [TKey], defaultValue: TDefault - ): TObject[TKey] | TDefault; + ): Exclude | TDefault; /** * @see _.get @@ -1763,7 +1763,7 @@ declare module "../index" { this: LoDashImplicitWrapper, path: TKey | [TKey], defaultValue: TDefault - ): TObject[TKey] | TDefault; + ): Exclude | TDefault; /** * @see _.get @@ -1839,7 +1839,7 @@ declare module "../index" { this: LoDashExplicitWrapper, path: TKey | [TKey], defaultValue: TDefault - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper | TDefault>; /** * @see _.get diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index c2c983ca6e..023758b4c3 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -1494,7 +1494,7 @@ declare namespace _ { (defaultValue: lodash.__, path: lodash.__, object: TObject | null | undefined): LodashGetOr1x4; (defaultValue: TDefault, path: lodash.__, object: TObject | null | undefined): LodashGetOr1x5; (defaultValue: lodash.__, path: TKey | [TKey], object: TObject | null | undefined): LodashGetOr1x6; - (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): Exclude | TDefault; (defaultValue: lodash.__, path: number): LodashGetOr2x2; (defaultValue: TDefault, path: number): LodashGetOr2x3; (defaultValue: lodash.__, path: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashGetOr2x4; @@ -1517,7 +1517,7 @@ declare namespace _ { interface LodashGetOr1x1 { (path: TKey | [TKey]): LodashGetOr1x3; (path: lodash.__, object: TObject | null | undefined): LodashGetOr1x5; - (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + (path: TKey | [TKey], object: TObject | null | undefined): Exclude | TDefault; (path: number): LodashGetOr2x3; (path: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashGetOr2x5; (path: number, object: lodash.NumericDictionary | null | undefined): T | TDefault; @@ -1528,16 +1528,16 @@ declare namespace _ { interface LodashGetOr1x2 { (defaultValue: TDefault): LodashGetOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr1x6; - (defaultValue: TDefault, object: TObject | null | undefined): TObject[TKey] | TDefault; + (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; } - type LodashGetOr1x3 = (object: TObject | null | undefined) => TObject[TKey] | TDefault; + type LodashGetOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault; interface LodashGetOr1x4 { (defaultValue: TDefault): LodashGetOr1x5; (defaultValue: lodash.__, path: TKey | [TKey]): LodashGetOr1x6; - (defaultValue: TDefault, path: TKey | [TKey]): TObject[TKey] | TDefault; + (defaultValue: TDefault, path: TKey | [TKey]): Exclude | TDefault; } - type LodashGetOr1x5 = (path: TKey | [TKey]) => TObject[TKey] | TDefault; - type LodashGetOr1x6 = (defaultValue: TDefault) => TObject[TKey] | TDefault; + type LodashGetOr1x5 = (path: TKey | [TKey]) => Exclude | TDefault; + type LodashGetOr1x6 = (defaultValue: TDefault) => Exclude | TDefault; interface LodashGetOr2x2 { (defaultValue: TDefault): LodashGetOr2x3; (defaultValue: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashGetOr2x6; @@ -2756,7 +2756,7 @@ declare namespace _ { (defaultValue: lodash.__, path: lodash.__, object: TObject | null | undefined): LodashPathOr1x4; (defaultValue: TDefault, path: lodash.__, object: TObject | null | undefined): LodashPathOr1x5; (defaultValue: lodash.__, path: TKey | [TKey], object: TObject | null | undefined): LodashPathOr1x6; - (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): Exclude | TDefault; (defaultValue: lodash.__, path: number): LodashPathOr2x2; (defaultValue: TDefault, path: number): LodashPathOr2x3; (defaultValue: lodash.__, path: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashPathOr2x4; @@ -2779,7 +2779,7 @@ declare namespace _ { interface LodashPathOr1x1 { (path: TKey | [TKey]): LodashPathOr1x3; (path: lodash.__, object: TObject | null | undefined): LodashPathOr1x5; - (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + (path: TKey | [TKey], object: TObject | null | undefined): Exclude | TDefault; (path: number): LodashPathOr2x3; (path: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashPathOr2x5; (path: number, object: lodash.NumericDictionary | null | undefined): T | TDefault; @@ -2790,16 +2790,16 @@ declare namespace _ { interface LodashPathOr1x2 { (defaultValue: TDefault): LodashPathOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr1x6; - (defaultValue: TDefault, object: TObject | null | undefined): TObject[TKey] | TDefault; + (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; } - type LodashPathOr1x3 = (object: TObject | null | undefined) => TObject[TKey] | TDefault; + type LodashPathOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault; interface LodashPathOr1x4 { (defaultValue: TDefault): LodashPathOr1x5; (defaultValue: lodash.__, path: TKey | [TKey]): LodashPathOr1x6; - (defaultValue: TDefault, path: TKey | [TKey]): TObject[TKey] | TDefault; + (defaultValue: TDefault, path: TKey | [TKey]): Exclude | TDefault; } - type LodashPathOr1x5 = (path: TKey | [TKey]) => TObject[TKey] | TDefault; - type LodashPathOr1x6 = (defaultValue: TDefault) => TObject[TKey] | TDefault; + type LodashPathOr1x5 = (path: TKey | [TKey]) => Exclude | TDefault; + type LodashPathOr1x6 = (defaultValue: TDefault) => Exclude | TDefault; interface LodashPathOr2x2 { (defaultValue: TDefault): LodashPathOr2x3; (defaultValue: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashPathOr2x6; @@ -2996,7 +2996,7 @@ declare namespace _ { (defaultValue: lodash.__, path: lodash.__, object: TObject | null | undefined): LodashPropOr1x4; (defaultValue: TDefault, path: lodash.__, object: TObject | null | undefined): LodashPropOr1x5; (defaultValue: lodash.__, path: TKey | [TKey], object: TObject | null | undefined): LodashPropOr1x6; - (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + (defaultValue: TDefault, path: TKey | [TKey], object: TObject | null | undefined): Exclude | TDefault; (defaultValue: lodash.__, path: number): LodashPropOr2x2; (defaultValue: TDefault, path: number): LodashPropOr2x3; (defaultValue: lodash.__, path: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashPropOr2x4; @@ -3019,7 +3019,7 @@ declare namespace _ { interface LodashPropOr1x1 { (path: TKey | [TKey]): LodashPropOr1x3; (path: lodash.__, object: TObject | null | undefined): LodashPropOr1x5; - (path: TKey | [TKey], object: TObject | null | undefined): TObject[TKey] | TDefault; + (path: TKey | [TKey], object: TObject | null | undefined): Exclude | TDefault; (path: number): LodashPropOr2x3; (path: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashPropOr2x5; (path: number, object: lodash.NumericDictionary | null | undefined): T | TDefault; @@ -3030,16 +3030,16 @@ declare namespace _ { interface LodashPropOr1x2 { (defaultValue: TDefault): LodashPropOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr1x6; - (defaultValue: TDefault, object: TObject | null | undefined): TObject[TKey] | TDefault; + (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; } - type LodashPropOr1x3 = (object: TObject | null | undefined) => TObject[TKey] | TDefault; + type LodashPropOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault; interface LodashPropOr1x4 { (defaultValue: TDefault): LodashPropOr1x5; (defaultValue: lodash.__, path: TKey | [TKey]): LodashPropOr1x6; - (defaultValue: TDefault, path: TKey | [TKey]): TObject[TKey] | TDefault; + (defaultValue: TDefault, path: TKey | [TKey]): Exclude | TDefault; } - type LodashPropOr1x5 = (path: TKey | [TKey]) => TObject[TKey] | TDefault; - type LodashPropOr1x6 = (defaultValue: TDefault) => TObject[TKey] | TDefault; + type LodashPropOr1x5 = (path: TKey | [TKey]) => Exclude | TDefault; + type LodashPropOr1x6 = (defaultValue: TDefault) => Exclude | TDefault; interface LodashPropOr2x2 { (defaultValue: TDefault): LodashPropOr2x3; (defaultValue: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashPropOr2x6; diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 94cabd0f37..45fb97d010 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -10,7 +10,7 @@ // Jack Moore , // Dominique Rau // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// /// diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 05c1a20215..9aae160f9a 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5148,6 +5148,9 @@ fp.now(); // $ExpectType number // _.get { + const value: string | undefined = anything; + const defaultValue: boolean = anything; + _.get([], Symbol.iterator); _.get([], [Symbol.iterator]); @@ -5157,6 +5160,9 @@ fp.now(); // $ExpectType number _.get({ a: { b: true } }, "a"); // $ExpectType { b: boolean; } _.get({ a: { b: true } }, ["a"]); // $ExpectType { b: boolean; } _.get({ a: { b: true } }, ["a", "b"]); // $ExpectType any + _.get({ a: undefined }, "a"); // $ExpectType undefined + _.get({ a: value }, "a", defaultValue); // $ExpectType string | boolean + _.get({ a: undefined }, "a", defaultValue); // $ExpectType boolean _("abc").get(1); // $ExpectType string _("abc").get(["0"], "_"); @@ -5164,6 +5170,9 @@ fp.now(); // $ExpectType number _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } _({ a: { b: true } }).get(["a"]); // $ExpectType { b: boolean; } _({ a: { b: true } }).get(["a", "b"]); // $ExpectType any + _({ a: undefined }).get("a"); // $ExpectType undefined + _({ a: value }).get("a", defaultValue); // $ExpectType string | boolean + _({ a: undefined }).get("a", defaultValue); // $ExpectType boolean _.chain("abc").get(1); // $ExpectType LoDashExplicitWrapper _.chain("abc").get(["0"], "_"); @@ -5171,6 +5180,9 @@ fp.now(); // $ExpectType number _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper + _.chain({ a: undefined }).get("a"); // $ExpectType LoDashExplicitWrapper + _.chain({ a: value }).get("a", defaultValue); // $ExpectType LoDashExplicitWrapper + _.chain({ a: undefined }).get("a", defaultValue); // $ExpectType LoDashExplicitWrapper fp.get(Symbol.iterator, []); // $ExpectType any fp.get(Symbol.iterator)([]); // $ExpectType any diff --git a/types/lodash/scripts/generate-modules.ts b/types/lodash/scripts/generate-modules.ts index 28d5e585c3..6965242937 100644 --- a/types/lodash/scripts/generate-modules.ts +++ b/types/lodash/scripts/generate-modules.ts @@ -56,7 +56,7 @@ async function globalDefinitionText(moduleName: string): Promise { // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts diff --git a/types/log-update/index.d.ts b/types/log-update/index.d.ts deleted file mode 100644 index 544223a766..0000000000 --- a/types/log-update/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Type definitions for log-update 2.0 -// Project: https://github.com/sindresorhus/log-update#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export = logUpdate; - -declare function logUpdate(...text: string[]): void; - -declare namespace logUpdate { - function clear(): void; - function done(): void; - const stderr: typeof logUpdate; - function create(stream: NodeJS.WritableStream): typeof logUpdate; -} diff --git a/types/log-update/log-update-tests.ts b/types/log-update/log-update-tests.ts deleted file mode 100644 index 9a0955f7d4..0000000000 --- a/types/log-update/log-update-tests.ts +++ /dev/null @@ -1,19 +0,0 @@ -import logUpdate = require('log-update'); - -logUpdate(` - ♥♥ - unicorns - ♥♥ -`); - -logUpdate.clear(); -logUpdate.done(); - -logUpdate.stderr('oh', 'my', 'oh', 'my'); -logUpdate.stderr.clear(); -logUpdate.stderr.done(); - -const logStdOut = logUpdate.create(process.stdout); -logStdOut('oh', 'my', 'oh', 'my'); -logStdOut.clear(); -logStdOut.done(); diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index 35c4880a5b..1a33a60c7d 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for lolex 3 +// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman // Josh Goldberg @@ -9,7 +9,7 @@ /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). @@ -126,6 +126,22 @@ export interface LolexClock extends GlobalTimers void; + /** + * Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop. + * + * @param callback Callback to be fired. + * @param timeout The maximum number of ticks before the callback must be fired. + * @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds. + */ + requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId; + + /** + * Clears a timer, as long as it was created using requestIdleCallback. + * + * @param id Timer ID or object. + */ + cancelIdleCallback: (id: TTimerId) => void; + /** * Get the number of waiting timers. * diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 2a01dd5916..d09cfcc042 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -59,10 +59,14 @@ const browserTimeout: number = browserClock.setTimeout(() => {}, 7); const browserInterval: number = browserClock.setInterval(() => {}, 7); const browserImmediate: number = browserClock.setImmediate(() => {}); const browserAnimationFrame: number = browserClock.requestAnimationFrame(() => {}); +const browserIdleCallback: number = browserClock.requestIdleCallback(() => {}); +const browserIdleCallbackWithTimeout: number = browserClock.requestIdleCallback(() => {}, 7); const nodeTimeout: lolex.NodeTimer = nodeClock.setTimeout(() => {}, 7); const nodeInterval: lolex.NodeTimer = nodeClock.setInterval(() => {}, 7); const nodeImmediate: lolex.NodeTimer = nodeClock.setImmediate(() => {}); const nodeAnimationFrame: lolex.NodeTimer = nodeClock.requestAnimationFrame(() => {}); +const nodeIdleCallback: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}); +const nodeIdleCallbackWithTimeout: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}, 7); nodeTimeout.ref(); nodeTimeout.unref(); @@ -71,11 +75,15 @@ browserClock.clearTimeout(browserTimeout); browserClock.clearInterval(browserInterval); browserClock.clearImmediate(browserImmediate); browserClock.cancelAnimationFrame(browserAnimationFrame); +browserClock.cancelIdleCallback(browserIdleCallback); +browserClock.cancelIdleCallback(browserIdleCallbackWithTimeout); nodeClock.clearTimeout(nodeTimeout); nodeClock.clearInterval(nodeInterval); nodeClock.clearImmediate(nodeImmediate); nodeClock.cancelAnimationFrame(nodeAnimationFrame); +nodeClock.cancelIdleCallback(nodeIdleCallback); +nodeClock.cancelIdleCallback(nodeIdleCallbackWithTimeout); browserClock.tick(7); browserClock.tick("08"); diff --git a/types/lowdb/_lodash.d.ts b/types/lowdb/_lodash.d.ts index 7267aab0d9..c24e2f1c08 100644 --- a/types/lowdb/_lodash.d.ts +++ b/types/lowdb/_lodash.d.ts @@ -1132,7 +1132,7 @@ declare module "./index" { this: LoDashExplicitSyncWrapper, path: TKey | [TKey], defaultValue: TDefault - ): LoDashExplicitSyncWrapper; + ): LoDashExplicitSyncWrapper | TDefault>; get( this: LoDashExplicitSyncWrapper<_.NumericDictionary>, path: number @@ -2728,7 +2728,7 @@ declare module "./index" { this: LoDashExplicitAsyncWrapper, path: TKey | [TKey], defaultValue: TDefault - ): LoDashExplicitAsyncWrapper; + ): LoDashExplicitAsyncWrapper | TDefault>; get( this: LoDashExplicitAsyncWrapper<_.NumericDictionary>, path: number diff --git a/types/lowdb/index.d.ts b/types/lowdb/index.d.ts index a8146ef8a2..3663b35823 100644 --- a/types/lowdb/index.d.ts +++ b/types/lowdb/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: typicode // Bazyli Brzóska // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// diff --git a/types/make-dir/index.d.ts b/types/make-dir/index.d.ts deleted file mode 100644 index 1805280240..0000000000 --- a/types/make-dir/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Type definitions for make-dir 1.0 -// Project: https://github.com/sindresorhus/make-dir -// Definitions by: Ika -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/// -import * as fs from 'fs'; - -export = makeDir; - -/** - * Returns a `Promise` for the path to the created directory. - * @param path Directory to create. - */ -declare function makeDir(path: string, options?: makeDir.Options): Promise; - -declare namespace makeDir { - /** - * Returns the path to the created directory. - * @param path Directory to create. - */ - function sync(path: string, options?: Options): string; - - interface Options { - /** - * Default: `0o777 & (~process.umask())` - * - * Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). - */ - mode?: number; - - /** - * Default: `require('fs')` - * - * Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). - */ - fs?: typeof fs; - } -} diff --git a/types/make-dir/make-dir-tests.ts b/types/make-dir/make-dir-tests.ts deleted file mode 100644 index 2767706bf6..0000000000 --- a/types/make-dir/make-dir-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import makeDir = require('make-dir'); -import * as fs from 'fs'; -import * as gfs from 'graceful-fs'; - -makeDir('path/to/somewhere').then(dirname => { - // do something -}); - -const dirname = makeDir.sync('path/to/somewhere'); - -makeDir('path/to/somewhere', {mode: parseInt('777', 8)}); -makeDir('path/to/somewhere', {fs}); -makeDir('path/to/somewhere', {fs: gfs}); diff --git a/types/make-dir/tsconfig.json b/types/make-dir/tsconfig.json deleted file mode 100644 index f1770d52af..0000000000 --- a/types/make-dir/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "make-dir-tests.ts" - ] -} \ No newline at end of file diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index 78a45b052c..74dfec5317 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -4,6 +4,7 @@ // BendingBender // CrossR // Mike Wickett +// Hitomi Hatsukaze // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace marked; @@ -102,6 +103,26 @@ declare namespace marked { text(text: string): string; } + class TextRenderer { + strong(text: string): string; + em(text: string): string; + codespan(text: string): string; + del(text: string): string; + text(text: string): string; + link(href: string, title: string, text: string): string; + image(href: string, title: string, text: string): string; + br(): string; + } + + class Parser { + constructor(options?: MarkedOptions); + parse(src: TokensList): string; + next(): Token; + peek(): Token | number; + parseText(): string; + tok(): string; + } + class Lexer { rules: Rules; tokens: TokensList; diff --git a/types/marked/marked-tests.ts b/types/marked/marked-tests.ts index 0edc376e43..2af775e397 100644 --- a/types/marked/marked-tests.ts +++ b/types/marked/marked-tests.ts @@ -48,3 +48,11 @@ const slugger = new marked.Slugger(); renderer.heading = (text, level, raw, slugger) => { return text + level.toString() + slugger.slug(raw); }; + +const textRenderer = new marked.TextRenderer(); +console.log(textRenderer.strong(text)); + +const parseTestText = "- list1\n - list1.1\n\n listend"; +const parseTestTokens: marked.TokensList = marked.lexer(parseTestText, options); +const parser = new marked.Parser(); +console.log(parser.parse(parseTestTokens)); diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index 20fb7154cb..285aed9e56 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for mathjs 5.0 -// Project: http://mathjs.org/ +// Project: https://mathjs.org/ // Definitions by: Ilya Shestakov , // Andy Patterson , // Brad Besserman diff --git a/types/moment-timezone/index.d.ts b/types/moment-timezone/index.d.ts index 95a8621fdd..9d365f01b4 100644 --- a/types/moment-timezone/index.d.ts +++ b/types/moment-timezone/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Michel Salib // Alan Brazil Lins // Agustin Carrasco +// Borys Kupar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import moment = require('moment'); diff --git a/types/moment-timezone/moment-timezone.d.ts b/types/moment-timezone/moment-timezone.d.ts new file mode 100644 index 0000000000..4f06f7e4f1 --- /dev/null +++ b/types/moment-timezone/moment-timezone.d.ts @@ -0,0 +1,3 @@ +import moment = require('moment'); + +export = moment; diff --git a/types/moment-timezone/tsconfig.json b/types/moment-timezone/tsconfig.json index 62cbfb4214..55ec6cf7bb 100644 --- a/types/moment-timezone/tsconfig.json +++ b/types/moment-timezone/tsconfig.json @@ -18,6 +18,7 @@ }, "files": [ "index.d.ts", + "moment-timezone.d.ts", "moment-timezone-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 79da3d5ead..230f593094 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -876,17 +876,8 @@ export interface Collection { findOne(filter: FilterQuery, options: FindOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ findOneAndDelete(filter: FilterQuery, callback: MongoCallback>): void; - findOneAndDelete(filter: FilterQuery, options?: { projection?: object, sort?: object, maxTimeMS?: number, session?: ClientSession }): Promise>; - findOneAndDelete( - filter: FilterQuery, - options: { - projection?: object, - sort?: object, - maxTimeMS?: number, - session?: ClientSession - }, - callback: MongoCallback> - ): void; + findOneAndDelete(filter: FilterQuery, options?: FindOneAndDeleteOption): Promise>; + findOneAndDelete(filter: FilterQuery, options: FindOneAndDeleteOption, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndReplace */ findOneAndReplace(filter: FilterQuery, replacement: object, callback: MongoCallback>): void; findOneAndReplace(filter: FilterQuery, replacement: object, options?: FindOneAndReplaceOption): Promise>; @@ -1317,7 +1308,7 @@ export interface CollectionAggregationOptions { * Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ bypassDocumentValidation?: boolean; - hint?: string | object; + hint?: string | object; raw?: boolean; promoteLongs?: boolean; promoteValues?: boolean; @@ -1432,6 +1423,7 @@ export interface FindOneAndReplaceOption extends CommonOptions { maxTimeMS?: number; upsert?: boolean; returnOriginal?: boolean; + collation?: CollationDocument; } /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndUpdate */ @@ -1439,6 +1431,15 @@ export interface FindOneAndUpdateOption extends FindOneAndReplaceOption { arrayFilters?: object[]; } +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ +export interface FindOneAndDeleteOption { + projection?: object; + sort?: object; + maxTimeMS?: number; + session?: ClientSession; + collation?: CollationDocument; +} + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoHaystackSearch */ export interface GeoHaystackSearchOptions { readPreference?: ReadPreference | string; @@ -1847,9 +1848,9 @@ export type CommandCursorResult = object | null; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html */ export class CommandCursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#hasNext */ - hasNext(): Promise; + hasNext(): Promise; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#hasNext */ - hasNext(callback: MongoCallback): void; + hasNext(callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#batchSize */ batchSize(value: number): CommandCursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#clone */ diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index e51290b451..7b02fb96d6 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -2423,6 +2423,13 @@ declare module "mongoose" { */ discriminator(name: string, schema: Schema): Model; + /** + * Adds a discriminator type. + * @param name discriminator model name + * @param schema discriminator model schema + */ + discriminator>(name: string, schema: Schema): M; + } /* diff --git a/types/move-file/index.d.ts b/types/move-file/index.d.ts deleted file mode 100644 index 7c86feca71..0000000000 --- a/types/move-file/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Type definitions for move-file 1.0 -// Project: https://github.com/sindresorhus/move-file#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = moveFile; - -declare function moveFile( - source: string, - destination: string, - options?: moveFile.Options -): Promise; - -declare namespace moveFile { - function sync(source: string, destination: string, options?: Options): void; - - interface Options { - overwrite?: boolean; - } -} diff --git a/types/move-file/move-file-tests.ts b/types/move-file/move-file-tests.ts deleted file mode 100644 index 36badd38c1..0000000000 --- a/types/move-file/move-file-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import moveFile = require('move-file'); - -// $ExpectType Promise -moveFile('source/unicorn.png', 'destination/unicorn.png'); -// $ExpectType Promise -moveFile('source/unicorn.png', 'destination/unicorn.png', { overwrite: false }); -// $ExpectType void -moveFile.sync('source/unicorn.png', 'destination/unicorn.png'); -// $ExpectType void -moveFile.sync('source/unicorn.png', 'destination/unicorn.png', { overwrite: false }); diff --git a/types/mumath/clamp.d.ts b/types/mumath/clamp.d.ts new file mode 100644 index 0000000000..9d674a9620 --- /dev/null +++ b/types/mumath/clamp.d.ts @@ -0,0 +1,6 @@ +/** + * Detects proper clamp min/max. + */ +declare function clamp(value: number, left: number, right: number): number; + +export = clamp; diff --git a/types/mumath/closest.d.ts b/types/mumath/closest.d.ts new file mode 100644 index 0000000000..762bcb6548 --- /dev/null +++ b/types/mumath/closest.d.ts @@ -0,0 +1,6 @@ +/** + * Get closest value out of a set. + */ +declare function closest(value: number, list: number[]): number; + +export = closest; diff --git a/types/mumath/index.d.ts b/types/mumath/index.d.ts index 8967bafa4f..ee0f0ff6c6 100644 --- a/types/mumath/index.d.ts +++ b/types/mumath/index.d.ts @@ -2,62 +2,17 @@ // Project: https://github.com/dfcreative/mumath // Definitions by: Adam Zerella // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.3 -/** - * Detects proper clamp min/max. - */ -export function clamp(value: number, left: number, right: number): number; +import clamp = require('./clamp'); +import closest = require('./closest'); +import isMultiple = require('./isMultiple'); +import len = require('./len'); +import lerp = require('./lerp'); +import mod = require('./mod'); +import order = require('./order'); +import precision = require('./precision'); +import round = require('./round'); +import scale = require('./scale'); +import within = require('./within'); -/** - * Get closest value out of a set. - */ -export function closest(value: number, list: number[]): number; - -/** - * Check if one number is multiple of other - * Same as a % b === 0, but with precision check. - */ -export function isMultiple(a: number, b: number, eps?: number): boolean; - -/** - * Return quadratic length of a vector. - */ -export function len(a: number, b: number): number; - -/** - * Return value interpolated between x and y. - */ -export function lerp(x: number, y: number, ratio: number): number; - -/** - * An enhanced mod-loop, like fmod — loops value within a frame. - */ -export function mod(value: number, max: number, min?: number): number; - -/** - * Get order of magnitude for a number. - */ -export function order(value: number): number; - -/** - * Get precision from float: - */ -export function precision(value: number): number; - -/** - * Rounds value to optional step. - */ -export function round(value: number, step?: number): number; - -/** - * Get first scale out of a list of basic scales, aligned to the power. E. g. - * step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000 - * Similar to closest, but takes all possible powers of scales. - */ -export function scale(value: number, list: number[]): number; - -/** - * Whether element is between left & right, including. - */ -export function within(value: number, left: number, right: number): number; +export { clamp, closest, isMultiple, len, lerp, mod, order, precision, round, scale, within }; diff --git a/types/mumath/isMultiple.d.ts b/types/mumath/isMultiple.d.ts new file mode 100644 index 0000000000..31c7a09b08 --- /dev/null +++ b/types/mumath/isMultiple.d.ts @@ -0,0 +1,7 @@ +/** + * Check if one number is multiple of other + * Same as a % b === 0, but with precision check. + */ +declare function isMultiple(a: number, b: number, eps?: number): boolean; + +export = isMultiple; diff --git a/types/mumath/len.d.ts b/types/mumath/len.d.ts new file mode 100644 index 0000000000..b2fae8a8e5 --- /dev/null +++ b/types/mumath/len.d.ts @@ -0,0 +1,6 @@ +/** + * Return quadratic length of a vector. + */ +declare function len(a: number, b: number): number; + +export = len; diff --git a/types/mumath/lerp.d.ts b/types/mumath/lerp.d.ts new file mode 100644 index 0000000000..5e09370be2 --- /dev/null +++ b/types/mumath/lerp.d.ts @@ -0,0 +1,6 @@ +/** + * Return value interpolated between x and y. + */ +declare function lerp(x: number, y: number, ratio: number): number; + +export = lerp; diff --git a/types/mumath/mod.d.ts b/types/mumath/mod.d.ts new file mode 100644 index 0000000000..ac1784fe06 --- /dev/null +++ b/types/mumath/mod.d.ts @@ -0,0 +1,6 @@ +/** + * An enhanced mod-loop, like fmod — loops value within a frame. + */ +declare function mod(value: number, max: number, min?: number): number; + +export = mod; diff --git a/types/mumath/mumath-tests.ts b/types/mumath/mumath-tests.ts index c0fed04336..a5b339b2fe 100644 --- a/types/mumath/mumath-tests.ts +++ b/types/mumath/mumath-tests.ts @@ -1,25 +1,48 @@ -import * as mumath from "mumath"; +import mumath = require("mumath"); + +import mumathClamp = require("mumath/clamp"); +import mumathClosest = require("mumath/closest"); +import mumathIsMultiple = require("mumath/isMultiple"); +import mumathLen = require("mumath/len"); +import mumathLerp = require("mumath/lerp"); +import mumathMod = require("mumath/mod"); +import mumathOrder = require("mumath/order"); +import mumathPrecision = require("mumath/precision"); +import mumathRound = require("mumath/round"); +import mumathScale = require("mumath/scale"); +import mumathWithin = require("mumath/within"); mumath.clamp(1, 2, 3); +mumathClamp(1, 2, 3); mumath.closest(5, [1, 7, 3, 6, 10]); +mumathClosest(5, [1, 7, 3, 6, 10]); mumath.isMultiple(5, 10, 1.000074); mumath.isMultiple(5, 10); +mumathIsMultiple(5, 10, 1.000074); mumath.len(15, 1.0); +mumathLen(15, 1.0); mumath.lerp(1, 2, 3); +mumathLerp(1, 2, 3); mumath.mod(1, 2, 3); mumath.mod(1, 2); +mumathMod(1, 2, 3); mumath.order(5); +mumathOrder(5); mumath.precision(5.0000001); +mumathPrecision(5.0000001); mumath.round(0.3, 0.5); +mumathRound(0.3, 0.5); mumath.scale(5.93, [1.0, 35, 10, 7.135]); +mumathScale(5.93, [1.0, 35, 10, 7.135]); mumath.within(5, 1, 10); +mumathWithin(5, 1, 10); diff --git a/types/mumath/order.d.ts b/types/mumath/order.d.ts new file mode 100644 index 0000000000..8ce4c396fa --- /dev/null +++ b/types/mumath/order.d.ts @@ -0,0 +1,6 @@ +/** + * Get order of magnitude for a number. + */ +declare function order(value: number): number; + +export = order; diff --git a/types/mumath/precision.d.ts b/types/mumath/precision.d.ts new file mode 100644 index 0000000000..1b1a7290cc --- /dev/null +++ b/types/mumath/precision.d.ts @@ -0,0 +1,6 @@ +/** + * Get precision from float: + */ +declare function precision(value: number): number; + +export = precision; diff --git a/types/mumath/round.d.ts b/types/mumath/round.d.ts new file mode 100644 index 0000000000..8966dc6068 --- /dev/null +++ b/types/mumath/round.d.ts @@ -0,0 +1,6 @@ +/** + * Rounds value to optional step. + */ +declare function round(value: number, step?: number): number; + +export = round; diff --git a/types/mumath/scale.d.ts b/types/mumath/scale.d.ts new file mode 100644 index 0000000000..2cb97bcb4f --- /dev/null +++ b/types/mumath/scale.d.ts @@ -0,0 +1,8 @@ +/** + * Get first scale out of a list of basic scales, aligned to the power. E. g. + * step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000 + * Similar to closest, but takes all possible powers of scales. + */ +declare function scale(value: number, list: number[]): number; + +export = scale; diff --git a/types/mumath/tsconfig.json b/types/mumath/tsconfig.json index 67aa9c2b29..e96b912780 100644 --- a/types/mumath/tsconfig.json +++ b/types/mumath/tsconfig.json @@ -20,6 +20,17 @@ }, "files": [ "index.d.ts", + "clamp.d.ts", + "closest.d.ts", + "isMultiple.d.ts", + "len.d.ts", + "lerp.d.ts", + "mod.d.ts", + "order.d.ts", + "precision.d.ts", + "round.d.ts", + "scale.d.ts", + "within.d.ts", "mumath-tests.ts" ] } diff --git a/types/mumath/within.d.ts b/types/mumath/within.d.ts new file mode 100644 index 0000000000..f1d7e56cbd --- /dev/null +++ b/types/mumath/within.d.ts @@ -0,0 +1,6 @@ +/** + * Whether element is between left & right, including. + */ +declare function within(value: number, left: number, right: number): number; + +export = within; diff --git a/types/node-dogstatsd/index.d.ts b/types/node-dogstatsd/index.d.ts index 36f8145202..9f3c56dff9 100644 --- a/types/node-dogstatsd/index.d.ts +++ b/types/node-dogstatsd/index.d.ts @@ -1,16 +1,36 @@ // Type definitions for Datadog's nodejs metrics client node-dogstatsd // Project: https://github.com/joybro/node-dogstatsd // Definitions by: Chris Bobo +// Michael Mifsud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare module "node-dogstatsd" { + import * as dgram from 'dgram'; export interface StatsDOptions { global_tags?: string[]; } - export class StatsD { - constructor(host: string, port?: number, socket?: string, options?: StatsDOptions); + export interface StatsDClient { + timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void; + + increment(stat: string, sample_rate?: number, tags?: string[]): void; + incrementBy(stat: string, value: number, tags?: string[]): void; + + decrement(stat: string, sample_rate?: number, tags?: string[]): void; + decrementBy(stat: string, value: number, tags?: string[]): void; + + gauge(stat: string, value: number, sample_rate?: number, tags?: string[]): void; + + histogram(stat: string, time: number, sample_rate?: number, tags?: string[]): void; + } + + export class StatsD implements StatsDClient { + public socket: dgram.Socket + + constructor(host: string, port?: number, socket?: dgram.Socket, options?: StatsDOptions); timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void; diff --git a/types/node-dogstatsd/node-dogstatsd-tests.ts b/types/node-dogstatsd/node-dogstatsd-tests.ts index 072c5b168e..949ed73eac 100644 --- a/types/node-dogstatsd/node-dogstatsd-tests.ts +++ b/types/node-dogstatsd/node-dogstatsd-tests.ts @@ -1,12 +1,14 @@ +import * as dgram from 'dgram'; import * as datadog from 'node-dogstatsd'; function test_statsd_client() { // can create client with defaults let client = new datadog.StatsD('localhost'); let options: datadog.StatsDOptions = { global_tags: ['environment:definitely_typed']}; + const socket: dgram.Socket = dgram.createSocket('udp4'); // can create client with all params - client = new datadog.StatsD('localhost', 8125, null, options); + client = new datadog.StatsD('localhost', 8125, socket, options); let key: string = 'key'; let timeValue: number = 99; diff --git a/types/node/globals.d.ts b/types/node/globals.d.ts index 210830f7e8..36726f5cc0 100644 --- a/types/node/globals.d.ts +++ b/types/node/globals.d.ts @@ -465,7 +465,17 @@ declare namespace NodeJS { showProxy?: boolean; maxArrayLength?: number | null; breakLength?: number; - compact?: boolean; + /** + * Setting this to `false` causes each object key + * to be displayed on a new line. It will also add new lines to text that is + * longer than `breakLength`. If set to a number, the most `n` inner elements + * are united on a single line as long as all properties fit into + * `breakLength`. Short array elements are also grouped together. Note that no + * text will be reduced below 16 characters, no matter the `breakLength` size. + * For more information, see the example below. + * @default `true` + */ + compact?: boolean | number; sorted?: boolean | ((a: string, b: string) => number); } diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 41bfd02671..498b54e52e 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Node.js 11.10 +// Type definitions for non-npm package Node.js 11.11 // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -36,6 +36,7 @@ // Samuel Ainsworth // Kyle Uehlein // Jordi Oliveras Rovira +// Thanik Bhongbhibhat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // NOTE: These definitions support NodeJS and TypeScript 3.2. @@ -63,6 +64,7 @@ interface WeakMapConstructor { } interface SetConstructor { } interface WeakSetConstructor { } interface Set {} +interface Map {} interface ReadonlySet {} interface IteratorResult { } interface Iterable { } diff --git a/types/node/net.d.ts b/types/node/net.d.ts index 33858de8df..d011f6297c 100644 --- a/types/node/net.d.ts +++ b/types/node/net.d.ts @@ -178,7 +178,7 @@ declare module "net" { listen(options: ListenOptions, listeningListener?: Function): this; listen(handle: any, backlog?: number, listeningListener?: Function): this; listen(handle: any, listeningListener?: Function): this; - close(callback?: Function): this; + close(callback?: (err?: Error) => void): this; address(): AddressInfo | string | null; getConnections(cb: (error: Error | null, count: number) => void): void; ref(): this; diff --git a/types/node/test/net.ts b/types/node/test/net.ts index a2276654c8..f2c212d1fc 100644 --- a/types/node/test/net.ts +++ b/types/node/test/net.ts @@ -26,9 +26,11 @@ import { LookupOneOptions } from 'dns'; ipv6Only: true, }); - // close has an optional callback function. No callback parameters are - // specified, so any callback function is permissible. - server = server.close((...args: any[]) => { }); + // close callback parameter can be either nothing (undefined) or an error + server = server.close(() => { }); + server = server.close((err) => { + if (typeof err !== 'undefined') { const _err: Error = err; } + }); // test the types of the address object fields const address: net.AddressInfo | string | null = server.address(); diff --git a/types/node/test/util.ts b/types/node/test/util.ts index 252e8824ae..3af024972e 100644 --- a/types/node/test/util.ts +++ b/types/node/test/util.ts @@ -30,6 +30,9 @@ import { readFile } from 'fs'; sorted: true, getters: 'set', }); + util.inspect(["This is nice"], { + compact: 42, + }); assert(typeof util.inspect.custom === 'symbol'); util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); diff --git a/types/node/v10/index.d.ts b/types/node/v10/index.d.ts index 65f057b262..cf67202129 100644 --- a/types/node/v10/index.d.ts +++ b/types/node/v10/index.d.ts @@ -34,6 +34,7 @@ // Samuel Ainsworth // Kyle Uehlein // Jordi Oliveras Rovira +// Thanik Bhongbhibhat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // NOTE: These definitions support NodeJS and TypeScript 3.1. diff --git a/types/node/v10/net.d.ts b/types/node/v10/net.d.ts index 27804375aa..056cdec17a 100644 --- a/types/node/v10/net.d.ts +++ b/types/node/v10/net.d.ts @@ -174,7 +174,7 @@ declare module "net" { listen(options: ListenOptions, listeningListener?: Function): this; listen(handle: any, backlog?: number, listeningListener?: Function): this; listen(handle: any, listeningListener?: Function): this; - close(callback?: Function): this; + close(callback?: (err?: Error) => void): this; address(): AddressInfo | string; getConnections(cb: (error: Error | null, count: number) => void): void; ref(): this; diff --git a/types/node/v10/node-tests.ts b/types/node/v10/node-tests.ts index 6602ce7af2..6ae1c52bde 100644 --- a/types/node/v10/node-tests.ts +++ b/types/node/v10/node-tests.ts @@ -1826,10 +1826,11 @@ async function asyncStreamPipelineFinished() { // close callback parameter is optional _server = _server.close(); - // close callback parameter doesn't specify any arguments, so any - // function is acceptable + // close callback parameter can be either nothing (undefined) or an error _server = _server.close(() => { }); - _server = _server.close((...args: any[]) => { }); + _server = _server.close((err) => { + if (typeof err !== 'undefined') { const _err: Error = err; } + }); } { @@ -3502,9 +3503,11 @@ import * as p from "process"; .ref() .unref(); - // close has an optional callback function. No callback parameters are - // specified, so any callback function is permissible. - server = server.close((...args: any[]) => { }); + // close callback parameter can be either nothing (undefined) or an error + server = server.close(() => { }); + server = server.close((err) => { + if (typeof err !== 'undefined') { const _err: Error = err; } + }); // test the types of the address object fields const address: net.AddressInfo | string = server.address(); diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 9728ade03f..83deb05d33 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -23,6 +23,7 @@ // Lishude // Andrew Makarov // Jordi Oliveras Rovira +// Thanik Bhongbhibhat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -2901,7 +2902,7 @@ declare module "net" { listen(options: ListenOptions, listeningListener?: Function): this; listen(handle: any, backlog?: number, listeningListener?: Function): this; listen(handle: any, listeningListener?: Function): this; - close(callback?: Function): this; + close(callback?: (err?: Error) => void): this; address(): { port: number; family: string; address: string; }; getConnections(cb: (error: Error | null, count: number) => void): void; ref(): this; diff --git a/types/node/v8/node-tests.ts b/types/node/v8/node-tests.ts index 706b39600a..0ca392ab33 100644 --- a/types/node/v8/node-tests.ts +++ b/types/node/v8/node-tests.ts @@ -1299,10 +1299,11 @@ namespace tls_tests { // close callback parameter is optional _server = _server.close(); - // close callback parameter doesn't specify any arguments, so any - // function is acceptable + // close callback parameter can be either nothing (undefined) or an error _server = _server.close(() => { }); - _server = _server.close((...args: any[]) => { }); + _server = _server.close((err) => { + if (typeof err !== 'undefined') { const _err: Error = err; } + }); } { @@ -2788,9 +2789,11 @@ namespace net_tests { .ref() .unref(); - // close has an optional callback function. No callback parameters are - // specified, so any callback function is permissible. - server = server.close((...args: any[]) => { }); + // close callback parameter can be either nothing (undefined) or an error + server = server.close(() => { }); + server = server.close((err) => { + if (typeof err !== 'undefined') { const _err: Error = err; } + }); // test the types of the address object fields let address = server.address(); diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index 9934b38eb4..ce36ad42d0 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -27,6 +27,7 @@ // Andrew Makarov // Eugene Y. Q. Shen // Jordi Oliveras Rovira +// Thanik Bhongbhibhat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -3316,7 +3317,7 @@ declare module "net" { listen(options: ListenOptions, listeningListener?: Function): this; listen(handle: any, backlog?: number, listeningListener?: Function): this; listen(handle: any, listeningListener?: Function): this; - close(callback?: Function): this; + close(callback?: (err?: Error) => void): this; address(): AddressInfo | string; getConnections(cb: (error: Error | null, count: number) => void): void; ref(): this; diff --git a/types/node/v9/node-tests.ts b/types/node/v9/node-tests.ts index 4d0b5407c7..7d29ffbf95 100644 --- a/types/node/v9/node-tests.ts +++ b/types/node/v9/node-tests.ts @@ -1327,10 +1327,11 @@ namespace tls_tests { // close callback parameter is optional _server = _server.close(); - // close callback parameter doesn't specify any arguments, so any - // function is acceptable + // close callback parameter can be either nothing (undefined) or an error _server = _server.close(() => { }); - _server = _server.close((...args: any[]) => { }); + _server = _server.close((err) => { + if (typeof err !== 'undefined') { const _err: Error = err; } + }); } { @@ -2826,9 +2827,11 @@ namespace net_tests { .ref() .unref(); - // close has an optional callback function. No callback parameters are - // specified, so any callback function is permissible. - server = server.close((...args: any[]) => { }); + // close callback parameter can be either nothing (undefined) or an error + server = server.close(() => { }); + server = server.close((err) => { + if (typeof err !== 'undefined') { const _err: Error = err; } + }); // test the types of the address object fields let address: net.AddressInfo | string = server.address(); diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 57e8c55d87..8152eb8a8d 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -25,7 +25,7 @@ export class Commit { static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise; - amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Promise; + amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree | Oid): Promise; author(): Signature; committer(): Signature; diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 62de0de6c4..3a02577b98 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -132,17 +132,18 @@ export class Diff { * * */ - static blobToBuffer(oldBlob: Blob, oldAsPath: string, - buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + static blobToBuffer(oldBlob?: Blob, oldAsPath?: string, + buffer?: string, bufferAsPath?: string, opts?: DiffOptions, fileCb?: Function, + binaryCb?: Function, hunkCb?: Function, lineCb?: Function): Promise; static fromBuffer(content: string, contentLen: number): Promise; - static indexToWorkdir(repo: Repository, index: Index, opts?: DiffOptions): Promise; + static indexToWorkdir(repo: Repository, index?: Index, opts?: DiffOptions): Promise; static indexToIndex(repo: Repository, oldIndex: Index, newIndex: Index, opts?: DiffOptions): Promise; - static treeToIndex(repo: Repository, oldTree: Tree, index: Index, opts?: DiffOptions): Promise; - static treeToTree(repo: Repository, oldTree: Tree, new_tree: Tree, opts?: DiffOptions): Promise; - static treeToWorkdir(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; - static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; + static treeToIndex(repo: Repository, oldTree?: Tree, index?: Index, opts?: DiffOptions): Promise; + static treeToTree(repo: Repository, oldTree?: Tree, new_tree?: Tree, opts?: DiffOptions): Promise; + static treeToWorkdir(repo: Repository, oldTree?: Tree, opts?: DiffOptions): Promise; + static treeToWorkdirWithIndex(repo: Repository, oldTree?: Tree, opts?: DiffOptions): Promise; - findSimilar(options: DiffFindOptions): Promise; + findSimilar(options?: DiffFindOptions): Promise; getDelta(idx: number): DiffDelta; getPerfdata(): Promise; numDeltas(): number; diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 8f0dd811a0..c0e18853a6 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for nodegit 0.24 // Project: https://github.com/nodegit/nodegit, http://nodegit.org -// Definitions by: Dolan Miu , Tobias Nießen +// Definitions by: Dolan Miu , +// Tobias Nießen , +// Pierre Vigier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export { AnnotatedCommit } from './annotated-commit'; diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts index 9051fa693b..ca7ff41e86 100644 --- a/types/nodegit/reset.d.ts +++ b/types/nodegit/reset.d.ts @@ -1,8 +1,9 @@ import { AnnotatedCommit } from './annotated-commit'; import { Repository } from './repository'; -import { Object } from './object'; import { Strarray } from './str-array'; import { CheckoutOptions } from './checkout-options'; +import { Commit } from './commit'; +import { Tag } from './tag'; export namespace Reset { const enum TYPE { @@ -16,11 +17,11 @@ export class Reset { /** * Look up a refs's commit. */ - static reset(repo: Repository, target: Object, resetType: number, checkoutOpts: CheckoutOptions): Promise; + static reset(repo: Repository, target: Commit | Tag, resetType: number, checkoutOpts: CheckoutOptions): Promise; /** * Look up a refs's commit. */ - static default(repo: Repository, target: Object, pathspecs: Strarray | string | string[]): Promise; + static default(repo: Repository, target: Commit | Tag, pathspecs: Strarray | string | string[]): Promise; /** * Sets the current head to the specified commit oid and optionally resets the index and working tree to match. * This behaves like reset but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages. diff --git a/types/nodegit/revert.d.ts b/types/nodegit/revert.d.ts index 1f9d4a2677..df804cbb48 100644 --- a/types/nodegit/revert.d.ts +++ b/types/nodegit/revert.d.ts @@ -13,7 +13,7 @@ export interface RevertOptions { } export class Revert { - static revert(repo: Repository, commit: Commit, givenOpts: RevertOptions): Promise; + static revert(repo: Repository, commit: Commit, givenOpts?: RevertOptions): Promise; /** * Reverts the given commit against the given "our" commit, producing an index that reflects the result of the revert. */ diff --git a/types/nodegit/time.d.ts b/types/nodegit/time.d.ts index 575c005781..cb42ea6838 100644 --- a/types/nodegit/time.d.ts +++ b/types/nodegit/time.d.ts @@ -1,4 +1,4 @@ export class Time { - time: number; - offset: number; + time(): number; + offset(): number; } diff --git a/types/oakdex-pokedex/index.d.ts b/types/oakdex-pokedex/index.d.ts new file mode 100644 index 0000000000..8ca4fa709d --- /dev/null +++ b/types/oakdex-pokedex/index.d.ts @@ -0,0 +1,349 @@ +// Type definitions for oakdex-pokedex 0.4 +// Project: https://github.com/jalyna/oakdex-pokedex +// Definitions by: Jalyna Schroeder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Translations { + de: string; + en: string; + cz?: string; + dk?: string; + fr?: string; + gr?: string; + it?: string; + pl?: string; + tr?: string; + jp?: string; + es?: string; +} + +export interface PokemonEvolution { + to: string; + level?: number; + happiness?: boolean; + trade?: boolean; + level_up?: boolean; + item?: string; + hold_item?: string; + move_learned?: string; + conditions?: string[]; +} + +export interface PokemonAbility { + name: string; + hidden?: boolean; +} + +export interface StatObject { + hp: number; + atk: number; + def: number; + sp_atk: number; + sp_def: number; + speed: number; +} + +export interface MegaEvolution { + types: string[]; + ability: string; + height_us: string; + height_eu: string; + weight_us: string; + weight_eu: string; + base_stats: StatObject; + mega_stone: string; + image_suffix?: string; +} + +export interface PokemonVariation { + condition?: string; + names: Translations; + types: string[]; + height_us?: string; + height_eu?: string; + weight_us?: string; + weight_eu?: string; + base_stats?: StatObject; + pokeathlon_stats?: { + speed?: number[]; + power?: number[]; + stamina?: number[]; + skill?: number[]; + jump?: number[] + }; + abilities?: string[]; + image_suffix?: string; +} + +export interface Learnset { + move: string; + level?: number; + tm?: string; + egg_move?: boolean; + variations?: string[]; +} + +export interface MoveLearnset { + games: string[]; + learnset: Learnset[]; +} + +export interface Pokemon { + names: Translations; + categories: Translations; + national_id: number; + kanto_id: number | null; + johto_id: number | null; + hoenn_id: number | null; + sinnoh_id: number | null; + unova_id: number | null; + kalos_id: number | null; + alola_id: number | null; + ultra_alola_id: number | null; + pokedex_entries: { + [key: string]: Translations; + }; + evolution_from: string | null; + evolutions: PokemonEvolution[]; + types: string[]; + abilities: PokemonAbility[]; + gender_ratios: null | { + female: number; + male: number; + }; + catch_rate: number; + egg_groups: string[]; + hatch_time: number[]; + height_us: string; + height_eu: string; + weight_us: string; + weight_eu: string; + base_exp_yield: number; + leveling_rate: string; + ev_yield: StatObject; + color: string; + base_friendship: number; + base_stats: StatObject; + pokeathlon_stats?: { + speed?: number[]; + power?: number[]; + stamina?: number[]; + skill?: number[]; + jump?: number[]; + }; + mega_evolutions: MegaEvolution[]; + variation_names?: Translations; + variations: PokemonVariation[]; + move_learnsets: MoveLearnset[]; +} + +export interface MoveStatusCondition { + condition: string; + probability: number; +} + +export interface MoveStatModifier { + stat: string; + change_by: number; + affects_user?: boolean; +} + +export interface MoveContest { + contest: string; + condition: string; + appeal: number; + jam: number; +} + +export interface Move { + names: Translations; + index_number: number; + pp: number; + max_pp: number; + power: number; + accuracy: number; + type: string; + category: string; + priority: number; + target: string; + critical_hit: number; + pokedex_entries: { + [key: string]: Translations; + }; + contests: MoveContest[]; + makes_contact: boolean; + affected_by_protect: boolean; + affected_by_magic_coat: boolean; + affected_by_snatch: boolean; + affected_by_mirror_move: boolean; + affected_by_kings_rock: boolean; + in_battle_properties?: { + increased_critical_hit_ratio?: boolean; + status_conditions?: MoveStatusCondition[] + }; + stat_modifiers?: MoveStatModifier[]; +} + +export interface Ability { + names: Translations; + index_number: number; + descriptions: Translations; +} + +export interface PokemonType { + names: Translations; + color: string; + effectivness: { + Normal: number; + Fighting: number; + Flying: number; + Poison: number; + Ground: number; + Rock: number; + Bug: number; + Ghost: number; + Steel: number; + Fire: number; + Water: number; + Grass: number; + Electric: number; + Psychic: number; + Ice: number; + Dragon: number; + Dark: number; + Fairy: number; + }; +} + +export interface LocationPokemon { + pokemon: string; + location: string; + min_level: number; + max_level: number; + rarity: string; + games: string[]; + day_times?: string[]; + seasons?: string[]; + variation?: string; +} + +export interface Location { + names: Translations; + pokemon: LocationPokemon[]; +} + +export interface Region { + names: Translations; + locations: Location[]; +} + +export interface EggGroup { + names: Translations; +} + +export interface Generation { + names: Translations; + dex_name: string; + number: number; + games: Translations[]; +} + +export interface Nature { + names: Translations; + increased_stat: string | null; + decreased_stat: string | null; + favorite_flavor: string | null; + disliked_flavor: string | null; +} + +export interface ItemPrice { + games: string[]; + buying: number; + selling: number; +} + +export interface ItemPocket { + pocket: string; + generations: number[]; +} + +export interface ItemDescription { + translations: Translations; + games: string[]; +} + +export interface ItemPokemonChange { + field: string; + change_by_percent?: number; + revive?: boolean; + change_by?: number; + change?: string; + conditions?: string[]; +} + +export interface ItemMoveChange { + field: string; + change_by_percent?: number; + change_by?: number; + change_by_max?: number; +} + +export interface ItemEffect { + condition: string; + target: string; + triggers_evolution?: boolean; + pokemon_changes?: ItemPokemonChange[]; + move_changes?: ItemMoveChange[]; +} + +export interface Item { + names: Translations; + category: string; + descriptions: ItemDescription[]; + prices: ItemPrice[]; + pockets: ItemPocket[]; + effects: ItemEffect[]; + fling_power: number; +} + +export interface Conditions { + [key: string]: any; +} + +export function resetPokemon(): void; + +export function importPokemon(customPokemon: string[] | string | Pokemon[]): void; + +export function findPokemon(idOrName: string | number): Pokemon | null; + +export function findMove(name: string): Move | null; + +export function findAbility(name: string): Ability | null; + +export function findType(name: string): PokemonType | null; + +export function findRegion(name: string): Region | null; + +export function findEggGroup(name: string): EggGroup | null; + +export function findGeneration(name: string): Generation | null; + +export function findNature(name: string): Nature | null; + +export function findItem(name: string): Item | null; + +export function allPokemon(conditions?: Conditions): Pokemon[]; + +export function allItems(conditions?: Conditions): Item[]; + +export function allTypes(conditions?: Conditions): PokemonType[]; + +export function allAbilities(conditions?: Conditions): Ability[]; + +export function allRegions(conditions?: Conditions): Region[]; + +export function allEggGroups(conditions?: Conditions): EggGroup[]; + +export function allGenerations(conditions?: Conditions): Generation[]; + +export function allNatures(conditions?: Conditions): Nature[]; diff --git a/types/oakdex-pokedex/oakdex-pokedex-tests.ts b/types/oakdex-pokedex/oakdex-pokedex-tests.ts new file mode 100644 index 0000000000..670c348cbb --- /dev/null +++ b/types/oakdex-pokedex/oakdex-pokedex-tests.ts @@ -0,0 +1,492 @@ +import { + Pokemon, + Move, + Ability, + PokemonType, + Region, + EggGroup, + Generation, + Nature, + Item +} from 'oakdex-pokedex'; + +// Pokemon +() => { + const pikachu: Pokemon = { + names: { + fr: 'Pikachu', + de: 'Pikachu', + it: 'Pikachu', + en: 'Pikachu' + }, + national_id: 25, + types: [ + 'Electric' + ], + abilities: [ + { + name: 'Static' + }, + { + name: 'Lightning Rod', + hidden: true + } + ], + gender_ratios: { + male: 50, + female: 50 + }, + catch_rate: 190, + egg_groups: [ + 'Field', + 'Fairy' + ], + hatch_time: [ + 5355, + 5609 + ], + height_us: '1\'04"', + height_eu: '0.4 m', + weight_us: '13.2 lbs.', + weight_eu: '6.0 kg', + base_exp_yield: 105, + leveling_rate: 'Medium Fast', + ev_yield: { + hp: 0, + atk: 0, + def: 0, + sp_atk: 0, + sp_def: 0, + speed: 2 + }, + color: 'Yellow', + base_friendship: 70, + base_stats: { + hp: 35, + atk: 55, + def: 30, + sp_atk: 50, + sp_def: 40, + speed: 90 + }, + evolutions: [ + { + to: 'Raichu', + item: 'Thunderstone' + } + ], + evolution_from: 'Pichu', + alola_id: 25, + categories: { + en: 'Mouse Pokémon', + de: 'Maus' + }, + kanto_id: 25, + johto_id: 22, + hoenn_id: 163, + sinnoh_id: 104, + unova_id: null, + kalos_id: 36, + mega_evolutions: [], + variations: [ + { + names: { + fr: 'Pikachu (Pokémon partenaire)', + de: 'Pikachu (Partner-Pokémon)', + it: 'Pikachu (Pokémon compagno)', + en: 'Pikachu (Partner Pokémon)' + }, + types: [ + 'Electric' + ], + base_stats: { + hp: 45, + atk: 80, + def: 50, + sp_atk: 75, + sp_def: 60, + speed: 120 + } + } + ], + pokedex_entries: { + Red: { + en: 'When several of these Pokémon gather, their electricity could build and cause lightning storms.', + de: 'Wenn sich mehrere dieser Pokémon versammeln, kann ihre Energie Blitzgewitter erzeugen.' + }, + Blue: { + en: 'When several of these Pokémon gather, their electricity could build and cause lightning storms.', + de: 'Wenn sich mehrere dieser Pokémon versammeln, kann ihre Energie Blitzgewitter erzeugen.' + } + }, + pokeathlon_stats: { + speed: [ + 3, + 4 + ], + power: [ + 3, + 4 + ], + stamina: [ + 3, + 4 + ], + skill: [ + 3, + 4 + ], + jump: [ + 3, + 4 + ] + }, + ultra_alola_id: 32, + move_learnsets: [ + { + games: [ + 'Red', + 'Blue' + ], + learnset: [ + { + move: 'Growl', + level: 1 + }, + { + move: 'Thunder Shock', + level: 1 + }, + { + move: 'Thunder Wave', + level: 9 + }, + { + move: 'Quick Attack', + level: 16 + }, + { + move: 'Swift', + level: 26 + }, + { + move: 'Agility', + level: 33 + }, + { + move: 'Thunder', + level: 43 + }, + { + move: 'Flash', + tm: 'HM5' + }, + { + move: 'Mega Punch', + tm: 'TM1' + }, + { + move: 'Mega Kick', + tm: 'TM5' + }, + { + move: 'Toxic', + egg_move: true + } + ] + } + ] + }; +}; + +// Move +() => { + const tackle: Move = { + index_number: 33, + pp: 35, + max_pp: 56, + power: 50, + accuracy: 100, + category: 'physical', + priority: 0, + target: 'target_adjacent_single', + critical_hit: 0, + makes_contact: true, + affected_by_protect: true, + affected_by_magic_coat: false, + affected_by_snatch: false, + affected_by_mirror_move: false, + affected_by_kings_rock: true, + names: { + cz: 'Nárazový útok', + dk: 'Tackling', + fr: 'Charge', + de: 'Tackle', + gr: 'Εφόρμηση', + en: 'Tackle' + }, + type: 'Normal', + contests: [ + { + contest: 'Contests', + appeal: 4, + jam: 0, + condition: 'Tough' + }, + { + contest: 'Super Contests', + appeal: 3, + jam: 0, + condition: 'Tough' + }, + { + contest: 'Contest Spectaculars', + appeal: 4, + jam: 0, + condition: 'Tough' + } + ], + pokedex_entries: { + Gold: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + }, + Silver: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + }, + Crystal: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + } + } + }; +}; + +// Ability +() => { + const airLock: Ability = { + index_number: 76, + names: { + fr: 'Air Lock', + de: 'Klimaschutz', + it: 'Riparo', + en: 'Air Lock' + }, + descriptions: { + en: 'Eliminates the effects of weather.', + de: 'Example' + } + }; +}; + +// EggGroup +() => { + const bug: EggGroup = { + names: { + en: 'Bug', + jp: 'むし (虫) Mushi', + fr: 'Insecte', + de: 'Käfer', + it: 'Coleottero', + es: 'Bicho' + } + }; +}; + +// Generation +() => { + const gen1: Generation = { + number: 1, + dex_name: 'kanto_id', + names: { + en: 'Generation I', + de: 'Generation I' + }, + games: [ + { + en: 'Red', + de: 'Rot' + }, + { + en: 'Blue', + de: 'Blau' + }, + { + en: 'Yellow', + de: 'Gelb' + } + ] + }; +}; + +// Item +() => { + const potion: Item = { + names: { + en: 'Potion', + de: 'Trank', + fr: 'Potion', + es: 'Poción', + it: 'Pozione' + }, + category: 'Potions', + descriptions: [ + { + games: [ + 'Gold', + 'Silver', + 'Crystal' + ], + translations: { + en: 'Restores Pokémon HP by 20.', + de: 'Füllt die KP um 20 auf.' + } + } + ], + prices: [ + { + games: [ + 'Red', + 'Blue', + 'Yellow' + ], + buying: 300, + selling: 150 + }, + { + games: [ + 'Sun', + 'Moon', + 'Ultra Sun', + 'Ultra Moon' + ], + buying: 200, + selling: 100 + } + ], + pockets: [ + { + generations: [ + 1, + 2, + 3 + ], + pocket: 'Items' + }, + { + generations: [ + 4, + 5, + 6, + 7 + ], + pocket: 'Medicine' + } + ], + fling_power: 30, + effects: [ + { + condition: 'Always', + target: 'Single Pokemon', + pokemon_changes: [ + { + field: 'current_hp', + change_by: 20 + } + ] + } + ] + }; +}; + +// Nature +() => { + const bold: Nature = { + names: { + en: 'Bold', + de: 'Kühn' + }, + increased_stat: 'def', + decreased_stat: 'atk', + favorite_flavor: 'Sour', + disliked_flavor: 'Spicy' + }; +}; + +// PokemonType +() => { + const dragon: PokemonType = { + names: { + dk: 'Drage', + fr: 'Dragon', + de: 'Drache', + gr: 'Δράκου Drakou', + it: 'Drago', + pl: 'SmokSmoczy', + en: 'Dragon' + }, + effectivness: { + Normal: 1, + Fighting: 1, + Flying: 1, + Poison: 1, + Ground: 1, + Rock: 1, + Bug: 1, + Ghost: 1, + Steel: 0.5, + Fire: 1, + Water: 1, + Grass: 1, + Electric: 1, + Psychic: 1, + Ice: 1, + Dragon: 2, + Dark: 1, + Fairy: 0 + }, + color: '#6F35FC' + }; +}; + +// Region +() => { + const alola: Region = { + names: { + en: 'Alola', + fr: 'Alola', + es: 'Alola', + de: 'Alola', + it: 'Alola' + }, + locations: [ + { + names: { + en: 'Route 1', + fr: 'Abords d\'Ekaeka', + es: 'Afueras de Hauoli', + de: 'Hauholi-Stadtrand', + it: 'Periferia di Hau\'oli' + }, + pokemon: [ + { + pokemon: 'Pikipek', + location: 'Walking', + min_level: 2, + max_level: 3, + rarity: 'common', + games: [ + 'Sun', + 'Moon' + ], + day_times: [ + 'day', + 'night' + ] + } + ] + } + ] + }; +}; diff --git a/types/oakdex-pokedex/tsconfig.json b/types/oakdex-pokedex/tsconfig.json new file mode 100644 index 0000000000..0934229423 --- /dev/null +++ b/types/oakdex-pokedex/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", + "oakdex-pokedex-tests.ts" + ] +} diff --git a/types/env-paths/tslint.json b/types/oakdex-pokedex/tslint.json similarity index 100% rename from types/env-paths/tslint.json rename to types/oakdex-pokedex/tslint.json diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index b55d2cbb42..c36864f3dd 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -962,11 +962,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3)
PowerPoint Y Y Y
Word Y Y Y
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3: without options
Mailbox Preview: with options)
PowerPoint Y Y Y
Word Y Y Y
* * @param options Optional. An object literal that contains one or more of the following properties. @@ -974,7 +974,7 @@ declare namespace Office { * this value indicates of the handled event should continue execution or be canceled. * For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. */ - completed(options?: any): void; + completed(options?: { allowEvent: boolean }): void; } /** @@ -1633,7 +1633,7 @@ declare namespace Office { */ controlBackgroundColor: string; /** - * Gets the Office theme body control color as a hexadecimal color triplet (e.g. "FFA500"). + * Gets the Office theme control foreground color as a hexadecimal color triplet (e.g. "FFA500"). */ controlForegroundColor: string; } @@ -10751,6 +10751,12 @@ declare namespace Office { * Gets the size of the attachment in bytes. */ size: number; + /** + * Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`. + * + * [Api set: Mailbox Preview] + */ + url: string; } /** * The body object provides methods for adding and updating the content of the message or appointment. diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f976e947ec..a9ad9e3de3 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -962,11 +962,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3)
PowerPoint Y Y Y
Word Y Y Y
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3: without options
Mailbox Preview: with options)
PowerPoint Y Y Y
Word Y Y Y
* * @param options Optional. An object literal that contains one or more of the following properties. @@ -974,7 +974,7 @@ declare namespace Office { * this value indicates of the handled event should continue execution or be canceled. * For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. */ - completed(options?: any): void; + completed(options?: { allowEvent: boolean }): void; } /** @@ -1633,7 +1633,7 @@ declare namespace Office { */ controlBackgroundColor: string; /** - * Gets the Office theme body control color as a hexadecimal color triplet (e.g. "FFA500"). + * Gets the Office theme control foreground color as a hexadecimal color triplet (e.g. "FFA500"). */ controlForegroundColor: string; } @@ -10751,6 +10751,12 @@ declare namespace Office { * Gets the size of the attachment in bytes. */ size: number; + /** + * Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`. + * + * [Api set: Mailbox Preview] + */ + url: string; } /** * The body object provides methods for adding and updating the content of the message or appointment. diff --git a/types/offscreencanvas/index.d.ts b/types/offscreencanvas/index.d.ts new file mode 100644 index 0000000000..89e2b14df6 --- /dev/null +++ b/types/offscreencanvas/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for non-npm package offscreencanvas-browser 2019.3 +// Project: https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 3.1 + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage +interface CanvasDrawImage { + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, sx: number, sy: number, sw: number, sh: number, + dx: number, dy: number, dw: number, dh: number): void; +} + +// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap +declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise; +declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas, sx: number, sy: number, + sw: number, sh: number): Promise; + +// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-transfercontroltooffscreen +interface HTMLCanvasElement extends HTMLElement { + transferControlToOffscreen(): OffscreenCanvas; +} + +// https://html.spec.whatwg.org/multipage/canvas.html#offscreencanvasrenderingcontext2d +interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, + CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, + CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, + CanvasTextDrawingStyles, CanvasPath { + readonly canvas: OffscreenCanvas; +} +declare var OffscreenCanvasRenderingContext2D: { + prototype: OffscreenCanvasRenderingContext2D; + new (): OffscreenCanvasRenderingContext2D; +}; + +// https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +interface OffscreenCanvas extends EventTarget { + width: number; + height: number; + getContext(contextId: "2d", contextAttributes?: CanvasRenderingContext2DSettings): + OffscreenCanvasRenderingContext2D | null; + getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): OffscreenCanvasRenderingContext2D + | WebGLRenderingContext | null; + transferToImageBitmap(): ImageBitmap; + convertToBlob(options?: { type?: string, quality?: number }): Promise; +} +declare var OffscreenCanvas: { + prototype: OffscreenCanvas; + new (width: number, height: number): OffscreenCanvas; +}; diff --git a/types/offscreencanvas/offscreencanvas-tests.ts b/types/offscreencanvas/offscreencanvas-tests.ts new file mode 100644 index 0000000000..9f89e374b3 --- /dev/null +++ b/types/offscreencanvas/offscreencanvas-tests.ts @@ -0,0 +1,33 @@ +// Test constructor +const offscreenCanvas: OffscreenCanvas = new OffscreenCanvas(20, 10); + +// Test OffscreenCanvas properties +let width: number = offscreenCanvas.width; +let height: number = offscreenCanvas.height; + +// Test OffscreenCanvas methods +const context2D: OffscreenCanvasRenderingContext2D | null = offscreenCanvas.getContext("2d"); +const webglContext: WebGLRenderingContext | null = offscreenCanvas.getContext("webgl"); +const otherContext: OffscreenCanvasRenderingContext2D | WebGLRenderingContext | null = + offscreenCanvas.getContext("foobar"); +const imageBitmap: ImageBitmap = offscreenCanvas.transferToImageBitmap(); +const blob1: Promise = offscreenCanvas.convertToBlob(); +const blob2: Promise = offscreenCanvas.convertToBlob({ type: "image/jpeg" }); +const blob3: Promise = offscreenCanvas.convertToBlob({ type: "image/jpeg", quality: 0.92 }); + +// Test OffscreenCanvasRenderingContext2D properties +const canvasRef: OffscreenCanvas = context2D!.canvas; + +// Test HTMLCanvasElement methods +const canvas: HTMLCanvasElement = document.createElement("canvas"); +const transferredCanvas: OffscreenCanvas = canvas.transferControlToOffscreen(); + +// Test CanvasRenderingContext2D methods +const ctx = canvas.getContext("2d")!; +ctx.drawImage(offscreenCanvas, 0, 0); +ctx.drawImage(offscreenCanvas, 0, 0, 20, 10); +ctx.drawImage(offscreenCanvas, 0, 0, 20, 10, 0, 0, 20, 10); + +// Test createImageBitmap function with offscreen canvas +const imageBitmap1 = createImageBitmap(offscreenCanvas); +const imageBitmap2 = createImageBitmap(offscreenCanvas, 1, 2, 3, 4); diff --git a/types/offscreencanvas/tsconfig.json b/types/offscreencanvas/tsconfig.json new file mode 100644 index 0000000000..12d786084f --- /dev/null +++ b/types/offscreencanvas/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", + "offscreencanvas-tests.ts" + ] +} diff --git a/types/move-file/tslint.json b/types/offscreencanvas/tslint.json similarity index 100% rename from types/move-file/tslint.json rename to types/offscreencanvas/tslint.json diff --git a/types/ol/assertionerror/index.d.ts b/types/ol/AssertionError/index.d.ts similarity index 100% rename from types/ol/assertionerror/index.d.ts rename to types/ol/AssertionError/index.d.ts diff --git a/types/ol/attribution/index.d.ts b/types/ol/Attribution/index.d.ts similarity index 100% rename from types/ol/attribution/index.d.ts rename to types/ol/Attribution/index.d.ts diff --git a/types/ol/collection/index.d.ts b/types/ol/Collection/index.d.ts similarity index 100% rename from types/ol/collection/index.d.ts rename to types/ol/Collection/index.d.ts diff --git a/types/ol/disposable/index.d.ts b/types/ol/Disposable/index.d.ts similarity index 100% rename from types/ol/disposable/index.d.ts rename to types/ol/Disposable/index.d.ts diff --git a/types/ol/feature/index.d.ts b/types/ol/Feature/index.d.ts similarity index 100% rename from types/ol/feature/index.d.ts rename to types/ol/Feature/index.d.ts diff --git a/types/ol/geolocation/index.d.ts b/types/ol/Geolocation/index.d.ts similarity index 100% rename from types/ol/geolocation/index.d.ts rename to types/ol/Geolocation/index.d.ts diff --git a/types/ol/graticule/index.d.ts b/types/ol/Graticule/index.d.ts similarity index 100% rename from types/ol/graticule/index.d.ts rename to types/ol/Graticule/index.d.ts diff --git a/types/ol/image/index.d.ts b/types/ol/Image/index.d.ts similarity index 100% rename from types/ol/image/index.d.ts rename to types/ol/Image/index.d.ts diff --git a/types/ol/imagebase/index.d.ts b/types/ol/ImageBase/index.d.ts similarity index 100% rename from types/ol/imagebase/index.d.ts rename to types/ol/ImageBase/index.d.ts diff --git a/types/ol/imagetile/index.d.ts b/types/ol/ImageTile/index.d.ts similarity index 100% rename from types/ol/imagetile/index.d.ts rename to types/ol/ImageTile/index.d.ts diff --git a/types/ol/kinetic/index.d.ts b/types/ol/Kinetic/index.d.ts similarity index 100% rename from types/ol/kinetic/index.d.ts rename to types/ol/Kinetic/index.d.ts diff --git a/types/ol/map/index.d.ts b/types/ol/Map/index.d.ts similarity index 100% rename from types/ol/map/index.d.ts rename to types/ol/Map/index.d.ts diff --git a/types/ol/mapbrowserevent/index.d.ts b/types/ol/MapBrowserEvent/index.d.ts similarity index 100% rename from types/ol/mapbrowserevent/index.d.ts rename to types/ol/MapBrowserEvent/index.d.ts diff --git a/types/ol/mapbrowserpointerevent/index.d.ts b/types/ol/MapBrowserPointerEvent/index.d.ts similarity index 100% rename from types/ol/mapbrowserpointerevent/index.d.ts rename to types/ol/MapBrowserPointerEvent/index.d.ts diff --git a/types/ol/mapevent/index.d.ts b/types/ol/MapEvent/index.d.ts similarity index 100% rename from types/ol/mapevent/index.d.ts rename to types/ol/MapEvent/index.d.ts diff --git a/types/ol/object/index.d.ts b/types/ol/Object/index.d.ts similarity index 100% rename from types/ol/object/index.d.ts rename to types/ol/Object/index.d.ts diff --git a/types/ol/observable/index.d.ts b/types/ol/Observable/index.d.ts similarity index 100% rename from types/ol/observable/index.d.ts rename to types/ol/Observable/index.d.ts diff --git a/types/ol/overlay/index.d.ts b/types/ol/Overlay/index.d.ts similarity index 100% rename from types/ol/overlay/index.d.ts rename to types/ol/Overlay/index.d.ts diff --git a/types/ol/tile/index.d.ts b/types/ol/Tile/index.d.ts similarity index 100% rename from types/ol/tile/index.d.ts rename to types/ol/Tile/index.d.ts diff --git a/types/ol/vectortile/index.d.ts b/types/ol/VectorTile/index.d.ts similarity index 100% rename from types/ol/vectortile/index.d.ts rename to types/ol/VectorTile/index.d.ts diff --git a/types/ol/view/index.d.ts b/types/ol/View/index.d.ts similarity index 100% rename from types/ol/view/index.d.ts rename to types/ol/View/index.d.ts diff --git a/types/ol/control/attribution.d.ts b/types/ol/control/Attribution.d.ts similarity index 100% rename from types/ol/control/attribution.d.ts rename to types/ol/control/Attribution.d.ts diff --git a/types/ol/control/control.d.ts b/types/ol/control/Control.d.ts similarity index 100% rename from types/ol/control/control.d.ts rename to types/ol/control/Control.d.ts diff --git a/types/ol/control/fullscreen.d.ts b/types/ol/control/Fullscreen.d.ts similarity index 100% rename from types/ol/control/fullscreen.d.ts rename to types/ol/control/Fullscreen.d.ts diff --git a/types/ol/control/mouseposition.d.ts b/types/ol/control/MousePosition.d.ts similarity index 100% rename from types/ol/control/mouseposition.d.ts rename to types/ol/control/MousePosition.d.ts diff --git a/types/ol/control/overviewmap.d.ts b/types/ol/control/OverviewMap.d.ts similarity index 100% rename from types/ol/control/overviewmap.d.ts rename to types/ol/control/OverviewMap.d.ts diff --git a/types/ol/control/rotate.d.ts b/types/ol/control/Rotate.d.ts similarity index 100% rename from types/ol/control/rotate.d.ts rename to types/ol/control/Rotate.d.ts diff --git a/types/ol/control/scaleline.d.ts b/types/ol/control/ScaleLine.d.ts similarity index 100% rename from types/ol/control/scaleline.d.ts rename to types/ol/control/ScaleLine.d.ts diff --git a/types/ol/control/zoom.d.ts b/types/ol/control/Zoom.d.ts similarity index 100% rename from types/ol/control/zoom.d.ts rename to types/ol/control/Zoom.d.ts diff --git a/types/ol/control/zoomslider.d.ts b/types/ol/control/ZoomSlider.d.ts similarity index 100% rename from types/ol/control/zoomslider.d.ts rename to types/ol/control/ZoomSlider.d.ts diff --git a/types/ol/control/zoomtoextent.d.ts b/types/ol/control/ZoomToExtent.d.ts similarity index 100% rename from types/ol/control/zoomtoextent.d.ts rename to types/ol/control/ZoomToExtent.d.ts diff --git a/types/ol/events/event.d.ts b/types/ol/events/Event.d.ts similarity index 100% rename from types/ol/events/event.d.ts rename to types/ol/events/Event.d.ts diff --git a/types/ol/events/eventtarget.d.ts b/types/ol/events/EventTarget.d.ts similarity index 100% rename from types/ol/events/eventtarget.d.ts rename to types/ol/events/EventTarget.d.ts diff --git a/types/ol/format/esrijson.d.ts b/types/ol/format/EsriJSON.d.ts similarity index 100% rename from types/ol/format/esrijson.d.ts rename to types/ol/format/EsriJSON.d.ts diff --git a/types/ol/format/feature.d.ts b/types/ol/format/Feature.d.ts similarity index 100% rename from types/ol/format/feature.d.ts rename to types/ol/format/Feature.d.ts diff --git a/types/ol/format/gml2.d.ts b/types/ol/format/GML2.d.ts similarity index 100% rename from types/ol/format/gml2.d.ts rename to types/ol/format/GML2.d.ts diff --git a/types/ol/format/gml3.d.ts b/types/ol/format/GML3.d.ts similarity index 100% rename from types/ol/format/gml3.d.ts rename to types/ol/format/GML3.d.ts diff --git a/types/ol/format/gmlbase.d.ts b/types/ol/format/GMLBase.d.ts similarity index 100% rename from types/ol/format/gmlbase.d.ts rename to types/ol/format/GMLBase.d.ts diff --git a/types/ol/format/gpx.d.ts b/types/ol/format/GPX.d.ts similarity index 100% rename from types/ol/format/gpx.d.ts rename to types/ol/format/GPX.d.ts diff --git a/types/ol/format/geojson.d.ts b/types/ol/format/GeoJSON.d.ts similarity index 100% rename from types/ol/format/geojson.d.ts rename to types/ol/format/GeoJSON.d.ts diff --git a/types/ol/format/igc.d.ts b/types/ol/format/IGC.d.ts similarity index 100% rename from types/ol/format/igc.d.ts rename to types/ol/format/IGC.d.ts diff --git a/types/ol/format/jsonfeature.d.ts b/types/ol/format/JSONFeature.d.ts similarity index 100% rename from types/ol/format/jsonfeature.d.ts rename to types/ol/format/JSONFeature.d.ts diff --git a/types/ol/format/kml.d.ts b/types/ol/format/KML.d.ts similarity index 100% rename from types/ol/format/kml.d.ts rename to types/ol/format/KML.d.ts diff --git a/types/ol/format/mvt.d.ts b/types/ol/format/MVT.d.ts similarity index 100% rename from types/ol/format/mvt.d.ts rename to types/ol/format/MVT.d.ts diff --git a/types/ol/format/osmxml.d.ts b/types/ol/format/OSMXML.d.ts similarity index 100% rename from types/ol/format/osmxml.d.ts rename to types/ol/format/OSMXML.d.ts diff --git a/types/ol/format/polyline.d.ts b/types/ol/format/Polyline.d.ts similarity index 100% rename from types/ol/format/polyline.d.ts rename to types/ol/format/Polyline.d.ts diff --git a/types/ol/format/textfeature.d.ts b/types/ol/format/TextFeature.d.ts similarity index 100% rename from types/ol/format/textfeature.d.ts rename to types/ol/format/TextFeature.d.ts diff --git a/types/ol/format/topojson.d.ts b/types/ol/format/TopoJSON.d.ts similarity index 100% rename from types/ol/format/topojson.d.ts rename to types/ol/format/TopoJSON.d.ts diff --git a/types/ol/format/wfs.d.ts b/types/ol/format/WFS.d.ts similarity index 100% rename from types/ol/format/wfs.d.ts rename to types/ol/format/WFS.d.ts diff --git a/types/ol/format/wkt.d.ts b/types/ol/format/WKT.d.ts similarity index 100% rename from types/ol/format/wkt.d.ts rename to types/ol/format/WKT.d.ts diff --git a/types/ol/format/wmscapabilities.d.ts b/types/ol/format/WMSCapabilities.d.ts similarity index 100% rename from types/ol/format/wmscapabilities.d.ts rename to types/ol/format/WMSCapabilities.d.ts diff --git a/types/ol/format/wmsgetfeatureinfo.d.ts b/types/ol/format/WMSGetFeatureInfo.d.ts similarity index 100% rename from types/ol/format/wmsgetfeatureinfo.d.ts rename to types/ol/format/WMSGetFeatureInfo.d.ts diff --git a/types/ol/format/wmtscapabilities.d.ts b/types/ol/format/WMTSCapabilities.d.ts similarity index 100% rename from types/ol/format/wmtscapabilities.d.ts rename to types/ol/format/WMTSCapabilities.d.ts diff --git a/types/ol/format/xml.d.ts b/types/ol/format/XML.d.ts similarity index 100% rename from types/ol/format/xml.d.ts rename to types/ol/format/XML.d.ts diff --git a/types/ol/format/xmlfeature.d.ts b/types/ol/format/XMLFeature.d.ts similarity index 100% rename from types/ol/format/xmlfeature.d.ts rename to types/ol/format/XMLFeature.d.ts diff --git a/types/ol/geom/circle.d.ts b/types/ol/geom/Circle.d.ts similarity index 100% rename from types/ol/geom/circle.d.ts rename to types/ol/geom/Circle.d.ts diff --git a/types/ol/geom/geometry.d.ts b/types/ol/geom/Geometry.d.ts similarity index 100% rename from types/ol/geom/geometry.d.ts rename to types/ol/geom/Geometry.d.ts diff --git a/types/ol/geom/geometrycollection.d.ts b/types/ol/geom/GeometryCollection.d.ts similarity index 100% rename from types/ol/geom/geometrycollection.d.ts rename to types/ol/geom/GeometryCollection.d.ts diff --git a/types/ol/geom/linestring.d.ts b/types/ol/geom/LineString.d.ts similarity index 100% rename from types/ol/geom/linestring.d.ts rename to types/ol/geom/LineString.d.ts diff --git a/types/ol/geom/linearring.d.ts b/types/ol/geom/LinearRing.d.ts similarity index 100% rename from types/ol/geom/linearring.d.ts rename to types/ol/geom/LinearRing.d.ts diff --git a/types/ol/geom/multipoint.d.ts b/types/ol/geom/MultiPoint.d.ts similarity index 100% rename from types/ol/geom/multipoint.d.ts rename to types/ol/geom/MultiPoint.d.ts diff --git a/types/ol/geom/multipolygon.d.ts b/types/ol/geom/MultiPolygon.d.ts similarity index 100% rename from types/ol/geom/multipolygon.d.ts rename to types/ol/geom/MultiPolygon.d.ts diff --git a/types/ol/geom/multilinestring.d.ts b/types/ol/geom/MultilineString.d.ts similarity index 100% rename from types/ol/geom/multilinestring.d.ts rename to types/ol/geom/MultilineString.d.ts diff --git a/types/ol/geom/point.d.ts b/types/ol/geom/Point.d.ts similarity index 100% rename from types/ol/geom/point.d.ts rename to types/ol/geom/Point.d.ts diff --git a/types/ol/geom/polygon.d.ts b/types/ol/geom/Polygon.d.ts similarity index 100% rename from types/ol/geom/polygon.d.ts rename to types/ol/geom/Polygon.d.ts diff --git a/types/ol/geom/simplegeometry.d.ts b/types/ol/geom/SimpleGeometry.d.ts similarity index 100% rename from types/ol/geom/simplegeometry.d.ts rename to types/ol/geom/SimpleGeometry.d.ts diff --git a/types/ol/interaction/doubleclickzoom.d.ts b/types/ol/interaction/DoubleClickZoom.d.ts similarity index 100% rename from types/ol/interaction/doubleclickzoom.d.ts rename to types/ol/interaction/DoubleClickZoom.d.ts diff --git a/types/ol/interaction/draganddrop.d.ts b/types/ol/interaction/DragAndDrop.d.ts similarity index 100% rename from types/ol/interaction/draganddrop.d.ts rename to types/ol/interaction/DragAndDrop.d.ts diff --git a/types/ol/interaction/dragbox.d.ts b/types/ol/interaction/DragBox.d.ts similarity index 100% rename from types/ol/interaction/dragbox.d.ts rename to types/ol/interaction/DragBox.d.ts diff --git a/types/ol/interaction/dragpan.d.ts b/types/ol/interaction/DragPan.d.ts similarity index 100% rename from types/ol/interaction/dragpan.d.ts rename to types/ol/interaction/DragPan.d.ts diff --git a/types/ol/interaction/dragrotate.d.ts b/types/ol/interaction/DragRotate.d.ts similarity index 100% rename from types/ol/interaction/dragrotate.d.ts rename to types/ol/interaction/DragRotate.d.ts diff --git a/types/ol/interaction/dragrotateandzoom.d.ts b/types/ol/interaction/DragRotateAndZoom.d.ts similarity index 100% rename from types/ol/interaction/dragrotateandzoom.d.ts rename to types/ol/interaction/DragRotateAndZoom.d.ts diff --git a/types/ol/interaction/dragzoom.d.ts b/types/ol/interaction/DragZoom.d.ts similarity index 100% rename from types/ol/interaction/dragzoom.d.ts rename to types/ol/interaction/DragZoom.d.ts diff --git a/types/ol/interaction/draw.d.ts b/types/ol/interaction/Draw.d.ts similarity index 100% rename from types/ol/interaction/draw.d.ts rename to types/ol/interaction/Draw.d.ts diff --git a/types/ol/interaction/extent.d.ts b/types/ol/interaction/Extent.d.ts similarity index 100% rename from types/ol/interaction/extent.d.ts rename to types/ol/interaction/Extent.d.ts diff --git a/types/ol/interaction/interaction.d.ts b/types/ol/interaction/Interaction.d.ts similarity index 100% rename from types/ol/interaction/interaction.d.ts rename to types/ol/interaction/Interaction.d.ts diff --git a/types/ol/interaction/keyboardpan.d.ts b/types/ol/interaction/KeyboardPan.d.ts similarity index 100% rename from types/ol/interaction/keyboardpan.d.ts rename to types/ol/interaction/KeyboardPan.d.ts diff --git a/types/ol/interaction/keyboardzoom.d.ts b/types/ol/interaction/KeyboardZoom.d.ts similarity index 100% rename from types/ol/interaction/keyboardzoom.d.ts rename to types/ol/interaction/KeyboardZoom.d.ts diff --git a/types/ol/interaction/modify.d.ts b/types/ol/interaction/Modify.d.ts similarity index 100% rename from types/ol/interaction/modify.d.ts rename to types/ol/interaction/Modify.d.ts diff --git a/types/ol/interaction/mousewheelzoom.d.ts b/types/ol/interaction/MouseWheelZoom.d.ts similarity index 100% rename from types/ol/interaction/mousewheelzoom.d.ts rename to types/ol/interaction/MouseWheelZoom.d.ts diff --git a/types/ol/interaction/pinchrotate.d.ts b/types/ol/interaction/PinchRotate.d.ts similarity index 100% rename from types/ol/interaction/pinchrotate.d.ts rename to types/ol/interaction/PinchRotate.d.ts diff --git a/types/ol/interaction/pinchzoom.d.ts b/types/ol/interaction/PinchZoom.d.ts similarity index 100% rename from types/ol/interaction/pinchzoom.d.ts rename to types/ol/interaction/PinchZoom.d.ts diff --git a/types/ol/interaction/pointer.d.ts b/types/ol/interaction/Pointer.d.ts similarity index 100% rename from types/ol/interaction/pointer.d.ts rename to types/ol/interaction/Pointer.d.ts diff --git a/types/ol/interaction/select.d.ts b/types/ol/interaction/Select.d.ts similarity index 100% rename from types/ol/interaction/select.d.ts rename to types/ol/interaction/Select.d.ts diff --git a/types/ol/interaction/snap.d.ts b/types/ol/interaction/Snap.d.ts similarity index 100% rename from types/ol/interaction/snap.d.ts rename to types/ol/interaction/Snap.d.ts diff --git a/types/ol/interaction/translate.d.ts b/types/ol/interaction/Translate.d.ts similarity index 100% rename from types/ol/interaction/translate.d.ts rename to types/ol/interaction/Translate.d.ts diff --git a/types/ol/layer/base.d.ts b/types/ol/layer/Base.d.ts similarity index 100% rename from types/ol/layer/base.d.ts rename to types/ol/layer/Base.d.ts diff --git a/types/ol/layer/group.d.ts b/types/ol/layer/Group.d.ts similarity index 100% rename from types/ol/layer/group.d.ts rename to types/ol/layer/Group.d.ts diff --git a/types/ol/layer/heatmap.d.ts b/types/ol/layer/Heatmap.d.ts similarity index 100% rename from types/ol/layer/heatmap.d.ts rename to types/ol/layer/Heatmap.d.ts diff --git a/types/ol/layer/image.d.ts b/types/ol/layer/Image.d.ts similarity index 100% rename from types/ol/layer/image.d.ts rename to types/ol/layer/Image.d.ts diff --git a/types/ol/layer/layer.d.ts b/types/ol/layer/Layer.d.ts similarity index 100% rename from types/ol/layer/layer.d.ts rename to types/ol/layer/Layer.d.ts diff --git a/types/ol/layer/tile.d.ts b/types/ol/layer/Tile.d.ts similarity index 100% rename from types/ol/layer/tile.d.ts rename to types/ol/layer/Tile.d.ts diff --git a/types/ol/layer/vector.d.ts b/types/ol/layer/Vector.d.ts similarity index 100% rename from types/ol/layer/vector.d.ts rename to types/ol/layer/Vector.d.ts diff --git a/types/ol/layer/vectortile.d.ts b/types/ol/layer/VectorTile.d.ts similarity index 100% rename from types/ol/layer/vectortile.d.ts rename to types/ol/layer/VectorTile.d.ts diff --git a/types/ol/ol-tests.ts b/types/ol/ol-tests.ts index be19e61a2b..f8117f43ac 100644 --- a/types/ol/ol-tests.ts +++ b/types/ol/ol-tests.ts @@ -1,317 +1,163 @@ -import ControlAttribution from 'ol/control/attribution'; - -import ControlControl from 'ol/control/control'; - -import ControlFullScreen from 'ol/control/fullscreen'; - -import ControlMousePosition from 'ol/control/mouseposition'; - -import ControlOverviewMap from 'ol/control/overviewmap'; - -import ControlRotate from 'ol/control/rotate'; - -import ControlScaleLine from 'ol/control/scaleline'; - -import ControlZoom from 'ol/control/zoom'; - -import ControlZoomSlider from 'ol/control/zoomslider'; - -import ControlZoomToExtent from 'ol/control/zoomtoextent'; - -import Eventscondition from 'ol/events/condition'; - -import EventsEvent from 'ol/events/event'; - -import EventsEventTarget from 'ol/events/eventtarget'; - -import FormatEsriJSON from 'ol/format/esrijson'; - -import FormatFeature from 'ol/format/feature'; - -import Formatfilter from 'ol/format/filter'; - -import FormatGeoJSON from 'ol/format/geojson'; - -import FormatGML2 from 'ol/format/gml2'; - -import FormatGML3 from 'ol/format/gml3'; - -import FormatGMLBase from 'ol/format/gmlbase'; - -import FormatGPX from 'ol/format/gpx'; - -import FormatIGC from 'ol/format/igc'; - -import FormatJSONFeature from 'ol/format/jsonfeature'; - -import FormatKML from 'ol/format/kml'; - -import FormatMVT from 'ol/format/mvt'; - -import FormatOSMXML from 'ol/format/osmxml'; - -import FormatPolyline from 'ol/format/polyline'; - -import FormatTextFeature from 'ol/format/textfeature'; - -import FormatTopoJSON from 'ol/format/topojson'; - -import FormatWFS from 'ol/format/wfs'; - -import FormatWKT from 'ol/format/wkt'; - -import FormatWMSCapabilities from 'ol/format/wmscapabilities'; - -import FormatWMSGetFeatureInfo from 'ol/format/wmsgetfeatureinfo'; - -import FormatWMTSCapabilities from 'ol/format/wmtscapabilities'; - -import FormatXML from 'ol/format/xml'; - -import FormatXMLFeature from 'ol/format/xmlfeature'; - -import GeomCircle from 'ol/geom/circle'; - -import GeomGeometry from 'ol/geom/geometry'; - -import GeomGeometryCollection from 'ol/geom/geometrycollection'; - -import GeomLinearRing from 'ol/geom/linearring'; - -import GeomLineString from 'ol/geom/linestring'; - -import GeomMultiLineString from 'ol/geom/multilinestring'; - -import GeomMultiPoint from 'ol/geom/multipoint'; - -import GeomMultiPolygon from 'ol/geom/multipolygon'; - -import GeomPoint from 'ol/geom/point'; - -import GeomPolygon from 'ol/geom/polygon'; - -import GeomSimpleGeometry from 'ol/geom/simplegeometry'; - -import InteractionDoubleClickZoom from 'ol/interaction/doubleclickzoom'; - -import InteractionDragAndDrop from 'ol/interaction/draganddrop'; - -import InteractionDragBox from 'ol/interaction/dragbox'; - -import InteractionDragPan from 'ol/interaction/dragpan'; - -import InteractionDragRotate from 'ol/interaction/dragrotate'; - -import InteractionDragRotateAndZoom from 'ol/interaction/dragrotateandzoom'; - -import InteractionDragZoom from 'ol/interaction/dragzoom'; - -import InteractionDraw from 'ol/interaction/draw'; - -import InteractionInteraction from 'ol/interaction/interaction'; - -import InteractionKeyboardPan from 'ol/interaction/keyboardpan'; - -import InteractionKeyboardZoom from 'ol/interaction/keyboardzoom'; - -import InteractionModify from 'ol/interaction/modify'; - -import InteractionMouseWheelZoom from 'ol/interaction/mousewheelzoom'; - -import InteractionPinchRotate from 'ol/interaction/pinchrotate'; - -import InteractionPinchZoom from 'ol/interaction/pinchzoom'; - -import InteractionPointer from 'ol/interaction/pointer'; - -import InteractionSelect from 'ol/interaction/select'; - -import InteractionSnap from 'ol/interaction/snap'; - -import InteractionTranslate from 'ol/interaction/translate'; - -import LayerBase from 'ol/layer/base'; - -import LayerGroup from 'ol/layer/group'; - -import LayerHeatmap from 'ol/layer/heatmap'; - -import LayerImage from 'ol/layer/image'; - -import LayerLayer from 'ol/layer/layer'; - -import LayerTile from 'ol/layer/tile'; - -import LayerVector from 'ol/layer/vector'; - -import LayerVectorTile from 'ol/layer/vectortile'; - -import PointerPointerEvent from 'ol/pointer/pointerevent'; - -import Proj from 'ol/proj'; - -import ProjProjection from 'ol/proj/projection'; - -import Rendercanvas from 'ol/render/canvas'; - -import RenderEvent from 'ol/render/event'; - -import RenderFeature from 'ol/render/feature'; - -import RenderVectorContext from 'ol/render/vectorcontext'; - -import SourceBingMaps from 'ol/source/bingmaps'; - -import SourceCartoDB from 'ol/source/cartodb'; - -import SourceCluster from 'ol/source/cluster'; - -import SourceImage from 'ol/source/image'; - -import SourceImageArcGISRest from 'ol/source/imagearcgisrest'; - -import SourceImageCanvas from 'ol/source/imagecanvas'; - -import SourceImageMapGuide from 'ol/source/imagemapguide'; - -import SourceImageStatic from 'ol/source/imagestatic'; - -import SourceImageVector from 'ol/source/imagevector'; - -import SourceImageWMS from 'ol/source/imagewms'; - -import SourceOSM from 'ol/source/osm'; - -import SourceRaster from 'ol/source/raster'; - -import SourceSource from 'ol/source/source'; - -import SourceStamen from 'ol/source/stamen'; - -import SourceTile from 'ol/source/tile'; - -import SourceTileArcGISRest from 'ol/source/tilearcgisrest'; - -import SourceTileDebug from 'ol/source/tiledebug'; - -import SourceTileImage from 'ol/source/tileimage'; - -import SourceTileJSON from 'ol/source/tilejson'; - -import SourceTileUTFGrid from 'ol/source/tileutfgrid'; - -import SourceTileWMS from 'ol/source/tilewms'; - -import SourceUrlTile from 'ol/source/urltile'; - -import SourceVector from 'ol/source/vector'; - -import SourceVectorTile from 'ol/source/vectortile'; - -import SourceWMTS from 'ol/source/wmts'; - -import SourceXYZ from 'ol/source/xyz'; - -import SourceZoomify from 'ol/source/zoomify'; - -import StyleAtlasManager from 'ol/style/atlasmanager'; - -import StyleCircle from 'ol/style/circle'; - -import StyleFill from 'ol/style/fill'; - -import StyleIcon from 'ol/style/icon'; - -import StyleImage from 'ol/style/image'; - -import StyleRegularShape from 'ol/style/regularshape'; - -import StyleStroke from 'ol/style/stroke'; - -import StyleStyle from 'ol/style/style'; - -import StyleText from 'ol/style/text'; - -import TilegridTileGrid from 'ol/tilegrid/tilegrid'; - -import TilegridWMTS from 'ol/tilegrid/wmts'; - -import AssertionError from 'ol/assertionerror'; - -import Attribution from 'ol/attribution'; - -import Collection from 'ol/collection'; - -import Color from 'ol/color'; - -import Colorlike from 'ol/colorlike'; - -import Control from 'ol/control'; - +import AssertionError from 'ol/AssertionError'; +import AtlasManager from 'ol/style/AtlasManager'; +// import Attribution from 'ol/Attribution'; +import Attribution from 'ol/control/Attribution'; +import Base from 'ol/layer/Base'; +import BingMaps from 'ol/source/BingMaps'; +import canvas from 'ol/render/canvas'; +import CartoDB from 'ol/source/CartoDB'; +import Circle from 'ol/geom/Circle'; +// import Circle from 'ol/style/Circle'; +import Cluster from 'ol/source/Cluster'; +import Collection from 'ol/Collection'; +import color from 'ol/color'; +import colorlike from 'ol/colorlike'; +import condition from 'ol/events/condition'; +import control from 'ol/control'; +import Control from 'ol/control/Control'; +// import coordinate from 'ol/coordinate'; import DeviceOrientation from 'ol/deviceorientation'; - -import Disposable from 'ol/disposable'; - -import Easing from 'ol/easing'; - -import Events from 'ol/events'; - -import Extent from 'ol/extent'; - -import Feature from 'ol/feature'; - -import FeatureLoader from 'ol/featureloader'; - -import Geolocation from 'ol/geolocation'; - -import Graticule from 'ol/graticule'; - -import Image from 'ol/image'; - -import ImageBase from 'ol/imagebase'; - -import ImageTile from 'ol/imagetile'; - -import Interaction from 'ol/interaction'; - -import Kinetic from 'ol/kinetic'; - -import Loadingstrategy from 'ol/loadingstrategy'; - -import Map from 'ol/map'; - -import MapBrowserEvent from 'ol/mapbrowserevent'; - -import MapBrowserPointerEvent from 'ol/mapbrowserpointerevent'; - -import MapEvent from 'ol/mapevent'; - -import Object from 'ol/object'; - -import Observable from 'ol/observable'; - -import Overlay from 'ol/overlay'; - +import Disposable from 'ol/Disposable'; +import DoubleClickZoom from 'ol/interaction/DoubleClickZoom'; +import DragAndDrop from 'ol/interaction/DragAndDrop'; +import DragBox from 'ol/interaction/DragBox'; +import DragPan from 'ol/interaction/DragPan'; +import DragRotateAndZoom from 'ol/interaction/DragRotateAndZoom'; +import DragRotate from 'ol/interaction/DragRotate'; +import DragZoom from 'ol/interaction/DragZoom'; +import Draw from 'ol/interaction/Draw'; +import easing from 'ol/easing'; +import EsriJSON from 'ol/format/EsriJSON'; +// import Event from 'ol/events/Event'; +import Event from 'ol/render/Event'; +import events from 'ol/events'; +import EventTarget from 'ol/events/EventTarget'; +import extent from 'ol/extent'; +import Extent from 'ol/interaction/Extent'; +// import Feature from 'ol/Feature'; +import Feature from 'ol/format/Feature'; +// import Feature from 'ol/render/Feature'; +import featureloader from 'ol/featureloader'; +import Fill from 'ol/style/Fill'; +import filter from 'ol/format/filter'; +import FullScreen from 'ol/control/Fullscreen'; +import GeoJSON from 'ol/format/GeoJSON'; +import Geolocation from 'ol/Geolocation'; +import GeometryCollection from 'ol/geom/GeometryCollection'; +import Geometry from 'ol/geom/Geometry'; +import GML2 from 'ol/format/GML2'; +import GML3 from 'ol/format/GML3'; +import GMLBase from 'ol/format/GMLBase'; +import GPX from 'ol/format/GPX'; +import Graticule from 'ol/Graticule'; +import Group from 'ol/layer/Group'; +import Heatmap from 'ol/layer/Heatmap'; +import Icon from 'ol/style/Icon'; +import IGC from 'ol/format/IGC'; +import ImageArcGISRest from 'ol/source/ImageArcGISRest'; +import ImageBase from 'ol/ImageBase'; +import ImageCanvas from 'ol/source/ImageCanvas'; +// import Image from 'ol/Image'; +import Image from 'ol/layer/Image'; +// import Image from 'ol/source/Image'; +// import Image from 'ol/style/Image'; +import ImageMapGuide from 'ol/source/ImageMapGuide'; +import ImageStatic from 'ol/source/ImageStatic'; +import ImageTile from 'ol/ImageTile'; +import ImageVector from 'ol/source/ImageVector'; +import ImageWMS from 'ol/source/ImageWMS'; +import interaction from 'ol/interaction'; +import Interaction from 'ol/interaction/Interaction'; +import JSONFeature from 'ol/format/JSONFeature'; +import KeyboardPan from 'ol/interaction/KeyboardPan'; +import KeyboardZoom from 'ol/interaction/KeyboardZoom'; +import Kinetic from 'ol/Kinetic'; +import KML from 'ol/format/KML'; +import Layer from 'ol/layer/Layer'; +import LinearRing from 'ol/geom/LinearRing'; +import LineString from 'ol/geom/LineString'; +import loadingstrategy from 'ol/loadingstrategy'; +import MapBrowserEvent from 'ol/MapBrowserEvent'; +import MapBrowserPointerEvent from 'ol/MapBrowserPointerEvent'; +import MapEvent from 'ol/MapEvent'; +import Map from 'ol/Map'; +import Modify from 'ol/interaction/Modify'; +import MousePosition from 'ol/control/MousePosition'; +import MouseWheelZoom from 'ol/interaction/MouseWheelZoom'; +import MultiLineString from 'ol/geom/MultilineString'; +import MultiPoint from 'ol/geom/MultiPoint'; +import MultiPolygon from 'ol/geom/MultiPolygon'; +import MVT from 'ol/format/MVT'; +import Object from 'ol/Object'; +import Observable from 'ol/Observable'; +import ol from 'ol'; +import OSM from 'ol/source/OSM'; +import OSMXML from 'ol/format/OSMXML'; +import Overlay from 'ol/Overlay'; +import OverviewMap from 'ol/control/OverviewMap'; +import PinchRotate from 'ol/interaction/PinchRotate'; +import PinchZoom from 'ol/interaction/PinchZoom'; +import PointerEvent from 'ol/pointer/PointerEvent'; +import Pointer from 'ol/interaction/Pointer'; +import Point from 'ol/geom/Point'; +import Polygon from 'ol/geom/Polygon'; +import Polyline from 'ol/format/Polyline'; +import Projection from 'ol/proj/Projection'; +import proj from 'ol/proj'; +import Raster from 'ol/source/Raster'; +import RegularShape from 'ol/style/RegularShape'; +import Rotate from 'ol/control/Rotate'; +import ScaleLine from 'ol/control/ScaleLine'; +import Select from 'ol/interaction/Select'; +import SimpleGeometry from 'ol/geom/SimpleGeometry'; +import Snap from 'ol/interaction/Snap'; +import Source from 'ol/source/Source'; import Sphere from 'ol/sphere'; - -import Tile from 'ol/tile'; - -import Tilegrid from 'ol/tilegrid'; - -import VectorTile from 'ol/vectortile'; - -import View from 'ol/view'; +import Stamen from 'ol/source/Stamen'; +import Stroke from 'ol/style/Stroke'; +import Style from 'ol/style/Style'; +import TextFeature from 'ol/format/TextFeature'; +import Text from 'ol/style/Text'; +import TileArcGISRest from 'ol/source/TileArcGISRest'; +import TileDebug from 'ol/source/TileDebug'; +import Tile from 'ol/layer/Tile'; +// import Tile from 'ol/source/Tile'; +// import Tile from 'ol/Tile'; +import tilegrid from 'ol/tilegrid'; +import TileGrid from 'ol/tilegrid/TileGrid'; +import TileImage from 'ol/source/TileImage'; +import TileJSON from 'ol/source/TileJSON'; +import TileUTFGrid from 'ol/source/TileUTFGrid'; +import TileWMS from 'ol/source/TileWMS'; +import TopoJSON from 'ol/format/TopoJSON'; +import Translate from 'ol/interaction/Translate'; +import UrlTile from 'ol/source/UrlTile'; +import VectorContext from 'ol/render/VectorContext'; +import Vector from 'ol/layer/Vector'; +// import Vector from 'ol/source/Vector'; +// import VectorTile from 'ol/layer/VectorTile'; +// import VectorTile from 'ol/source/VectorTile'; +import VectorTile from 'ol/VectorTile'; +import View from 'ol/View'; +import WFS from 'ol/format/WFS'; +import WKT from 'ol/format/WKT'; +import WMSCapabilities from 'ol/format/WMSCapabilities'; +import WMSGetFeatureInfo from 'ol/format/WMSGetFeatureInfo'; +import WMTSCapabilities from 'ol/format/WMTSCapabilities'; +import WMTS from 'ol/source/WMTS'; +// import WMTS from 'ol/tilegrid/WMTS'; +import XMLFeature from 'ol/format/XMLFeature'; +import XML from 'ol/format/XML'; +import XYZ from 'ol/source/XYZ'; +import Zoom from 'ol/control/Zoom'; +import Zoomify from 'ol/source/Zoomify'; +import ZoomSlider from 'ol/control/ZoomSlider'; +import ZoomToExtent from 'ol/control/ZoomToExtent'; // Map const map: ol.Map = new Map({} as any); 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); -map.addInteraction(interaction); // View let view: View; diff --git a/types/ol/pointer/pointerevent.d.ts b/types/ol/pointer/PointerEvent.d.ts similarity index 100% rename from types/ol/pointer/pointerevent.d.ts rename to types/ol/pointer/PointerEvent.d.ts diff --git a/types/ol/proj/projection.d.ts b/types/ol/proj/Projection.d.ts similarity index 100% rename from types/ol/proj/projection.d.ts rename to types/ol/proj/Projection.d.ts diff --git a/types/ol/render/event.d.ts b/types/ol/render/Event.d.ts similarity index 100% rename from types/ol/render/event.d.ts rename to types/ol/render/Event.d.ts diff --git a/types/ol/render/feature.d.ts b/types/ol/render/Feature.d.ts similarity index 100% rename from types/ol/render/feature.d.ts rename to types/ol/render/Feature.d.ts diff --git a/types/ol/render/vectorcontext.d.ts b/types/ol/render/VectorContext.d.ts similarity index 100% rename from types/ol/render/vectorcontext.d.ts rename to types/ol/render/VectorContext.d.ts diff --git a/types/ol/source/bingmaps.d.ts b/types/ol/source/BingMaps.d.ts similarity index 100% rename from types/ol/source/bingmaps.d.ts rename to types/ol/source/BingMaps.d.ts diff --git a/types/ol/source/cartodb.d.ts b/types/ol/source/CartoDB.d.ts similarity index 100% rename from types/ol/source/cartodb.d.ts rename to types/ol/source/CartoDB.d.ts diff --git a/types/ol/source/cluster.d.ts b/types/ol/source/Cluster.d.ts similarity index 100% rename from types/ol/source/cluster.d.ts rename to types/ol/source/Cluster.d.ts diff --git a/types/ol/source/image.d.ts b/types/ol/source/Image.d.ts similarity index 100% rename from types/ol/source/image.d.ts rename to types/ol/source/Image.d.ts diff --git a/types/ol/source/imagearcgisrest.d.ts b/types/ol/source/ImageArcGISRest.d.ts similarity index 100% rename from types/ol/source/imagearcgisrest.d.ts rename to types/ol/source/ImageArcGISRest.d.ts diff --git a/types/ol/source/imagecanvas.d.ts b/types/ol/source/ImageCanvas.d.ts similarity index 100% rename from types/ol/source/imagecanvas.d.ts rename to types/ol/source/ImageCanvas.d.ts diff --git a/types/ol/source/imagemapguide.d.ts b/types/ol/source/ImageMapGuide.d.ts similarity index 100% rename from types/ol/source/imagemapguide.d.ts rename to types/ol/source/ImageMapGuide.d.ts diff --git a/types/ol/source/imagestatic.d.ts b/types/ol/source/ImageStatic.d.ts similarity index 100% rename from types/ol/source/imagestatic.d.ts rename to types/ol/source/ImageStatic.d.ts diff --git a/types/ol/source/imagevector.d.ts b/types/ol/source/ImageVector.d.ts similarity index 100% rename from types/ol/source/imagevector.d.ts rename to types/ol/source/ImageVector.d.ts diff --git a/types/ol/source/imagewms.d.ts b/types/ol/source/ImageWMS.d.ts similarity index 100% rename from types/ol/source/imagewms.d.ts rename to types/ol/source/ImageWMS.d.ts diff --git a/types/ol/source/osm.d.ts b/types/ol/source/OSM.d.ts similarity index 100% rename from types/ol/source/osm.d.ts rename to types/ol/source/OSM.d.ts diff --git a/types/ol/source/raster.d.ts b/types/ol/source/Raster.d.ts similarity index 100% rename from types/ol/source/raster.d.ts rename to types/ol/source/Raster.d.ts diff --git a/types/ol/source/source.d.ts b/types/ol/source/Source.d.ts similarity index 100% rename from types/ol/source/source.d.ts rename to types/ol/source/Source.d.ts diff --git a/types/ol/source/stamen.d.ts b/types/ol/source/Stamen.d.ts similarity index 100% rename from types/ol/source/stamen.d.ts rename to types/ol/source/Stamen.d.ts diff --git a/types/ol/source/tile.d.ts b/types/ol/source/Tile.d.ts similarity index 100% rename from types/ol/source/tile.d.ts rename to types/ol/source/Tile.d.ts diff --git a/types/ol/source/tilearcgisrest.d.ts b/types/ol/source/TileArcGISRest.d.ts similarity index 100% rename from types/ol/source/tilearcgisrest.d.ts rename to types/ol/source/TileArcGISRest.d.ts diff --git a/types/ol/source/tiledebug.d.ts b/types/ol/source/TileDebug.d.ts similarity index 100% rename from types/ol/source/tiledebug.d.ts rename to types/ol/source/TileDebug.d.ts diff --git a/types/ol/source/tileimage.d.ts b/types/ol/source/TileImage.d.ts similarity index 100% rename from types/ol/source/tileimage.d.ts rename to types/ol/source/TileImage.d.ts diff --git a/types/ol/source/tilejson.d.ts b/types/ol/source/TileJSON.d.ts similarity index 100% rename from types/ol/source/tilejson.d.ts rename to types/ol/source/TileJSON.d.ts diff --git a/types/ol/source/tileutfgrid.d.ts b/types/ol/source/TileUTFGrid.d.ts similarity index 100% rename from types/ol/source/tileutfgrid.d.ts rename to types/ol/source/TileUTFGrid.d.ts diff --git a/types/ol/source/tilewms.d.ts b/types/ol/source/TileWMS.d.ts similarity index 100% rename from types/ol/source/tilewms.d.ts rename to types/ol/source/TileWMS.d.ts diff --git a/types/ol/source/urltile.d.ts b/types/ol/source/UrlTile.d.ts similarity index 100% rename from types/ol/source/urltile.d.ts rename to types/ol/source/UrlTile.d.ts diff --git a/types/ol/source/vector.d.ts b/types/ol/source/Vector.d.ts similarity index 100% rename from types/ol/source/vector.d.ts rename to types/ol/source/Vector.d.ts diff --git a/types/ol/source/vectortile.d.ts b/types/ol/source/VectorTile.d.ts similarity index 100% rename from types/ol/source/vectortile.d.ts rename to types/ol/source/VectorTile.d.ts diff --git a/types/ol/source/wmts.d.ts b/types/ol/source/WMTS.d.ts similarity index 100% rename from types/ol/source/wmts.d.ts rename to types/ol/source/WMTS.d.ts diff --git a/types/ol/source/xyz.d.ts b/types/ol/source/XYZ.d.ts similarity index 100% rename from types/ol/source/xyz.d.ts rename to types/ol/source/XYZ.d.ts diff --git a/types/ol/source/zoomify.d.ts b/types/ol/source/Zoomify.d.ts similarity index 100% rename from types/ol/source/zoomify.d.ts rename to types/ol/source/Zoomify.d.ts diff --git a/types/ol/style/atlasmanager.d.ts b/types/ol/style/AtlasManager.d.ts similarity index 100% rename from types/ol/style/atlasmanager.d.ts rename to types/ol/style/AtlasManager.d.ts diff --git a/types/ol/style/circle.d.ts b/types/ol/style/Circle.d.ts similarity index 100% rename from types/ol/style/circle.d.ts rename to types/ol/style/Circle.d.ts diff --git a/types/ol/style/fill.d.ts b/types/ol/style/Fill.d.ts similarity index 100% rename from types/ol/style/fill.d.ts rename to types/ol/style/Fill.d.ts diff --git a/types/ol/style/icon.d.ts b/types/ol/style/Icon.d.ts similarity index 100% rename from types/ol/style/icon.d.ts rename to types/ol/style/Icon.d.ts diff --git a/types/ol/style/image.d.ts b/types/ol/style/Image.d.ts similarity index 100% rename from types/ol/style/image.d.ts rename to types/ol/style/Image.d.ts diff --git a/types/ol/style/regularshape.d.ts b/types/ol/style/RegularShape.d.ts similarity index 100% rename from types/ol/style/regularshape.d.ts rename to types/ol/style/RegularShape.d.ts diff --git a/types/ol/style/stroke.d.ts b/types/ol/style/Stroke.d.ts similarity index 100% rename from types/ol/style/stroke.d.ts rename to types/ol/style/Stroke.d.ts diff --git a/types/ol/style/style.d.ts b/types/ol/style/Style.d.ts similarity index 100% rename from types/ol/style/style.d.ts rename to types/ol/style/Style.d.ts diff --git a/types/ol/style/text.d.ts b/types/ol/style/Text.d.ts similarity index 100% rename from types/ol/style/text.d.ts rename to types/ol/style/Text.d.ts diff --git a/types/ol/tilegrid/tilegrid.d.ts b/types/ol/tilegrid/TileGrid.d.ts similarity index 100% rename from types/ol/tilegrid/tilegrid.d.ts rename to types/ol/tilegrid/TileGrid.d.ts diff --git a/types/ol/tilegrid/wmts.d.ts b/types/ol/tilegrid/WMTS.d.ts similarity index 100% rename from types/ol/tilegrid/wmts.d.ts rename to types/ol/tilegrid/WMTS.d.ts diff --git a/types/ol/tsconfig.json b/types/ol/tsconfig.json index 186bb605e0..8751d240da 100644 --- a/types/ol/tsconfig.json +++ b/types/ol/tsconfig.json @@ -20,159 +20,159 @@ "files": [ "index.d.ts", "ol-tests.ts", - "control/attribution.d.ts", - "control/control.d.ts", - "control/fullscreen.d.ts", - "control/mouseposition.d.ts", - "control/overviewmap.d.ts", - "control/rotate.d.ts", - "control/scaleline.d.ts", - "control/zoom.d.ts", - "control/zoomslider.d.ts", - "control/zoomtoextent.d.ts", + "control/Attribution.d.ts", + "control/Control.d.ts", + "control/Fullscreen.d.ts", + "control/MousePosition.d.ts", + "control/OverviewMap.d.ts", + "control/Rotate.d.ts", + "control/ScaleLine.d.ts", + "control/Zoom.d.ts", + "control/ZoomSlider.d.ts", + "control/ZoomToExtent.d.ts", "events/condition.d.ts", - "events/event.d.ts", - "events/eventtarget.d.ts", - "format/esrijson.d.ts", - "format/feature.d.ts", + "events/Event.d.ts", + "events/EventTarget.d.ts", + "format/EsriJSON.d.ts", + "format/Feature.d.ts", "format/filter.d.ts", - "format/geojson.d.ts", - "format/gml2.d.ts", - "format/gml3.d.ts", - "format/gmlbase.d.ts", - "format/gpx.d.ts", - "format/igc.d.ts", - "format/jsonfeature.d.ts", - "format/kml.d.ts", - "format/mvt.d.ts", - "format/osmxml.d.ts", - "format/polyline.d.ts", - "format/textfeature.d.ts", - "format/topojson.d.ts", - "format/wfs.d.ts", - "format/wkt.d.ts", - "format/wmscapabilities.d.ts", - "format/wmsgetfeatureinfo.d.ts", - "format/wmtscapabilities.d.ts", - "format/xml.d.ts", - "format/xmlfeature.d.ts", - "geom/circle.d.ts", - "geom/geometry.d.ts", - "geom/geometrycollection.d.ts", - "geom/linearring.d.ts", - "geom/linestring.d.ts", - "geom/multilinestring.d.ts", - "geom/multipoint.d.ts", - "geom/multipolygon.d.ts", - "geom/point.d.ts", - "geom/polygon.d.ts", - "geom/simplegeometry.d.ts", - "interaction/doubleclickzoom.d.ts", - "interaction/draganddrop.d.ts", - "interaction/dragbox.d.ts", - "interaction/dragpan.d.ts", - "interaction/dragrotate.d.ts", - "interaction/dragrotateandzoom.d.ts", - "interaction/dragzoom.d.ts", - "interaction/draw.d.ts", - "interaction/extent.d.ts", - "interaction/interaction.d.ts", - "interaction/keyboardpan.d.ts", - "interaction/keyboardzoom.d.ts", - "interaction/modify.d.ts", - "interaction/mousewheelzoom.d.ts", - "interaction/pinchrotate.d.ts", - "interaction/pinchzoom.d.ts", - "interaction/pointer.d.ts", - "interaction/select.d.ts", - "interaction/snap.d.ts", - "interaction/translate.d.ts", - "layer/base.d.ts", - "layer/group.d.ts", - "layer/heatmap.d.ts", - "layer/image.d.ts", - "layer/layer.d.ts", - "layer/tile.d.ts", - "layer/vector.d.ts", - "layer/vectortile.d.ts", - "pointer/pointerevent.d.ts", + "format/GeoJSON.d.ts", + "format/GML2.d.ts", + "format/GML3.d.ts", + "format/GMLBase.d.ts", + "format/GPX.d.ts", + "format/IGC.d.ts", + "format/JSONFeature.d.ts", + "format/KML.d.ts", + "format/MVT.d.ts", + "format/OSMXML.d.ts", + "format/Polyline.d.ts", + "format/TextFeature.d.ts", + "format/TopoJSON.d.ts", + "format/WFS.d.ts", + "format/WKT.d.ts", + "format/WMSCapabilities.d.ts", + "format/WMSGetFeatureInfo.d.ts", + "format/WMTSCapabilities.d.ts", + "format/XML.d.ts", + "format/XMLFeature.d.ts", + "geom/Circle.d.ts", + "geom/GeometryCollection.d.ts", + "geom/Geometry.d.ts", + "geom/LinearRing.d.ts", + "geom/LineString.d.ts", + "geom/MultilineString.d.ts", + "geom/MultiPoint.d.ts", + "geom/MultiPolygon.d.ts", + "geom/Point.d.ts", + "geom/Polygon.d.ts", + "geom/SimpleGeometry.d.ts", + "interaction/DoubleClickZoom.d.ts", + "interaction/DragAndDrop.d.ts", + "interaction/DragBox.d.ts", + "interaction/DragPan.d.ts", + "interaction/DragRotateAndZoom.d.ts", + "interaction/DragRotate.d.ts", + "interaction/DragZoom.d.ts", + "interaction/Draw.d.ts", + "interaction/Extent.d.ts", + "interaction/Interaction.d.ts", + "interaction/KeyboardPan.d.ts", + "interaction/KeyboardZoom.d.ts", + "interaction/Modify.d.ts", + "interaction/MouseWheelZoom.d.ts", + "interaction/PinchRotate.d.ts", + "interaction/PinchZoom.d.ts", + "interaction/Pointer.d.ts", + "interaction/Select.d.ts", + "interaction/Snap.d.ts", + "interaction/Translate.d.ts", + "layer/Base.d.ts", + "layer/Group.d.ts", + "layer/Heatmap.d.ts", + "layer/Image.d.ts", + "layer/Layer.d.ts", + "layer/Tile.d.ts", + "layer/Vector.d.ts", + "layer/VectorTile.d.ts", + "pointer/PointerEvent.d.ts", "proj/index.d.ts", - "proj/projection.d.ts", + "proj/Projection.d.ts", "render/canvas.d.ts", - "render/event.d.ts", - "render/feature.d.ts", - "render/vectorcontext.d.ts", - "source/bingmaps.d.ts", - "source/cartodb.d.ts", - "source/cluster.d.ts", - "source/image.d.ts", - "source/imagearcgisrest.d.ts", - "source/imagecanvas.d.ts", - "source/imagemapguide.d.ts", - "source/imagestatic.d.ts", - "source/imagevector.d.ts", - "source/imagewms.d.ts", - "source/osm.d.ts", - "source/raster.d.ts", - "source/source.d.ts", - "source/stamen.d.ts", - "source/tile.d.ts", - "source/tilearcgisrest.d.ts", - "source/tiledebug.d.ts", - "source/tileimage.d.ts", - "source/tilejson.d.ts", - "source/tileutfgrid.d.ts", - "source/tilewms.d.ts", - "source/urltile.d.ts", - "source/vector.d.ts", - "source/vectortile.d.ts", - "source/wmts.d.ts", - "source/xyz.d.ts", - "source/zoomify.d.ts", - "style/atlasmanager.d.ts", - "style/circle.d.ts", - "style/fill.d.ts", - "style/icon.d.ts", - "style/image.d.ts", - "style/regularshape.d.ts", - "style/stroke.d.ts", - "style/style.d.ts", - "style/text.d.ts", - "tilegrid/tilegrid.d.ts", - "tilegrid/wmts.d.ts", - "assertionerror/index.d.ts", - "attribution/index.d.ts", - "collection/index.d.ts", + "render/Event.d.ts", + "render/Feature.d.ts", + "render/VectorContext.d.ts", + "source/BingMaps.d.ts", + "source/CartoDB.d.ts", + "source/Cluster.d.ts", + "source/ImageArcGISRest.d.ts", + "source/ImageCanvas.d.ts", + "source/Image.d.ts", + "source/ImageMapGuide.d.ts", + "source/ImageStatic.d.ts", + "source/ImageVector.d.ts", + "source/ImageWMS.d.ts", + "source/OSM.d.ts", + "source/Raster.d.ts", + "source/Source.d.ts", + "source/Stamen.d.ts", + "source/TileArcGISRest.d.ts", + "source/TileDebug.d.ts", + "source/Tile.d.ts", + "source/TileImage.d.ts", + "source/TileJSON.d.ts", + "source/TileUTFGrid.d.ts", + "source/TileWMS.d.ts", + "source/UrlTile.d.ts", + "source/Vector.d.ts", + "source/VectorTile.d.ts", + "source/WMTS.d.ts", + "source/XYZ.d.ts", + "source/Zoomify.d.ts", + "style/AtlasManager.d.ts", + "style/Circle.d.ts", + "style/Fill.d.ts", + "style/Icon.d.ts", + "style/Image.d.ts", + "style/RegularShape.d.ts", + "style/Stroke.d.ts", + "style/Style.d.ts", + "style/Text.d.ts", + "tilegrid/TileGrid.d.ts", + "tilegrid/WMTS.d.ts", + "AssertionError/index.d.ts", + "Attribution/index.d.ts", + "Collection/index.d.ts", "color/index.d.ts", "colorlike/index.d.ts", "control/index.d.ts", "coordinate/index.d.ts", "deviceorientation/index.d.ts", - "disposable/index.d.ts", + "Disposable/index.d.ts", "easing/index.d.ts", "events/index.d.ts", "extent/index.d.ts", - "feature/index.d.ts", + "Feature/index.d.ts", "featureloader/index.d.ts", - "geolocation/index.d.ts", - "graticule/index.d.ts", - "image/index.d.ts", - "imagebase/index.d.ts", - "imagetile/index.d.ts", + "Geolocation/index.d.ts", + "Graticule/index.d.ts", + "ImageBase/index.d.ts", + "Image/index.d.ts", + "ImageTile/index.d.ts", "interaction/index.d.ts", - "kinetic/index.d.ts", + "Kinetic/index.d.ts", "loadingstrategy/index.d.ts", - "map/index.d.ts", - "mapbrowserevent/index.d.ts", - "mapbrowserpointerevent/index.d.ts", - "mapevent/index.d.ts", - "object/index.d.ts", - "observable/index.d.ts", - "overlay/index.d.ts", + "MapBrowserEvent/index.d.ts", + "MapBrowserPointerEvent/index.d.ts", + "MapEvent/index.d.ts", + "Map/index.d.ts", + "Object/index.d.ts", + "Observable/index.d.ts", + "Overlay/index.d.ts", "sphere/index.d.ts", - "tile/index.d.ts", + "Tile/index.d.ts", "tilegrid/index.d.ts", - "vectortile/index.d.ts", - "view/index.d.ts" + "VectorTile/index.d.ts", + "View/index.d.ts" ] -} \ No newline at end of file +} diff --git a/types/on-change/index.d.ts b/types/on-change/index.d.ts deleted file mode 100644 index 44fff26e60..0000000000 --- a/types/on-change/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for on-change 0.1 -// Project: https://github.com/sindresorhus/on-change#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -export = onChange; - -declare function onChange(object: T, onChange: () => void): T; diff --git a/types/on-change/on-change-tests.ts b/types/on-change/on-change-tests.ts deleted file mode 100644 index 003d89aab7..0000000000 --- a/types/on-change/on-change-tests.ts +++ /dev/null @@ -1,17 +0,0 @@ -import onChange = require('on-change'); - -const object = { - foo: false, - a: { - b: [ - { - c: false, - }, - ], - }, -}; - -const watchedObject = onChange(object, () => {}); - -watchedObject.foo = true; -watchedObject.a.b[0].c = true; diff --git a/types/open-graph/index.d.ts b/types/open-graph/index.d.ts new file mode 100644 index 0000000000..14a3fe3ce6 --- /dev/null +++ b/types/open-graph/index.d.ts @@ -0,0 +1,74 @@ +// Type definitions for open-graph 0.2 +// Project: https://github.com/samholmes/node-open-graph +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +declare namespace og { + interface Metadata { + [key: string]: string | string[] | undefined; + /** An alternate url to use if the webpage requires HTTPS. */ + secure_url?: string | string[]; + /** A MIME type for this image. */ + type?: string | string[]; + } + + interface ImageVideoMetadata extends Metadata { + /** A description of what is in the image (not a caption). If the page specifies an `og:image` it should specify `og:image:alt`. */ + alt?: string | string[]; + /** The number of pixels high. */ + height?: string | string[]; + /** The */ + url?: string | string[]; + /** The number of pixels wide. */ + width?: string | string[]; + } + + interface Data { + [key: string]: string | string[] | ImageVideoMetadata | Metadata | undefined; + /** A URL to an audio file to accompany this object. */ + audio?: string | string[] | Metadata; + /** A one to two sentence description of your object. */ + description?: string | string[]; + /** + * The word that appears before this object's title in a sentence. An enum of (a, an, the, "", auto). + * If auto is chosen, the consumer of your data should chose between "a" or "an". Default is "" (blank). + */ + determiner?: string | string[]; + /** An image URL which should represent your object within the graph. */ + image?: string | string[] | ImageVideoMetadata; + /** The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`. */ + locale?: + | string | string[] + | { + /** An array of other locales this page is available in. */ + alternate?: string | string[]; + }; + /** If your object is part of a larger web site, the name which should be displayed for the overall site. e.g., "IMDb". */ + site_name?: string | string[]; + /** The title of your object as it should appear within the graph, e.g., "The Rock". */ + title: string | string[]; + /** The type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required. */ + type?: string | string[]; + /** The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/". */ + url?: string | string[]; + /** A URL to a video file that complements this object. */ + video?: string | string[] | ImageVideoMetadata; + } + + type DataCallback = (err: Error | null, data: Data | undefined) => void; + type RequestCallback = (err: Error | null, data: string | undefined) => void; + + interface Options { + strict?: boolean; + } + + function parse(websiteContent: string, options?: Options): Data; + function getHTML(url: string | Cheerio, callback: RequestCallback): void; +} + +declare function og(url: string, callback: og.DataCallback, options?: og.Options): void; + +export = og; diff --git a/types/open-graph/open-graph-tests.ts b/types/open-graph/open-graph-tests.ts new file mode 100644 index 0000000000..4e3db10438 --- /dev/null +++ b/types/open-graph/open-graph-tests.ts @@ -0,0 +1,18 @@ +import og = require('open-graph'); + +const url = 'http://github.com/samholmes/node-open-graph/raw/master/test.html'; + +og(url, (err, meta) => { + if (meta) { + meta.custom; + meta.description; // $ExpectType string | string[] | undefined + } +}); + +og.parse('content', { + strict: true, +}); + +og.getHTML('http://github.com/samholmes/node-open-graph/raw/master/test.html', (err, data) => { + data; // $ExpectType string | undefined +}); diff --git a/types/open-graph/tsconfig.json b/types/open-graph/tsconfig.json new file mode 100644 index 0000000000..72fa10a12d --- /dev/null +++ b/types/open-graph/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", + "open-graph-tests.ts" + ] +} diff --git a/types/on-change/tslint.json b/types/open-graph/tslint.json similarity index 100% rename from types/on-change/tslint.json rename to types/open-graph/tslint.json diff --git a/types/openpgp/common/index.d.ts b/types/openpgp/common/index.d.ts new file mode 100644 index 0000000000..88796dea9d --- /dev/null +++ b/types/openpgp/common/index.d.ts @@ -0,0 +1,5 @@ +export class HKP { + constructor(keyServerUrl?: string); + lookup(options: {keyId?: string, query?: string }): Promise; + upload(publicKeyArmored: string): Promise; +} diff --git a/types/openpgp/index.d.ts b/types/openpgp/index.d.ts index d564c6df6d..628663a9ec 100644 --- a/types/openpgp/index.d.ts +++ b/types/openpgp/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for openpgp 4.0.1 +// Type definitions for openpgp 4.4.8 // Project: http://openpgpjs.org/ // Definitions by: Guillaume Lacasa // Errietta Kostala @@ -10,6 +10,8 @@ export as namespace openpgp; +export * from './common'; + export interface UserId { name?: string, email?: string, diff --git a/types/openpgp/openpgp-tests.ts b/types/openpgp/openpgp-tests.ts index 19e305cb26..100941074a 100644 --- a/types/openpgp/openpgp-tests.ts +++ b/types/openpgp/openpgp-tests.ts @@ -135,6 +135,23 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); return verified.signatures[0].valid; })(); +async () => { + let hkp = new openpgp.HKP(); + + const hkpOptions = { + query: 'alice@example.com' + }; + + const armoredPubkey = await hkp.lookup(hkpOptions); + await openpgp.key.readArmored(armoredPubkey); + + hkp = new openpgp.HKP('https://pgp.mit.edu'); + + const pubkey = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----'; + + await hkp.upload(pubkey); +} + // Open PGP Tests diff --git a/types/openpgp/ts3.2/index.d.ts b/types/openpgp/ts3.2/index.d.ts index 428f785dbe..e7f8cdd714 100644 --- a/types/openpgp/ts3.2/index.d.ts +++ b/types/openpgp/ts3.2/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for openpgp 4.0.1 +// Type definitions for openpgp 4.4.8 // Project: http://openpgpjs.org/ // Definitions by: Guillaume Lacasa // Errietta Kostala @@ -9,6 +9,8 @@ export as namespace openpgp; +export * from '../common'; + export interface UserId { name?: string, email?: string, diff --git a/types/ora/index.d.ts b/types/ora/index.d.ts deleted file mode 100644 index 13104b0b5c..0000000000 --- a/types/ora/index.d.ts +++ /dev/null @@ -1,290 +0,0 @@ -// Type definitions for ora 3.1 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed -// Christian Rackerseder -// BendingBender -// Aleh Zasypkin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -/// - -export = ora; - -/** - * Elegant terminal spinner. - * - * @param options If a string is provided, it is treated as a shortcut for `options.text`. - */ -declare function ora(options?: ora.Options | string): ora.Ora; - -declare namespace ora { - /** - * Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills - * or with `.fail()` if it rejects. - * - * @param action - * @param options If a string is provided, it is treated as a shortcut for `options.text`. - * @returns The spinner instance. - */ - function promise(action: PromiseLike, options?: Options | string): Ora; - - interface Ora { - /** - * A boolean of whether the instance is currently spinning. - */ - readonly isSpinning: boolean; - - /** - * Change the text. - */ - text: string; - - /** - * Change the spinner color. - */ - color: Color; - - /** - * Change the spinner. - */ - spinner: SpinnerName | Spinner; - - /** - * Change the spinner indent. - */ - indent: number; - - /** - * Start the spinner. - * - * @param text Set the current text. - * @returns The spinner instance. - */ - start(text?: string): Ora; - - /** - * Stop and clear the spinner. - * - * @returns The spinner instance. - */ - stop(): Ora; - - /** - * Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - succeed(text?: string): Ora; - - /** - * Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - fail(text?: string): Ora; - - /** - * Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - warn(text?: string): Ora; - - /** - * Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - info(text?: string): Ora; - - /** - * Stop the spinner and change the symbol or text. - * - * @param options - * @returns The spinner instance. - */ - stopAndPersist(options?: PersistOptions): Ora; - - /** - * Clear the spinner. - * @returns The spinner instance. - */ - clear(): Ora; - - /** - * Manually render a new frame. - * @returns The spinner instance. - */ - render(): Ora; - - /** - * Get a new frame. - * @returns The spinner instance. - */ - frame(): Ora; - } - - interface Options { - /** - * Text to display after the spinner. - */ - text?: string; - /** - * Name of one of the provided spinners. See `example.js` in this repo if you want to test out different spinners. - * On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support. - * - * Or an object like: - * - * @example - * { - * interval: 80, // optional - * frames: ['-', '+', '-'] - * } - * - * @default 'dots' - */ - spinner?: SpinnerName | Spinner; - /** - * Color of the spinner. - * @default 'cyan' - */ - color?: Color; - /** - * Set to `false` to stop Ora from hiding the cursor. - * @default true - */ - hideCursor?: boolean; - /** - * Indent the spinner with the given number of spaces. - * @default 0 - */ - indent?: number; - /** - * Interval between each frame. - * - * Spinners provide their own recommended interval, so you don't really need to specify this. - * @default Provided by the spinner or 100 - */ - interval?: number; - /** - * Stream to write the output. - * - * You could for example set this to `process.stdout` instead. - * @default process.stderr - */ - stream?: NodeJS.WritableStream; - /** - * Force enable/disable the spinner. If not specified, the spinner will be enabled - * if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment. - * - * Note that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, - * colors, and other ansi escape codes. It will still log text. - */ - isEnabled?: boolean; - } - - interface PersistOptions { - /** - * Symbol to replace the spinner with. - * @default ' ' - */ - symbol?: string; - /** - * Text to be persisted. - * @default Current text - */ - text?: string; - } - - interface Spinner { - interval?: number; - frames: string[]; - } - - type SpinnerName = - | 'dots' - | 'dots2' - | 'dots3' - | 'dots4' - | 'dots5' - | 'dots6' - | 'dots7' - | 'dots8' - | 'dots9' - | 'dots10' - | 'dots11' - | 'dots12' - | 'line' - | 'line2' - | 'pipe' - | 'simpleDots' - | 'simpleDotsScrolling' - | 'star' - | 'star2' - | 'flip' - | 'hamburger' - | 'growVertical' - | 'growHorizontal' - | 'balloon' - | 'balloon2' - | 'noise' - | 'bounce' - | 'boxBounce' - | 'boxBounce2' - | 'triangle' - | 'arc' - | 'circle' - | 'squareCorners' - | 'circleQuarters' - | 'circleHalves' - | 'squish' - | 'toggle' - | 'toggle2' - | 'toggle3' - | 'toggle4' - | 'toggle5' - | 'toggle6' - | 'toggle7' - | 'toggle8' - | 'toggle9' - | 'toggle10' - | 'toggle11' - | 'toggle12' - | 'toggle13' - | 'arrow' - | 'arrow2' - | 'arrow3' - | 'bouncingBar' - | 'bouncingBall' - | 'smiley' - | 'monkey' - | 'hearts' - | 'clock' - | 'earth' - | 'moon' - | 'runner' - | 'pong' - | 'shark' - | 'dqpb' - | 'weather' - | 'christmas' - | 'grenade' - | 'point' - | 'layer'; - - type Color = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray'; -} diff --git a/types/ora/ora-tests.ts b/types/ora/ora-tests.ts deleted file mode 100644 index 4e06c11248..0000000000 --- a/types/ora/ora-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { PassThrough } from 'stream'; -import ora = require('ora'); - -const spinner = ora('Loading unicorns'); -ora({ text: 'Loading unicorns' }); -ora({ spinner: 'squish' }); -ora({ spinner: { frames: ['-', '+', '-'] } }); -ora({ spinner: { interval: 80, frames: ['-', '+', '-'] } }); -ora({ color: 'cyan' }); -ora({ color: 'foo' }); // $ExpectError -ora({ hideCursor: true }); -ora({ indent: 1 }); -ora({ interval: 80 }); -ora({ stream: new PassThrough() }); -ora({ isEnabled: true }); - -spinner.color = 'yellow'; -spinner.text = 'Loading rainbows'; -spinner.isSpinning; // $ExpectType boolean -spinner.isSpinning = true; // $ExpectError -spinner.spinner = 'dots'; -spinner.indent = 5; - -spinner.start(); -spinner.start('Test text'); -spinner.stop(); -spinner.succeed(); -spinner.succeed('fooed'); -spinner.fail(); -spinner.fail('failed to foo'); -spinner.warn(); -spinner.warn('warn foo'); -spinner.info(); -spinner.info('info foo'); -spinner.stopAndPersist(); -spinner.stopAndPersist({ text: 'all done' }); -spinner.stopAndPersist({ symbol: '@', text: 'all done' }); -spinner.clear(); -spinner.render(); -spinner.frame(); - -const resolves = Promise.resolve(1); -ora.promise(resolves, 'foo'); -ora.promise(resolves, { - stream: new PassThrough(), - text: 'foo', - color: 'blue', - isEnabled: true, -}); diff --git a/types/ora/v0/index.d.ts b/types/ora/v0/index.d.ts deleted file mode 100644 index 771f6beef6..0000000000 --- a/types/ora/v0/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for ora 0.3 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed , Christian Rackerseder -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; -interface Options { - text?: string; - spinner?: string | Spinner; - color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; -} -interface Spinner { - interval?: number; - frames: string[]; -} -interface Instance { - start(): Instance; - stop(): Instance; - succeed(): Instance; - fail(): Instance; - stopAndPersist(symbol?: string): Instance; - clear(): Instance; - render(): Instance; - frame(): Instance; - text: string; - color: Color; -} -declare function ora(options: Options | string): Instance; -export = ora; diff --git a/types/ora/v0/ora-tests.ts b/types/ora/v0/ora-tests.ts deleted file mode 100644 index b6e2a671dc..0000000000 --- a/types/ora/v0/ora-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ -import ora = require('ora'); - -const spinner = ora('Loading unicorns').start(); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); diff --git a/types/ora/v0/tsconfig.json b/types/ora/v0/tsconfig.json deleted file mode 100644 index b614f6cbc4..0000000000 --- a/types/ora/v0/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "ora": [ - "ora/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "ora-tests.ts" - ] -} \ No newline at end of file diff --git a/types/ora/v1/index.d.ts b/types/ora/v1/index.d.ts deleted file mode 100644 index a3099f6cd9..0000000000 --- a/types/ora/v1/index.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -// Type definitions for ora 1.3 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed -// Christian Rackerseder -// BendingBender -// Aleh Zasypkin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -type SpinnerName = - 'dots' - | 'dots2' - | 'dots3' - | 'dots4' - | 'dots5' - | 'dots6' - | 'dots7' - | 'dots8' - | 'dots9' - | 'dots10' - | 'dots11' - | 'dots12' - | 'line' - | 'line2' - | 'pipe' - | 'simpleDots' - | 'simpleDotsScrolling' - | 'star' - | 'star2' - | 'flip' - | 'hamburger' - | 'growVertical' - | 'growHorizontal' - | 'balloon' - | 'balloon2' - | 'noise' - | 'bounce' - | 'boxBounce' - | 'boxBounce2' - | 'triangle' - | 'arc' - | 'circle' - | 'squareCorners' - | 'circleQuarters' - | 'circleHalves' - | 'squish' - | 'toggle' - | 'toggle2' - | 'toggle3' - | 'toggle4' - | 'toggle5' - | 'toggle6' - | 'toggle7' - | 'toggle8' - | 'toggle9' - | 'toggle10' - | 'toggle11' - | 'toggle12' - | 'toggle13' - | 'arrow' - | 'arrow2' - | 'arrow3' - | 'bouncingBar' - | 'bouncingBall' - | 'smiley' - | 'monkey' - | 'hearts' - | 'clock' - | 'earth' - | 'moon' - | 'runner' - | 'pong' - | 'shark' - | 'dqpb'; - -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; - -interface Options { - text?: string; - spinner?: SpinnerName | Spinner; - color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; - hideCursor?: boolean; -} - -interface PersistOptions { - symbol?: string; - text?: string; -} - -interface Spinner { - interval?: number; - frames: string[]; -} - -declare class Ora { - start(text?: string): Ora; - - stop(): Ora; - - succeed(text?: string): Ora; - - fail(text?: string): Ora; - - warn(text?: string): Ora; - - info(text?: string): Ora; - - stopAndPersist(options?: PersistOptions | string): Ora; - - clear(): Ora; - - render(): Ora; - - frame(): Ora; - - text: string; - - color: Color; - - frameIndex: number; -} - -interface oraFactory { - (options?: Options | string): Ora; - - new (options?: Options | string): Ora; - - promise(action: PromiseLike, options?: Options | string): Ora; -} - -declare const ora: oraFactory; - -export = ora; diff --git a/types/ora/v1/ora-tests.ts b/types/ora/v1/ora-tests.ts deleted file mode 100644 index 56a0d498c3..0000000000 --- a/types/ora/v1/ora-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { PassThrough } from 'stream'; -import Ora = require('ora'); - -const spinner = Ora('Loading unicorns').start(); - -const spinnerNothing = Ora().start(); - -const spinnerNew = new Ora({ - text: 'Loading unicorns', - spinner: 'squish' -}); - -const spinnerNew2 = new Ora({ - stream: new PassThrough(), - text: 'foo', - color: 'cyan', - enabled: true -}); - -spinner.start(); -spinner.start('Test text'); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); - -setTimeout(() => { - spinner.succeed(); -}, 2000); - -spinner.succeed(); -spinner.succeed('fooed'); -spinner.fail(); -spinner.fail('failed to foo'); -spinner.warn(); -spinner.info(); -spinner.stopAndPersist(); -spinner.stopAndPersist('@'); -spinner.stopAndPersist({text: 'all done'}); -spinner.stopAndPersist({symbol: '@', text: 'all done'}); - -const resolves = Promise.resolve(1); -Ora.promise(resolves, { - stream: new PassThrough(), - text: 'foo', - color: 'blue', - enabled: true -}); diff --git a/types/ora/v1/tsconfig.json b/types/ora/v1/tsconfig.json deleted file mode 100644 index ad30053dff..0000000000 --- a/types/ora/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "ora": [ - "ora/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true - }, - "files": [ - "index.d.ts", - "ora-tests.ts" - ] -} diff --git a/types/p-event/index.d.ts b/types/p-event/index.d.ts deleted file mode 100644 index 6f76b75748..0000000000 --- a/types/p-event/index.d.ts +++ /dev/null @@ -1,205 +0,0 @@ -// Type definitions for p-event 2.3 -// Project: https://github.com/sindresorhus/p-event#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { PCancelable } from 'p-cancelable'; - -export = pEvent; - -/** - * Promisify an event by waiting for it to be emitted. - * - * Returns a `Promise` that is fulfilled when emitter emits an event matching `event`, or rejects if emitter emits - * any of the events defined in the `rejectionEvents` option. - * - * **Note**: `event` is a string for a single event type, for example, `'data'`. To listen on multiple - * events, pass an array of strings, such as `['started', 'stopped']`. - * - * The returned promise has a `.cancel()` method, which when called, removes the event listeners and causes the promise to never be settled. - * - * @param emitter Event emitter object. Should have either a `.on()`/`.addListener()`/`.addEventListener()` and - * `.off()`/`.removeListener()`/`.removeEventListener()` method, like the [Node.js `EventEmitter`](https://nodejs.org/api/events.html) and - * [DOM events](https://developer.mozilla.org/en-US/docs/Web/Events). - * @param event Name of the event or events to listen to. If the same event is defined both here and in - * `rejectionEvents`, this one takes priority. - */ -declare function pEvent( - emitter: pEvent.Emitter, - event: string | symbol | Array, - options: pEvent.MultiArgsOptions -): PCancelable>; -declare function pEvent( - emitter: pEvent.Emitter, - event: string | symbol | Array, - filter: pEvent.FilterFn -): PCancelable; -declare function pEvent( - emitter: pEvent.Emitter, - event: string | symbol | Array, - options?: pEvent.Options -): PCancelable; - -declare namespace pEvent { - /** - * Wait for multiple event emissions. Returns an array. - */ - function multiple( - emitter: Emitter, - event: string | symbol | Array, - options: MultipleMultiArgsOptions - ): PCancelable>>; - function multiple( - emitter: Emitter, - event: string | symbol | Array, - options: MultipleOptions - ): PCancelable; - - /** - * Returns an [async iterator](http://2ality.com/2016/10/asynchronous-iteration.html) that lets you asynchronously - * iterate over events of `event` emitted from `emitter`. The iterator ends when `emitter` emits an event matching - * any of the events defined in `resolutionEvents`, or rejects if `emitter` emits any of the events defined in - * the `rejectionEvents` option. - */ - function iterator( - emitter: Emitter, - event: string | symbol | Array, - options: IteratorMultiArgsOptions - ): AsyncIterableIterator>; - function iterator( - emitter: Emitter, - event: string | symbol | Array, - filter: FilterFn - ): AsyncIterableIterator; - function iterator( - emitter: Emitter, - event: string | symbol | Array, - options?: IteratorOptions - ): AsyncIterableIterator; - - interface Emitter { - on?: AddRmListenerFn; - addListener?: AddRmListenerFn; - addEventListener?: AddRmListenerFn; - off?: AddRmListenerFn; - removeListener?: AddRmListenerFn; - removeEventListener?: AddRmListenerFn; - } - - type FilterFn = (el: T) => boolean; - - interface Options { - /** - * Events that will reject the promise. - * @default ['error'] - */ - rejectionEvents?: Array; - /** - * By default, the promisified function will only return the first argument from the event callback, - * which works fine for most APIs. This option can be useful for APIs that return multiple arguments - * in the callback. Turning this on will make it return an array of all arguments from the callback, - * instead of just the first argument. This also applies to rejections. - * - * @example - * const pEvent = require('p-event'); - * const emitter = require('./some-event-emitter'); - * - * (async () => { - * const [foo, bar] = await pEvent(emitter, 'finish', {multiArgs: true}); - * })(); - * - * @default false - */ - multiArgs?: boolean; - /** - * Time in milliseconds before timing out. - * @default Infinity - */ - timeout?: number; - /** - * Filter function for accepting an event. - * - * @example - * const pEvent = require('p-event'); - * const emitter = require('./some-event-emitter'); - * - * (async () => { - * const result = await pEvent(emitter, '🦄', value => value > 3); - * // Do something with first 🦄 event with a value greater than 3 - * })(); - */ - filter?: FilterFn; - } - - interface MultiArgsOptions extends Options { - multiArgs: true; - } - - interface MultipleOptions extends Options { - /** - * The number of times the event needs to be emitted before the promise resolves. - */ - count: number; - /** - * Whether to resolve the promise immediately. Emitting one of the `rejectionEvents` won't throw an error. - * - * **Note**: The returned array will be mutated when an event is emitted. - * - * @example - * const emitter = new EventEmitter(); - * - * const promise = pEvent.multiple(emitter, 'hello', { - * resolveImmediately: true, - * count: Infinity - * }); - * - * const result = await promise; - * console.log(result); - * //=> [] - * - * emitter.emit('hello', 'Jack'); - * console.log(result); - * //=> ['Jack'] - * - * emitter.emit('hello', 'Mark'); - * console.log(result); - * //=> ['Jack', 'Mark'] - * - * // Stops listening - * emitter.emit('error', new Error('😿')); - * - * emitter.emit('hello', 'John'); - * console.log(result); - * //=> ['Jack', 'Mark'] - */ - resolveImmediately?: boolean; - } - - interface MultipleMultiArgsOptions extends MultipleOptions { - multiArgs: true; - } - - interface IteratorOptions extends Options { - /** - * Maximum number of events for the iterator before it ends. When the limit is reached, the iterator will be - * marked as `done`. This option is useful to paginate events, for example, fetching 10 events per page. - * @default Infinity - */ - limit?: number; - /** - * Events that will end the iterator. - * @default [] - */ - resolutionEvents?: Array; - } - - interface IteratorMultiArgsOptions extends IteratorOptions { - multiArgs: true; - } -} - -type AddRmListenerFn = ( - event: string | symbol, - listener: (arg1: T, ...args: TRest[]) => void -) => void; diff --git a/types/p-event/p-event-tests.ts b/types/p-event/p-event-tests.ts deleted file mode 100644 index dbbe50eee7..0000000000 --- a/types/p-event/p-event-tests.ts +++ /dev/null @@ -1,110 +0,0 @@ -/// - -import pEvent = require('p-event'); -import { EventEmitter } from 'events'; -import * as fs from 'fs'; - -class NodeEmitter extends EventEmitter { - on(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - addListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - addEventListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - off(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - removeListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - removeEventListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } -} - -class DomEmitter implements EventTarget { - addEventListener( - type: 'foo', - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions - ): void {} - - dispatchEvent(event: Event): boolean { - return false; - } - - removeEventListener( - type: 'foo', - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions - ): void {} -} - -pEvent(new NodeEmitter(), 'finish'); // $ExpectType PCancelable -pEvent(new NodeEmitter(), '🦄', value => value > 3); // $ExpectType PCancelable -pEvent(new DomEmitter(), 'finish'); // $ExpectType PCancelable -pEvent(document, 'DOMContentLoaded'); // $ExpectType PCancelable - -pEvent(new NodeEmitter(), 'finish', { rejectionEvents: ['error'] }); // $ExpectType PCancelable -pEvent(new NodeEmitter(), 'finish', { timeout: 1 }); // $ExpectType PCancelable -pEvent(new NodeEmitter(), 'finish', { filter: value => value > 3 }); // $ExpectType PCancelable -pEvent(new NodeEmitter(), 'finish', { multiArgs: true }); // $ExpectType PCancelable<(string | number)[]> - -pEvent(new NodeEmitter(), 'finish').cancel(); - -// $ExpectType PCancelable -pEvent.multiple(new NodeEmitter(), 'hello', { - count: Infinity, -}); -// $ExpectType PCancelable -pEvent.multiple(new NodeEmitter(), 'hello', { - resolveImmediately: true, - count: Infinity, -}); -// $ExpectType PCancelable<(string | number)[][]> -pEvent.multiple(new NodeEmitter(), 'hello', { - count: Infinity, - multiArgs: true, -}); -// $ExpectError -pEvent.multiple(new NodeEmitter(), 'hello', {}); -// $ExpectError -pEvent.multiple(new NodeEmitter(), 'hello'); - -pEvent.iterator(new NodeEmitter(), 'finish'); // $ExpectType AsyncIterableIterator -pEvent.iterator(new NodeEmitter(), '🦄', value => value > 3); // $ExpectType AsyncIterableIterator - -pEvent.iterator(new NodeEmitter(), 'finish', { limit: 1 }); // $ExpectType AsyncIterableIterator -pEvent.iterator(new NodeEmitter(), 'finish', { resolutionEvents: ['finish'] }); // $ExpectType AsyncIterableIterator -pEvent.iterator(new NodeEmitter(), 'finish', { multiArgs: true }); // $ExpectType AsyncIterableIterator<(string | number)[]> - -async function getOpenReadStream(file: string) { - const stream = fs.createReadStream(file); - await pEvent(stream, 'open'); - return stream; -} - -(async () => { - const stream = await getOpenReadStream('unicorn.txt'); - stream.pipe(process.stdout); -})().catch(console.error); - -(async () => { - try { - const result = await pEvent(new NodeEmitter(), 'finish'); - - if (result === 1) { - throw new Error('Emitter finished with an error'); - } - - // `emitter` emitted a `finish` event with an acceptable value - console.log(result); - } catch (error) { - // `emitter` emitted an `error` event or - // emitted a `finish` with 'unwanted result' - console.error(error); - } -})(); diff --git a/types/p-event/tsconfig.json b/types/p-event/tsconfig.json deleted file mode 100644 index dfde34c0e1..0000000000 --- a/types/p-event/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es2016", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-event-tests.ts" - ] -} diff --git a/types/p-event/v1/index.d.ts b/types/p-event/v1/index.d.ts deleted file mode 100644 index 0fde40d140..0000000000 --- a/types/p-event/v1/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Type definitions for p-event 1.3 -// Project: https://github.com/sindresorhus/p-event#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = pEvent; - -declare function pEvent(emitter: pEvent.Emitter, event: string | symbol, options: MultiArgsOptions): Promise>; -declare function pEvent(emitter: pEvent.Emitter, event: string | symbol, filter: FilterFn): Promise; -declare function pEvent(emitter: pEvent.Emitter, event: string | symbol, options?: pEvent.Options): Promise; - -declare namespace pEvent { - interface Emitter { - on?: AddRmListenerFn; - addListener?: AddRmListenerFn; - addEventListener?: AddRmListenerFn; - off?: AddRmListenerFn; - removeListener?: AddRmListenerFn; - removeEventListener?: AddRmListenerFn; - } - - interface Options { - rejectionEvents?: string[]; - multiArgs?: boolean; - timeout?: number; - filter?: FilterFn; - } -} - -type AddRmListenerFn = (event: string | symbol, listener: (arg1: T, ...args: TRest[]) => void) => void; -type FilterFn = (el: T) => boolean; - -interface MultiArgsOptions extends pEvent.Options { - multiArgs: true; -} diff --git a/types/p-event/v1/p-event-tests.ts b/types/p-event/v1/p-event-tests.ts deleted file mode 100644 index 0295cdb34b..0000000000 --- a/types/p-event/v1/p-event-tests.ts +++ /dev/null @@ -1,61 +0,0 @@ -/// - -import pEvent = require('p-event'); -import * as events from 'events'; -import * as fs from 'fs'; - -class MyEmitter extends events.EventEmitter { -} - -class MyDomEmitter implements EventTarget { - addEventListener(type: 'foo', listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void { - } - - dispatchEvent(event: Event): boolean { - return false; - } - - removeEventListener(type: 'foo', listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void { - } -} - -pEvent(new MyEmitter(), 'finish') - .then(result => { - console.log(result); - }) - .catch(error => { - console.error(error); - }); - -pEvent(new MyEmitter(), 'finish').then(result => { - const str: string = result; -}); - -pEvent(new MyDomEmitter(), 'finish').then(result => { - const e: Event | undefined = result; -}); - -pEvent(document, 'DOMContentLoaded').then(() => { - console.log('😎'); -}); - -pEvent(new MyEmitter(), 'finish', {multiArgs: true}).then(result => { - const strArr: string[] = result; -}); - -pEvent(new MyEmitter(), '🦄', value => value > 3).then(result => { - const num: number = result; -}); - -async function getOpenReadStream(file: string) { - const stream = fs.createReadStream(file); - await pEvent(stream, 'open'); - return stream; -} - -getOpenReadStream('unicorn.txt') - .then(stream => { - console.log('Is readable:', stream.readable); - stream.pipe(process.stdout); - }) - .catch(console.error); diff --git a/types/p-event/v1/tsconfig.json b/types/p-event/v1/tsconfig.json deleted file mode 100644 index e8374c9b9e..0000000000 --- a/types/p-event/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": false, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "p-event": [ - "p-event/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-event-tests.ts" - ] -} diff --git a/types/p-limit/index.d.ts b/types/p-limit/index.d.ts deleted file mode 100644 index de7b0a07d9..0000000000 --- a/types/p-limit/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Type definitions for p-limit 2.1 -// Project: https://github.com/sindresorhus/p-limit#readme -// Definitions by: BendingBender -// Linus Unnebäck -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 - -export = pLimit; - -/** - * Run multiple promise-returning & async functions with limited concurrency. - * @param concurrency Concurrency limit. Minimum: `1`. - * @returns A `limit` function. - */ -declare function pLimit(concurrency: number): pLimit.Limit; - -declare namespace pLimit { - interface Limit { - /** - * Returns the promise returned by calling `fn(...args)`. - * - * @param fn Promise-returning/async function. - * @param args Any arguments to pass through to `fn`. - * Support for passing arguments on to the `fn` is provided in order to be able to avoid - * creating unnecessary closures. You probably don't need this optimization unless you're - * pushing a lot of functions. - */ - ( - fn: (...args: TArgs) => PromiseLike | R, - ...args: TArgs - ): Promise; - - /** - * The number of promises that are currently running. - */ - readonly activeCount: number; - - /** - * The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - */ - readonly pendingCount: number; - } -} diff --git a/types/p-limit/p-limit-tests.ts b/types/p-limit/p-limit-tests.ts deleted file mode 100644 index 3f9fb51083..0000000000 --- a/types/p-limit/p-limit-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import pLimit = require('p-limit'); - -const limit = pLimit(1); - -const input = [ - limit(() => Promise.resolve('foo')), - limit(() => Promise.resolve('bar')), - limit(() => Promise.resolve(undefined)), -]; - -Promise.all(input); // $ExpectType Promise<(string | undefined)[]> - -limit((a: string) => '', 'test').then(v => { - v; // $ExpectType string -}); -limit((a: string, b: number) => Promise.resolve(''), 'test', 1).then(v => { - v; // $ExpectType string -}); - -limit.activeCount; // $ExpectType number -limit.activeCount = 1; // $ExpectError -limit.pendingCount; // $ExpectType number -limit.pendingCount = 1; // $ExpectError diff --git a/types/p-queue/index.d.ts b/types/p-queue/index.d.ts deleted file mode 100644 index 96fda8426a..0000000000 --- a/types/p-queue/index.d.ts +++ /dev/null @@ -1,160 +0,0 @@ -// Type definitions for p-queue 3.1 -// Project: https://github.com/sindresorhus/p-queue#readme -// Definitions by: BendingBender -// Evan Shortiss -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -/// - -import { EventEmitter } from 'events'; - -export = PQueue; - -/** - * Promise queue with concurrency control. - */ -declare class PQueue< - TEnqueueOptions extends PQueue.QueueAddOptions = PQueue.DefaultAddOptions -> extends EventEmitter { - /** - * Size of the queue. - */ - readonly size: number; - - /** - * Number of pending promises. - */ - readonly pending: number; - - /** - * Whether the queue is currently paused. - */ - readonly isPaused: boolean; - - constructor(opts?: PQueue.Options); - - /** - * Adds a sync or async task to the queue. Always returns a promise. - * @param fn Promise-returning/async function. - * @param opts - */ - add(fn: PQueue.Task, opts?: TEnqueueOptions): Promise; - - /** - * Same as `.add()`, but accepts an array of sync or async functions - * and returns a promise that resolves when all functions are resolved. - * @param fn Array of Promise-returning/async functions. - */ - addAll(fns: Array>, opts?: TEnqueueOptions): 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; - - addListener(event: 'active', listener: () => void): this; - on(event: 'active', listener: () => void): this; - once(event: 'active', listener: () => void): this; - prependListener(event: 'active', listener: () => void): this; - prependOnceListener(event: 'active', listener: () => void): this; - removeListener(event: 'active', listener: () => void): this; - off(event: 'active', listener: () => void): this; - removeAllListeners(event?: 'active'): this; - listeners(event: 'active'): Array<() => void>; - rawListeners(event: 'active'): Array<() => void>; - emit(event: 'active'): boolean; - eventNames(): Array<'active'>; - listenerCount(type: 'active'): number; -} - -declare namespace PQueue { - interface QueueAddOptions { - [key: string]: any; - } - - interface QueueClassConstructor { - new (): QueueClass; - } - - interface QueueClass { - size: number; - - enqueue(run: () => void, options?: TEnqueueOptions): void; - - dequeue(): (() => void) | undefined; - } - - interface Options { - /** - * Concurrency limit. Minimum: `1`. - * @default Infinity - */ - concurrency?: number; - /** - * Whether queue tasks within concurrency limit, are auto-executed as soon as they're added. - * @default true - */ - autoStart?: boolean; - /** - * Class with a `enqueue` and `dequeue` method, and a `size` getter. See the - * [Custom QueueClass](https://github.com/sindresorhus/p-queue#custom-queueclass) section. - */ - queueClass?: QueueClassConstructor; - /** - * The max number of runs in the given interval of time. Minimum: `1`. - * @default Infinity - */ - intervalCap?: number; - /** - * The length of time in milliseconds before the interval count resets. Must be finite. Minimum: `0`. - * @default 0 - */ - interval?: number; - /** - * Whether the task must finish in the given interval or will be carried over into the next interval count. - * @default false - */ - carryoverConcurrencyCount?: boolean; - } - - interface DefaultAddOptions { - /** - * Priority of operation. Operations with greater priority will be scheduled first. - * @default 0 - */ - priority?: number; - } - - type Task = (() => PromiseLike) | (() => T); -} diff --git a/types/p-queue/p-queue-tests.ts b/types/p-queue/p-queue-tests.ts deleted file mode 100644 index 4ce6fbb13e..0000000000 --- a/types/p-queue/p-queue-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import PQueue = require('p-queue'); - -const queue = new PQueue({ concurrency: 1 }); -new PQueue({ autoStart: false }); -new PQueue({ intervalCap: 1 }); -new PQueue({ interval: 0 }); -new PQueue({ carryoverConcurrencyCount: true }); - -queue.add(() => Promise.resolve('sindresorhus.com')); // $ExpectType Promise -queue.add(() => 'sindresorhus.com'); // $ExpectType Promise -queue.add(() => 'sindresorhus.com', { priority: 1 }); // $ExpectType Promise - -queue.addAll([() => Promise.resolve('oh'), () => 'hi']); // $ExpectType Promise -queue.addAll([() => Promise.resolve('oh'), () => 1]); // $ExpectType Promise<(string | number)[]> -queue.addAll([() => Promise.resolve('oh'), () => 'hi'], { priority: 1 }); // $ExpectType Promise - -queue.onEmpty(); // $ExpectType Promise -queue.onIdle(); // $ExpectType Promise -queue.start(); -queue.pause(); -queue.clear(); - -queue.size; // $ExpectType number -queue.size = 1; // $ExpectError -queue.pending; // $ExpectType number -queue.pending = 5; // $ExpectError -queue.isPaused; // $ExpectType boolean -queue.isPaused = true; // $ExpectError - -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/tsconfig.json b/types/p-queue/tsconfig.json deleted file mode 100644 index b3dd5e5314..0000000000 --- a/types/p-queue/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-queue-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-queue/v2/index.d.ts b/types/p-queue/v2/index.d.ts deleted file mode 100644 index 568de0ca1d..0000000000 --- a/types/p-queue/v2/index.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -// 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 deleted file mode 100644 index fcd48c852d..0000000000 --- a/types/p-queue/v2/p-queue-tests.ts +++ /dev/null @@ -1,51 +0,0 @@ -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 deleted file mode 100644 index 49d979aa06..0000000000 --- a/types/p-queue/v2/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "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/passport-github2/index.d.ts b/types/passport-github2/index.d.ts index 0048cfd901..a938e8c36b 100644 --- a/types/passport-github2/index.d.ts +++ b/types/passport-github2/index.d.ts @@ -29,6 +29,7 @@ export interface StrategyOption extends passport.AuthenticateOptions { scopeSeparator?: string; customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; + userEmailURL?: string; } export type OAuth2StrategyOptionsWithoutRequiredURLs = Pick< @@ -50,6 +51,7 @@ export interface _StrategyOptionsBase extends OAuth2StrategyOptionsWithoutRequir scopeSeparator?: string; customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; + userEmailURL?: string; } export interface StrategyOptions extends _StrategyOptionsBase { diff --git a/types/pdfjs-dist/index.d.ts b/types/pdfjs-dist/index.d.ts index 81de4624f9..84d40e926a 100644 --- a/types/pdfjs-dist/index.d.ts +++ b/types/pdfjs-dist/index.d.ts @@ -1,487 +1,471 @@ -// Type definitions for PDF.js v0.1.0 +// Type definitions for PDF.js v2.0 // Project: https://github.com/mozilla/pdf.js -// Definitions by: Josh Baldwin +// Definitions by: Josh Baldwin , Dmitrii Sorin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 -/* -Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/pdf.d.ts - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -*/ +/// interface PDFPromise { - isResolved(): boolean; - isRejected(): boolean; - resolve(value: T): void; - reject(reason: string): void; - then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; + isResolved(): boolean; + isRejected(): boolean; + resolve(value: T): void; + reject(reason: string): void; + then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; } interface PDFTreeNode { - title: string; - bold: boolean; - italic: boolean; - color: number[]; // [r,g,b] - dest: any; - items: PDFTreeNode[]; + title: string; + bold: boolean; + italic: boolean; + color: number[]; // [r,g,b] + dest: any; + items: PDFTreeNode[]; } interface PDFInfo { - PDFFormatVersion: string; - IsAcroFormPresent: boolean; - IsXFAPresent: boolean; - [key: string]: any; // return type is string, typescript chokes + PDFFormatVersion: string; + IsAcroFormPresent: boolean; + IsXFAPresent: boolean; + [key: string]: any; // return type is string, typescript chokes } interface PDFMetadata { - parse(): void; - get(name: string): string; - has(name: string): boolean; + parse(): void; + get(name: string): string; + has(name: string): boolean; } interface PDFSource { - url?: string; - data?: Uint8Array; - httpHeaders?: any; - password?: string; + url?: string; + data?: Uint8Array; + httpHeaders?: any; + password?: string; } interface PDFProgressData { - loaded: number; - total: number; + loaded: number; + total: number; } interface PDFDocumentProxy { - /** - * Total number of pages the PDF contains. - **/ - numPages: number; + /** + * Total number of pages the PDF contains. + **/ + numPages: number; - /** - * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] - **/ - fingerprint: string; + /** + * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] + **/ + fingerprint: string; - /** - * True if embedded document fonts are in use. Will be set during rendering of the pages. - **/ - embeddedFontsUsed(): boolean; + /** + * True if embedded document fonts are in use. Will be set during rendering of the pages. + **/ + embeddedFontsUsed(): boolean; - /** - * @param number The page number to get. The first page is 1. - * @return A promise that is resolved with a PDFPageProxy. - **/ - getPage(number: number): PDFPromise; + /** + * @param number The page number to get. The first page is 1. + * @return A promise that is resolved with a PDFPageProxy. + **/ + getPage(number: number): PDFPromise; - /** - * TODO: return type of Promise - * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. - **/ - getDestinations(): PDFPromise; + /** + * TODO: return type of Promise + * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. + **/ + getDestinations(): PDFPromise; - /** - * A promise that is resolved with an array of all the JavaScript strings in the name tree. - **/ - getJavaScript(): PDFPromise; + /** + * A promise that is resolved with an array of all the JavaScript strings in the name tree. + **/ + getJavaScript(): PDFPromise; - /** - * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode - **/ - getOutline(): PDFPromise; + /** + * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode + **/ + getOutline(): PDFPromise; - /** - * A promise that is resolved with the info and metadata of the PDF. - **/ - getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; + /** + * A promise that is resolved with the info and metadata of the PDF. + **/ + getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; - /** - * Is the PDF encrypted? - **/ - isEncrypted(): PDFPromise; + /** + * Is the PDF encrypted? + **/ + isEncrypted(): PDFPromise; - /** - * A promise that is resolved with Uint8Array that has the raw PDF data. - **/ - getData(): PDFPromise; + /** + * A promise that is resolved with Uint8Array that has the raw PDF data. + **/ + getData(): PDFPromise; - /** - * TODO: return type of Promise - * A promise that is resolved when the document's data is loaded. - **/ - dataLoaded(): PDFPromise; + /** + * TODO: return type of Promise + * A promise that is resolved when the document's data is loaded. + **/ + dataLoaded(): PDFPromise; - /** - * - **/ - destroy(): void; + /** + * + **/ + destroy(): void; } interface PDFRef { - num: number; - gen: any; // todo + num: number; + gen: any; // todo } interface PDFPageViewportOptions { - viewBox: any; - scale: number; - rotation: number; - offsetX: number; - offsetY: number; - dontFlip: boolean; + viewBox: any; + scale: number; + rotation: number; + offsetX: number; + offsetY: number; + dontFlip: boolean; } interface PDFPageViewport { - width: number; - height: number; - fontScale: number; - transforms: number[]; + width: number; + height: number; + fontScale: number; + transforms: number[]; - clone(options: PDFPageViewportOptions): PDFPageViewport; - convertToViewportPoint(x: number, y: number): number[]; // [x, y] - convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] - convertToPdfPoint(x: number, y: number): number[]; // [x, y] + clone(options: PDFPageViewportOptions): PDFPageViewport; + convertToViewportPoint(x: number, y: number): number[]; // [x, y] + convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] + convertToPdfPoint(x: number, y: number): number[]; // [x, y] } interface PDFAnnotationData { - subtype: string; - rect: number[]; // [x1, y1, x2, y2] - annotationFlags: any; // todo - color: number[]; // [r,g,b] - borderWidth: number; - hasAppearance: boolean; + subtype: string; + rect: number[]; // [x1, y1, x2, y2] + annotationFlags: any; // todo + color: number[]; // [r,g,b] + borderWidth: number; + hasAppearance: boolean; } interface PDFAnnotations { - getData(): PDFAnnotationData; - hasHtml(): boolean; // always false - getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() - getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated - isViewable(): boolean; - loadResources(keys: any): PDFPromise; - getOperatorList(evaluator: any): PDFPromise; - // ... todo + getData(): PDFAnnotationData; + hasHtml(): boolean; // always false + getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() + getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated + isViewable(): boolean; + loadResources(keys: any): PDFPromise; + getOperatorList(evaluator: any): PDFPromise; + // ... todo } interface PDFRenderTextLayer { - beginLayout(): void; - endLayout(): void; - appendText(): void; + beginLayout(): void; + endLayout(): void; + appendText(): void; } interface PDFRenderImageLayer { - beginLayout(): void; - endLayout(): void; - appendImage(): void; + beginLayout(): void; + endLayout(): void; + appendImage(): void; } interface PDFRenderParams { - canvasContext: CanvasRenderingContext2D; - viewport?: PDFPageViewport; - textLayer?: PDFRenderTextLayer; - imageLayer?: PDFRenderImageLayer; - continueCallback?: (_continue: () => void) => void; + canvasContext: CanvasRenderingContext2D; + viewport?: PDFPageViewport; + textLayer?: PDFRenderTextLayer; + imageLayer?: PDFRenderImageLayer; + continueCallback?: (_continue: () => void) => void; } interface PDFViewerParams { - container: HTMLElement; - viewer?: HTMLElement; + container: HTMLElement; + viewer?: HTMLElement; } /** * RenderTask is basically a promise but adds a cancel function to termiate it. **/ -interface PDFRenderTask extends PDFPromise { +interface PDFRenderTask extends PDFLoadingTask { - /** - * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. - **/ - cancel(): void; + /** + * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. + **/ + cancel(): void; } interface PDFPageProxy { - /** - * Page number of the page. First page is 1. - **/ - pageNumber: number; + /** + * Page number of the page. First page is 1. + **/ + pageNumber: number; - /** - * The number of degrees the page is rotated clockwise. - **/ - rotate: number; + /** + * The number of degrees the page is rotated clockwise. + **/ + rotate: number; - /** - * The reference that points to this page. - **/ - ref: PDFRef; + /** + * The reference that points to this page. + **/ + ref: PDFRef; - /** - * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. - **/ - view: number[]; + /** + * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. + **/ + view: number[]; - /** - * @param scale The desired scale of the viewport. - * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. - * @return - **/ - getViewport(scale: number, rotate?: number): PDFPageViewport; + /** + * @param scale The desired scale of the viewport. + * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. + * @param dontFlip + * @return + **/ + getViewport(scale: number, rotate?: number, dontFlip?: boolean): PDFPageViewport; - /** - * A promise that is resolved with an array of the annotation objects. - **/ - getAnnotations(): PDFPromise; + /** + * A promise that is resolved with an array of the annotation objects. + **/ + getAnnotations(): PDFPromise; - /** - * Begins the process of rendering a page to the desired context. - * @param params Rendering options. - * @return An extended promise that is resolved when the page finishes rendering. - **/ - render(params: PDFRenderParams): PDFRenderTask; + /** + * Begins the process of rendering a page to the desired context. + * @param params Rendering options. + * @return An extended promise that is resolved when the page finishes rendering. + **/ + render(params: PDFRenderParams): PDFRenderTask; - /** - * A promise that is resolved with the string that is the text content frm the page. - **/ - getTextContent(): PDFPromise; + /** + * A promise that is resolved with the string that is the text content frm the page. + **/ + getTextContent(): PDFPromise; - /** - * marked as future feature - **/ - //getOperationList(): PDFPromise<>; + /** + * marked as future feature + **/ + //getOperationList(): PDFPromise<>; - /** - * Destroyes resources allocated by the page. - **/ - destroy(): void; + /** + * Destroyes resources allocated by the page. + **/ + destroy(): void; } interface TextContentItem { - str: string; - transform: number[]; // [0..5] 4=x, 5=y - width: number; - height: number; - dir: string; // Left-to-right (ltr), etc - fontName: string; // A lookup into the styles map of the owning TextContent + str: string; + transform: number[]; // [0..5] 4=x, 5=y + width: number; + height: number; + dir: string; // Left-to-right (ltr), etc + fontName: string; // A lookup into the styles map of the owning TextContent } interface TextContent { - items: TextContentItem[]; - styles: any; + items: TextContentItem[]; + styles: any; } /** * A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. **/ interface PDFObjects { - get(objId: number, callback?: any): any; - resolve(objId: number, data: any): any; - isResolved(objId: number): boolean; - hasData(objId: number): boolean; - getData(objId: number): any; - clear(): void; + get(objId: number, callback?: any): any; + resolve(objId: number, data: any): any; + isResolved(objId: number): boolean; + hasData(objId: number): boolean; + getData(objId: number): any; + clear(): void; } interface PDFJSUtilStatic { - /** - * Normalize rectangle so that (x1,y1) < (x2,y2) - * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] - * - * For coordinate systems whose origin lies in the bottom-left, this - * means normalization to (BL,TR) ordering. For systems with origin in the - * top-left, this means (TL,BR) ordering. - **/ - normalizeRect(rect:number[]): number[]; + /** + * Normalize rectangle so that (x1,y1) < (x2,y2) + * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] + * + * For coordinate systems whose origin lies in the bottom-left, this + * means normalization to (BL,TR) ordering. For systems with origin in the + * top-left, this means (TL,BR) ordering. + **/ + normalizeRect(rect:number[]): number[]; } export const PDFJS: PDFJSStatic; interface PDFJSStatic { - /** - * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. - **/ - maxImageSize: number; + /** + * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. + **/ + maxImageSize: number; - /** - * The url of where the predefined Adobe CMaps are located. Include trailing - * slash. - */ - cMapUrl: string; + /** + * The url of where the predefined Adobe CMaps are located. Include trailing + * slash. + */ + cMapUrl: string; - /** - * Specifies if CMaps are binary packed. - */ - cMapPacked: boolean; + /** + * Specifies if CMaps are binary packed. + */ + cMapPacked: boolean; - /** - * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. - **/ - disableFontFace: boolean; + /** + * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. + **/ + disableFontFace: boolean; - /** - * Path for image resources, mainly for annotation icons. Include trailing - * slash. - */ - imageResourcesPath: string; + /** + * Path for image resources, mainly for annotation icons. Include trailing + * slash. + */ + imageResourcesPath: string; - /** - * Disable the web worker and run all code on the main thread. This will happen - * automatically if the browser doesn't support workers or sending typed arrays - * to workers. - */ - disableWorker: boolean; + /** + * Disable the web worker and run all code on the main thread. This will happen + * automatically if the browser doesn't support workers or sending typed arrays + * to workers. + */ + disableWorker: boolean; - /** - * Path and filename of the worker file. Required when the worker is enabled in - * development mode. If unspecified in the production build, the worker will be - * loaded based on the location of the pdf.js file. - */ - workerSrc: string; + /** + * Path and filename of the worker file. Required when the worker is enabled in + * development mode. If unspecified in the production build, the worker will be + * loaded based on the location of the pdf.js file. + */ + workerSrc: string; - /** - * Disable range request loading of PDF files. When enabled and if the server - * supports partial content requests then the PDF will be fetched in chunks. - * Enabled (false) by default. - */ - disableRange: boolean; + /** + * Disable range request loading of PDF files. When enabled and if the server + * supports partial content requests then the PDF will be fetched in chunks. + * Enabled (false) by default. + */ + disableRange: boolean; - /** - * Disable streaming of PDF file data. By default PDF.js attempts to load PDF - * in chunks. This default behavior can be disabled. - */ - disableStream: boolean; + /** + * Disable streaming of PDF file data. By default PDF.js attempts to load PDF + * in chunks. This default behavior can be disabled. + */ + disableStream: boolean; - /** - * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js - * will automatically keep fetching more data even if it isn't needed to display - * the current page. This default behavior can be disabled. - * - * NOTE: It is also necessary to disable streaming, see above, - * in order for disabling of pre-fetching to work correctly. - */ - disableAutoFetch: boolean; + /** + * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js + * will automatically keep fetching more data even if it isn't needed to display + * the current page. This default behavior can be disabled. + * + * NOTE: It is also necessary to disable streaming, see above, + * in order for disabling of pre-fetching to work correctly. + */ + disableAutoFetch: boolean; - /** - * Enables special hooks for debugging PDF.js. - */ - pdfBug: boolean; + /** + * Enables special hooks for debugging PDF.js. + */ + pdfBug: boolean; - /** - * Enables transfer usage in postMessage for ArrayBuffers. - */ - postMessageTransfers: boolean; + /** + * Enables transfer usage in postMessage for ArrayBuffers. + */ + postMessageTransfers: boolean; - /** - * Disables URL.createObjectURL usage. - */ - disableCreateObjectURL: boolean; + /** + * Disables URL.createObjectURL usage. + */ + disableCreateObjectURL: boolean; - /** - * Disables WebGL usage. - */ - disableWebGL: boolean; + /** + * Disables WebGL usage. + */ + disableWebGL: boolean; - /** - * Disables fullscreen support, and by extension Presentation Mode, - * in browsers which support the fullscreen API. - */ - disableFullscreen: boolean; + /** + * Disables fullscreen support, and by extension Presentation Mode, + * in browsers which support the fullscreen API. + */ + disableFullscreen: boolean; - /** - * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements - * - */ - disableTextLayer: boolean; + /** + * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements + * + */ + disableTextLayer: boolean; - /** - * Enables CSS only zooming. - */ - useOnlyCssZoom: boolean; + /** + * Enables CSS only zooming. + */ + useOnlyCssZoom: boolean; - /** - * Controls the logging level. - * The constants from PDFJS.VERBOSITY_LEVELS should be used: - * - errors - * - warnings [default] - * - infos - */ - verbosity: number; + /** + * Controls the logging level. + * The constants from PDFJS.VERBOSITY_LEVELS should be used: + * - errors + * - warnings [default] + * - infos + */ + verbosity: number; - /** - * The maximum supported canvas size in total pixels e.g. width * height. - * The default value is 4096 * 4096. Use -1 for no limit. - */ - maxCanvasPixels: number; + /** + * The maximum supported canvas size in total pixels e.g. width * height. + * The default value is 4096 * 4096. Use -1 for no limit. + */ + maxCanvasPixels: number; - /** - * Opens external links in a new window if enabled. The default behavior opens - * external links in the PDF.js window. - */ - openExternalLinksInNewWindow: boolean; + /** + * Opens external links in a new window if enabled. The default behavior opens + * external links in the PDF.js window. + */ + openExternalLinksInNewWindow: boolean; - /** - * Determines if we can eval strings as JS. Primarily used to improve - * performance for font rendering. - */ - isEvalSupported: boolean; + /** + * Determines if we can eval strings as JS. Primarily used to improve + * performance for font rendering. + */ + isEvalSupported: boolean; - Util: PDFJSUtilStatic; - - /** - * This is the main entry point for loading a PDF and interacting with it. - * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) - * is used, which means it must follow the same origin rules that any XHR does - * e.g. No corss domain requests without CORS. - * @param source - * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. - * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. - * @param progressCallback Progress callback. - * @return A promise that is resolved with PDFDocumentProxy object. - **/ - getDocument( - source: string, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: Uint8Array, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: PDFSource, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - PDFViewer(params: PDFViewerParams): void; - /** - * yet another viewer, this will render only one page at the time, reducing rendering time - * very important for mobile development - * @params {PDFViewerParams} - */ - PDFSinglePageViewer(params: PDFViewerParams): void; + PDFViewer(params: PDFViewerParams): void; + /** + * yet another viewer, this will render only one page at the time, reducing rendering time + * very important for mobile development + * @params {PDFViewerParams} + */ + PDFSinglePageViewer(params: PDFViewerParams): void; } + +interface PDFLoadingTask { + promise: PDFPromise; +} + +declare const Util: PDFJSUtilStatic; + +/** + * This is the main entry point for loading a PDF and interacting with it. + * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) + * is used, which means it must follow the same origin rules that any XHR does + * e.g. No corss domain requests without CORS. + * @param source + * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. + * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. + * @param progressCallback Progress callback. + * @return A promise that is resolved with PDFDocumentProxy object. + **/ +declare function getDocument( + source: string, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; + +declare function getDocument( + source: Uint8Array, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; + +declare function getDocument( + source: PDFSource, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; diff --git a/types/pdfjs-dist/pdfjs-dist-tests.ts b/types/pdfjs-dist/pdfjs-dist-tests.ts index ef569b2fda..cb7be752af 100644 --- a/types/pdfjs-dist/pdfjs-dist-tests.ts +++ b/types/pdfjs-dist/pdfjs-dist-tests.ts @@ -1,4 +1,4 @@ -import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; +import { getDocument, PDFDocumentProxy, PDFPromise, Util } from 'pdfjs-dist'; // // Fetch the PDF document from the URL using promises @@ -6,7 +6,7 @@ import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; var pdfDoc: PDFDocumentProxy; var pageNum: number; -PDFJS.getDocument('helloworld.pdf').then(function (pdf) { +getDocument('helloworld.pdf').promise.then(function (pdf) { // Using promise to fetch the page pdfDoc = pdf; pageNum = 1; @@ -32,7 +32,7 @@ function renderPage(pageNum: number) { // https://github.com/mozilla/pdf.js/blob/master/examples/acroforms/forms.js // const rect = viewport.convertToViewportRectangle([100,100,0,0]); - const normalizedRect = PDFJS.Util.normalizeRect(rect); + const normalizedRect = Util.normalizeRect(rect); const point = viewport.convertToViewportPoint(100, 100); const pdfPoint = viewport.convertToPdfPoint(100, 100); @@ -57,6 +57,6 @@ function goNext() { // // Test PDFPromise allows return value mutation // -var promise: PDFPromise = PDFJS.getDocument('helloworld.pdf').then(pdf => { +var promise: PDFPromise = getDocument('helloworld.pdf').promise.then(pdf => { return "arbitrary string"; -}); \ No newline at end of file +}); diff --git a/types/pendo-io-browser/index.d.ts b/types/pendo-io-browser/index.d.ts new file mode 100644 index 0000000000..dfc04e25d4 --- /dev/null +++ b/types/pendo-io-browser/index.d.ts @@ -0,0 +1,167 @@ +// Type definitions for non-npm package Pendo.io Agent 2.16 +// Project: https://www.pendo.io/ +// Definitions by: Aaron Beall +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +declare namespace pendo { + interface Identity { + visitor: Visitor; + account?: Account; + } + + type Metadata = Record; + + interface Visitor extends Metadata { + id: string; + } + + interface Account extends Metadata { + id?: string; + } + + interface InitOptions extends Identity { + apiKey?: string; + excludeAllText?: boolean; + excludeTitle?: boolean; + disablePersistence?: boolean; + guides?: { + delay?: boolean; + disable?: boolean; + timeout?: number; + tooltip?: { + arrowSize?: number; + } + }; + events?: EventCallbacks; + } + + interface EventCallbacks { + ready?(): void; + guidesLoaded?(): void; + guidesFailed?(): void; + } + + interface Pendo { + // Initialization and Identification + initialize(options: InitOptions): void; + identify(visitorId: string, accountId?: string): void; + identify(identity: Identity): void; + isReady(): boolean; + flushNow(): Promise; + updateOptions(visitorMetadata: Metadata): void; + getVersion(): string; + getVisitorId(): string; + getAccountId(): string; + getCurrentUrl(): string; + + // Guides and Guide Center + findGuideByName(name: string): Guide | void; + findGuideById(id: string): Guide | void; + showGuideByName(name: string): void; + showGuideById(id: string): void; + toggleLauncher(): void; + removeLauncher(): void; + + // Troubleshooting + loadGuides(): void; + startGuides(): void; + stopGuides(): void; + + // Debugging + enableDebugging(): void; + disableDebugging(): void; + isDebuggingEnabled(coerce?: false): "Yes" | "No"; + isDebuggingEnabled(coerce: true): boolean; + debugging: Debugging; + + // Events + events: Events; + track(trackType: string, metadata?: Metadata): void; + + // Guide Events + onGuideAdvanced(step?: GuideStep): void; + onGuideAdvanced(steps: { steps: number }): void; + onGuidePrevious(step?: GuideStep): void; + onGuideDismissed(step?: GuideStep): void; + onGuideDismissed(until: { until: "reload" }): void; + + // Other + validateInstall(): void; + dom(input: any): HTMLElement; // TODO + } + + interface Debugging { + getEventCache(): any[]; // TODO + getAllGuides(): Guide[]; + getAutoGuides(): { auto: Guide[]; override: Guide[] }; + getBadgeGuides(): Guide[]; + getLauncherGuides(): Guide[]; + } + + type Events = { + [K in keyof EventCallbacks]-?: (callback: EventCallbacks[K]) => Events; + }; + + interface Guide { + createdByUser: User; + createdAt: number; + lastUpdatedByUser: User; + lastUpdatedAt: number; + kind: string; + rootVersionId: string; + stableVersionId: string; + id: string; + name: string; + state: "published" | "staged" | "draft" | "disabled"; + launchMethod: "api" | "automatic" | "badge" | "dom" | "launcher"; + isMultiStep: boolean; + steps: GuideStep[]; + attributes: { + type: string; + device: { desktop: boolean; mobile: boolean; type: "desktop" | "mobile" }; + badge: any; + priority: number; + launcher: { keywords: string[] }; + }; + audience: any[]; // TODO + audienceUiHint: { filters: any[] }; // TODO + resetAt: number; + publishedAt: number; + } + + interface User { + id: string; + username: string; + first: string; + last: string; + role: number; + userType: string; + } + + interface GuideStep { + id: string; + guideId: string; + type: string; + elementPathRule: string; + contentType: string; + contentUrl?: string; + contentUrlCss?: string; + contentUrlJs?: string; + rank: number; + advanceMethod: "button" | "programatic" /* sic */ | "element"; + thumbnailUrls?: string; + attributes: { + height: number; + width: number; + autoHeight: boolean; + position: string; + css: string; + variables: any; + }; + lastUpdatedAt: number; + resetAt: number; + } +} + +declare const pendo: pendo.Pendo; diff --git a/types/pendo-io-browser/pendo-io-browser-tests.ts b/types/pendo-io-browser/pendo-io-browser-tests.ts new file mode 100644 index 0000000000..16db208cda --- /dev/null +++ b/types/pendo-io-browser/pendo-io-browser-tests.ts @@ -0,0 +1,77 @@ +// Examples from: https://developers.pendo.io/docs/?bash#agent-api + +pendo.initialize({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.identify( + "PUT_VISITOR_ID_HERE", + "PUT_ACCOUNT_ID_HERE" +); + +pendo.identify({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.debugging.getEventCache(); + +pendo.events + .ready(() => { + // Do something once `pendo.isReady()` would return `true` + }) + .guidesLoaded(() => { + // Do something when Guides load + }) + .guidesFailed(() => { + // Do something when Guides fail to load + }); + +pendo.initialize({ + apiKey: 'YOUR_API_KEY', + visitor: { id: "" }, + account: { id: "" }, + events: { + ready() { + // Do something when pendo is initialized + } + } +}); + +pendo.track("User Registered", { + userId: "user.id", + plan: "user.plan", + accountType: "Facebook" +}); + +try { + throw new Error(); +} catch (error) { + pendo.track("JIRA-12345--error-tripped", { + message: error.message, + stack: error.stack + }); +} + +pendo.dom("").closest('._pendo-guide-next_'); + +pendo.onGuideAdvanced(); +pendo.onGuideAdvanced({ steps: 2 }); +pendo.onGuideDismissed(); diff --git a/types/pendo-io-browser/tsconfig.json b/types/pendo-io-browser/tsconfig.json new file mode 100644 index 0000000000..e5b8fc4c3f --- /dev/null +++ b/types/pendo-io-browser/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", + "pendo-io-browser-tests.ts" + ] +} diff --git a/types/ora/tslint.json b/types/pendo-io-browser/tslint.json similarity index 100% rename from types/ora/tslint.json rename to types/pendo-io-browser/tslint.json diff --git a/types/phoenix/index.d.ts b/types/phoenix/index.d.ts index 8b0e6574d8..daff513651 100644 --- a/types/phoenix/index.d.ts +++ b/types/phoenix/index.d.ts @@ -1,22 +1,26 @@ -// Type definitions for phoenix +// Type definitions for phoenix 1.4 // Project: https://github.com/phoenixframework/phoenix -// Definitions by: Mirosław Ciastek , John Goff +// Definitions by: Mirosław Ciastek , John Goff , Po Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 -declare module "phoenix" { +declare module 'phoenix' { class Push { - constructor(channel: Channel, event: string, payload: any, timeout: number); + constructor( + channel: Channel, + event: string, + payload: object, + timeout: number, + ); - resend(timeout: number): void; send(): void; + resend(timeout: number): void; - receive(status: string, callback: (response?: any) => void): Push; + receive(status: string, callback: (response?: any) => any): this; } - export class Channel { - constructor(topic: string, params?: Object, socket?: Socket); - - rejoinUntilConnected(): void; + class Channel { + constructor(topic: string, params?: object | Function, socket?: Socket); join(timeout?: number): Push; leave(timeout?: number): Push; @@ -28,50 +32,50 @@ declare module "phoenix" { on(event: string, callback: (response?: any) => void): void; off(event: string): void; - canPush(): boolean; - - push(event: string, payload: Object, timeout?: number): Push; + push(event: string, payload: object, timeout?: number): Push; } - export class Socket { - constructor(endPoint: string, opts?: Object); + type ConnectionState = 'connecting' | 'open' | 'closing' | 'closed'; + + interface SocketConnectOption { + params: object | Function; + transport: any; + timeout: number; + heartbeatIntervalMs: number; + reconnectAfterMs: number; + longpollernumber: number; + encode: (payload: object, callback: Function) => any; + decode: (payload: string, callback: Function) => any; + logger: (kind: string, message: string, data: any) => void; + } + + class Socket { + constructor(endPoint: string, opts?: Partial); protocol(): string; endPointURL(): string; - disconnect(callback?: Function, code?: string, reason?: any): void; connect(params?: any): void; + disconnect(callback?: Function, code?: number, reason?: string): void; + connectionState(): ConnectionState; + isConnected(): boolean; - log(kind: string, msg: string, data: any): void; + remove(channel: Channel): void; + channel(topic: string, chanParams?: object): Channel; + push(data: object): void; + + log(kind: string, message: string, data: object): void; + hasLogger(): boolean; onOpen(callback: Function): void; onClose(callback: Function): void; onError(callback: Function): void; onMessage(callback: Function): void; - onConnOpen(): void; - onConnClose(event: any): void; - onConnError(error: any): void; - - triggerChanError(): void; - - connectionState(): string; - - isConnected(): boolean; - - remove(channel: Channel): void; - channel(topic: string, chanParams?: Object): Channel; - - push(data: any): void; - makeRef(): string; - sendHeartbeat(): void; - flushSendBuffer(): void; - - onConnMessage(rawMessage: any): void; } - export class LongPoll { + class LongPoll { constructor(endPoint: string); normalizeEndpoint(endPoint: string): string; @@ -86,8 +90,10 @@ declare module "phoenix" { close(code?: any, reason?: any): void; } - export class Ajax { - request( + class Ajax { + static states: {[state: string]: number}; + + static request( method: string, endPoint: string, accept: string, @@ -97,7 +103,7 @@ declare module "phoenix" { callback?: (response?: any) => void ): void; - xdomainRequest( + static xdomainRequest( req: any, method: string, endPoint: string, @@ -107,7 +113,7 @@ declare module "phoenix" { callback?: (response?: any) => void ): void; - xhrRequest( + static xhrRequest( req: any, method: string, endPoint: string, @@ -118,28 +124,37 @@ declare module "phoenix" { callback?: (response?: any) => void ): void; - parseJSON(resp: string): JSON; - serialize(obj: any, parentKey: string): string; - appendParams(url: string, params: any): string; + static parseJSON(resp: string): JSON; + static serialize(obj: any, parentKey: string): string; + static appendParams(url: string, params: any): string; } - export class Presence { - constructor(channel: Channel, opts?: Object); + class Presence { + constructor(channel: Channel, opts?: object); + + onJoin(callback: Function): void; + onLeave(callback: Function): void; + onSync(callback: Function): void; + list(chooser?: (key: string, presence: any) => T): T[]; + inPendingSyncState(): boolean; static syncState( - currentState: any, - newState: any, + currentState: object, + newState: object, onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void, onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void ): any; static syncDiff( - currentState: any, - newState: any, + currentState: object, + diff: {joins: object; leaves: object}, onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void, onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void ): any; - static list(presences: Object, chooser?: Function): any; + static list( + presences: object, + chooser?: (key: string, presence: any) => T, + ): T[]; } } diff --git a/types/phoenix/phoenix-tests.ts b/types/phoenix/phoenix-tests.ts index 1e7641fc91..6e34b5c50c 100644 --- a/types/phoenix/phoenix-tests.ts +++ b/types/phoenix/phoenix-tests.ts @@ -1,46 +1,46 @@ import { Socket, Channel, Presence } from 'phoenix'; function test_socket() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); socket.connect(); } function test_channel() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); socket.connect(); - const channel = socket.channel("room:123", {token: '123'}); + const channel = socket.channel('room:123', {token: '123'}); - channel.on("new_msg", msg => console.log("Got message", msg)); + channel.on('new_msg', msg => console.log('Got message', msg)); - channel.push("new_msg", {body: 'some value'}, 10000) - .receive("ok", (msg) => console.log("created message", msg)) - .receive("error", (reasons) => console.log("create failed", reasons)) - .receive("timeout", () => console.log("Networking issue...")); + channel.push('new_msg', {body: 'some value'}, 10000) + .receive('ok', (msg) => console.log('created message', msg)) + .receive('error', (reasons) => console.log('create failed', reasons)) + .receive('timeout', () => console.log('Networking issue...')); channel.join() - .receive("ok", ({messages}) => console.log("catching up", messages)) - .receive("error", ({reason}) => console.log("failed join", reason)) - .receive("timeout", () => console.log("Networking issue. Still waiting...")); + .receive('ok', ({messages}) => console.log('catching up', messages)) + .receive('error', ({reason}) => console.log('failed join', reason)) + .receive('timeout', () => console.log('Networking issue. Still waiting...')); } function test_hooks() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); socket.connect(); - socket.onError(() => console.log("there was an error with the connection!")); - socket.onClose(() => console.log("the connection dropped")); + socket.onError(() => console.log('there was an error with the connection!')); + socket.onClose(() => console.log('the connection dropped')); - const channel = socket.channel("room:123", {token: '123'}); + const channel = socket.channel('room:123', {token: '123'}); - channel.onError(() => console.log("there was an error!")); - channel.onClose(() => console.log("the channel has gone away gracefully")) + channel.onError(() => console.log('there was an error!')); + channel.onClose(() => console.log('the channel has gone away gracefully')); } function test_presence() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); - const channel = socket.channel("room:123", {token: '123'}); + const channel = socket.channel('room:123', {token: '123'}); const presence = new Presence(channel); let presenceState = {}; @@ -49,12 +49,12 @@ function test_presence() { Presence.list(state, (id: string) => id).forEach(console.log); }; - channel.on("presence_state", (state) => { + channel.on('presence_state', (state) => { presenceState = Presence.syncState(presenceState, state); logState(presenceState); }); - channel.on("presence_diff", (diff) => { + channel.on('presence_diff', (diff) => { presenceState = Presence.syncState(presenceState, diff); logState(presenceState); }); diff --git a/types/phoenix/tslint.json b/types/phoenix/tslint.json index a41bf5d19a..6fca40ff8d 100644 --- a/types/phoenix/tslint.json +++ b/types/phoenix/tslint.json @@ -1,79 +1,117 @@ { - "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", + "rules": { + "arrow-return-shorthand": true, + "ban-types": false, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-spacing": false, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": false, + "member-access": false, + "member-ordering": false, + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-declare-current-package": false, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-single-declare-module": false, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-class": false, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "single" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + } } + diff --git a/types/pkg-conf/index.d.ts b/types/pkg-conf/index.d.ts deleted file mode 100644 index 6a783c1891..0000000000 --- a/types/pkg-conf/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for pkg-conf 2.1 -// Project: https://github.com/sindresorhus/pkg-conf#readme -// Definitions by: Jorge Gonzalez -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -declare namespace pkgConf { - type AnyJson = boolean | number | string | null | JsonArray | JsonMap; - interface JsonArray extends Array { } - interface JsonMap { - [key: string]: AnyJson; - } - - interface Options { - // Directory to start looking up for a package.json file. - // Default: process.cwd() - cwd?: string; - // Default config. - defaults?: object; - // Skip package.json files that have the namespaced config explicitly set to false. - skipOnFalse?: boolean; - } - - // Returns the config. - function sync(namespace: string, options?: Options): JsonMap; - // Pass in the config returned from any of the above methods. - // Returns the filepath to the package.json file or null when not found. - function filepath(config: JsonMap): string | null; -} - -// Returns a Promise for the config. -declare function pkgConf(namespace: string, options?: pkgConf.Options): Promise; - -export = pkgConf; diff --git a/types/pkg-conf/pkg-conf-tests.ts b/types/pkg-conf/pkg-conf-tests.ts deleted file mode 100644 index bf2dee1e2f..0000000000 --- a/types/pkg-conf/pkg-conf-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -import pkgConf = require('pkg-conf'); - -pkgConf('name'); // $ExpectType Promise -const config = pkgConf.sync('bugs'); // $ExpectType JsonMap -pkgConf.filepath(config); // $ExpectType string | null -config.url; // $ExpectType AnyJson diff --git a/types/plurals-cldr/index.d.ts b/types/plurals-cldr/index.d.ts new file mode 100644 index 0000000000..a65fc4e2c8 --- /dev/null +++ b/types/plurals-cldr/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for plurals-cldr 1.0 +// Project: https://github.com/nodeca/plurals-cldr +// Definitions by: Joel Spadin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type Form = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'; + +interface Plural { + /** + * Returns the form name for a given number. If the locale is not + * supported, returns `null`. + * + * @param locale The locale code. + * @param number The number to check. May be passed as a string to keep + * trailing zeroes. + */ + (locale: string, number: number | string): Form | null; + + /** + * Returns an array of available forms for the given locale. If the + * locale is not supported, returns `null`. + * + * @param locale The locale code. + */ + forms(locale: string): Form[] | null; + + /** + * Returns the index of the form for a given number. If the locale is + * not supported, returns `-1`. + * + * This is convenient for implementing a lookup from a compact, ordered + * list. The order of forms for all locales is `zero`, `one`, `two`, + * `few`, `many`, `other`. Remove the forms not used by a locale to get + * the indices of each. + * + * @param locale The locale code. + * @param number The number to check. May be passed as a string to keep + * trailing zeroes. + */ + indexOf(locale: string, number: number | string): number; +} + +/** + * Gets the CLDR cardinal plural forms for numbers in different locales. + */ +declare const plural: Plural & { + /** + * Gets the CLDR ordinal plural forms for numbers in different locales. + */ + ordinal: Plural; +}; + +export = plural; diff --git a/types/plurals-cldr/plurals-cldr-tests.ts b/types/plurals-cldr/plurals-cldr-tests.ts new file mode 100644 index 0000000000..7927afe761 --- /dev/null +++ b/types/plurals-cldr/plurals-cldr-tests.ts @@ -0,0 +1,15 @@ +import plural = require('plurals-cldr'); + +plural('en', 0); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null +plural('en', ''); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null + +plural.forms('en'); // $ExpectType Form[] | null +plural.indexOf('en', 0); // $ExpectType number +plural.indexOf('en', ''); // $ExpectType number + +plural.ordinal('en', 0); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null +plural.ordinal('en', ''); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null + +plural.ordinal.forms('en'); // $ExpectType Form[] | null +plural.ordinal.indexOf('en', 0); // $ExpectType number +plural.ordinal.indexOf('en', ''); // $ExpectType number diff --git a/types/plurals-cldr/tsconfig.json b/types/plurals-cldr/tsconfig.json new file mode 100644 index 0000000000..593fbd1545 --- /dev/null +++ b/types/plurals-cldr/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", + "plurals-cldr-tests.ts" + ] +} diff --git a/types/ora/v0/tslint.json b/types/plurals-cldr/tslint.json similarity index 100% rename from types/ora/v0/tslint.json rename to types/plurals-cldr/tslint.json diff --git a/types/png-async/index.d.ts b/types/png-async/index.d.ts deleted file mode 100644 index cef8207ae2..0000000000 --- a/types/png-async/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Type definitions for png-async -// Project: https://github.com/kanreisa/node-png-async -// Definitions by: Yuki KAN -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - - -import stream = require('stream'); - -export interface IImageOptions { - width?: number; - height?: number; - fill?: boolean; - checkCRC?: boolean; - deflateChunkSize?: number; - deflateLevel?: number; - deflateStrategy?: EDeflateStrategy; - filterType?: EFilterType; -} - -export declare enum EDeflateStrategy { - DEFAULT_STRATEGY = 0, - FILTERED = 1, - HUFFMAN_ONLY = 2, - RLE = 3, - FIXED = 4, -} - -export declare enum EFilterType { - Auto = -1, - None = 0, - Sub = 1, - Up = 2, - Average = 3, - Paeth = 4, -} - -export declare function createImage(option?: IImageOptions): Image; - -export declare class Image extends stream.Duplex { - width: number; - height: number; - gamma: number; - data: Buffer; - constructor(option?: IImageOptions); - pack(): Image; - parse(data: Buffer, callback?: (err: Error, image: Image) => void): Image; - write(data: any, cb?: any): boolean; - end(data?: any): void; - bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image; -} diff --git a/types/png-async/png-async-tests.ts b/types/png-async/png-async-tests.ts deleted file mode 100644 index f108fe66b8..0000000000 --- a/types/png-async/png-async-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ - -import fs = require('fs'); -import png = require('png-async'); - -var devnull = process.platform === 'win32' ? 'nul' : '/dev/null'; - -// stream test -var img = new png.Image({ - width: 1, - height: 1, - fill: true -}) - .pack() - .pipe(png.createImage({ - deflateStrategy: png.EDeflateStrategy.FIXED, - filterType: png.EFilterType.Auto - }) - .on('parsed', function () { - - if (this.data[0] !== 0) { - throw new Error('invalid data'); - } - - this.data[0] = 255; - this.data[3] = 255; - - this.pack().pipe(fs.createWriteStream(devnull)).on('finish', () => { - console.log('done'); - }); - }) - ); diff --git a/types/png-async/tsconfig.json b/types/png-async/tsconfig.json deleted file mode 100644 index 181b899496..0000000000 --- a/types/png-async/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "png-async-tests.ts" - ] -} \ No newline at end of file diff --git a/types/png-async/tslint.json b/types/png-async/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/png-async/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "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 - } -} diff --git a/types/pretty-time/index.d.ts b/types/pretty-time/index.d.ts new file mode 100644 index 0000000000..0dadc88091 --- /dev/null +++ b/types/pretty-time/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for pretty-time 1.1 +// Project: https://github.com/jonschlinkert/pretty-time +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +type Increment = + | 'ns' + | 'nano' + | 'nanosecond' + | 'nanoseconds' + | 'μs' + | 'micro' + | 'microsecond' + | 'microseconds' + | 'ms' + | 'milli' + | 'millisecond' + | 'milliseconds' + | 's' + | 'sec' + | 'second' + | 'seconds' + | 'm' + | 'min' + | 'minute' + | 'minutes' + | 'h' + | 'hr' + | 'hour' + | 'hours' + | 'd' + | 'day' + | 'days' + | 'w' + | 'wk' + | 'week' + | 'weeks'; + +declare function prettyTime(time: number[], smallest?: Increment, digits?: number): string; + +export = prettyTime; diff --git a/types/pretty-time/pretty-time-tests.ts b/types/pretty-time/pretty-time-tests.ts new file mode 100644 index 0000000000..895042ecd1 --- /dev/null +++ b/types/pretty-time/pretty-time-tests.ts @@ -0,0 +1,13 @@ +import DateTime = require("pretty-time"); + +DateTime([1200708, 795428088]); + +DateTime([0, 795428088]); + +DateTime([0, 795428088], 'h'); + +DateTime([0, 795428088], 'm'); + +DateTime([0, 795428088], 'μs', 2); + +DateTime([0, 795428088], 'ms', 1); diff --git a/types/pretty-time/tsconfig.json b/types/pretty-time/tsconfig.json new file mode 100644 index 0000000000..d18e4b1fa1 --- /dev/null +++ b/types/pretty-time/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pretty-time-tests.ts" + ] +} diff --git a/types/pretty-time/tslint.json b/types/pretty-time/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/pretty-time/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index 1b9428392a..e043587e16 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -31,6 +31,8 @@ export interface JSONObject { } export type SerializableOrJSHandle = Serializable | JSHandle; +export type Platform = "mac" | "win32" | "win64" | "linux"; + /** Defines `$eval` and `$$eval` for Page, Frame and ElementHandle. */ export interface Evalable { /** @@ -2187,6 +2189,40 @@ export interface CoverageEntry { ranges: Array<{start: number, end: number}>; } +/** BrowserFetcher can download and manage different versions of Chromium. */ +export interface BrowserFetcher { + /** The method initiates a HEAD request to check if the revision is available. */ + canDownload(revision: string): Promise; + /** The method initiates a GET request to download the revision from the host. */ + download(revision: string, progressCallback?: (downloadBytes: number, totalBytes: number) => void): Promise; + localRevisions(): Promise; + platform(): Platform; + remove(revision: string): Promise; + revisionInfo(revision: string): RevisionInfo; +} + +export interface RevisionInfo { + /** The revision the info was created from */ + revision: string; + /** Path to the extracted revision folder */ + folderPath: string; + /** Path to the revision executable */ + executablePath: string; + /** URL this revision can be downloaded from */ + url: string; + /** whether the revision is locally available on disk */ + local: boolean; +} + +export interface FetcherOptions { + /** A download host to be used. Defaults to `https://storage.googleapis.com`. */ + host?: string; + /** A path for the downloads folder. Defaults to `/.local-chromium`, where `` is puppeteer's package root. */ + path?: string; + /** Possible values are: `mac`, `win32`, `win64`, `linux`. Defaults to the current platform. */ + platform?: Platform; +} + /** Attaches Puppeteer to an existing Chromium instance */ export function connect(options?: ConnectOptions): Promise; /** The default flags that Chromium will be launched with */ @@ -2195,3 +2231,5 @@ export function defaultArgs(options?: ChromeArgOptions): string[]; export function executablePath(): string; /** The method launches a browser instance with given arguments. The browser will be closed when the parent node.js process is closed. */ export function launch(options?: LaunchOptions): Promise; +/** This methods attaches Puppeteer to an existing Chromium instance. */ +export function createBrowserFetcher(options?: FetcherOptions): BrowserFetcher; diff --git a/types/puppeteer/puppeteer-tests.ts b/types/puppeteer/puppeteer-tests.ts index e5c287b6ee..90006c77d4 100644 --- a/types/puppeteer/puppeteer-tests.ts +++ b/types/puppeteer/puppeteer-tests.ts @@ -618,3 +618,28 @@ puppeteer.launch().then(async browser => { ); console.log('there are', numMatchingEls, 'banana paragaphs'); }); + +(async () => { + const rev = '630727'; + const defaultFetcher = puppeteer.createBrowserFetcher(); + const options: puppeteer.FetcherOptions = { + host: 'https://storage.googleapis.com', + path: '/tmp/.local-chromium', + platform: 'linux', + }; + const browserFetcher = puppeteer.createBrowserFetcher(options); + const canDownload = await browserFetcher.canDownload(rev); + if (canDownload) { + const revisionInfo = await browserFetcher.download(rev); + const localRevisions = await browserFetcher.localRevisions(); + const browser = await puppeteer.launch({executablePath: revisionInfo.executablePath}); + browser.close(); + if (localRevisions.includes(rev)) { + await browserFetcher.remove(rev); + } + await browserFetcher.download(rev, (download, total) => { + console.log('downloadBytes:', download, 'totalBytes:', total); + }); + await browserFetcher.remove(rev); + } +}); diff --git a/types/query-string/index.d.ts b/types/query-string/index.d.ts deleted file mode 100644 index 3eaf34c159..0000000000 --- a/types/query-string/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for query-string 6.2 -// Project: https://github.com/sindresorhus/query-string -// Definitions by: Sam Verschueren -// Tanguy Krotoff -// HuHuanming -// Madara Uchiha -// Josh Holmer -// Simon Van den Broeck -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -export interface ParseOptions { - arrayFormat?: 'bracket' | 'index' | 'none'; - decode?: boolean; -} - -export interface InputParams { - [key: string]: any; -} - -export interface OutputParams { - [key: string]: string | string[] | undefined; -} - -/** - * Parse a query string into an object. - * Leading ? or # are ignored, so you can pass location.search or location.hash directly. - */ -export function parse(str: string, options?: ParseOptions): OutputParams; - -export function parseUrl(str: string, options?: ParseOptions): {url: string, query: OutputParams}; - -export interface StringifyOptions { - strict?: boolean; - encode?: boolean; - arrayFormat?: 'bracket' | 'index' | 'none'; - sort?: ((m: string, n: string) => boolean) | boolean; -} - -/** - * Stringify an object into a query string, sorting the keys. - */ -export function stringify(obj: InputParams, options?: StringifyOptions): string; - -/** - * Extract a query string from a URL that can be passed into .parse(). - */ -export function extract(str: string): string; diff --git a/types/query-string/query-string-tests.ts b/types/query-string/query-string-tests.ts deleted file mode 100644 index 33152ce445..0000000000 --- a/types/query-string/query-string-tests.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as queryString from 'query-string'; - -// stringify -{ - let result: string; - // test obj - result = queryString.stringify({ - str: 'bar', - strArray: ['baz'], - num: 123, - numArray: [456], - bool: true, - boolArray: [false] - }); - - // test options - result = queryString.stringify({ foo: 'bar' }, { strict: false }); - result = queryString.stringify({ foo: 'bar' }, { encode: false }); - result = queryString.stringify({ foo: 'bar' }, { strict: false, encode: false }); -} - -// For each section below, the second line ensures the real answer is of the declared -// type. You can find the real answer by running the first line of each section. - -// parse -{ - let fooBar = queryString.parse('?foo=bar'); - fooBar = {foo: "bar"}; - - let fooBarBaz1 = queryString.parse('&foo=bar&foo=baz'); - fooBarBaz1 = { foo: [ 'bar', 'baz' ] }; - - let fooBarBaz2 = queryString.parse('&foo[]=bar&foo[]=baz', {arrayFormat: 'bracket'}); - fooBarBaz2 = { foo: [ 'bar', 'baz' ] }; -} - -// extract -{ - let result1 = queryString.extract('http://foo.bar/?abc=def&hij=klm'); - result1 = 'abc=def&hij=klm'; - - let result2 = queryString.extract('http://foo.bar/?foo=bar'); - result2 = 'foo=bar'; -} diff --git a/types/query-string/tsconfig.json b/types/query-string/tsconfig.json deleted file mode 100644 index 83d5a52072..0000000000 --- a/types/query-string/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "query-string-tests.ts" - ] -} \ No newline at end of file diff --git a/types/query-string/tslint.json b/types/query-string/tslint.json deleted file mode 100644 index e765bc9e16..0000000000 --- a/types/query-string/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-single-declare-module": false - } -} diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index e1b1f21334..e0313e5957 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ramda 0.25 +// Type definitions for ramda 0.26 // Project: https://github.com/donnut/typescript-ramda, https://ramdajs.com // Definitions by: Erwin Poeze // Tycho Grouwstra @@ -27,8 +27,9 @@ // John Ottenlips // Nitesh Phadatare // Krantisinh Deshmukh +// Pierre-Antoine Mills // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.2 /// /// @@ -275,6 +276,7 @@ /// /// /// +/// declare let R: R.Static; @@ -366,77 +368,6 @@ declare namespace R { never }; - // @see https://gist.github.com/donnut/fd56232da58d25ceecf1, comment by @albrow - interface CurriedTypeGuard2 { - (t1: T1): (t2: T2) => t2 is R; - (t1: T1, t2: T2): t2 is R; - } - - interface CurriedTypeGuard3 { - (t1: T1): CurriedTypeGuard2; - (t1: T1, t2: T2): (t3: T3) => t3 is R; - (t1: T1, t2: T2, t3: T3): t3 is R; - } - - interface CurriedTypeGuard4 { - (t1: T1): CurriedTypeGuard3; - (t1: T1, t2: T2): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3): (t4: T4) => t4 is R; - (t1: T1, t2: T2, t3: T3, t4: T4): t4 is R; - } - - interface CurriedTypeGuard5 { - (t1: T1): CurriedTypeGuard4; - (t1: T1, t2: T2): CurriedTypeGuard3; - (t1: T1, t2: T2, t3: T3): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3, t4: T4): (t5: T5) => t5 is R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): t5 is R; - } - - interface CurriedTypeGuard6 { - (t1: T1): CurriedTypeGuard5; - (t1: T1, t2: T2): CurriedTypeGuard4; - (t1: T1, t2: T2, t3: T3): CurriedTypeGuard3; - (t1: T1, t2: T2, t3: T3, t4: T4): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): (t6: T6) => t6 is R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): t6 is R; - } - - interface CurriedFunction2 { - (t1: T1): (t2: T2) => R; - (t1: T1, t2: T2): R; - } - - interface CurriedFunction3 { - (t1: T1): CurriedFunction2; - (t1: T1, t2: T2): (t3: T3) => R; - (t1: T1, t2: T2, t3: T3): R; - } - - interface CurriedFunction4 { - (t1: T1): CurriedFunction3; - (t1: T1, t2: T2): CurriedFunction2; - (t1: T1, t2: T2, t3: T3): (t4: T4) => R; - (t1: T1, t2: T2, t3: T3, t4: T4): R; - } - - interface CurriedFunction5 { - (t1: T1): CurriedFunction4; - (t1: T1, t2: T2): CurriedFunction3; - (t1: T1, t2: T2, t3: T3): CurriedFunction2; - (t1: T1, t2: T2, t3: T3, t4: T4): (t5: T5) => R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; - } - - interface CurriedFunction6 { - (t1: T1): CurriedFunction5; - (t1: T1, t2: T2): CurriedFunction4; - (t1: T1, t2: T2, t3: T3): CurriedFunction3; - (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction2; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): (t6: T6) => R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): R; - } - interface Placeholder { __isRamdaPlaceholder__: true; } interface Reduced { @@ -463,11 +394,11 @@ declare namespace R { * Creates a new list iteration function from an existing one by adding two new parameters to its callback * function: the current index, and the entire list. */ - addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): CurriedFunction2<(item: T, idx: number, list?: T[]) => U, ReadonlyArray, U[]>; + addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): Curry.Curry<(a: (item: T, idx: number, list?: T[]) => U, b: ReadonlyArray) => U[]>; /* Special case for forEach */ - addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): CurriedFunction2<(item: T, idx: number, list?: T[]) => void, ReadonlyArray, T[]>; + addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): Curry.Curry<(a: (item: T, idx: number, list?: T[]) => void, b: ReadonlyArray) => T[]>; /* Special case for reduce */ - addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): CurriedFunction3<(acc: U, item: T, idx: number, list?: T[]) => U, U, ReadonlyArray, U>; + addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): Curry.Curry<(a: (acc: U, item: T, idx: number, list?: T[]) => U, b: U, c: ReadonlyArray) => U>; /** * Applies a function to the value at the given index of an array, returning a new copy of the array with the @@ -583,7 +514,7 @@ declare namespace R { assocPath(path: Path, __: Placeholder, obj: U): (val: T) => U; assocPath(path: Path, val: T, obj: U): U; assocPath(path: Path, val: T): (obj: U) => U; - assocPath(path: Path): CurriedFunction2; + assocPath(path: Path): Curry.Curry<(a: T, b: U) => U>; /** * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 @@ -835,17 +766,7 @@ declare namespace R { * Returns a curried equivalent of the provided function. The curried function has two unusual capabilities. * First, its arguments needn't be provided one at a time. */ - curry(fn: (a: T1, b: T2) => b is TResult): CurriedTypeGuard2; - curry(fn: (a: T1, b: T2, c: T3) => c is TResult): CurriedTypeGuard3; - curry(fn: (a: T1, b: T2, c: T3, d: T4) => d is TResult): CurriedTypeGuard4; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => e is TResult): CurriedTypeGuard5; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => f is TResult): CurriedTypeGuard6; - curry(fn: (a: T1, b: T2) => TResult): CurriedFunction2; - curry(fn: (a: T1, b: T2, c: T3) => TResult): CurriedFunction3; - curry(fn: (a: T1, b: T2, c: T3, d: T4) => TResult): CurriedFunction4; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => TResult): CurriedFunction5; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => TResult): CurriedFunction6; - curry(fn: (...a: any[]) => any): (...a: any[]) => any; + curry any>(f: F): Curry.Curry; /** * Returns a curried equivalent of the provided function, with the specified arity. The curried function has @@ -970,7 +891,7 @@ declare namespace R { */ eqBy(fn: (a: T) => U, a: T, b: T): boolean; eqBy(fn: (a: T) => U, a: T): (b: T) => boolean; - eqBy(fn: (a: T) => U): CurriedFunction2; + eqBy(fn: (a: T) => U): Curry.Curry<(a: T, b: T) => boolean>; /** * Reports whether two functions have the same value for the specified property. @@ -1444,7 +1365,7 @@ declare namespace R { */ maxBy(keyFn: (a: T) => Ord, a: T, b: T): T; maxBy(keyFn: (a: T) => Ord, a: T): (b: T) => T; - maxBy(keyFn: (a: T) => Ord): CurriedFunction2; + maxBy(keyFn: (a: T) => Ord): Curry.Curry<(a: T, b: T) => T>; /** * Returns the mean of the given list of numbers. @@ -1558,7 +1479,7 @@ declare namespace R { */ minBy(keyFn: (a: T) => Ord, a: T, b: T): T; minBy(keyFn: (a: T) => Ord, a: T): (b: T) => T; - minBy(keyFn: (a: T) => Ord): CurriedFunction2; + minBy(keyFn: (a: T) => Ord): Curry.Curry<(a: T, b: T) => T>; /** * Divides the second parameter by the first and returns the remainder. @@ -1727,7 +1648,7 @@ declare namespace R { */ pathEq(path: Path, val: any, obj: any): boolean; pathEq(path: Path, val: any): (obj: any) => boolean; - pathEq(path: Path): CurriedFunction2; + pathEq(path: Path): Curry.Curry<(a: any, b: any) => boolean>; /** * If the given, non-null object has a value at the given path, returns the value at that path. @@ -1735,14 +1656,14 @@ declare namespace R { */ pathOr(defaultValue: T, path: Path, obj: any): any; pathOr(defaultValue: T, path: Path): (obj: any) => any; - pathOr(defaultValue: T): CurriedFunction2; + pathOr(defaultValue: T): Curry.Curry<(a: Path, b: any) => any>; /** * Returns true if the specified object property at given path satisfies the given predicate; false otherwise. */ pathSatisfies(pred: (val: T) => boolean, path: Path, obj: U): boolean; pathSatisfies(pred: (val: T) => boolean, path: Path): (obj: U) => boolean; - pathSatisfies(pred: (val: T) => boolean): CurriedFunction2; + pathSatisfies(pred: (val: T) => boolean): Curry.Curry<(a: Path, b: U) => boolean>; /** * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the @@ -2180,7 +2101,7 @@ declare namespace R { */ propSatisfies(pred: (val: T) => boolean, name: string, obj: U): boolean; propSatisfies(pred: (val: T) => boolean, name: string): (obj: U) => boolean; - propSatisfies(pred: (val: T) => boolean): CurriedFunction2; + propSatisfies(pred: (val: T) => boolean): Curry.Curry<(a: string, b: U) => boolean>; /** * Returns a list of numbers from `from` (inclusive) to `to` @@ -2205,8 +2126,8 @@ declare namespace R { */ reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: ReadonlyArray): { [index: string]: TResult }; reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: ReadonlyArray) => { [index: string]: TResult }; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): CurriedFunction2<(elem: T) => string, ReadonlyArray, { [index: string]: TResult }>; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult): CurriedFunction3 string, ReadonlyArray, { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): Curry.Curry<(a: (elem: T) => string, b: ReadonlyArray) => { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult): Curry.Curry<(a: TResult, b: (elem: T) => string, c: ReadonlyArray) => { [index: string]: TResult }>; /** * Returns a value wrapped to indicate that it is the final value of the reduce and @@ -2232,8 +2153,8 @@ declare namespace R { */ reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: ReadonlyArray): TResult; reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: ReadonlyArray) => TResult; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): CurriedFunction2, TResult>; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean): CurriedFunction3<(acc: TResult, elem: T) => TResult, TResult, ReadonlyArray, TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): Curry.Curry<(a: TResult, b: ReadonlyArray) => TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean): Curry.Curry<(a: (acc: TResult, elem: T) => TResult, b: TResult, c: ReadonlyArray) => TResult>; /** * Similar to `filter`, except that it keeps only values for which the given predicate @@ -2387,7 +2308,7 @@ declare namespace R { * Duplication is determined according to the value returned by applying the supplied predicate to two list elements. */ symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - symmetricDifferenceWith(pred: (a: T, b: T) => boolean): CurriedFunction2, ReadonlyArray, T[]>; + symmetricDifferenceWith(pred: (a: T, b: T) => boolean): Curry.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; /** * A function that always returns true. Any passed in parameters are ignored. @@ -2581,7 +2502,7 @@ declare namespace R { * determined according to the value returned by applying the supplied predicate to two list elements. */ unionWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - unionWith(pred: (a: T, b: T) => boolean): CurriedFunction2, ReadonlyArray, T[]>; + unionWith(pred: (a: T, b: T) => boolean): Curry.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; /** * Returns a new list containing only one copy of each element in the original list. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 16ba23d85b..fdac7648db 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -68,6 +68,10 @@ class F2 { return a + b + c + d; } + function addTenFixedNumbers(a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7, i: 8, k: 9, l: 10): number { + return a + b + c + d; + } + const x1: (a: number, b: number, c: number, d: number) => number = R.curry(addFourNumbers); // because of the current way of currying, the following call results in a type error // const x2: Function = R.curry(addFourNumbers)(1,2,4) @@ -76,6 +80,8 @@ class F2 { const y1: number = R.curry(addFourNumbers)(1)(2)(3)(4); const y2: number = R.curry(addFourNumbers)(1, 2)(3, 4); const y3: number = R.curry(addFourNumbers)(1, 2, 3)(4); + const y4: number = R.curry(addTenFixedNumbers)(R.__, 1, 2)(0)(3)(R.__, R.__)(R.__, 5)(4)(6, 7)(R.__)(8, R.__, R.__)(9, 10); + const y5: number = R.curry(addTenFixedNumbers)(R.__, 1, R.__)(R.__, 2)(0, 3)(R.__, 5)(4, R.__)(R.__)(6, R.__, 8, 9, 10)(7); R.nAry(0); R.nAry(0, takesNoArg); @@ -119,7 +125,8 @@ class F2 { const cars: Car[] = [{speed: 65}, {}]; for (const car of cars) { if (typeGuardCurried(1)(2)(3)(4)(5)(car)) { - drive(car); + drive(car); // $ExpectError + // Generic Curry solved a previously non reported issue } } }; @@ -2784,3 +2791,5 @@ class Why { () => { R.bind(console.log, console); }; + +// Curry tests diff --git a/types/ramda/tools.d.ts b/types/ramda/tools.d.ts new file mode 100644 index 0000000000..b6f814012b --- /dev/null +++ b/types/ramda/tools.d.ts @@ -0,0 +1,114 @@ +/// + +// All the following types are explained here: +// https://medium.freecodecamp.org/typescript-curry-ramda-types-f747e99744ab +// https://github.com/pirix-gh/medium/blob/master/types-curry-ramda/src/index.ts +declare namespace Tools { + type Head = + T extends [any, ...any[]] + ? T[0] + : never; + + type Tail = + ((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) + ? TT + : []; + + type HasTail = + T extends ([] | [any]) + ? false + : true; + + type Last = { + 0: Last>; + 1: Head; + }[ + HasTail extends true + ? 0 + : 1 + ]; + + type Length = + T['length']; + + type Prepend = + ((head: E, ...args: T) => any) extends ((...args: infer U) => any) + ? U + : T; + + type Drop = { + 0: Drop, Prepend>; + 1: T; + }[ + Length extends N + ? 1 + : 0 + ]; + + type Cast = X extends Y ? X : Y; + + type Pos = + Length; + + type Next = + Prepend; + + type Prev = + Tail; + + type Iterator = { + 0: Iterator, Next>; + 1: From; + }[ + Pos extends Index + ? 1 + : 0 + ]; + + type Reverse = { + 0: Reverse], R>, Next>; + 1: R; + }[ + Pos extends Length + ? 1 + : 0 + ]; + + type Concat = + Reverse extends infer R ? Cast : never, T2>; + + type Append = + Concat; +} + +declare namespace Curry { + type GapOf = + T1[Tools.Pos] extends R.Placeholder + ? Tools.Append], TN> + : TN; + + type GapsOf = { + 0: GapsOf extends infer G ? Tools.Cast : never, Tools.Next>; + 1: Tools.Concat, T2> extends infer D ? Tools.Cast : never>; + }[ + Tools.Pos extends Tools.Length + ? 1 + : 0 + ]; + + type PartialGaps = { + [K in keyof T]?: T[K] | R.Placeholder + }; + + type CleanedGaps = { + [K in keyof T]: NonNullable + }; + + type Gaps = CleanedGaps>; + + type Curry any)> = + (...args: Tools.Cast>>, any[]>) => + GapsOf> extends [any, ...any[]] + ? Curry<(...args: GapsOf> extends infer G ? Tools.Cast : never) => ReturnType> + : ReturnType; +} diff --git a/types/ramda/tsconfig.json b/types/ramda/tsconfig.json index 4de4f10d8f..92fcdd531d 100644 --- a/types/ramda/tsconfig.json +++ b/types/ramda/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", + "tools.d.ts", "ramda-tests.ts" ] } \ No newline at end of file diff --git a/types/rc-slider/index.d.ts b/types/rc-slider/index.d.ts index ba40bc0d7d..1f16fbe267 100644 --- a/types/rc-slider/index.d.ts +++ b/types/rc-slider/index.d.ts @@ -6,6 +6,7 @@ // Jacob Froman // Deanna Veale // Nick Maddren +// Roman Nevolin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -204,6 +205,11 @@ export interface HandleProps extends CommonApiProps { * Styling option offset */ offset: number; + /** + * Set the tabIndex of the slider handle. + * @default 0 + */ + tabIndex?: number; } export interface WithTooltipProps { diff --git a/types/rc-slider/rc-slider-tests.tsx b/types/rc-slider/rc-slider-tests.tsx index 5b246dd7ab..15aea1ff4c 100644 --- a/types/rc-slider/rc-slider-tests.tsx +++ b/types/rc-slider/rc-slider-tests.tsx @@ -15,6 +15,7 @@ ReactDOM.render( className="bottom" vertical={true} offset={10} + tabIndex={-1} />, document.querySelector('.another-app') ); diff --git a/types/react-big-calendar/index.d.ts b/types/react-big-calendar/index.d.ts index 7a6bebe1c2..85914eda10 100644 --- a/types/react-big-calendar/index.d.ts +++ b/types/react-big-calendar/index.d.ts @@ -120,6 +120,7 @@ export interface Components { dayWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; dateCellWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; timeSlotWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + timeGutterHeader?: React.SFC | React.Component | React.ComponentClass | JSX.Element; timeGutterWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; toolbar?: React.ComponentType; agenda?: { diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 93fa2c9c6a..f916a4c293 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -5,6 +5,7 @@ // Paito Anderson // Andreas Richter // Dale Fenton +// Håkon Holhjem // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -126,7 +127,7 @@ export interface TypeaheadProps { but not the list of original options unless handled as such by Typeahead's parent. The newly added item will always be returned as an object even if the other options are simply strings, so be sure your onChange callback can handle this. */ - allowNew?: boolean; + allowNew?: boolean | ((results: T[], props: AllTypeaheadOwnAndInjectedProps) => boolean); /* Autofocus the input when the component initially mounts. */ autoFocus?: boolean; @@ -172,6 +173,9 @@ export interface TypeaheadProps { Does not work with allowNew. */ highlightOnlyResult?: boolean; + /* An html id attribute, required for assistive technologies such as screen readers. */ + id?: string | number; + /* Whether the filter should ignore accents and other diacritical marks. */ ignoreDiacritics?: boolean; @@ -198,7 +202,7 @@ export interface TypeaheadProps { so as not to render too many DOM nodes in the case of large data sets. */ maxResults?: number; - /* Id applied to the top-level menu element. Required for accessibility. */ + /* DEPRECATED. Id applied to the top-level menu element. Required for accessibility. */ menuId?: string; /* Number of input characters that must be entered before showing results. */ @@ -253,6 +257,10 @@ export interface TypeaheadProps { /* Placeholder text for the input. */ placeholder?: string; + /* Whether to use fixed positioning for the menu, which is useful when rendering inside a + container with overflow: hidden;. Uses absolute positioning by default. */ + positionFixed?: boolean; + /* Callback for custom menu rendering. */ renderMenu?: (results: Array>, menuProps: any) => React.ReactNode; diff --git a/types/react-credit-cards/index.d.ts b/types/react-credit-cards/index.d.ts index 4cbf2f9830..015334e1c3 100644 --- a/types/react-credit-cards/index.d.ts +++ b/types/react-credit-cards/index.d.ts @@ -1,14 +1,14 @@ -// Type definitions for react-credit-cards 0.7 +// Type definitions for react-credit-cards 0.8 // Project: https://github.com/amarofashion/react-credit-cards -// Definitions by: Vytautas Strimaitis , Ole Frank +// Definitions by: Vytautas Strimaitis , Ole Frank , zzanol // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from "react"; export interface CallbackArgument { - isValid: boolean; - type: { issuer: string; maxLength: number }; + issuer: string; + maxLength: number; } export type Focused = "name" | "number" | "expiry" | "cvc"; diff --git a/types/react-csv/components/CommonPropTypes.d.ts b/types/react-csv/components/CommonPropTypes.d.ts new file mode 100644 index 0000000000..4bad3dd766 --- /dev/null +++ b/types/react-csv/components/CommonPropTypes.d.ts @@ -0,0 +1,22 @@ +import { MouseEventHandler } from "react"; + +export interface LabelKeyObject { + label: string; + key: string; +} + +export type Data = object[]; +export type Headers = LabelKeyObject[] | string[]; +export type SyncClickHandler = (event: MouseEventHandler) => boolean | void; +export type AsyncClickHandler = (event: MouseEventHandler, done: (proceed?: boolean) => void) => void; + +export interface CommonPropTypes { + data: string | Data; + headers?: Headers; + enclosingCharacter?: string; + separator?: string; + filename?: string; + uFEFF?: boolean; + onClick?: SyncClickHandler | AsyncClickHandler; + asyncOnClick?: boolean; +} diff --git a/types/react-csv/components/Download.d.ts b/types/react-csv/components/Download.d.ts new file mode 100644 index 0000000000..282f41596a --- /dev/null +++ b/types/react-csv/components/Download.d.ts @@ -0,0 +1,9 @@ +import { Component } from "react"; +import { CommonPropTypes } from "./CommonPropTypes"; + +export interface DownloadPropTypes extends CommonPropTypes { + target?: string; +} + +export default class Download extends Component { +} diff --git a/types/react-csv/components/Link.d.ts b/types/react-csv/components/Link.d.ts new file mode 100644 index 0000000000..3e133095de --- /dev/null +++ b/types/react-csv/components/Link.d.ts @@ -0,0 +1,5 @@ +import { Component } from "react"; +import { CommonPropTypes } from "./CommonPropTypes"; + +export default class Link extends Component { +} diff --git a/types/react-csv/index.d.ts b/types/react-csv/index.d.ts new file mode 100644 index 0000000000..1390ce1361 --- /dev/null +++ b/types/react-csv/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for react-csv 1.1 +// Project: https://github.com/react-csv/react-csv +// Definitions by: Vincent Pizzo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export { default as CSVLink } from "./components/Link"; +export { default as CSVDownload } from "./components/Download"; diff --git a/types/react-csv/react-csv-tests.tsx b/types/react-csv/react-csv-tests.tsx new file mode 100644 index 0000000000..a099d60626 --- /dev/null +++ b/types/react-csv/react-csv-tests.tsx @@ -0,0 +1,77 @@ +import * as React from "react"; +import { render } from "react-dom"; +import { CSVLink, CSVDownload } from "react-csv"; + +const headers = [ + {label: 'First Name', key: 'details.firstName'}, + {label: 'Last Name', key: 'details.lastName'}, + {label: 'Job', key: 'job'}, +]; + +const headersStrings = ['foo', 'bar']; + +const data = [ + {details: {firstName: 'Ahmed', lastName: 'Tomi'}, job: 'manager'}, + {details: {firstName: 'John', lastName: 'Jones'}, job: 'developer'}, +]; + +const dataString = `firstname,lastname +Ahmed,Tomi +Raed,Labes +Yezzi,Min l3b +`; + +const syncOnClickReturn = (event: React.MouseEventHandler) => { + window.console.log(event); + return true; +}; +const syncOnClickVoid = (event: React.MouseEventHandler) => window.console.log(event); +const asyncOnClickReturn = (event: React.MouseEventHandler, done: (proceed?: boolean) => void) => { + window.console.log(event); + done(true); +}; +const asyncOnClickVoid = (event: React.MouseEventHandler, done: (proceed?: boolean) => void) => { + window.console.log(event); + done(); +}; + +const node = document.getElementById("main"); + +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); + +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); diff --git a/types/react-csv/tsconfig.json b/types/react-csv/tsconfig.json new file mode 100644 index 0000000000..cc91fd7689 --- /dev/null +++ b/types/react-csv/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "noUnusedParameters": true, + "noUnusedLocals": true + }, + "files": [ + "index.d.ts", + "components/CommonPropTypes.d.ts", + "components/Download.d.ts", + "components/Link.d.ts", + "react-csv-tests.tsx" + ] +} diff --git a/types/react-csv/tslint.json b/types/react-csv/tslint.json new file mode 100644 index 0000000000..310959b38e --- /dev/null +++ b/types/react-csv/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": "dtslint/dt.json", + "rules": { } +} diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts index 36c161beb0..e0a152c610 100644 --- a/types/react-dnd-multi-backend/index.d.ts +++ b/types/react-dnd-multi-backend/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/LouisBrunner/react-dnd-multi-backend, https://louisbrunner.github.io/dnd-multi-backend/packages/react-dnd-multi-backend // Definitions by: Janeene Beeforth // Adam Haglund +// Rob Valentine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -97,7 +98,10 @@ export interface PreviewProps { * This is frequently used with the Touch backend to provide a preview on mobile devices. */ export class Preview extends PureComponent {} - +/** + * Pre-existing/default react-dnd-multi-backend transition available to use. + */ + export const MouseTransition: Transition; /** * Pre-existing/default react-dnd-touch-backend transition available to use. * This transition has the setting for "enableMouseEvents" turned on. diff --git a/types/react-lazyload/index.d.ts b/types/react-lazyload/index.d.ts index 3fd9b075e4..9d7453188a 100644 --- a/types/react-lazyload/index.d.ts +++ b/types/react-lazyload/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import { Component } from "react"; +import { Component, ReactNode } from "react"; export interface LazyLoadProps { once?: boolean; @@ -13,10 +13,10 @@ export interface LazyLoadProps { overflow?: boolean; resize?: boolean; scroll?: boolean; - children?: JSX.Element; + children?: ReactNode; throttle?: number | boolean; debounce?: number | boolean; - placeholder?: any; + placeholder?: ReactNode; unmountIfInvisible?: boolean; } diff --git a/types/react-map-gl/index.d.ts b/types/react-map-gl/index.d.ts index 4d147d3611..04c4d9aed9 100644 --- a/types/react-map-gl/index.d.ts +++ b/types/react-map-gl/index.d.ts @@ -226,6 +226,7 @@ export interface InteractiveMapProps extends StaticMapProps { keyboard?: boolean; onHover?: (event: PointerEvent) => void; onClick?: (event: PointerEvent) => void; + onNativeClick?: (event: PointerEvent) => void; onDblClick?: (event: PointerEvent) => void; onContextMenu?: (event: PointerEvent) => void; onMouseDown?: (event: PointerEvent) => void; diff --git a/types/react-native-tab-view/index.d.ts b/types/react-native-tab-view/index.d.ts index a6e6b27735..43517fa20b 100644 --- a/types/react-native-tab-view/index.d.ts +++ b/types/react-native-tab-view/index.d.ts @@ -212,6 +212,8 @@ export type TabBarProps = SceneRendererProps< renderBadge?: (scene: Scene) => ReactNode onTabPress?: (scene: Scene) => void onTabLongPress?: (scene: Scene) => void + activeColor?: string + inactiveColor?: string pressColor?: string pressOpacity?: number scrollEnabled?: boolean diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index f2b0b968fb..9b2aee84e2 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -872,10 +872,6 @@ export interface StackNavigatorConfig } // Return createNavigationContainer -export function StackNavigator( - routeConfigMap: NavigationRouteConfigMap, - stackConfig?: StackNavigatorConfig -): NavigationContainer; export function createStackNavigator( routeConfigMap: NavigationRouteConfigMap, @@ -892,11 +888,6 @@ export interface SwitchNavigatorConfig { // Return createNavigationContainer export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig; -export function SwitchNavigator( - routeConfigMap: NavigationRouteConfigMap, - switchConfig?: SwitchNavigatorConfig -): NavigationContainer; - export function createSwitchNavigator( routeConfigMap: NavigationRouteConfigMap, switchConfig?: SwitchNavigatorConfig @@ -962,11 +953,6 @@ export interface DrawerNavigatorConfig drawerLockMode?: DrawerLockMode; } -export function DrawerNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawerConfig?: DrawerNavigatorConfig -): NavigationContainer; - export function createDrawerNavigator( routeConfigMap: NavigationRouteConfigMap, drawerConfig?: DrawerNavigatorConfig @@ -1021,15 +1007,6 @@ export interface BottomTabNavigatorConfig } // From navigators/TabNavigator.js -export function TabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; - -export function createTabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; export function createBottomTabNavigator( routeConfigMap: NavigationRouteConfigMap, diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 777a8fa9f3..2f7c65f9cd 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -36,7 +36,7 @@ import { createSwitchNavigator, SwitchNavigatorConfig, TabBarTop, - createTabNavigator, + createMaterialTopTabNavigator, TabNavigatorConfig, Transitioner, HeaderBackButton, @@ -245,7 +245,7 @@ const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = { }, }; -const BasicTabNavigator = createTabNavigator( +const BasicTabNavigator = createMaterialTopTabNavigator( routeConfigMap, tabNavigatorConfig, ); diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 5adeb43612..3ef1005cd8 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -6,7 +6,6 @@ // Frank Tan // Nicholas Boll // Dibyo Majumdar -// Prashant Deva // Thomas Charlat // Valentin Descamps // Johann Rakotoharisoa @@ -44,6 +43,8 @@ import { Store } from 'redux'; +import { NonReactStatics } from 'hoist-non-react-statics'; + // Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html export type Omit = Pick>; @@ -96,7 +97,10 @@ export type GetProps = C extends ComponentType ? P : never; // Applies LibraryManagedAttributes (proper handling of defaultProps // and propTypes), as well as defines WrappedComponent. -export type ConnectedComponentClass = ComponentClass> & { +export type ConnectedComponentClass< + C extends ComponentType, + P +> = ComponentClass> & NonReactStatics & { WrappedComponent: C; }; diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index ee5b9c1d94..085874a523 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -1167,6 +1167,48 @@ function TestLibraryManagedAttributes() { { }} />; } +function TestNonReactStatics() { + interface OwnProps { + bar: number; + } + + interface MapStateProps { + foo: string; + } + + class Component extends React.Component { + static defaultProps = { + bar: 0, + }; + + static meaningOfLife = 42; + + render() { + return
; + } + } + + function mapStateToProps(state: any): MapStateProps { + return { + foo: 'foo', + }; + } + + Component.meaningOfLife; + Component.defaultProps.bar; + + const ConnectedComponent = connect(mapStateToProps)(Component); + + // This is a non-React static and should be hoisted as-is. + ConnectedComponent.meaningOfLife; + + // This is a React static, so it's not hoisted. + // However, ConnectedComponent is still a ComponentClass, which specifies `defaultProps` + // as an optional static member. We can force an error (and assert that `defaultProps` + // wasn't hoisted) by reaching into the `defaultProps` object without a null check. + ConnectedComponent.defaultProps.bar; // $ExpectError +} + function TestProviderContext() { const store: Store = createStore((state = {}) => state); const nullContext = React.createContext(null); diff --git a/types/react-request/index.d.ts b/types/react-request/index.d.ts index 0806dda260..3134825fbe 100644 --- a/types/react-request/index.d.ts +++ b/types/react-request/index.d.ts @@ -15,6 +15,7 @@ export interface RenderProps { response: Response | null; url: string; data: T | null; + doFetch: (options?: FetchRequestProps) => Promise; } export interface FetchRequestProps extends RequestInit { diff --git a/types/react-request/react-request-tests.tsx b/types/react-request/react-request-tests.tsx index 6a4ff71212..5e5edf31d2 100644 --- a/types/react-request/react-request-tests.tsx +++ b/types/react-request/react-request-tests.tsx @@ -8,13 +8,16 @@ interface ServerResponse { export default class BasicReactRequest extends React.Component { render() { return url='/api/server'> - {({ fetching, failed, data, response }) => { + {({ fetching, failed, data, response, doFetch }) => { if (fetching || !response) { return

Loading...

; } if (failed) { return

Failed to load

; } + if (!data) { + doFetch(); + } return

{data ? data.foo : 'data was null'}

; }} ; diff --git a/types/react-router-config/index.d.ts b/types/react-router-config/index.d.ts index 0dc1544ca6..bf719c5760 100644 --- a/types/react-router-config/index.d.ts +++ b/types/react-router-config/index.d.ts @@ -15,6 +15,7 @@ export interface RouteConfigComponentProps> | React.ComponentType; path?: string; diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 6ed1f19bd0..62c80aef8f 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -20,6 +20,7 @@ // Duong Tran // Ben Smith // Wesley Tsai +// Sebastian Silbermann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -124,8 +125,8 @@ export interface match { url: string; } -// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html -export type Omit = Pick>; +// Omit taken from https://github.com/Microsoft/TypeScript/issues/28339#issuecomment-467220238 +export type Omit = T extends any ? Pick> : never; export function matchPath(pathname: string, props: string | RouteProps, parent?: match | null): match | null; diff --git a/types/react-router/test/WithRouter.tsx b/types/react-router/test/WithRouter.tsx index 4db65a32bd..5782b08429 100644 --- a/types/react-router/test/WithRouter.tsx +++ b/types/react-router/test/WithRouter.tsx @@ -22,3 +22,31 @@ const WithRouterTestFunction = () => ( ); const WithRouterTestClass = () => ; + +// union props +{ + interface Book { + kind: 'book'; + author: string; + } + + interface Magazine { + kind: 'magazine'; + issue: number; + } + + type SomethingToRead = (Book | Magazine) & RouteComponentProps; + + const Readable: React.SFC = props => { + if (props.kind === 'magazine') { + return
magazine #{props.issue}
; + } + + return
magazine #{props.author}
; + }; + + const RoutedReadable = withRouter(Readable); + + ; + ; // $ExpectError +} diff --git a/types/react-scroll-into-view-if-needed/index.d.ts b/types/react-scroll-into-view-if-needed/index.d.ts new file mode 100644 index 0000000000..2522833fbd --- /dev/null +++ b/types/react-scroll-into-view-if-needed/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for react-scroll-into-view-if-needed 2.1 +// Project: https://github.com/icd2k3/react-scroll-into-view-if-needed#readme +// Definitions by: Angus Fretwell +// Allan Pope +// Jonathan Ly +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +import * as React from 'react'; +import * as ScrollIntoViewIfNeeded from 'scroll-into-view-if-needed'; + +export interface ReactScrollIntoViewIfNeededProps + extends React.HTMLProps { + options?: ScrollIntoViewIfNeeded.Options; + active?: boolean; + elementType?: keyof JSX.IntrinsicElements; +} + +export default class ReactScrollIntoViewIfNeeded extends React.Component< + ReactScrollIntoViewIfNeededProps +> {} diff --git a/types/react-scroll-into-view-if-needed/package.json b/types/react-scroll-into-view-if-needed/package.json new file mode 100644 index 0000000000..bc0a926e27 --- /dev/null +++ b/types/react-scroll-into-view-if-needed/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "scroll-into-view-if-needed": "*" + } +} diff --git a/types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx b/types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx new file mode 100644 index 0000000000..562615e74c --- /dev/null +++ b/types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx @@ -0,0 +1,52 @@ +import * as React from 'react'; +import ReactScrollIntoViewIfNeeded from 'react-scroll-into-view-if-needed'; + +const validOptions = { + block: 'start', + scrollMode: 'if-needed', + skipOverflowHiddenElements: true +}; + +const invalidOptions = { + invalidOption: 'foobar' +}; + +() => ( + + Children + +); + +() => ( + + Children + +); + +() => ( + + Children + +); + +() => ( + + Children + +); diff --git a/types/del/tsconfig.json b/types/react-scroll-into-view-if-needed/tsconfig.json similarity index 65% rename from types/del/tsconfig.json rename to types/react-scroll-into-view-if-needed/tsconfig.json index 6143d08346..cfa539dc78 100644 --- a/types/del/tsconfig.json +++ b/types/react-scroll-into-view-if-needed/tsconfig.json @@ -1,23 +1,17 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6", "dom"], + "jsx": "react", "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, + "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "del-tests.ts" - ] -} \ No newline at end of file + "files": ["index.d.ts", "react-scroll-into-view-if-needed-tests.tsx"] +} diff --git a/types/ora/v1/tslint.json b/types/react-scroll-into-view-if-needed/tslint.json similarity index 100% rename from types/ora/v1/tslint.json rename to types/react-scroll-into-view-if-needed/tslint.json diff --git a/types/react-select/lib/Select.d.ts b/types/react-select/lib/Select.d.ts index 11853f6be9..57fef3bb9c 100644 --- a/types/react-select/lib/Select.d.ts +++ b/types/react-select/lib/Select.d.ts @@ -50,7 +50,9 @@ export interface FormatOptionLabelMeta { selectValue: ValueType; } -export interface Props { +export type SelectComponentsProps = { [key in string]: any }; + +export interface Props extends SelectComponentsProps { /* Aria label (for assistive tech) */ 'aria-label'?: string; /* HTML ID of an element that should be used as the label (for assistive tech) */ diff --git a/types/react-widgets/lib/Multiselect.d.ts b/types/react-widgets/lib/Multiselect.d.ts index 56a2753d3e..afafdfcb12 100644 --- a/types/react-widgets/lib/Multiselect.d.ts +++ b/types/react-widgets/lib/Multiselect.d.ts @@ -1,12 +1,14 @@ -import * as React from 'react'; -import { ReactWidgetsCommonDropdownProps, AutoFocus } from './CommonProps'; +import * as React from "react"; +import { ReactWidgetsCommonDropdownProps, AutoFocus } from "./CommonProps"; -interface MultiselectProps extends ReactWidgetsCommonDropdownProps, AutoFocus { +interface MultiselectProps + extends ReactWidgetsCommonDropdownProps, + AutoFocus { /** * Enables the list option creation UI. onFilter will only the UI when actively filtering for a list item. * @default 'onFilter' */ - allowCreate?: boolean | 'onFilter'; + allowCreate?: boolean | "onFilter"; /** * The current values of the Multiselect. The value should can null, or an array of * valueField values, or an array of objects (such as a few items in the data array) @@ -20,20 +22,26 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps void; + onChange?: ( + dataItems: any[], + metadata: { + dataItem: any; + action: "insert" | "remove"; + originalEvent?: any; + lastValue?: any[]; + searchTerm?: string; + } + ) => void; /** * This handler fires when an item has been selected from the list. It fires before the * onChange handler, and fires regardless of whether the value has actually changed */ - onSelect?: (value: any, metadata: { - originalEvent: any; - }) => void; + onSelect?: ( + value: any, + metadata: { + originalEvent: any; + } + ) => void; /** * This handler fires when the user chooses to create a new tag, not in the data list. It is * up to the widget parent to implement creation logic, a common implementation is shown @@ -100,11 +108,14 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps void; + onSearch?: ( + searchTerm: string, + metadata: { + action: "clear" | "input"; + lastSearchTerm?: string; + originalEvent?: any; + } + ) => void; /** * Whether or not the Multiselect is open. When unset (undefined) the Multiselect will * handle the opening and closing internally. The defaultOpen prop can be used to set an @@ -124,7 +135,12 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps boolean); + filter?: + | false + | "startsWith" + | "endsWith" + | "contains" + | ((dataItem: any, searchTerm: string) => boolean); /** * Use in conjunction with the filter prop. Filter the list without regard for case. This * only applies to non function values for filter. @@ -167,6 +183,11 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps{props.value}; @@ -18,105 +26,97 @@ function listComponent(props: { value: string }) { class Test extends React.Component> { render() { return ( -
- - - - - - - +
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + +
+
+ + + + + + + +
+
+ + + } + /> + + + + + + + +
+
+ } + /> +
-
- - - - - - - -
-
- - - - - -
-
- - - - - - - -
-
- - - - } - /> - - - - - - -
-
- } /> -
-
); } } diff --git a/types/react/index.d.ts b/types/react/index.d.ts index a2dd9ee144..dd7756d2b2 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -21,6 +21,7 @@ // Jessica Franco // Paul Sherman // Sunil Pai +// Saransh Kataria // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -426,7 +427,7 @@ declare namespace React { // always pass children as variadic arguments to `createElement`. // In the future, if we can define its call signature conditionally // on the existence of `children` in `P`, then we should remove this. - readonly props: Readonly>; + readonly props: Readonly

& Readonly<{ children?: ReactNode }>; state: Readonly; /** * @deprecated @@ -1777,6 +1778,7 @@ declare namespace React { rel?: string; target?: string; type?: string; + referrerPolicy?: string; } // tslint:disable-next-line:no-empty-interface diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 44f97c933b..56ffd20265 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -13,6 +13,7 @@ // Andrew Palugniok // Robert Stigsson // Kosaku Kurino +// Leon Ng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -219,7 +220,7 @@ export interface BarProps extends EventAttributes, Partial | object; // see label section at http://recharts.org/#/en-US/api/Bar - label?: boolean | Label | React.SFC | React.ReactElement | ContentRenderer; + label?: boolean | Label | LabelProps | React.SFC | React.ReactElement | ContentRenderer; } export class Bar extends React.Component { } diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 08d077875a..752dccd876 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redux-form 7.5 +// Type definitions for redux-form 8.1 // Project: https://github.com/erikras/redux-form, https://redux-form.com // Definitions by: Carson Full // Daniel Lytkin @@ -13,6 +13,7 @@ // Kamil Wojcik // Mohamed Shaaban // Ethan Setnik +// Walter Barbagallo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 import { diff --git a/types/redux-form/lib/Field.d.ts b/types/redux-form/lib/Field.d.ts index 194a322408..f0e1c0a6cc 100644 --- a/types/redux-form/lib/Field.d.ts +++ b/types/redux-form/lib/Field.d.ts @@ -44,7 +44,7 @@ export interface BaseFieldProps

extends Partial { parse?: Parser; validate?: Validator | Validator[]; warn?: Validator | Validator[]; - withRef?: boolean; + forwardRef?: boolean; immutableProps?: string[]; } diff --git a/types/redux-form/lib/FieldArray.d.ts b/types/redux-form/lib/FieldArray.d.ts index a4599b5e97..b84d04ad5a 100644 --- a/types/redux-form/lib/FieldArray.d.ts +++ b/types/redux-form/lib/FieldArray.d.ts @@ -6,7 +6,7 @@ export interface BaseFieldArrayProps

{ component: ComponentType

; validate?: Validator | Validator[]; warn?: Validator | Validator[]; - withRef?: boolean; + forwardRef?: boolean; props?: P; rerenderOnEveryChange?: boolean; } diff --git a/types/redux-form/lib/Fields.d.ts b/types/redux-form/lib/Fields.d.ts index f5ec106852..93b7fbcc74 100644 --- a/types/redux-form/lib/Fields.d.ts +++ b/types/redux-form/lib/Fields.d.ts @@ -1,5 +1,10 @@ import { Component, ComponentType } from "react"; -import { Formatter, Parser, WrappedFieldProps } from "../index"; +import { Formatter, Parser, WrappedFieldProps, Validator } from "../index"; + +export type FieldsWarnerOrValidator = + | Validator + | Validator[] + | { [name: string]: Validator | Validator[] }; interface BaseFieldsProps

{ names: string[]; @@ -7,7 +12,9 @@ interface BaseFieldsProps

{ format?: Formatter | null; props?: P; parse?: Parser; - withRef?: boolean; + forwardRef?: boolean; + validate?: FieldsWarnerOrValidator; + warn?: FieldsWarnerOrValidator; } export interface GenericFields

extends Component & P> { diff --git a/types/redux-form/lib/FormName.d.ts b/types/redux-form/lib/FormName.d.ts index 6cfc6f3708..501035fdf4 100644 --- a/types/redux-form/lib/FormName.d.ts +++ b/types/redux-form/lib/FormName.d.ts @@ -1,7 +1,7 @@ import { ReactNode, StatelessComponent } from "react"; export interface FormNameProps { - children: (props: { form: string }) => ReactNode; + children: (props: { form: string, sectionPrefix?: string }) => ReactNode; } export const FormName: StatelessComponent; diff --git a/types/redux-form/lib/actions.d.ts b/types/redux-form/lib/actions.d.ts index 955d3d3f5e..85fec56908 100644 --- a/types/redux-form/lib/actions.d.ts +++ b/types/redux-form/lib/actions.d.ts @@ -36,11 +36,11 @@ export declare function registerField(form: string, name: string, type: FieldTyp export declare function reset(form: string): FormAction; export declare function resetSection(form: string, ...sections: string[]): FormAction; export declare function startAsyncValidation(form: string): FormAction; -export declare function stopAsyncValidation(form: string, errors?: FormErrors): FormAction; +export declare function stopAsyncValidation(form: string, errors?: FormErrors): FormAction; export declare function setSubmitFailed(form: string, ...fields: string[]): FormAction; export declare function setSubmitSucceeded(form: string, ...fields: string[]): FormAction; export declare function startSubmit(form: string): FormAction; -export declare function stopSubmit(form: string, errors?: FormErrors): FormAction; +export declare function stopSubmit(form: string, errors?: FormErrors): FormAction; export declare function submit(form: string): FormAction; export declare function clearSubmit(form: string): FormAction; export declare function clearSubmitErrors(form: string): FormAction; @@ -49,8 +49,8 @@ export declare function clearFields(form: string, keepTouched: boolean, persiste export declare function touch(form: string, ...fields: string[]): FormAction; export declare function unregisterField(form: string, name: string): FormAction; export declare function untouch(form: string, ...fields: string[]): FormAction; -export declare function updateSyncErrors(from: string, syncErrors: FormErrors, error: T): FormAction; -export declare function updateSyncWarnings(form: string, syncWarnings: FormWarnings, warning: T): FormAction; +export declare function updateSyncErrors(from: string, syncErrors: FormErrors, error: T): FormAction; +export declare function updateSyncWarnings(form: string, syncWarnings: FormWarnings, warning: T): FormAction; declare const actions: { arrayInsert: typeof arrayInsert, diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 8ad71bbc42..2fa2e8efa1 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -422,7 +422,11 @@ class FormNameTest extends React.Component { render() { return ( - {({ form }) => Form Name is: {form}} + {({ form, sectionPrefix }) => ( + + Form name is {form} and section prefix is {sectionPrefix} + + )} ); } diff --git a/types/redux-form/tsconfig.json b/types/redux-form/tsconfig.json index ea57d2a38a..a7c3f2ede4 100644 --- a/types/redux-form/tsconfig.json +++ b/types/redux-form/tsconfig.json @@ -29,6 +29,7 @@ "lib/Fields.d.ts", "lib/FieldArray.d.ts", "lib/Form.d.ts", + "lib/FormName.d.ts", "lib/FormSection.d.ts", "lib/formValues.d.ts", "lib/formValueSelector.d.ts", @@ -37,4 +38,4 @@ "lib/selectors.d.ts", "lib/SubmissionError.d.ts" ] -} \ No newline at end of file +} diff --git a/types/redux-form/v7/immutable/index.d.ts b/types/redux-form/v7/immutable/index.d.ts new file mode 100644 index 0000000000..2ce6164232 --- /dev/null +++ b/types/redux-form/v7/immutable/index.d.ts @@ -0,0 +1,30 @@ +export { + Field, + FieldArray, + Fields, + Form, + FormName, + FormSection, + reduxForm, + reducer, + formValueSelector, + getFormAsyncErrors, + getFormInitialValues, + getFormMeta, + getFormNames, + getFormSubmitErrors, + getFormSyncErrors, + getFormSyncWarnings, + getFormValues, + hasSubmitFailed, + hasSubmitSucceeded, + isDirty, + isInvalid, + isPristine, + isSubmitting, + isAsyncValidating, + isValid, + SubmissionError, + startSubmit, + stopSubmit, +} from '../'; diff --git a/types/redux-form/v7/index.d.ts b/types/redux-form/v7/index.d.ts new file mode 100644 index 0000000000..08d077875a --- /dev/null +++ b/types/redux-form/v7/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for redux-form 7.5 +// Project: https://github.com/erikras/redux-form, https://redux-form.com +// Definitions by: Carson Full +// Daniel Lytkin +// Karol Janyst +// Luka Zakrajsek +// Alex Young +// Anton Novik +// Huw Martin +// Ethan Resnick +// Tim de Koning +// Maddi Joyce +// Kamil Wojcik +// Mohamed Shaaban +// Ethan Setnik +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 +import { + ComponentClass, + StatelessComponent, + ReactElement +} from "react"; + +export type FieldType = "Field" | "FieldArray"; + +export interface ErrorOther { + _error?: T; +} + +export type FormErrors = { + [P in keyof FormData]?: ReactElement | T; +} & ErrorOther; + +export interface WarningOther { + _warning?: T; +} + +export type FormWarnings = { + [P in keyof FormData]?: ReactElement | string | WarningOther; +}; + +export interface RegisteredFieldState { + name: string; + type: FieldType; +} + +export type Omit = Pick; + +export * from "./lib/reduxForm"; +export * from "./lib/Field"; +export * from "./lib/Fields"; +export * from "./lib/FieldArray"; +export * from "./lib/Form"; +export * from "./lib/FormName"; +export * from "./lib/FormSection"; +export * from "./lib/formValues"; +export * from "./lib/formValueSelector"; +export * from "./lib/reducer"; +export * from "./lib/SubmissionError"; +export * from "./lib/actions"; +export * from "./lib/actionTypes"; +export * from "./lib/selectors"; diff --git a/types/redux-form/v7/lib/Field.d.ts b/types/redux-form/v7/lib/Field.d.ts new file mode 100644 index 0000000000..194a322408 --- /dev/null +++ b/types/redux-form/v7/lib/Field.d.ts @@ -0,0 +1,103 @@ +import { + Component, + ComponentType, + ReactElement, + ChangeEvent, + DragEvent, + FocusEvent, + InputHTMLAttributes, + SelectHTMLAttributes, + TextareaHTMLAttributes +} from "react"; +import { Dispatch } from "redux"; + +export type Normalizer = (value: any, previousValue?: any, allValues?: any, previousAllValues?: any) => any; +export type Formatter = (value: any, name: string) => any; +export type Parser = (value: any, name: string) => any; +export type Validator = (value: any, allValues?: any, props?: any, name?: any) => any; + +export type EventHandler = (event: Event, name?: string) => void; +export type EventWithDataHandler = (event?: Event, newValue?: any, previousValue?: any, name?: string) => void; + +export interface EventOrValueHandler extends EventHandler { + (value: any): void; +} + +export interface CommonFieldInputProps { + name: string; + onDragStart: EventHandler>; + onDrop: EventHandler>; + onFocus: EventHandler>; +} + +export interface CommonFieldProps extends CommonFieldInputProps { + onBlur: EventWithDataHandler>; + onChange: EventWithDataHandler>; +} + +export interface BaseFieldProps

extends Partial { + name: string; + component?: ComponentType | "input" | "select" | "textarea"; + format?: Formatter | null; + normalize?: Normalizer; + props?: P; + parse?: Parser; + validate?: Validator | Validator[]; + warn?: Validator | Validator[]; + withRef?: boolean; + immutableProps?: string[]; +} + +export interface GenericField

extends Component & P> { + dirty: boolean; + name: string; + pristine: boolean; + value: any; + getRenderedComponent(): Component; +} + +export type GenericFieldHTMLAttributes = + InputHTMLAttributes | + SelectHTMLAttributes | + TextareaHTMLAttributes; + +export class Field

extends Component

{ + dirty: boolean; + name: string; + pristine: boolean; + value: any; + getRenderedComponent(): Component; +} + +export interface WrappedFieldProps { + input: WrappedFieldInputProps; + meta: WrappedFieldMetaProps; +} + +export interface WrappedFieldInputProps extends CommonFieldInputProps { + checked?: boolean; + value: any; + onBlur: EventOrValueHandler>; + onChange: EventOrValueHandler>; +} + +export interface WrappedFieldMetaProps { + active?: boolean; + autofilled: boolean; + asyncValidating: boolean; + dirty: boolean; + dispatch: Dispatch; + error?: any; + form: string; + initial: any; + invalid: boolean; + pristine: boolean; + submitting: boolean; + submitFailed: boolean; + touched: boolean; + valid: boolean; + visited: boolean; + warning?: any; +} + +export default Field; diff --git a/types/redux-form/v7/lib/FieldArray.d.ts b/types/redux-form/v7/lib/FieldArray.d.ts new file mode 100644 index 0000000000..a4599b5e97 --- /dev/null +++ b/types/redux-form/v7/lib/FieldArray.d.ts @@ -0,0 +1,61 @@ +import { Component, ComponentType } from "react"; +import { Validator } from "../index"; + +export interface BaseFieldArrayProps

{ + name: string; + component: ComponentType

; + validate?: Validator | Validator[]; + warn?: Validator | Validator[]; + withRef?: boolean; + props?: P; + rerenderOnEveryChange?: boolean; +} + +export interface GenericFieldArray extends Component & Partial

> { + name: string; + valid: boolean; + getRenderedComponent(): Component & P>; +} + +export class FieldArray

extends Component & Partial

> implements GenericFieldArray { + name: string; + valid: boolean; + getRenderedComponent(): Component & P>; +} + +export interface WrappedFieldArrayProps { + fields: FieldArrayFieldsProps; + meta: FieldArrayMetaProps; +} + +export type FieldIterate = (name: string, index: number, fields: FieldArrayFieldsProps) => R; + +export interface FieldArrayFieldsProps { + forEach(callback: FieldIterate): void; + get(index: number): FieldValue; + getAll(): FieldValue[]; + removeAll(): void; + insert(index: number, value: FieldValue): void; + name: string; + length: number; + map(callback: FieldIterate): R[]; + pop(): FieldValue; + push(value: FieldValue): void; + remove(index: number): void; + shift(): FieldValue; + swap(indexA: number, indexB: number): void; + move(from: number, to: number): void; + unshift(value: FieldValue): void; +} + +export interface FieldArrayMetaProps { + dirty: boolean; + error?: any; + form: string; + invalid: boolean; + pristine: boolean; + submitFailed: boolean; + submitting: boolean; + valid: boolean; + warning?: any; +} diff --git a/types/redux-form/v7/lib/Fields.d.ts b/types/redux-form/v7/lib/Fields.d.ts new file mode 100644 index 0000000000..f5ec106852 --- /dev/null +++ b/types/redux-form/v7/lib/Fields.d.ts @@ -0,0 +1,31 @@ +import { Component, ComponentType } from "react"; +import { Formatter, Parser, WrappedFieldProps } from "../index"; + +interface BaseFieldsProps

{ + names: string[]; + component?: ComponentType; + format?: Formatter | null; + props?: P; + parse?: Parser; + withRef?: boolean; +} + +export interface GenericFields

extends Component & P> { + dirty: boolean; + names: string[]; + pristine: boolean; + values: { [name: string]: any }; + getRenderedComponent(): Component; +} + +export class Fields

extends Component & P> implements GenericFields

{ + dirty: boolean; + names: string[]; + pristine: boolean; + values: { [name: string]: any }; + getRenderedComponent(): Component; +} + +interface WrappedFieldsProps { + [name: string]: WrappedFieldsProps & WrappedFieldProps; +} diff --git a/types/redux-form/v7/lib/Form.d.ts b/types/redux-form/v7/lib/Form.d.ts new file mode 100644 index 0000000000..0eee944be5 --- /dev/null +++ b/types/redux-form/v7/lib/Form.d.ts @@ -0,0 +1,12 @@ +import { Component, FormHTMLAttributes, FormEvent, FormEventHandler } from "react"; +import { FormProps, FormErrors, FormSubmitHandler, Omit } from "../index"; + +interface FormSubmitProp { + onSubmit?: FormSubmitHandler; +} + +export type FormProps = Omit, "onSubmit"> & FormSubmitProp; + +export class GenericForm extends Component> {} + +export class Form extends Component> implements GenericForm {} diff --git a/types/redux-form/v7/lib/FormName.d.ts b/types/redux-form/v7/lib/FormName.d.ts new file mode 100644 index 0000000000..6cfc6f3708 --- /dev/null +++ b/types/redux-form/v7/lib/FormName.d.ts @@ -0,0 +1,9 @@ +import { ReactNode, StatelessComponent } from "react"; + +export interface FormNameProps { + children: (props: { form: string }) => ReactNode; +} + +export const FormName: StatelessComponent; + +export default FormName; diff --git a/types/redux-form/v7/lib/FormSection.d.ts b/types/redux-form/v7/lib/FormSection.d.ts new file mode 100644 index 0000000000..bed9ba765b --- /dev/null +++ b/types/redux-form/v7/lib/FormSection.d.ts @@ -0,0 +1,10 @@ +import { Component, ComponentType } from "react"; + +export interface FormSectionProps

{ + name: string; + component?: ComponentType

; +} + +export declare class FormSection

extends Component & P> {} + +export default FormSection; diff --git a/types/redux-form/v7/lib/SubmissionError.d.ts b/types/redux-form/v7/lib/SubmissionError.d.ts new file mode 100644 index 0000000000..50695f34d0 --- /dev/null +++ b/types/redux-form/v7/lib/SubmissionError.d.ts @@ -0,0 +1,7 @@ +import { FormErrors } from "../index"; + +export declare class SubmissionError extends Error { + constructor(errors?: FormErrors); +} + +export default SubmissionError; diff --git a/types/redux-form/v7/lib/actionTypes.d.ts b/types/redux-form/v7/lib/actionTypes.d.ts new file mode 100644 index 0000000000..7718ba74ab --- /dev/null +++ b/types/redux-form/v7/lib/actionTypes.d.ts @@ -0,0 +1,39 @@ +export interface ActionTypes { + ARRAY_INSERT: string; + ARRAY_MOVE: string; + ARRAY_POP: string; + ARRAY_PUSH: string; + ARRAY_REMOVE: string; + ARRAY_REMOVE_ALL: string; + ARRAY_SHIFT: string; + ARRAY_SPLICE: string; + ARRAY_UNSHIFT: string; + ARRAY_SWAP: string; + AUTOFILL: string; + BLUR: string; + CHANGE: string; + CLEAR_SUBMIT: string; + CLEAR_SUBMIT_ERRORS: string; + CLEAR_ASYNC_ERROR: string; + CLEAR_FIELDS: string; + DESTROY: string; + FOCUS: string; + INITIALIZE: string; + REGISTER_FIELD: string; + RESET: string; + RESET_SECTION: string; + SET_SUBMIT_FAILED: string; + SET_SUBMIT_SUCCEEDED: string; + START_ASYNC_VALIDATION: string; + START_SUBMIT: string; + STOP_ASYNC_VALIDATION: string; + STOP_SUBMIT: string; + SUBMIT: string; + TOUCH: string; + UNREGISTER_FIELD: string; + UNTOUCH: string; + UPDATE_SYNC_ERRORS: string; + UPDATE_SYNC_WARNINGS: string; +} + +export const actionTypes: ActionTypes; diff --git a/types/redux-form/v7/lib/actions.d.ts b/types/redux-form/v7/lib/actions.d.ts new file mode 100644 index 0000000000..955d3d3f5e --- /dev/null +++ b/types/redux-form/v7/lib/actions.d.ts @@ -0,0 +1,92 @@ +import { Action } from "redux"; +import { FormErrors, FormWarnings, FieldType } from "../index"; + +export interface FormAction extends Action { + meta?: any; + payload?: any; + error?: any; +} + +export declare function arrayInsert(form: string, field: string, index: number, value: any): FormAction; +export declare function arrayMove(form: string, field: string, from: number, to: number): FormAction; +export declare function arrayPop(form: string, field: string): FormAction; +export declare function arrayPush(form: string, field: string, value: any): FormAction; +export declare function arrayRemove(form: string, field: string, index: number): FormAction; +export declare function arrayRemoveAll(form: string, field: string): FormAction; +export declare function arrayShift(form: string, field: string): FormAction; +export declare function arraySplice(form: string, field: string, index: number, removeNum: number, value: any): FormAction; +export declare function arraySwap(form: string, field: string, indexA: number, indexB: number): FormAction; +export declare function arrayUnshift(form: string, field: string, value: any): FormAction; +export declare function autofill(form: string, field: string, value: any): FormAction; +export declare function blur(form: string, field: string, value: any, touch?: boolean): FormAction; +export declare function change(form: string, field: string, value: any, touch?: boolean, persistentSubmitErrors?: boolean): FormAction; +export declare function destroy(...form: string[]): FormAction; +export declare function focus(form: string, field: string): FormAction; + +export interface InitializeOptions { + keepDirty: boolean; + keepSubmitSucceeded: boolean; + updateUnregisteredFields: boolean; + keepValues: boolean; +} + +export declare function initialize(form: string, data: any, keepDirty?: boolean, options?: Partial): FormAction; +export declare function initialize(form: string, data: any, options?: Partial): FormAction; +export declare function registerField(form: string, name: string, type: FieldType): FormAction; +export declare function reset(form: string): FormAction; +export declare function resetSection(form: string, ...sections: string[]): FormAction; +export declare function startAsyncValidation(form: string): FormAction; +export declare function stopAsyncValidation(form: string, errors?: FormErrors): FormAction; +export declare function setSubmitFailed(form: string, ...fields: string[]): FormAction; +export declare function setSubmitSucceeded(form: string, ...fields: string[]): FormAction; +export declare function startSubmit(form: string): FormAction; +export declare function stopSubmit(form: string, errors?: FormErrors): FormAction; +export declare function submit(form: string): FormAction; +export declare function clearSubmit(form: string): FormAction; +export declare function clearSubmitErrors(form: string): FormAction; +export declare function clearAsyncError(form: string, field: string): FormAction; +export declare function clearFields(form: string, keepTouched: boolean, persistentSubmitErrors: boolean, ...fields: string[]): FormAction; +export declare function touch(form: string, ...fields: string[]): FormAction; +export declare function unregisterField(form: string, name: string): FormAction; +export declare function untouch(form: string, ...fields: string[]): FormAction; +export declare function updateSyncErrors(from: string, syncErrors: FormErrors, error: T): FormAction; +export declare function updateSyncWarnings(form: string, syncWarnings: FormWarnings, warning: T): FormAction; + +declare const actions: { + arrayInsert: typeof arrayInsert, + arrayMove: typeof arrayMove, + arrayPop: typeof arrayPop, + arrayPush: typeof arrayPush, + arrayRemove: typeof arrayRemove, + arrayRemoveAll: typeof arrayRemoveAll, + arrayShift: typeof arrayShift, + arraySplice: typeof arraySplice, + arraySwap: typeof arraySwap, + arrayUnshift: typeof arrayUnshift, + autofill: typeof autofill, + blur: typeof blur, + change: typeof change, + clearSubmit: typeof clearSubmit, + clearSubmitErrors: typeof clearSubmitErrors, + clearAsyncError: typeof clearAsyncError, + clearFields: typeof clearFields, + destroy: typeof destroy, + focus: typeof focus, + initialize: typeof initialize, + registerField: typeof registerField, + reset: typeof reset, + startAsyncValidation: typeof startAsyncValidation, + startSubmit: typeof startSubmit, + stopAsyncValidation: typeof stopAsyncValidation, + stopSubmit: typeof stopSubmit, + submit: typeof submit, + setSubmitFailed: typeof setSubmitFailed, + setSubmitSucceeded: typeof setSubmitSucceeded, + touch: typeof touch, + unregisterField: typeof unregisterField, + untouch: typeof untouch, + updateSyncErrors: typeof updateSyncErrors, + updateSyncWarnings: typeof updateSyncWarnings +}; + +export default actions; diff --git a/types/redux-form/v7/lib/formValueSelector.d.ts b/types/redux-form/v7/lib/formValueSelector.d.ts new file mode 100644 index 0000000000..e13ffd3c5d --- /dev/null +++ b/types/redux-form/v7/lib/formValueSelector.d.ts @@ -0,0 +1,8 @@ +import { FormStateMap } from "../index"; + +export function formValueSelector( + form: string, + getFormState?: (state: State) => FormStateMap +): (state: State, ...field: string[]) => any; + +export default formValueSelector; diff --git a/types/redux-form/v7/lib/formValues.d.ts b/types/redux-form/v7/lib/formValues.d.ts new file mode 100644 index 0000000000..1052f8533e --- /dev/null +++ b/types/redux-form/v7/lib/formValues.d.ts @@ -0,0 +1,13 @@ +import { ComponentClass, ComponentType } from "react"; +import { InjectedFormProps } from "../index"; + +export function formValues< + Values, + P = {} +>(obj: Values): (component: ComponentType

) => ComponentClass

; + +export function formValues< + FormData = {}, + K extends keyof FormData = keyof FormData, + P = {} +>(...names: K[]): (component: ComponentType

>) => ComponentClass

>; diff --git a/types/redux-form/v7/lib/reducer.d.ts b/types/redux-form/v7/lib/reducer.d.ts new file mode 100644 index 0000000000..f2ee374cf2 --- /dev/null +++ b/types/redux-form/v7/lib/reducer.d.ts @@ -0,0 +1,42 @@ +import { Reducer } from "redux"; +import { FieldType } from "../index"; + +export interface FormReducer extends Reducer { + plugin(reducers: FormReducerMapObject): Reducer; +} + +export const reducer: FormReducer; + +export interface FormReducerMapObject { + // and `` to make it compatible with redux@3 + // tslint:disable-next-line use-default-type-parameter + [formName: string]: Reducer; +} + +export interface FormStateMap { + [formName: string]: FormState; +} + +export interface FormState { + registeredFields: RegisteredFieldState[]; + fields?: {[name: string]: FieldState}; + values?: { [fieldName: string]: any }; + active?: string; + anyTouched?: boolean; + submitting?: boolean; + submitErrors?: { [fieldName: string]: string }; + submitFailed?: boolean; +} + +export interface RegisteredFieldState { + name: string; + type: FieldType; +} + +export interface FieldState { + active?: boolean; + touched?: boolean; + visited?: boolean; +} + +export default reducer; diff --git a/types/redux-form/v7/lib/reduxForm.d.ts b/types/redux-form/v7/lib/reduxForm.d.ts new file mode 100644 index 0000000000..e37214f5d0 --- /dev/null +++ b/types/redux-form/v7/lib/reduxForm.d.ts @@ -0,0 +1,164 @@ +import { + Component, + ComponentClass, + ComponentType, + ReactElement, + SyntheticEvent, + StatelessComponent, + FormEventHandler +} from "react"; +import { Dispatch } from "redux"; +import { + FormErrors, + ErrorOther, + FormWarnings, + WarningOther, + RegisteredFieldState, + FormStateMap +} from "../index"; + +export type FormSubmitHandler = + (values: FormData, dispatch: Dispatch, props: P) => void | FormErrors | Promise; + +export type GetFormState = (state: any) => FormStateMap; +export interface SubmitHandler { + ( + submit: FormSubmitHandler, + props?: InjectedFormProps, + valid?: boolean, + asyncValidate?: any, + fields?: string[] + ): any; + (event: SyntheticEvent): void; +} + +export interface ValidateCallback { + values: FormData; + nextProps: P & InjectedFormProps; + props: P & InjectedFormProps; + initialRender: boolean; + structure: any; +} + +export interface AsyncValidateCallback { + asyncErrors?: FormErrors; + initialized: boolean; + trigger: "blur" | "submit"; + blurredField?: string; + pristine: boolean; + syncValidationPasses: boolean; +} + +export interface InjectedArrayProps { + insert(field: string, index: number, value: any): void; + move(field: string, from: number, to: number): void; + pop(field: string): void; + push(field: string, value: any): void; + remove(field: string, index: number): void; + removeAll(field: string): void; + shift(field: string): void; + splice(field: string, index: number, removeNum: number, value: any): void; + swap(field: string, indexA: number, indexB: number): void; + unshift(field: string, value: any): void; +} + +export interface RegisteredField { + count: number; + name: string; + type: "Field" | "FieldArray"; +} + +export interface InjectedFormProps { + anyTouched: boolean; + array: InjectedArrayProps; + asyncValidate(): void; + asyncValidating: string | boolean; + autofill(field: string, value: any): void; + blur(field: string, value: any): void; + change(field: string, value: any): void; + clearAsyncError(field: string): void; + destroy(): void; + dirty: boolean; + error: ErrorType; + form: string; + handleSubmit: SubmitHandler; + initialize(data: Partial): void; + initialized: boolean; + initialValues: Partial; + invalid: boolean; + pristine: boolean; + reset(): void; + submitFailed: boolean; + submitSucceeded: boolean; + submitting: boolean; + touch(...field: string[]): void; + untouch(...field: string[]): void; + valid: boolean; + warning: any; + registeredFields: { [name: string]: RegisteredField }; +} + +export interface ConfigProps { + form: string; + asyncBlurFields?: string[]; + asyncChangeFields?: string[]; + asyncValidate?(values: FormData, dispatch: Dispatch, props: P & InjectedFormProps, blurredField: string): Promise; + destroyOnUnmount?: boolean; + enableReinitialize?: boolean; + forceUnregisterOnUnmount?: boolean; + getFormState?: GetFormState; + immutableProps?: string[]; + initialValues?: Partial; + keepDirtyOnReinitialize?: boolean; + updateUnregisteredFields?: boolean; + onChange?(values: Partial, dispatch: Dispatch, props: P & InjectedFormProps, previousValues: Partial): void; + onSubmit?: FormSubmitHandler, ErrorType> | SubmitHandler, ErrorType>; + onSubmitFail?( + errors: FormErrors | undefined, + dispatch: Dispatch, + submitError: any, + props: P & InjectedFormProps + ): void; + onSubmitSuccess?(result: any, dispatch: Dispatch, props: P & InjectedFormProps): void; + propNamespace?: string; + pure?: boolean; + shouldValidate?(params: ValidateCallback): boolean; + shouldError?(params: ValidateCallback): boolean; + shouldWarn?(params: ValidateCallback): boolean; + shouldAsyncValidate?(params: AsyncValidateCallback): boolean; + touchOnBlur?: boolean; + touchOnChange?: boolean; + persistentSubmitErrors?: boolean; + validate?(values: FormData, props: P & InjectedFormProps): FormErrors; + warn?(values: FormData, props: P & InjectedFormProps): FormWarnings; +} + +export interface FormInstance extends Component

{ + dirty: boolean; + invalid: boolean; + pristine: boolean; + registeredFields: RegisteredFieldState[]; + reset(): void; + resetSection(...sections: string[]): void; + submit(): Promise; + valid: boolean; + values: Partial; + wrappedInstance: ReactElement

>; +} + +export interface DecoratedComponentClass { + new(props?: P, context?: any): FormInstance; +} + +export type FormDecorator = + (component: ComponentType

>) => DecoratedComponentClass; + +export declare function reduxForm( + config: ConfigProps +): FormDecorator>, ErrorType>; + +export declare function reduxForm( + config: Partial> +): FormDecorator, ErrorType>; + +export default reduxForm; diff --git a/types/redux-form/v7/lib/selectors.d.ts b/types/redux-form/v7/lib/selectors.d.ts new file mode 100644 index 0000000000..c97d99859b --- /dev/null +++ b/types/redux-form/v7/lib/selectors.d.ts @@ -0,0 +1,25 @@ +import { FormErrors, GetFormState } from "../index"; + +export type DataSelector = (formName: string, getFormState?: GetFormState) => (state: State) => FormData; +export type ErrorSelector = (formName: string, getFormState?: GetFormState) => (state: State) => FormErrors; +export type BooleanSelector = (formName: string, getFormState?: GetFormState) => (state: State) => boolean; +export type NamesSelector = (getFormState?: GetFormState) => (state: State) => string[]; +export type FormOrFieldsBooleanSelector = (formName: string, getFormState?: GetFormState) => (state: State, ...fields: string[]) => boolean; + +export const getFormValues: DataSelector; +export const getFormInitialValues: DataSelector; +export const getFormSyncErrors: ErrorSelector; +export const getFormMeta: DataSelector; +export const getFormAsyncErrors: ErrorSelector; +export const getFormSyncWarnings: ErrorSelector; +export const getFormSubmitErrors: ErrorSelector; +export const getFormError: ErrorSelector; +export const getFormNames: NamesSelector; +export const isDirty: FormOrFieldsBooleanSelector; +export const isPristine: FormOrFieldsBooleanSelector; +export const isValid: BooleanSelector; +export const isInvalid: BooleanSelector; +export const isSubmitting: BooleanSelector; +export const isAsyncValidating: BooleanSelector; +export const hasSubmitSucceeded: BooleanSelector; +export const hasSubmitFailed: BooleanSelector; diff --git a/types/redux-form/v7/package.json b/types/redux-form/v7/package.json new file mode 100644 index 0000000000..998f8e9b38 --- /dev/null +++ b/types/redux-form/v7/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "redux": "^3.6.0 || ^4.0.0" + } +} diff --git a/types/redux-form/v7/redux-form-tests.tsx b/types/redux-form/v7/redux-form-tests.tsx new file mode 100644 index 0000000000..8ad71bbc42 --- /dev/null +++ b/types/redux-form/v7/redux-form-tests.tsx @@ -0,0 +1,464 @@ +import * as React from 'react'; +import { Action, Dispatch } from "redux"; +import { + reduxForm, + InjectedFormProps, + Form, + FormName, + GenericForm, + FormSection, + formValues, + formValueSelector, + Field, + GenericField, + WrappedFieldProps, + Fields, + GenericFields, + WrappedFieldsProps, + FieldArray, + GenericFieldArray, + WrappedFieldArrayProps, + BaseFieldProps, + reducer, + FormAction, + actionTypes, + submit, + SubmissionError, + FieldArrayFieldsProps +} from "redux-form"; + +import { + Field as ImmutableField, + reduxForm as immutableReduxForm, + startSubmit as immutableStartSubmit, + stopSubmit as immutableStopSubmit +} from "redux-form/immutable"; + +import LibField, { + WrappedFieldProps as LibWrappedFieldProps +} from "redux-form/lib/Field"; +import libReducer from "redux-form/lib/reducer"; +import LibFormSection from "redux-form/lib/FormSection"; +import libFormValueSelector from "redux-form/lib/formValueSelector"; +import libReduxForm from "redux-form/lib/reduxForm"; +import libActions from "redux-form/lib/actions"; +import LibSubmissionError from "redux-form/lib/SubmissionError"; + +/* Decorated components */ +interface TestFormData { + foo: string; +} + +/* Some tests only make sense with multiple values */ +interface MultivalueFormData { + foo: string; + bar?: string; + fizz: string; +} + +interface TestFormComponentProps { + baz: string; +} + +type InjectedProps = InjectedFormProps; + +class TestFormComponent extends React.Component { + render() { + const { form, initialValues, error } = this.props; + const foo = initialValues.foo; + const errorIsString = error + 'test'; + return null; + } +} + +const TestFormRequired = reduxForm({})(TestFormComponent); +const TestForm = reduxForm({ form : "test" })(TestFormComponent); +const TestFormImmRequired = immutableReduxForm({})(TestFormComponent); +const TestFormImm = immutableReduxForm({ form : "test" })(TestFormComponent); + +const TestFormStatelessComponent: React.StatelessComponent = ({ form, initialValues }) => { + const foo = initialValues.foo; + return null; +}; + +const TestFormStatelessRequired = reduxForm({})(TestFormStatelessComponent); +const TestFormStateless = reduxForm({ form : "test" })(TestFormStatelessComponent); + +/* formValues decorator */ + +const ItemList = formValues("foo")( + ({ foo }) => { + return null; + } +); + +const ItemListObj = formValues({ fooBar : "foo" })( + ({ fooBar }) => { + return null; + } +); + +/* Custom FormSection */ + +interface MyFormSectionProps { + foo: string; +} + +const MyFormSection: React.StatelessComponent = ({ children, foo }) => null; + +/* Custom Field */ + +interface MyFieldCustomProps { + foo: string; +} +type MyFieldProps = MyFieldCustomProps & WrappedFieldProps; +const MyField: React.StatelessComponent = ({ + children, + input, + meta, + foo +}) => { + input.onBlur("value"); + input.onBlur({} as React.SyntheticEvent); + + input.onChange("value"); + input.onChange({} as React.SyntheticEvent); + + input.onDragStart({} as React.DragEvent); + + input.onDrop({} as React.DragEvent); + + input.onFocus({} as React.FocusEvent); + return null; +}; +const FieldCustom = Field as new () => GenericField; + +type FieldProps = BaseFieldProps & MyFieldCustomProps; +const FieldCustomComp: React.StatelessComponent = props => ( + +); + +const MyFieldImm: React.StatelessComponent = ({ + children, + input, + meta, + foo +}) => null; +const FieldImmutableCustom = ImmutableField as new () => GenericField; + +/* Custom Fields */ + +interface MyFieldsCustomProps { + foo: string; +} +type MyFieldsProps = MyFieldsCustomProps & WrappedFieldsProps; +const MyFields: React.StatelessComponent = ({ + children, + foo +}) => null; +const FieldsCustom = Fields as new () => GenericFields; + +/* FieldArray */ + +const MyArrayField: React.StatelessComponent = ({ + children +}) => null; + +/* Custom FieldArray */ + +interface MyFieldValue { + num: number; +} +interface MyFieldArrayCustomProps { + foo: string; +} + +const MyCustomArrayField: React.StatelessComponent = ({ + children, + foo +}) => null; + +type MyFieldArrayProps = MyFieldArrayCustomProps & WrappedFieldArrayProps; +const MyFieldArray: React.StatelessComponent = ({ + children, + fields +}) => null; +const FieldArrayCustom = FieldArray as new () => GenericFieldArray; + +/* Tests */ +const TestForms: React.StatelessComponent = () => { + return ( +

+ + + + + + + + +
+ ); +}; + +// Specifying form data type is not required here, but is recommended to avoid confusion +const testFormWithValidationDecorator = reduxForm({ + form: "testWithValidation", + validate: (values, props) => { + return { + foo: "Bad foo" + }; + } +}); + +// Specifying form data type is not required here, but is recommended to avoid confusion +const testFormWithInitialValuesDecorator = reduxForm({ + form: "testWithValidation", + initialValues: { + foo: "A Foo is here" + } +}); + +// Specifying form data type *is* required here, because type inference will guess the type of +// the form data type parameter to be {foo: string}. The result of validate does not contain "foo" +const testFormWithInitialValuesAndValidationDecorator = reduxForm({ + form: "testWithValidation", + initialValues: { + foo: "A Foo is here" + }, + validate: (values, props) => { + return { + bar: "Bad foo" + }; + } +}); + +const testFormWithChangeFunctionDecorator = reduxForm({ + form: "testWithValidation", + onChange: (values: Partial, + dispatch: Dispatch, + props: TestFormComponentProps & InjectedFormProps, + previousValues: Partial) => {} +}); + +type TestProps = {} & InjectedFormProps; +const Test = reduxForm({ + form : "test" +})( + class Test extends React.Component { + handleSubmitForm = (values: Partial, dispatch: Dispatch, props: {}) => {}; + + render() { + const { handleSubmit } = this.props; + const FormCustom = Form as new () => GenericForm; + + return ( +
+ + + name="my-section" + component={MyFormSection} + foo="hello" + /> + + + + + + + + + {}} + onBlur={(event, newValue, previousValue, fieldName) => {}} + /> + + + + + + + + + + + + null } + /> + + null } + foo="bar" + /> + + + name="field9" + component={ MyArrayField } + /> + + + + +
+ ); + } + } +); + +reducer({}, { + type: "ACTION" +}); + +reducer.plugin({ + myForm: (state: any, action: FormAction) => { + if (action.type === actionTypes.CHANGE && action.meta.form === "securitySettings") { + return { + ...state, + values: { + ...state.values, + downloadLinkAutoPassword: true, + }, + }; + } else { + return state; + } + } +}); + +try { + throw new SubmissionError({_error: "Submission failed."}); +} catch (error) { + if (!(error instanceof SubmissionError)) { + throw new Error("SubmissionError not imported correctly"); + } +} + +/* Test using versions imported directly/as defaults from lib */ +const DefaultField = ( + +); + +libReducer({}, { + type: "ACTION" +}); + +const DefaultFormSection = ( + +); + +const TestLibFormRequired = libReduxForm({})(TestFormComponent); +const TestLibForm = libReduxForm({ form : "test" })(TestFormComponent); + +const testSubmit = submit("test"); +const testLibSubmit = libActions.submit("test"); + +try { + throw new LibSubmissionError({_error: "Submission failed."}); +} catch (error) { + if (!(error instanceof LibSubmissionError)) { + throw new Error("SubmissionError from lib not imported correctly"); + } +} + +/* Test handleSubmit prop using as onSubmit handler */ +type HandleSubmitTestProps = {} & InjectedFormProps; +const HandleSubmitTestForm = reduxForm({ + form : "test" +})( + (props: HandleSubmitTestProps) =>
+); + +class HandleSubmitTest extends React.Component { + handleSubmit = (values: Partial, dispatch: Dispatch, props: {}) => {}; + render() { + return ; + } +} + +class FormNameTest extends React.Component { + render() { + return ( + + {({ form }) => Form Name is: {form}} + + ); + } +} + +// Test SubmissionError with custom error format +// See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/26494 +// Note: explicit parameters not needed in TS 2.7 +new LibSubmissionError<{ myField: any }, string[]>({ + _error: ["First form-level error", "Second form-level error"], + myField: ["Field-level error"] +}); + +new SubmissionError({ + _error: ["First form-level error", "Second form-level error"] +}); + +// Test forms with custom error format. +const HandleSubmitTestForm2 = reduxForm({ form : "test" })( + (props: InjectedFormProps) => +); + +class HandleSubmitTest2 extends React.Component { + handleSubmit = (values: Partial, dispatch: Dispatch, props: {}) => {}; + render() { + return ; + } +} + +type InjectedProps2 = InjectedFormProps; +class TestFormComponent2 extends React.Component { + render() { + const { error, initialValues, handleSubmit } = this.props; + error.concat(['error is a string array']); + + handleSubmit((values) => ({ foo: ['string'], _error: [] })); + return null; + } +} diff --git a/types/redux-form/v7/tsconfig.json b/types/redux-form/v7/tsconfig.json new file mode 100644 index 0000000000..19b1709823 --- /dev/null +++ b/types/redux-form/v7/tsconfig.json @@ -0,0 +1,48 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "experimentalDecorators": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "jsx": "react", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "redux-form": [ + "redux-form/v7" + ], + "redux-form/*": [ + "redux-form/v7/*" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redux-form-tests.tsx", + "immutable/index.d.ts", + "lib/actions.d.ts", + "lib/actionTypes.d.ts", + "lib/Field.d.ts", + "lib/Fields.d.ts", + "lib/FieldArray.d.ts", + "lib/Form.d.ts", + "lib/FormSection.d.ts", + "lib/formValues.d.ts", + "lib/formValueSelector.d.ts", + "lib/reducer.d.ts", + "lib/reduxForm.d.ts", + "lib/selectors.d.ts", + "lib/SubmissionError.d.ts" + ] +} diff --git a/types/tabris-plugin-firebase/tslint.json b/types/redux-form/v7/tslint.json similarity index 67% rename from types/tabris-plugin-firebase/tslint.json rename to types/redux-form/v7/tslint.json index 4c4fc86ace..f3568a0139 100644 --- a/types/tabris-plugin-firebase/tslint.json +++ b/types/redux-form/v7/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + "no-object-literal-type-assertion": false, "strict-export-declare-modifiers": false } } diff --git a/types/repeat-element/index.d.ts b/types/repeat-element/index.d.ts new file mode 100644 index 0000000000..2c3cd5d633 --- /dev/null +++ b/types/repeat-element/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for repeat-element 1.1 +// Project: https://github.com/jonschlinkert/repeat-element +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/** + * Create an array by repeating the given value n times. + */ +declare function repeat(element: unknown, num: number): unknown[]; + +export = repeat; diff --git a/types/repeat-element/repeat-element-tests.ts b/types/repeat-element/repeat-element-tests.ts new file mode 100644 index 0000000000..b76b7b4b7e --- /dev/null +++ b/types/repeat-element/repeat-element-tests.ts @@ -0,0 +1,9 @@ +import repeat = require("repeat-element"); + +repeat(5, 5); + +repeat({some: 'object'}, 5); + +repeat('a', 5); + +repeat(null, 5); diff --git a/types/repeat-element/tsconfig.json b/types/repeat-element/tsconfig.json new file mode 100644 index 0000000000..6e7674eafd --- /dev/null +++ b/types/repeat-element/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "repeat-element-tests.ts" + ] +} diff --git a/types/repeat-element/tslint.json b/types/repeat-element/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/repeat-element/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/repeat-string/index.d.ts b/types/repeat-string/index.d.ts new file mode 100644 index 0000000000..5664484e22 --- /dev/null +++ b/types/repeat-string/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for repeat-string 1.6 +// Project: https://github.com/jonschlinkert/repeat-string +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Repeat the given `string` the specified `number` of times. + */ +declare function repeat(str: string, num: number): string; + +export = repeat; diff --git a/types/repeat-string/repeat-string-tests.ts b/types/repeat-string/repeat-string-tests.ts new file mode 100644 index 0000000000..c2692d7569 --- /dev/null +++ b/types/repeat-string/repeat-string-tests.ts @@ -0,0 +1,3 @@ +import Repeat = require("repeat-string"); + +Repeat('A', 5); diff --git a/types/repeat-string/tsconfig.json b/types/repeat-string/tsconfig.json new file mode 100644 index 0000000000..a56114d84f --- /dev/null +++ b/types/repeat-string/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "repeat-string-tests.ts" + ] +} diff --git a/types/repeat-string/tslint.json b/types/repeat-string/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/repeat-string/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/resize-observer-browser/index.d.ts b/types/resize-observer-browser/index.d.ts new file mode 100644 index 0000000000..83291fe4a0 --- /dev/null +++ b/types/resize-observer-browser/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for non-npm package resize-observer-browser 0.1 +// Project: https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver, https://developers.google.com/web/updates/2016/10/resizeobserver, https://wicg.github.io/ResizeObserver/ +// Definitions by: Chives +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +export class ResizeObserver { + constructor(callback: ResizeObserverCallback); + disconnect(): void; + observe(target: Element): void; + unobserve(target: Element): void; +} + +export type ResizeObserverCallback = (entries: ResizeObserverEntry[]) => void; + +export interface ResizeObserverEntry { + readonly target: Element; + readonly contentRect: DOMRectReadOnly; +} diff --git a/types/resize-observer-browser/resize-observer-browser-tests.ts b/types/resize-observer-browser/resize-observer-browser-tests.ts new file mode 100644 index 0000000000..5596f13870 --- /dev/null +++ b/types/resize-observer-browser/resize-observer-browser-tests.ts @@ -0,0 +1,13 @@ +import { ResizeObserver } from "resize-observer-browser"; + +function resizeObserverCreates(): void { + const resizeObserver: ResizeObserver = new ResizeObserver((entries) => { + const div = document.getElementById('display-div')!; + const rect = entries[0].contentRect; + div.textContent = `${rect.left} ${rect.right}`; + }); + const div = document.getElementById('resized-div')!; + resizeObserver.observe(div); + resizeObserver.unobserve(div); + resizeObserver.disconnect(); +} diff --git a/types/resize-observer-browser/tsconfig.json b/types/resize-observer-browser/tsconfig.json new file mode 100644 index 0000000000..849758c836 --- /dev/null +++ b/types/resize-observer-browser/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "resize-observer-browser-tests.ts" + ] +} diff --git a/types/p-event/tslint.json b/types/resize-observer-browser/tslint.json similarity index 100% rename from types/p-event/tslint.json rename to types/resize-observer-browser/tslint.json diff --git a/types/resumablejs/index.d.ts b/types/resumablejs/index.d.ts index c87d669a07..45047b7cf7 100644 --- a/types/resumablejs/index.d.ts +++ b/types/resumablejs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Resumable.js v1.0.2 // Project: https://github.com/23/resumable.js // Definitions by: Daniel McAssey +// Kenneth Kidmose Johnsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Resumable { @@ -213,7 +214,7 @@ declare namespace Resumable { /** * Look up a ResumableFile object by its unique identifier. **/ - getFromUniqueIdentifier(uniqueIdentifier: string): void; + getFromUniqueIdentifier(uniqueIdentifier: string): ResumableFile; /** * Returns the total size of the upload in bytes. **/ diff --git a/types/retinajs/index.d.ts b/types/retinajs/index.d.ts new file mode 100644 index 0000000000..7d02ebc90b --- /dev/null +++ b/types/retinajs/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for retinajs 2.1 +// Project: https://github.com/strues/retinajs +// Definitions by: senjyouhara +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = retinajs.retina; + +export as namespace retinajs; + +declare namespace retinajs { + // var hasWindow: boolean; + + // var environment: number; + + // var srcReplace: RegExp; + + // var inlineReplace: RegExp; + + // var selector: string; + + // var processedAttr: string; + + // var processedAttr: string; + + // function arrayify(object: any): any[]; + + // function chooseCap(cap: number | string): number; + + // function forceOriginalDimensions(image: any): any; + + // function setSourceIfAvailable(image: any, retinaURL: string): void; + + // function dynamicSwapImage(image: any, src: string): void; + + // function manualSwapImage(image: any, hdsrc: string): void; + + // function getImages(images: any[] | null): any[]; + + // function cleanBgImg(img: any): any; + + function retina(images?: any): void; +} diff --git a/types/retinajs/retinajs-tests.ts b/types/retinajs/retinajs-tests.ts new file mode 100644 index 0000000000..382f843e60 --- /dev/null +++ b/types/retinajs/retinajs-tests.ts @@ -0,0 +1,3 @@ +import retina = require("retinajs"); + +retina(); diff --git a/types/is-online/tsconfig.json b/types/retinajs/tsconfig.json similarity index 94% rename from types/is-online/tsconfig.json rename to types/retinajs/tsconfig.json index 7009c26024..c022eaf6cc 100644 --- a/types/is-online/tsconfig.json +++ b/types/retinajs/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "is-online-tests.ts" + "retinajs-tests.ts" ] } diff --git a/types/p-event/v1/tslint.json b/types/retinajs/tslint.json similarity index 100% rename from types/p-event/v1/tslint.json rename to types/retinajs/tslint.json diff --git a/types/rollup-plugin-delete/package.json b/types/rollup-plugin-delete/package.json index 272f65edde..8971fd5346 100644 --- a/types/rollup-plugin-delete/package.json +++ b/types/rollup-plugin-delete/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "rollup": ">=0.60.0" + "del": "*", + "rollup": ">=0.60.0 <1.2.0" } } diff --git a/types/sc-hot-reboot/package.json b/types/sc-hot-reboot/package.json new file mode 100644 index 0000000000..a0e2ec3c5c --- /dev/null +++ b/types/sc-hot-reboot/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chokidar": "^2.1.2" + } +} diff --git a/types/seen/index.d.ts b/types/seen/index.d.ts new file mode 100644 index 0000000000..7e2e90b51f --- /dev/null +++ b/types/seen/index.d.ts @@ -0,0 +1,795 @@ +// Type definitions for seen 0.2 +// Project: https://github.com/themadcreator/seen +// Definitions by: Adam Vernon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.1 + +/** + * The animator class is useful for creating an animation loop. We supply pre and post events for apply animation changes between frames. + */ +export class Animator { + dispatch: Events.Dispatcher; + timestamp: number; + frameDelay: number | null; + constructor(); + animateFrame(): this; + frame(t?: boolean): this; + onAfter(handler: FrameHandler): this; + onBefore(handler: FrameHandler): this; + onFrame(handler: FrameHandler): this; + start(): this; + stop(): this; +} + +export interface FrameHandler { + (timestamp: number, deltaTimestamp: number): void; +} + +/** + * The Bounds object contains an axis-aligned bounding box. + */ +export class Bounds { + constructor(); + add(p: Point): this; + center(): Point; + contains(p: Point): boolean; + copy(): this; + depth(): number; + height(): number; + intersect(box: Bounds): this; + maxX(): number; + maxY(): number; + maxZ(): number; + minX(): number; + minY(): number; + minZ(): number; + pad(x: number, y: number, z: number): this; + reset(): this; + valid(): boolean; + width(): number; + static points(points: Point[]): Bounds; + static xywh(x: number, y: number, w: number, h: number): Bounds; + static xyzwhd(x: number, y: number, z: number, w: number, h: number, d: number): Bounds; +} + +/** + * The Camera model contains all three major components of the 3D to 2D tranformation. + * + * First, we transform object from world-space (the same space that the coordinates of surface points are in after all their transforms are applied) to camera space. Typically, this will place all + * viewable objects into a cube with coordinates: x = -1 to 1, y = -1 to 1, z = 1 to 2 + * + * Second, we apply the projection trasform to create perspective parallax and what not. + * + * Finally, we rescale to the viewport size. + * + * These three steps allow us to easily create shapes whose coordinates match up to screen coordinates in the z = 0 plane. + */ +export class Camera extends Transformable { + projection: Matrix; + defaults: { projection: Matrix }; + constructor(transform?: Matrix); +} + +export class CanvasCirclePainter extends CanvasStyler { + circle(center: { x: number, y: number }, radius: number): CanvasCirclePainter; +} + +export class CanvasLayerRenderContext extends RenderLayerContext { + constructor(ctx: CanvasRenderingContext2D); + circle(): CanvasCirclePainter; + path(): CanvasPathPainter; + rect(): CanvasRectPainter; + text(): CanvasTextPainter; +} + +export class CanvasPathPainter extends CanvasStyler { + path(points: Point[]): this; +} + +export class CanvasRectPainter extends CanvasStyler { + rect(width: number, height: number): this; +} + +export class CanvasRenderContext extends RenderContext { + el: HTMLCanvasElement; + ctx: CanvasRenderingContext2D; + constructor(elementOrId: string | HTMLElement); + layer(layer: RenderLayerContext): this; + reset(): void; +} + +export class CanvasStyler { + constructor(ctx: CanvasRenderingContext2D); + draw(style?: { stroke?: string, 'stroke-width'?: number, 'text-anchor'?: string }): this; + fill(style?: { fill?: string, 'fill-opacity'?: number, 'text-anchor'?: string }): this; +} + +export class CanvasTextPainter { + constructor(ctx: CanvasRenderingContext2D); + fillText(m: Matrix, text: string, style?: { font: string, fill?: string, 'text-anchor'?: string }): this; +} + +/** + * Color objects store RGB and Alpha values from 0 to 255. + */ +export class Color { + r: number; + g: number; + b: number; + a: number; + constructor(r?: number, g?: number, b?: number, a?: number); + addChannels(c: Color): this; + clamp(min?: number, max?: number): this; + copy(): this; + hex(): string; + minChannels(c: Color): this; + multiplyChannels(c: Color): this; + offset(n: number): this; + scale(n: number): this; + style(): string; +} + +/** + * Adds simple mouse drag eventing to a DOM element. A ‘drag’ event is emitted as the user is dragging their mouse. This is the easiest way to add mouse- look or mouse-rotate to a scene. + */ +export class Drag { + el: HTMLElement; + inertia: boolean; + dispatch: Events.Dispatcher; + defaults: { inertia: boolean }; + constructor(elementOrId: string | HTMLElement, options?: { inertia?: boolean }); + on(type: string, listener: (e: { offset: number[], offsetRelative: number[] }) => void): Events.Dispatcher; +} + +export class FillLayer extends RenderLayer { + constructor(width: number, height: number, fill: string); + render(context: RenderLayerContext): void; +} + +export class Grad { + x: number; + y: number; + z: number; + constructor(x: number, y: number, z: number); + dot(x: number, y: number, z: number): number; +} + +/** + * A class for computing mouse interia for interial scrolling + */ +export class InertialMouse { + xy: number[]; + constructor(); + damp(): this; + get(): [number, number]; + reset(): this; + update(xy: [number, number]): this; + static inertiaExtinction: number; + static inertiaMsecDelay: number; + static smoothingTimeout: number; +} + +export interface LightOptions { + point?: Point; + color?: Color; + intensity?: number; + normal?: Point; + enabled?: boolean; +} + +/** + * This model object holds the attributes and transformation of a light source. + */ +export class Light extends Transformable { + type: string; + point: Point; + color: Color; + intensity: number; + normal: Point; + enabled: boolean; + id: string; + defaults: LightOptions; + constructor(type: 'point' | 'directional' | 'ambient', options?: LightOptions); + render(): void; +} + +/** + * The LightRenderModel stores pre-computed values necessary for shading surfaces with the supplied Light. + */ +export class LightRenderModel { + colorIntensity: Color; + type: string; + intensity: number; + point: Point; + origin: Point; + normal: Point; + constructor(light: Light, transform: Matrix); +} + +export interface MaterialOptions { + color?: Color; + metallic?: boolean; + specularColor?: Color; + specularExponent?: number; + shader?: Shader; +} + +/** + * Material objects hold the attributes that desribe the color and finish of a surface. + */ +export class Material { + color: Color; + metallic: boolean; + specularColor: Color; + specularExponent: number; + shader: Shader; + defaults: MaterialOptions; + constructor(color?: Color, options?: MaterialOptions); + render(lights?: Light[], shader?: Shader, renderData?: RenderModel): Color; + static create(value?: Material | Color | string): Material; +} + +/** + * The Matrix class stores transformations in the scene. These include: (1) Camera Projection and Viewport transformations. (2) Transformations of any Transformable type object, such as Shapes or + * Models + * + * Most of the methods on Matrix are destructive, so be sure to use .copy() when you want to preserve an object’s value. + */ +export class Matrix { + m: number[]; + baked: number[]; + constructor(m?: number[]); + bake(m?: number[]): this; + copy(): this; + matrix(m: number[]): this; + multiply(b: Matrix): this; + reset(): this; + rotx(theta: number): this; + roty(theta: number): this; + rotz(theta: number): this; + scale(x?: number, y?: number, z?: number): this; + translate(x?: number, y?: number, z?: number): this; + transpose(): this; +} + +export class Mocap { + bvh: any; + constructor(bvh?: any); + createMocapModel(shapeFactory?: () => Shape): MocapModel; + static DEFAULT_SHAPE_FACTORY(joint?: any, endpoint?: Point): Shape; + static parse(source: string): Mocap; +} + +export class MocapAnimator extends Animator { + constructor(mocap: MocapModel); + renderFrame(): void; +} + +export class MocapModel { + constructor(model: Model, frames: any[], frameDelay?: number); + applyFrameTransforms(frameIndex: number): number; +} + +/** + * The object model class. It stores Shapes, Lights, and other Models as well as a transformation matrix. + * + * Notably, models are hierarchical, like a tree. This means you can isolate the transformation of groups of shapes in the scene, as well as create chains of transformations for creating, for + * example, articulated skeletons. + */ +export class Model extends Transformable { + constructor(); + add(...args: Array): this; + append(): this; + eachRenderable(lightFn: (light: Light, matrix?: Matrix) => Model, shapeFn: (item: Shape | Model, lightModels?: Model[], matrix?: Matrix) => any): void; + eachShape(f: (shape: Shape) => any): void; + remove(...args: Array): void; +} + +export interface MouseEventOptions { + dragStart?: EventListener; + drag?: EventListener; + dragEnd?: EventListener; + mouseMove?: EventListener; + mouseDown?: EventListener; + mouseUp?: EventListener; + mouseWheel?: EventListener; +} + +/** + * An event dispatcher for mouse and drag events on a single dom element. The available events are 'dragStart', 'drag', 'dragEnd', 'mouseMove', 'mouseDown', 'mouseUp', 'mouseWheel' + */ +export class MouseEvents { + el: HTMLElement; + dispatch: Events.Dispatcher; + constructor(elementOrId: string | HTMLElement, options?: MouseEventOptions); + attach(): void; + detach(): void; +} + +/** + * Parser for Wavefront .obj files + * + * Note: Wavefront .obj array indicies are 1-based. + */ +export class ObjParser { + vertices: number[][]; + faces: number[][]; + commands: { v: (v: any) => any, f: (f: any) => any }; + constructor(); + mapFacePoints(faceMap: (points: Point[]) => any): void; + parse(contents: string): void; +} + +/** + * Each Painter overrides the paint method. It uses the supplied RenderLayerContext‘s builders to create and style the geometry on screen. + */ +export class Painter { + constructor(); + paint(renderModel: RenderModel, context: RenderLayerContext): void; +} + +export class PathPainter extends Painter { } + +/** + * The Point object contains x,y,z, and w coordinates. Points support various arithmetic operations with other Points, scalars, or Matrices. + * + * Most of the methods on Point are destructive, so be sure to use .copy() when you want to preserve an object’s value. + */ +export class Point { + x: number; + y: number; + z: number; + w: number; + constructor(x?: number, y?: number, z?: number, w?: number); + add(q: Point): this; + copy(): this; + cross(q: Point): this; + divide(n: number): this; + dot(q: Point): number; + magnitude(): number; + magnitudeSquared(): number; + multiply(n: number): this; + normalize(): this; + perpendicular(): this; + round(): this; + set(p: Point): this; + subtract(q: Point): this; + transform(matrix: Matrix): this; + translate(x: number, y: number, z: number): this; +} + +/** + * A Quaterionion class for computing quaterion multiplications. This creates more natural mouse rotations. + */ +export class Quaternion { + q: Point; + constructor(); + multiply(q: Point): this; + toMatrix(): Matrix; + static axisAngle(x: number, y: number, z: number, angleRads: number): Quaternion; + static pixelsPerRadian: number; + static pointAngle(p: Point, angleRads: number): Quaternion; + static xyToTransform(x: number, y: number): Matrix; +} + +export class RenderAnimator extends Animator { } + +/** + * The RenderContext uses RenderModels produced by the scene’s render method to paint the shapes into an HTML element. Since we support both SVG and Canvas painters, the RenderContext and + * RenderLayerContext define a common interface. + */ +export class RenderContext { + layers: RenderLayerContext[]; + constructor(); + animate(): RenderAnimator; + cleanup(): void; + layer(layer: RenderLayerContext): this; + render(): this; + reset(): void; + sceneLayer(scene: Scene): this; +} + +export class RenderLayer { + constructor(); + render(context: RenderLayerContext): void; +} + +/** + * The RenderLayerContext defines the interface for producing painters that can paint various things into the current layer. + */ +export class RenderLayerContext { + constructor(); + circle(): any; + cleanup(): void; + path(): any; + rect(): any; + reset(): void; + text(): any; +} + +/** + * The RenderModel object contains the transformed and projected points as well as various data needed to shade and paint a Surface. + * + * Once initialized, the object will have a constant memory footprint down to Number primitives. Also, we compare each transform and projection to prevent unnecessary re-computation. + * + * If you need to force a re-computation, mark the surface as ‘dirty’. + */ +export class RenderModel { + constructor(surface: Surface, transform: Matrix, projection: Matrix, viewport: Matrix); + update(transform: Matrix, projection: Matrix, viewport: Matrix): void; +} + +/** + * A Scene is the main object for a view of a scene. + */ +export class Scene { + constructor(options?: SceneOptions); + defaults(): SceneOptions; + flushCache(): void; + render(): Transformable[]; +} + +export interface SceneOptions { + model?: Model; + camera?: Camera; + viewport?: Viewport; + shader?: Shader; + cullBackfaces?: boolean; + fractionalPoints?: boolean; + cache?: boolean; +} + +export class SceneLayer extends RenderLayer { + model: Model; + camera: Camera; + viewport: Viewport; + shader: Shader; + cullBackfaces: boolean; + fractionalPoints: boolean; + cache: boolean; + constructor(scene: Scene); + render(context: RenderLayerContext): void; +} + +/** + * The Shader class is the base class for all shader objects. + */ +export class Shader { + constructor(); + shade(lights: Light[], renderModel: RenderModel, material: Material): void; +} + +/** + * The Phong shader implements the Phong shading model with a diffuse, specular, and ambient term. + * + * See https://en.wikipedia.org/wiki/Phong_reflection_model for more information + */ +export class Phong extends Shader { } + +/** + * The DiffusePhong shader implements the Phong shading model with a diffuse and ambient term (no specular). + */ +export class DiffusePhong extends Shader { } + +/** + * The Ambient shader colors surfaces from ambient light only. + */ +export class Ambient extends Shader { } + +/** + * The Flat shader colors surfaces with the material color, disregarding all light sources. + */ +export class Flat extends Shader { } + +/** + * A Shape contains a collection of surface. They may create a closed 3D shape, but not necessarily. For example, a cube is a closed shape, but a patch is not. + */ +export class Shape extends Transformable { + type: string; + surfaces: Surface[]; + constructor(type: string, surfaces: Surface[]); + eachSurface(f: (s: Surface) => void): this; + fill(fill: string | Color): this; + stroke(stroke: string | Color): this; +} + +export class Simplex3D { + perm: number[]; + gradP: Grad[]; + constructor(seed?: number); + noise(x: number, y: number, z: number): number; + seed(seed: number): void; +} + +/** + * A Surface is a defined as a planar object in 3D space. These paths don’t necessarily need to be convex, but they should be non-degenerate. This library does not support shapes with holes. + */ +export class Surface { + points: Point[]; + painter: Painter; + id: string; + cullBackfaces: boolean; + dirty: boolean | null; + fillMaterial: Material; + strokeMaterial: Material; + constructor(points: Point[], painter?: Painter); + fill(fill: string | Color): this; + stroke(stroke: string | Color): this; +} + +export class SvgCirclePainter extends SvgStyler { + circle(center: Point, radius: number): this; +} + +export class SvgLayerRenderContext extends RenderLayerContext { + constructor(group: SVGGElement); + circle(): SvgCirclePainter; + path(): SvgPathPainter; + rect(): SvgRectPainter; + text(): SvgTextPainter; +} + +export class SvgPathPainter extends SvgStyler { + path(points: Point[]): this; +} + +export class SvgRectPainter extends SvgStyler { + rect(width: number, height: number): this; +} + +export class SvgRenderContext extends RenderContext { + svg: SVGSVGElement; + layers: SvgLayerRenderContext[]; + constructor(svgElementOrId: string | HTMLElement); +} + +export class SvgStyler { + constructor(elementFactory: (name: string) => HTMLElement); + clear(): this; + draw(style?: Partial): this; + fill(style?: Partial): this; +} + +export class SvgTextPainter { + constructor(elementFactory: (name: string) => HTMLElement); + fillText(m: number[], text: string, style?: Partial): void; +} + +export class TextPainter extends Painter { } + +/** + * Transformable base class extended by Shape and Model. + * + * The advantages of keeping transforms in Matrix form are (1) lazy computation of point position (2) ability combine hierarchical transformations easily (3) ability to reset transformations to an + * original state. + * + * Resetting transformations is especially useful when you want to animate interpolated values. Instead of computing the difference at each animation step, you can compute the global interpolated + * value for that time step and apply that value directly to a matrix (once it is reset). + */ +export class Transformable { + baked: number[]; + m: Matrix; + constructor(); + transform(m: Matrix): this; + bake(m?: number[]): this; + matrix(m: number[]): this; + reset(): this; + rotx(theta: number): this; + roty(theta: number): this; + rotz(theta: number): this; + scale(x?: number, y?: number, z?: number): this; + translate(x?: number, y?: number, z?: number): this; +} + +/** + * A transition object to manage to animation of shapes + */ +export class Transition { + duration: number; + defaults: { duration: number }; + constructor(options?: { duration?: number }); + firstFrame(): void; + frame(): void; + lastFrame(): void; + update(t?: number): boolean; +} + +/** + * A seen.Animator for updating seen.Transtions. We include keyframing to make sure we wait for one transition to finish before starting the next one. + */ +export class TransitionAnimator extends Animator { + dispatch: Events.Dispatcher; + timestamp: number; + frameDelay: number | null; + queue: Transition[][]; + transitions: Transition[]; + add(txn: Transition): void; + keyframe(): void; + update(t?: number): void; +} + +/** + * Adds simple mouse wheel eventing to a DOM element. A ‘zoom’ event is emitted as the user is scrolls their mouse wheel. + */ +export class Zoom { + el: HTMLElement; + speed: number; + dispatch: Events.Dispatcher; + defaults: { smooth: boolean }; + constructor(elementOrId: string | HTMLElement, options?: { smooth?: boolean }); +} + +export const Painters: { + path: PathPainter, + text: TextPainter +}; +export function C(r?: number, g?: number, b?: number, a?: number): Color; +export function CanvasContext(elementOrId: string | HTMLElement, scene?: Scene): CanvasRenderContext; + +/** + * Create a render context for the element with the specified elementId. elementId should correspond to either an SVG or Canvas element. + */ +export function Context(elementOrId: string | HTMLElement, scene?: Scene): RenderContext; + +export function M(m?: number[]): Matrix; + +export function P(x?: number, y?: number, z?: number, w?: number): Point; + +export function SvgContext(elementOrId: string | HTMLElement, scene?: Scene): SvgRenderContext; + +/** + * It is not possible exactly render text in a scene with a perspective projection because Canvas and SVG support only affine transformations. So, in order to fake it, we create an affine transform + * that approximates the linear effects of a perspective projection on an unrendered planar surface that represents the text’s shape. We can use this transform directly in the text painter to warp + * the text. + * + * This fake projection will produce unrealistic results with large strings of text that are not broken into their own shapes. + */ +export const Affine: { + INITIAL_STATE_MATRIX: number[][], + ORTHONORMAL_BASIS(): Point[], + solveForAffineTransform(points: Point[]): number[] +}; + +export const BvhParser: { + SyntaxError(message: string, expected: string, found: string, location: any): void, + parse(input: string): any +}; + +export const Colors: { + CSS_RGBA_STRING_REGEX: RegExp, + black(): Color, + gray(): Color, + hex(hex: string): Color, + hsl(h: number, s: number, l: number, a?: number): Color, + parse(str: string): Color, + randomShape(shape: Shape, sat?: number, lit?: number): void, + randomSurfaces(shape: Shape, sat?: number, lit?: number): void, + randomSurfaces2(shape: Shape, drift?: number, sat?: number, lit?: number): void, + rgb(r: number, g: number, b: number, a?: number): Color, + white(): Color +}; + +export namespace Events { +/** + * The Dispatcher class. These objects have methods that can be invoked like dispatch.eventName(). Listeners can be registered with dispatch.on('eventName.uniqueId', callback). Listeners can be + * removed with dispatch.on('eventName.uniqueId', null). Listeners can also be registered and removed with dispatch.eventName.on('name', callback). + * + * Note that only one listener with the name event name and id can be registered at once. If you to generate unique ids, you can use the seen.Util.uniqueId() method. + */ + class Dispatcher { + constructor(); + on(type: string, listener: EventListener): Dispatcher; + } + +/** + * Return a new dispatcher that creates event types using the supplied string argument list. The returned Dispatcher will have methods with the names of the event types. + */ + function dispatch(): Dispatcher; + + function Event(): void; +} + +export const Lights: { + ambient(opts?: LightOptions): Light, + directional(opts?: LightOptions): Light, + point(opts?: LightOptions): Light +}; + +/** + * A few useful Matrix objects. + */ +export const Matrices: { + flipX(): Matrix, + flipY(): Matrix, + flipZ(): Matrix, + identity(): Matrix +}; + +export const Models: { + default(): Model +}; + +/** + * A few useful Point objects. Be sure that you don’t invoke destructive methods on these objects. + */ +export const Points: { + X(): Point, + Y(): Point, + Z(): Point, + ZERO(): Point +}; + +/** + * These projection methods return a 3D to 2D Matrix transformation. Each projection assumes the camera is located at (0,0,0). + */ +export const Projections: { + ortho(left?: number, right?: number, bottom?: number, top?: number, near?: number, far?: number): Matrix, + perspective(left?: number, right?: number, bottom?: number, top?: number, near?: number, far?: number): Matrix, + perspectiveFov(fovyInDegrees?: number, front?: number): Matrix +}; + +/** + * These shading functions compute the shading for a surface. To reduce code duplication, we aggregate them in a utils object. + */ +export const ShaderUtils: { + applyAmbient(c: Color, light: Light): void, + applyDiffuse(c: Color, light: Light, lightNormal: Point, surfaceNormal: Point, material?: Material): void, + applyDiffuseAndSpecular(c: Color, light: Light, lightNormal: Point, surfaceNormal: Point, material: Material): void +}; + +export const Shaders: { + ambient(): Ambient, + diffuse(): DiffusePhong, + flat(): Flat, + phong(): Phong +}; + +/** + * Shape primitives and shape-making methods + */ +export const Shapes: { + arrow(thickness?: number, tailLength?: number, tailWidth?: number, headLength?: number, headPointiness?: number): Shape, + cube(): Shape, + custom(s: Shape): Shape, + extrude(points: Point[], offset: Point): Shape, + icosahedron(): Shape, + mapPointsToSurfaces(points: Point[], coordinateMap: number[][]): Surface[], + obj(objContents: string, cullBackfaces?: boolean): Shape, + patch(nx?: number, ny?: number): Shape, + path(points: Point[]): Shape, + pipe(point1: Point, point2: Point, radius?: number, segments?: number): Shape, + pyramid(): Shape, + rectangle(point1: Point, point2: Point): Shape, + sphere(subdivisions?: number): Shape, + tetrahedron(): Shape, + text(text: string, surfaceOptions?: Partial): Shape, + unitcube(): Shape +}; + +/** + * Utility methods + */ +export const Util: { + arraysEqual(a: T[], b: T[]): boolean, + defaults(obj: T, opts: Partial, defaults: Partial): void, + element(elementOrId: string | HTMLElement): HTMLElement, + uniqueId(prefix?: string): string +}; + +export interface Viewport { + prescale: Matrix; + postscale: Matrix; +} + +export const Viewports: { + center(width?: number, height?: number, x?: number, y?: number): Viewport, + origin(width?: number, height?: number, x?: number, y?: number): Viewport +}; + +/** + * A global window event dispatcher. Attaches listeners only if window is defined. + */ +export const WindowEvents: { + on(type: string, listener: EventListener): Events.Dispatcher; +}; diff --git a/types/seen/seen-tests.ts b/types/seen/seen-tests.ts new file mode 100644 index 0000000000..05f23905ca --- /dev/null +++ b/types/seen/seen-tests.ts @@ -0,0 +1,61 @@ +/** + * Converted to TypeScript from: http://seenjs.io/demo-noisy-sphere.html + */ + +import { Shapes, Colors, Scene, Models, Viewports, Context, Simplex3D, Drag, Quaternion, RenderContext, Shape, Point, Surface, Matrix } from 'seen'; + +const width = 900; +const height = 500; + +const shape: Shape = Shapes.sphere(2).scale(150); +Colors.randomSurfaces2(shape); + +const scene: Scene = new Scene({ + fractionalPoints: true, + cullBackfaces: false, + model: Models["default"]().add(shape), + viewport: Viewports.center(width, height) +}); + +const context: RenderContext = Context('seen-canvas', scene).render(); + +const ref: Surface[] = shape.surfaces; +const originals: Point[][] = []; +let surf: Surface; +for (let j = 0, len: number = ref.length; j < len; j++) { + surf = ref[j]; + originals.push(surf.points.map(p => { + return p.copy(); + })); + surf.fillMaterial.color.a = 150; +} + +const noiser: Simplex3D = new Simplex3D(Math.random()); + +context.animate().onBefore((t, dt) => { + let n: number; + let p: Point; + let ref2: Point[]; + const ref1: Surface[] = shape.surfaces; + for (let k = 0, len1 = ref1.length; k < len1; k++) { + surf = ref1[k]; + ref2 = surf.points; + for (let i = 0, l = 0, len2 = ref2.length; l < len2; i = ++l) { + p = ref2[i]; + n = noiser.noise(p.x, p.y, p.z + t * 1e-4); + surf.points[i] = originals[k][i].copy().multiply(1 + n / 3); + } + surf.dirty = true; + } + return shape.rotx(dt * 1e-4).rotz(-dt * 1e-4); +}).start(); + +const dragger: Drag = new Drag(document.getElementById('seen-canvas')!, { + inertia: true +}); + +dragger.on('drag.rotate', (e) => { + const xform: Matrix = Quaternion.xyToTransform(e.offsetRelative[0], e.offsetRelative[1]); + shape.transform(xform); + return context.render(); +}); diff --git a/types/seen/tsconfig.json b/types/seen/tsconfig.json new file mode 100644 index 0000000000..e56ea79e69 --- /dev/null +++ b/types/seen/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", + "seen-tests.ts" + ] +} diff --git a/types/p-limit/tslint.json b/types/seen/tslint.json similarity index 100% rename from types/p-limit/tslint.json rename to types/seen/tslint.json diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index f4a0c01efb..a74c294906 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -168,6 +168,14 @@ interface Select2Plugin { (method: 'search'): JQuery; (options: Select2Options): JQuery; + + /** + * Select2 exposes its default options via the $.fn.select2.defaults + * object. Properties changed in this object (same properties configurable + * through the constructor) will take effect for every instance created + * after the change. + */ + defaults: Partial; } interface JQuery { diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index 4a0a496e13..af2bdfd583 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -1,3 +1,8 @@ +$.extend($.fn.select2.defaults, { + width: 'copy', + minimumInputLength: 12 +}); + $("#e9").select2(); $("#e2").select2({ placeholder: "Select a State", diff --git a/types/sendmail/index.d.ts b/types/sendmail/index.d.ts new file mode 100644 index 0000000000..1bab6d27b6 --- /dev/null +++ b/types/sendmail/index.d.ts @@ -0,0 +1,65 @@ +// Type definitions for sendmail 1.4 +// Project: https://github.com/guileen/node-sendmail +// Definitions by: Saeid Ostad +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare namespace sendMailFactory { + interface Options { + logger?: { + debug?: () => void; + info?: () => void; + warn?: () => void; + error?: () => void; + }; + silent?: boolean; + /** Default: False */ + dkim?: + | boolean + | { + privateKey: string; + keySelector: string; + }; + /** Default: False */ + devPort?: number | boolean; + /** Default: localhost */ + devHost?: string; + /** Default: 25 */ + smtpPort?: number; + /** Default: -1 - extra smtp host after resolveMX */ + smtpHost?: string | number; + } + + interface MailInput { + from: string; + to: string; + cc?: string; + bcc?: string; + replyTo?: string; + returnTo?: string; + subject: string; + type?: string; + charset?: string; + encoding?: string; + id?: string; + headers?: object; + content?: string; + html?: string; + attachments?: Array<{ + type: string; + filename: string; + content: any; + }>; + } +} + +type CallbackFn = (err: Error, domain: string) => void; + +type SendMailFn = ( + mail: sendMailFactory.MailInput, + callback: CallbackFn +) => void; + +declare function sendMailFactory(options: sendMailFactory.Options): SendMailFn; + +export = sendMailFactory; diff --git a/types/sendmail/sendmail-tests.ts b/types/sendmail/sendmail-tests.ts new file mode 100644 index 0000000000..5b0f50979b --- /dev/null +++ b/types/sendmail/sendmail-tests.ts @@ -0,0 +1,24 @@ +import sendmail = require("sendmail"); + +const emailSender = sendmail({ + silent: false +}); + +const sendEmail = (options: sendmail.MailInput): Promise => + new Promise((resolve, reject) => { + emailSender(options, (err, reply) => { + // if error happened or returned code is now started with 2** + if (err || !reply.startsWith("2")) { + reject(err); + } else { + resolve(true); + } + }); + }); + +sendEmail({ + from: "Test Mail ", + to: "test@mydomain.com", + subject: "First Test", + html: "This is a Test message!" +}); diff --git a/types/sendmail/tsconfig.json b/types/sendmail/tsconfig.json new file mode 100644 index 0000000000..248bfdbfdf --- /dev/null +++ b/types/sendmail/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", "sendmail-tests.ts"] +} diff --git a/types/p-queue/tslint.json b/types/sendmail/tslint.json similarity index 100% rename from types/p-queue/tslint.json rename to types/sendmail/tslint.json diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 107e01495a..9aba040234 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Sequelize 4.27.11 -// Project: http://sequelizejs.com +// Project: http://sequelizejs.com, https://github.com/sequelize/sequelize // Definitions by: samuelneff // Peter Harris // Ivan Drinchev @@ -281,6 +281,11 @@ declare namespace sequelize { * Apply a scope on the related model, or remove its default scope by passing false. */ scope?: string | boolean; + + /** + * Load further nested related models + */ + include?: IncludeOptions; } /** @@ -1379,7 +1384,7 @@ declare namespace sequelize { * Should the join model have timestamps */ timestamps?: boolean; - + /** * Belongs-To-Many creates a unique key when primary key is not present on through model. This unique key name can be overridden using uniqueKey option. */ @@ -5938,6 +5943,15 @@ declare namespace sequelize { cls: any; useCLS(namespace:cls.Namespace): Sequelize; + /** + * Default export for `import Sequelize from 'sequelize';` kind of imports + */ + default: SequelizeStatic; + + /** + * Export sequelize static on the instance for `import Sequelize from 'sequelize';` kind of imports + */ + Sequelize: SequelizeStatic; } interface QueryOptionsTransactionRequired { } diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 3e5fc74142..3a13906f06 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1,6 +1,16 @@ import Sequelize = require("sequelize"); import Q = require('q'); import Bluebird = require('bluebird'); +import SequelizeAsDefault from 'sequelize'; +import { Sequelize as SequelizeAsIndividualExport } from 'sequelize'; + +// +// Import checks +// ~~~~~~~~~~~~~ +// +Sequelize.Model.Instance +SequelizeAsDefault.Model.Instance +SequelizeAsIndividualExport.Model.Instance // // Fixtures @@ -239,6 +249,13 @@ warehouse.getProducts(); warehouse.getProducts({ where: {}, scope: false }); warehouse.getProducts({ where: {}, scope: false }).then((products) => products[0].id); +interface ProductInstanceIncludeBarcode extends ProductInstance { + barcode: BarcodeInstance +} +warehouse.getProducts({ where: {}, scope: false, include: {model: Barcode, as: 'barcode'} }).then((products) => { + (products[0] as ProductInstanceIncludeBarcode).barcode +}); + warehouse.setProducts(); warehouse.setProducts([product]); warehouse.setProducts([product], { validate: true }).then(() => { }); diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index 484edd089d..6acc528bc0 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Sequelize 3.30.4 -// Project: http://sequelizejs.com +// Project: http://sequelizejs.com, https://github.com/sequelize/sequelize // Definitions by: samuelneff // Peter Harris // Ivan Drinchev diff --git a/types/serialport/index.d.ts b/types/serialport/index.d.ts index c1a81376fa..73296d82e2 100644 --- a/types/serialport/index.d.ts +++ b/types/serialport/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/EmergingTechnologyAdvisors/node-serialport // Definitions by: Jeremy Foster // Andrew Pearson +// Cameron Tacklind // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -100,7 +101,7 @@ declare namespace SerialPort { constructor(options: {delimiter: string | Buffer | number[], includeDelimiter?: boolean}); } class Readline extends Delimiter { - constructor(options: {delimiter: string | Buffer | number[], encoding?: 'ascii'|'utf8'|'utf16le'|'ucs2'|'base64'|'binary'|'hex'}); + constructor(options: {delimiter: string | Buffer | number[], encoding?: 'ascii'|'utf8'|'utf16le'|'ucs2'|'base64'|'binary'|'hex', includeDelimiter?: boolean}); } class Ready extends Stream.Transform { constructor(options: {delimiter: string | Buffer | number[]}); diff --git a/types/serialport/serialport-tests.ts b/types/serialport/serialport-tests.ts index d6541a63c2..476199b506 100644 --- a/types/serialport/serialport-tests.ts +++ b/types/serialport/serialport-tests.ts @@ -105,8 +105,8 @@ function test_parsers() { const ByteLengthParser = new SerialPort.parsers.ByteLength({length: 8}); const CCTalkParser = new SerialPort.parsers.CCTalk(); - const DelimiterParser = new SerialPort.parsers.Delimiter({ delimiter: Buffer.from('EOL') }); - const ReadlineParser = new SerialPort.parsers.Readline({ delimiter: '\r\n' }); + const DelimiterParser = new SerialPort.parsers.Delimiter({ delimiter: Buffer.from('EOL'), includeDelimiter: true }); + const ReadlineParser = new SerialPort.parsers.Readline({ delimiter: '\r\n', includeDelimiter: false }); const ReadyParser = new SerialPort.parsers.Ready({ delimiter: 'READY' }); const RegexParser = new SerialPort.parsers.Regex({regex: /.*/}); diff --git a/types/serialport/v6/index.d.ts b/types/serialport/v6/index.d.ts index 2f5f8fc55d..2ada54c85f 100644 --- a/types/serialport/v6/index.d.ts +++ b/types/serialport/v6/index.d.ts @@ -90,7 +90,7 @@ declare namespace SerialPort { constructor(options: {delimiter: string | Buffer | number[], includeDelimiter?: boolean}); } class Readline extends Delimiter { - constructor(options: {delimiter: string | Buffer | number[], encoding?: 'ascii'|'utf8'|'utf16le'|'ucs2'|'base64'|'binary'|'hex'}); + constructor(options: {delimiter: string | Buffer | number[], encoding?: 'ascii'|'utf8'|'utf16le'|'ucs2'|'base64'|'binary'|'hex', includeDelimiter?: boolean}); } class Ready extends Stream.Transform { constructor(options: {data: string | Buffer | number[]}); diff --git a/types/sharp/index.d.ts b/types/sharp/index.d.ts index e47418badf..5fcc47a26d 100644 --- a/types/sharp/index.d.ts +++ b/types/sharp/index.d.ts @@ -947,6 +947,7 @@ declare namespace sharp { interface KernelEnum { nearest: "nearest"; cubic: "cubic"; + mitchell: "mitchell"; lanczos2: "lanczos2"; lanczos3: "lanczos3"; } diff --git a/types/sinon/ts3.1/index.d.ts b/types/sinon/ts3.1/index.d.ts index 2157678aaa..80ec4ee483 100644 --- a/types/sinon/ts3.1/index.d.ts +++ b/types/sinon/ts3.1/index.d.ts @@ -145,7 +145,32 @@ declare namespace Sinon { calledAfter(call: SinonSpyCall): boolean; } - interface SinonSpy + /** + * A test spy is a function that records arguments, return value, + * the value of this and exception thrown (if any) for all its calls. + */ + interface SinonSpy extends SinonInspectable { + // Methods + (...args: TArgs): TReturnValue; + + /** + * Creates a spy that only records calls when the received arguments match those passed to withArgs. + * This is useful to be more expressive in your assertions, where you can access the spy with the same call. + * @param args Expected args + */ + withArgs(...args: MatchArguments): SinonSpy; + + /** + * Set the displayName of the spy or stub. + * @param name + */ + named(name: string): SinonSpy; + } + + /** + * The part of the spy API that allows inspecting the calls made on a spy. + */ + interface SinonInspectable extends Pick< SinonSpyCallApi, Exclude, 'args'> @@ -209,9 +234,6 @@ declare namespace Sinon { * If the call did not explicitly return a value, the value at the call’s location in .returnValues will be undefined. */ returnValues: TReturnValue[]; - - // Methods - (...args: any[]): any; /** * Returns true if the spy was called before @param anotherSpy * @param anotherSpy @@ -232,12 +254,6 @@ declare namespace Sinon { * @param anotherSpy */ calledImmediatelyAfter(anotherSpy: SinonSpy): boolean; - /** - * Creates a spy that only records calls when the received arguments match those passed to withArgs. - * This is useful to be more expressive in your assertions, where you can access the spy with the same call. - * @param args Expected args - */ - withArgs(...args: MatchArguments): SinonSpy; /** * Returns true if the spy was always called with @param obj as this. * @param obj @@ -292,11 +308,6 @@ declare namespace Sinon { * Returns an Array with all callbacks return values in the order they were called, if no error is thrown. */ invokeCallback(...args: TArgs): void; - /** - * Set the displayName of the spy or stub. - * @param name - */ - named(name: string): SinonSpy; /** * Returns the nth call. * Accessing individual calls helps with more detailed behavior verification when the spy is called more than once. @@ -338,7 +349,7 @@ declare namespace Sinon { /** * Spies on the provided function */ - (func: Function): SinonSpy; + any>(func: F): SinonSpy, ReturnType>; /** * Creates a spy for object.method and replaces the original method with the spy. * An exception is thrown if the property is not already a function. @@ -1155,129 +1166,129 @@ declare namespace Sinon { * Passes if spy was never called * @param spy */ - notCalled(spy: SinonSpy): void; + notCalled(spy: SinonInspectable): void; /** * Passes if spy was called at least once. */ - called(spy: SinonSpy): void; + called(spy: SinonInspectable): void; /** * Passes if spy was called once and only once. */ - calledOnce(spy: SinonSpy): void; + calledOnce(spy: SinonInspectable): void; /** * Passes if spy was called exactly twice. */ - calledTwice(spy: SinonSpy): void; + calledTwice(spy: SinonInspectable): void; /** * Passes if spy was called exactly three times. */ - calledThrice(spy: SinonSpy): void; + calledThrice(spy: SinonInspectable): void; /** * Passes if spy was called exactly num times. */ - callCount(spy: SinonSpy, count: number): void; + callCount(spy: SinonInspectable, count: number): void; /** * Passes if provided spies were called in the specified order. * @param spies */ - callOrder(...spies: SinonSpy[]): void; + callOrder(...spies: SinonInspectable[]): void; /** * Passes if spy was ever called with obj as its this value. * It’s possible to assert on a dedicated spy call: sinon.assert.calledOn(spy.firstCall, arg1, arg2, ...);. */ - calledOn(spyOrSpyCall: SinonSpy | SinonSpyCall, obj: any): void; + calledOn(spyOrSpyCall: SinonInspectable | SinonSpyCall, obj: any): void; /** * Passes if spy was always called with obj as its this value. */ - alwaysCalledOn(spy: SinonSpy, obj: any): void; + alwaysCalledOn(spy: SinonInspectable, obj: any): void; /** * Passes if spy was called with the provided arguments. * It’s possible to assert on a dedicated spy call: sinon.assert.calledWith(spy.firstCall, arg1, arg2, ...);. * @param spyOrSpyCall * @param args */ - calledWith(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void; + calledWith(spyOrSpyCall: SinonInspectable | SinonSpyCall, ...args: MatchArguments): void; /** * Passes if spy was always called with the provided arguments. * @param spy * @param args */ - alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWith(spy: SinonInspectable, ...args: MatchArguments): void; /** * Passes if spy was never called with the provided arguments. * @param spy * @param args */ - neverCalledWith(spy: SinonSpy, ...args: any[]): void; + neverCalledWith(spy: SinonInspectable, ...args: MatchArguments): void; /** * Passes if spy was called with the provided arguments and no others. * It’s possible to assert on a dedicated spy call: sinon.assert.calledWithExactly(spy.getCall(1), arg1, arg2, ...);. * @param spyOrSpyCall * @param args */ - calledWithExactly( - spyOrSpyCall: SinonSpy | SinonSpyCall, - ...args: any[] + calledWithExactly( + spyOrSpyCall: SinonInspectable | SinonSpyCall, + ...args: MatchArguments ): void; /** * Passes if spy was always called with the provided arguments and no others. */ - alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWithExactly(spy: SinonInspectable, ...args: MatchArguments): void; /** * Passes if spy was called with matching arguments. * This behaves the same way as sinon.assert.calledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). * It’s possible to assert on a dedicated spy call: sinon.assert.calledWithMatch(spy.secondCall, arg1, arg2, ...);. */ - calledWithMatch( - spyOrSpyCall: SinonSpy | SinonSpyCall, - ...args: any[] + calledWithMatch( + spyOrSpyCall: SinonInspectable | SinonSpyCall, + ...args: TArgs ): void; /** * Passes if spy was always called with matching arguments. * This behaves the same way as sinon.assert.alwaysCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). */ - alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWithMatch(spy: SinonInspectable, ...args: TArgs): void; /** * Passes if spy was never called with matching arguments. * This behaves the same way as sinon.assert.neverCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). * @param spy * @param args */ - neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + neverCalledWithMatch(spy: SinonInspectable, ...args: TArgs): void; /** * Passes if spy was called with the new operator. * It’s possible to assert on a dedicated spy call: sinon.assert.calledWithNew(spy.secondCall, arg1, arg2, ...);. * @param spyOrSpyCall */ - calledWithNew(spyOrSpyCall: SinonSpy | SinonSpyCall): void; + calledWithNew(spyOrSpyCall: SinonInspectable | SinonSpyCall): void; /** * Passes if spy threw any exception. */ - threw(spyOrSpyCall: SinonSpy | SinonSpyCall): void; + threw(spyOrSpyCall: SinonInspectable | SinonSpyCall): void; /** * Passes if spy threw the given exception. * The exception is an actual object. * It’s possible to assert on a dedicated spy call: sinon.assert.threw(spy.thirdCall, exception);. */ - threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: string): void; + threw(spyOrSpyCall: SinonInspectable | SinonSpyCall, exception: string): void; /** * Passes if spy threw the given exception. * The exception is a String denoting its type. * It’s possible to assert on a dedicated spy call: sinon.assert.threw(spy.thirdCall, exception);. */ - threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: any): void; + threw(spyOrSpyCall: SinonInspectable | SinonSpyCall, exception: any): void; /** * Like threw, only required for all calls to the spy. */ - alwaysThrew(spy: SinonSpy): void; + alwaysThrew(spy: SinonInspectable): void; /** * Like threw, only required for all calls to the spy. */ - alwaysThrew(spy: SinonSpy, exception: string): void; + alwaysThrew(spy: SinonInspectable, exception: string): void; /** * Like threw, only required for all calls to the spy. */ - alwaysThrew(spy: SinonSpy, exception: any): void; + alwaysThrew(spy: SinonInspectable, exception: any): void; /** * Uses sinon.match to test if the arguments can be considered a match. */ @@ -1714,7 +1725,7 @@ declare namespace Sinon { createStubInstance( constructor: StubbableType, overrides?: { [K in keyof TType]?: - SinonStubbedMember | TType[K] extends (...args: any[]) => infer R ? R : TType[K] } + SinonStubbedMember | (TType[K] extends (...args: any[]) => infer R ? R : TType[K]) } ): SinonStubbedInstance; } diff --git a/types/sinon/ts3.1/sinon-tests.ts b/types/sinon/ts3.1/sinon-tests.ts index 0f07193704..8e74cf30cf 100644 --- a/types/sinon/ts3.1/sinon-tests.ts +++ b/types/sinon/ts3.1/sinon-tests.ts @@ -1,5 +1,4 @@ import sinon = require("sinon"); -import Bluebird = require("bluebird"); function testSandbox() { const obj = {}; @@ -84,14 +83,17 @@ function testSandbox() { const privateFooStubbedInstance = sb.createStubInstance(PrivateFoo); stubInstance.foo.calledWith('foo', 1); privateFooStubbedInstance.foo.calledWith(); - const clsFoo: sinon.SinonStub = stubInstance.foo; - const privateFooFoo: sinon.SinonStub = privateFooStubbedInstance.foo; + const clsFoo: sinon.SinonStub<[string, number], number> = stubInstance.foo; + const privateFooFoo: sinon.SinonStub<[], void> = privateFooStubbedInstance.foo; const clsBar: number = stubInstance.bar; const privateFooBar: number = privateFooStubbedInstance.bar; sb.createStubInstance(cls, { - foo: (arg1: string, arg2: number) => 2, + foo: sinon.stub<[string, number], number>().returns(1), bar: 1 }); + sb.createStubInstance(cls, { + foo: 1, // used as return value + }); } function testFakeServer() { @@ -292,6 +294,50 @@ function testAssert() { sinon.assert.expose(obj); sinon.assert.expose(obj, { prefix: 'blah' }); sinon.assert.expose(obj, { includeFail: true }); + + const typedSpy = sinon.spy((arg1: string, arg2: boolean) => 123); + sinon.assert.notCalled(typedSpy); + sinon.assert.called(typedSpy); + sinon.assert.calledOnce(typedSpy); + sinon.assert.calledTwice(typedSpy); + sinon.assert.calledThrice(typedSpy); + sinon.assert.callCount(typedSpy, 3); + sinon.assert.callOrder(typedSpy, spyTwo); + sinon.assert.calledOn(typedSpy, obj); + sinon.assert.calledOn(typedSpy.firstCall, obj); + sinon.assert.alwaysCalledOn(typedSpy, obj); + sinon.assert.alwaysCalledWith(typedSpy, 'a', 'b', 'c'); // $ExpectError + sinon.assert.alwaysCalledWith(typedSpy, 'a', true); + sinon.assert.neverCalledWith(typedSpy, 'a', false); + sinon.assert.neverCalledWith(typedSpy, 'a', 'b'); // $ExpectError + sinon.assert.calledWithExactly(typedSpy, 'a', true); + sinon.assert.calledWithExactly(typedSpy, 'a', 'b'); // $ExpectError + sinon.assert.alwaysCalledWithExactly(typedSpy, 'a', true); + sinon.assert.alwaysCalledWithExactly(typedSpy, 'a', 1); // $ExpectError + sinon.assert.calledWithMatch(typedSpy, 'a', true); + sinon.assert.calledWithMatch(typedSpy.firstCall, 'a', true); + sinon.assert.calledWithMatch(typedSpy.firstCall, 'a', 2); // $ExpectError + sinon.assert.alwaysCalledWithMatch(typedSpy, 'a', true); + sinon.assert.alwaysCalledWithMatch(typedSpy, 'a', 2); // $ExpectError + sinon.assert.neverCalledWithMatch(typedSpy, 'a', true); + sinon.assert.neverCalledWithMatch(typedSpy, 'a', 2); // $ExpectError + sinon.assert.calledWithNew(typedSpy); + sinon.assert.calledWithNew(typedSpy.firstCall); + sinon.assert.threw(typedSpy); + sinon.assert.threw(typedSpy.firstCall); + sinon.assert.threw(typedSpy, 'foo error'); + sinon.assert.threw(typedSpy.firstCall, 'foo error'); + sinon.assert.threw(typedSpy, new Error('foo')); + sinon.assert.threw(typedSpy.firstCall, new Error('foo')); + sinon.assert.alwaysThrew(typedSpy); + sinon.assert.alwaysThrew(typedSpy, 'foo error'); + sinon.assert.alwaysThrew(typedSpy, new Error('foo')); + sinon.assert.match('a', 'b'); + sinon.assert.match(1, 1 + 1); + sinon.assert.match({ a: 1 }, { b: 2, c: 'abc' }); + sinon.assert.expose(obj); + sinon.assert.expose(obj, { prefix: 'blah' }); + sinon.assert.expose(obj, { includeFail: true }); } function testTypedSpy() { @@ -330,7 +376,7 @@ function testTypedSpy() { } function testSpy() { - const fn = () => { }; + let fn = (arg: string, arg2: number): boolean => true; const obj = class { foo() { } set bar(val: number) { } @@ -338,12 +384,11 @@ function testSpy() { }; const instance = new obj(); - let spy = sinon.spy(); + const spy = sinon.spy(); // $ExpectType SinonSpy const spyTwo = sinon.spy().named('spyTwo'); - spy = sinon.spy(fn); - spy = sinon.spy(instance, 'foo'); - spy = sinon.spy(instance, 'bar', ['set', 'get']); + const methodSpy = sinon.spy(instance, 'foo'); + const methodSpy2 = sinon.spy(instance, 'bar', ['set', 'get']); let count = 0; count = spy.callCount; @@ -361,7 +406,12 @@ function testSpy() { arr = spy.exceptions; arr = spy.returnValues; - spy('a', 'b'); + const fnSpy = sinon.spy(fn); // $ExpectType SinonSpy<[string, number], boolean> + fn = fnSpy; // Should be assignable to original function + fnSpy('a', 1); // $ExpectType boolean + fnSpy.args; // $ExpectType [string, number][] + fnSpy.returnValues; // $ExpectType boolean[] + spy(1, 2); spy(true); @@ -425,14 +475,13 @@ function testSpy() { function testStub() { const obj = class { - foo() { } + foo(arg: string): number { return 1; } promiseFunc() { return Promise.resolve('foo'); } - promiseLikeFunc() { return {} as any as Bluebird; } + promiseLikeFunc() { return Promise.resolve('foo') as PromiseLike; } }; const instance = new obj(); - let stub = sinon.stub(); - stub = sinon.stub(instance, 'foo').named('namedStub'); + const stub = sinon.stub(); const spy: sinon.SinonSpy = stub; @@ -493,6 +542,25 @@ function testStub() { stub.yieldsToAsync('foo', 'a', 2); stub.yieldsToOnAsync('foo', instance, 'a', 2); stub.withArgs('a', 2).returns(true); + + // Type-safe stubs + const stub2 = sinon.stub(instance, 'foo').named('namedStub'); + instance.foo = stub2; // Should be assignable to original + stub2.returns(true); // $ExpectError + stub2.returns(5); + stub2.returns('foo'); // $ExpectError + stub2.callsFake((arg: string) => 1); + stub2.callsFake((arg: number) => 1); // $ExpectError + stub2.callsFake((arg: string) => 'a'); // $ExpectError + stub2.onCall(1).returns(2); + stub2.withArgs('a', 2).returns('true'); // $ExpectError + stub2.withArgs('a').returns(1); + stub2.withArgs('a').returns('a'); // $ExpectError + + const pStub = sinon.stub(instance, 'promiseFunc'); + pStub.resolves(); + pStub.resolves('foo'); + pStub.resolves(1); // $ExpectError } function testTypedStub() { diff --git a/types/sketchapp/index.d.ts b/types/sketchapp/index.d.ts index b45dcefe50..79a9226508 100644 --- a/types/sketchapp/index.d.ts +++ b/types/sketchapp/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for non-npm package the SketchApp 1.0 // Project: https://github.com/xlayers/xlayers // Definitions by: Wassim Chegham +// Phetsinorath William // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped type SketchMSBorderPositionEnum = 0 | 1 | 2 | 3; @@ -17,9 +18,34 @@ type SketchMSLayerListExpandedType = 0 | 1 | 2; type SketchMSEncodedBase64BinaryPlist = string; type SketchMSNSColorArchive = SketchMSKeyValueArchive; type SketchMSLayer = SketchMSPage | SketchMSSymbolMaster; +type SketchMSUserData = SketchMSUserDocument | SketchMSUserPage; interface SketchMSNestedSymbolOverride { symbolID: string; } +interface SketchMSPreview { + source: string; + width: number; + height: number; +} +interface SketchMSUserPage { + [key: string]: { + scrollOrigin: SketchMSCurvePoint; + zoomValue: number; + }; +} +interface SketchMSUserDocument { + document: { + pageListCollapsed: number; + pageListHeight: number; + }; +} +interface SketchMSData { + pages: SketchMSPage[]; + previews: SketchMSPreview[]; + document: SketchMSDocumentData; + user: SketchMSUserData; + meta: SketchMSMetadata; +} interface SketchMSStringAttribute { _class: 'stringAttribute'; attributes: { @@ -83,8 +109,8 @@ interface SketchMSImageDataReference { } type SketchMSPointString = string; interface SketchMSPath { - _class: 'path'; - isClosed: boolean; + _class: 'path' | 'shapePath' | 'rectangle' | 'oval' | 'triangle'; + isClosed?: boolean; points: SketchMSCurvePoint[]; } interface SketchMSCurvePoint { @@ -355,6 +381,8 @@ interface SketchMSSymbolMaster { attributedString: SketchMSAttributedString; name: string; layers: SketchMSLayer[]; + points: SketchMSPath; + isClosed?: boolean; isVisible: boolean; nameIsFixed: boolean; grid: SketchMSSimpleGrid; diff --git a/types/snazzy-info-window/package.json b/types/snazzy-info-window/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/snazzy-info-window/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/sntp/index.d.ts b/types/sntp/index.d.ts new file mode 100644 index 0000000000..9f94651df8 --- /dev/null +++ b/types/sntp/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for sntp 3.0 +// Project: https://github.com/hueniverse/sntp +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Options { + host?: string; + port?: number; + resolveReference?: boolean; + timeout?: number; +} + +export interface TimeOptions { + isValid: boolean; + leapIndicator: string; + version: number; + mode: string; + stratum: string; + pollInterval: number; + precision: number; + rootDelay: number; + rootDispersion: number; + referenceId: string; + referenceTimestamp: number; + originateTimestamp: number; + receiveTimestamp: number; + transmitTimestamp: number; + d: number; + t: number; + receivedLocally: number; +} + +export function start(options?: Options): Promise; + +export function stop(): void; + +export function offset(): Promise; + +export function time(options?: Options): Promise; + +export function now(): number; diff --git a/types/sntp/sntp-tests.ts b/types/sntp/sntp-tests.ts new file mode 100644 index 0000000000..1e6f80d35b --- /dev/null +++ b/types/sntp/sntp-tests.ts @@ -0,0 +1,18 @@ +import Sntp = require('sntp'); + +const options = { + host: 'abc', + port: 123, +}; + +Sntp.now(); + +Sntp.start(options); +Sntp.start(); + +Sntp.stop(); + +Sntp.time(options); +Sntp.time(); + +Sntp.offset(); diff --git a/types/sntp/tsconfig.json b/types/sntp/tsconfig.json new file mode 100644 index 0000000000..4bf279440e --- /dev/null +++ b/types/sntp/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sntp-tests.ts" + ] +} diff --git a/types/sntp/tslint.json b/types/sntp/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/sntp/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/source-map-support/index.d.ts b/types/source-map-support/index.d.ts index f92a8383b5..00ad396b9e 100644 --- a/types/source-map-support/index.d.ts +++ b/types/source-map-support/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for source-map-support 0.4 +// Type definitions for source-map-support 0.5 // Project: https://github.com/evanw/node-source-map-support -// Definitions by: Bart van der Schoor , Jason Cheatham +// Definitions by: Bart van der Schoor , Jason Cheatham , Alcedo Nathaniel De Guzman Jr // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -37,6 +37,7 @@ export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */; export function getErrorSource(error: Error): string | null; export function mapSourcePosition(position: Position): Position; export function retrieveSourceMap(source: string): UrlAndMap | null; +export function resetRetrieveHandlers(): void; /** * Install SourceMap support. diff --git a/types/source-map-support/source-map-support-tests.ts b/types/source-map-support/source-map-support-tests.ts index 7b07c2970f..cb773b9958 100644 --- a/types/source-map-support/source-map-support-tests.ts +++ b/types/source-map-support/source-map-support-tests.ts @@ -41,3 +41,5 @@ p = sms.mapSourcePosition(p); let u: sms.UrlAndMap | null; u = retrieveSourceMap("foo"); + +sms.resetRetrieveHandlers(); diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 3ed7c96a51..531d49a3b3 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -12,6 +12,9 @@ import events = require("events"); export const OPEN_READONLY: number; export const OPEN_READWRITE: number; export const OPEN_CREATE: number; +export const OPEN_SHAREDCACHE: number; +export const OPEN_PRIVATECACHE: number; +export const OPEN_URI: number; export const cached: { Database(filename: string, callback?: (this: Database, err: Error | null) => void): Database; @@ -94,6 +97,9 @@ export interface sqlite3 { OPEN_READONLY: number; OPEN_READWRITE: number; OPEN_CREATE: number; + OPEN_SHAREDCACHE: number; + OPEN_PRIVATECACHE: number; + OPEN_URI: number; cached: typeof cached; RunResult: RunResult; Statement: typeof Statement; diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 19a7edae66..f364158fc6 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -53,6 +53,17 @@ function runChainExample() { runChainExample(); +function runMemoryChainExample() { + console.log(`createDb chain - in-memory database`); + db = new sqlite3.Database( + ':memory:', + sqlite3. OPEN_CREATE | sqlite3.OPEN_READWRITE | sqlite3.OPEN_SHAREDCACHE, + createTable); + db.configure("busyTimeout", 1000); +} + +runMemoryChainExample(); + db.serialize(() => { db.run("CREATE TABLE lorem (info TEXT)"); diff --git a/types/ssh2-streams/index.d.ts b/types/ssh2-streams/index.d.ts index 54d6359538..8b2530edb0 100644 --- a/types/ssh2-streams/index.d.ts +++ b/types/ssh2-streams/index.d.ts @@ -1686,23 +1686,17 @@ export interface Stats extends Attributes { } export namespace utils { - export function parseKey(keyData: string | Buffer): ParsedKey | Error; - export function genPublicKey(privKeyInfo: ParsedKey): ParsedKey; - export function decryptKey(privKeyInfo: ParsedKey, passphrase: string): void; + export function parseKey(keyData: string | Buffer, passphrase?: string): ParsedKey | {}[]; } export interface ParsedKey { - fulltype: string; type: string; - extra: string; comment: string; - encryption: string; - private: Buffer; - privateOrig: Buffer; - public: Buffer; - publicOrig: Buffer; - ppk?: boolean; - privateMAC?: string; + getPrivatePEM(): string; + getPublicPEM(): string; + getPublicSSH(): string; + sign(data: string | Buffer): Buffer | Error; + verify(data: string | Buffer, signature: Buffer): boolean | Error; } export interface ReadFileOptions { diff --git a/types/ssh2-streams/ssh2-streams-tests.ts b/types/ssh2-streams/ssh2-streams-tests.ts index 7fd73756d5..c813d4eeb4 100644 --- a/types/ssh2-streams/ssh2-streams-tests.ts +++ b/types/ssh2-streams/ssh2-streams-tests.ts @@ -87,9 +87,7 @@ server.forwardedTcpip(0, 0, 0, { bindAddr: "bindAddr", bindPort: 8080, remoteAdd server.x11(0, 0, 0, { originAddr: "originAddr", originPort: 0 }); server.openssh_forwardedStreamLocal(0, 0, 0, { socketPath: "socketPath" }); -const maybeParsedKey = ssh2.utils.parseKey("keyData"); -ssh2.utils.decryptKey(parsedKey, "passphrase"); -const publicKey = ssh2.utils.genPublicKey(parsedKey); +const maybeParsedKey = ssh2.utils.parseKey("keyData", "passphrase"); declare const attrs: ssh2.Attributes; diff --git a/types/ssh2/ssh2-tests.ts b/types/ssh2/ssh2-tests.ts index aa599498b5..87a0ea713f 100644 --- a/types/ssh2/ssh2-tests.ts +++ b/types/ssh2/ssh2-tests.ts @@ -313,7 +313,8 @@ var buffersEqual = require('buffer-equal-constant-time'), //ssh2 = require('ssh2'), utils = ssh2.utils; -var pubKey = utils.genPublicKey(utils.parseKey(fs.readFileSync('user.pub')) as ssh2_streams.ParsedKey); +var pubKey = utils.parseKey(fs.readFileSync('user.pub')) as ssh2_streams.ParsedKey; +var pubKeySSH = Buffer.from(pubKey.getPublicSSH()); new ssh2.Server({ hostKeys: [fs.readFileSync('host.key')] @@ -326,15 +327,14 @@ new ssh2.Server({ && ctx.password === 'bar') ctx.accept(); else if (ctx.method === 'publickey' - && ctx.key.algo === pubKey.fulltype - && buffersEqual(ctx.key.data, pubKey.public)) { + && ctx.key.algo === pubKey.type + && buffersEqual(ctx.key.data, pubKeySSH)) { if (ctx.signature) { - var verifier = crypto.createVerify(ctx.sigAlgo); - verifier.update(ctx.blob); - if (verifier.verify(pubKey.publicOrig.toString("utf8"), ctx.signature)) + if (pubKey.verify(ctx.blob, ctx.signature)) { ctx.accept(); - else + } else { ctx.reject(); + } } else { // if no signature present, that means the client is just checking // the validity of the given public key diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index d10652dabe..dbfd84a13d 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -4,6 +4,7 @@ // Martynas Kadisa // A.MacLeay // Michael Loughry +// Alan Choi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -50,11 +51,9 @@ export function object(name: string, value: T, groupId?: string): T; export function radios(name: string, options: { [s: string]: T }, value?: T, groupId?: string): string; -export type SelectValue = string | number; -export function select(name: string, options: { [s: string]: T }, value: T | ReadonlyArray, groupId?: string): T; -export function select(name: string, options: { [s: string]: ReadonlyArray }, value: ReadonlyArray, groupId?: string): T[]; -export function select(name: string, options: { [s: string]: T | ReadonlyArray }, value: T | ReadonlyArray, groupId?: string): T | T[]; -export function select(name: string, options: ReadonlyArray, value: T, groupId?: string): T; +export function select(name: string, options: { [s: string]: T }, value: T, groupId?: string): T; +export function select(name: string, options: ReadonlyArray, value: T, groupId?: string): T; +export function select(name: string, options: ReadonlyArray, value: string, groupId?: string): string; export function date(name: string, value?: Date, groupId?: string): Date; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index c0c7f325ed..d09447f75d 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -94,7 +94,21 @@ stories.add('dynamic knobs', () => { }); const readonlyOptionsArray: ReadonlyArray = ['hi']; -select('With readonly array', readonlyOptionsArray, readonlyOptionsArray[0]); +select('With readonly string array', readonlyOptionsArray, readonlyOptionsArray[0]); + +type StringLiteralType = 'Apple' | 'Banana' | 'Grapes'; +const stringLiteralArray: StringLiteralType[] = ['Apple', 'Banana', 'Grapes']; + +let selectedFruit: StringLiteralType; + +// type of value returned from `select` must be `StringLiteralType`. +selectedFruit = select('With string literal array', stringLiteralArray, stringLiteralArray[0]); + +const optionsObject = { + Apple: { taste: 'sweet', color: 'red' }, + Lemon: { taste: 'sour', color: 'yellow' } +}; +select('With object', optionsObject, optionsObject.Apple); const genericArray = array('With regular array', ['hi', 'there']); diff --git a/types/storybook__addon-storyshots/index.d.ts b/types/storybook__addon-storyshots/index.d.ts index 546386ce40..6310e7f55e 100644 --- a/types/storybook__addon-storyshots/index.d.ts +++ b/types/storybook__addon-storyshots/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for @storybook/addon-storyshots 3.4 -// Project: https://github.com/storybooks/storybook/tree/master/addons/storyshots, https://github.com/storybooks/storybook/tree/master/addons/storyshorts/storyshots-core +// Project: https://github.com/storybooks/storybook/tree/master/addons/storyshots, https://github.com/storybooks/storybook/tree/master/addons/storyshots/storyshots-core // Definitions by: Bradley Ayers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.1 diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 41e591c839..772a4bdb87 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for stripe 6.19 +// Type definitions for stripe 6.25 // Project: https://github.com/stripe/stripe-node/ // Definitions by: William Johnston // Peter Harris @@ -17,6 +17,7 @@ // Slava Yultyyev // Corey Psoinos // Saransh Kataria +// Jonas Keisel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -53,6 +54,7 @@ declare class Stripe { events: Stripe.resources.Events; invoices: Stripe.resources.Invoices; invoiceItems: Stripe.resources.InvoiceItems; + paymentIntents: Stripe.resources.PaymentIntents; payouts: Stripe.resources.Payouts; plans: Stripe.resources.Plans; /** @@ -2980,6 +2982,417 @@ declare namespace Stripe { type PayoutTypes = "bank_account" | "card"; } + namespace paymentIntents { + interface IPaymentIntent extends IResourceObject { + /** + * Value is "payment_intent". + */ + object: 'payment_intent'; + + /** + * The amount in cents that is to be collected from this PaymentIntent. + */ + amount: number; + + /** + * The amount that can be captured with from this PaymentIntent (in cents). + */ + amount_capturable: number; + + /** + * The amount that was collected from this PaymentIntent (in cents). + */ + amount_received: number; + + /** + * ID of the Connect application that created the PaymentIntent. [Expandable] + */ + application?: string | applications.IApplication | null; + + /** + * A fee in cents that will be applied to the invoice and transferred to the application owner's Stripe account. + */ + application_fee_amount?: number | null; + + /** + * Populated when `status` is `canceled`, this is the time at which the PaymentIntent was canceled. + * Measured in seconds since the Unix epoch. + */ + canceled_at: number | null; + + /** + * User-given reason for cancellation of this PaymentIntent. + */ + cancelation_reason: PaymentIntentCancelationReason | null; + + /** + * Capture method of this PaymentIntent. + */ + capture_method: 'automatic' | 'manual'; + + /** + * Charges that were created by this PaymentIntent, if any. + */ + charges: IList; + + /** + * The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key. Please refer to dynamic authentication guide on how client_secret should be handled. + */ + client_secret: string; + + /** + * Confirmation method of this PaymentIntent. + */ + confirmation_method: 'secret' | 'publishable'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Three-letter ISO currency code, in lowercase. Must be a supported currency. + */ + currency: string; + + /** + * ID of the Customer this PaymentIntent is for if one exists. [Expandable] + */ + customer: string | customers.ICustomer | null; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. + */ + description?: string; + + /** + * The payment error encountered in the previous PaymentIntent confirmation. + */ + last_payment_error: IStripeError | null; + + livemode: boolean; + + metadata: IMetadata; + + /** + * If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source. + */ + next_action: + | IPaymentIntentNextActionUseStripeSdk + | IPaymentIntentNextActionRedirectToUrl; + + /** + * The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents Connect usage guide for details. [Expandable] + */ + on_behalf_of?: string | null; + + /** + * The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. + */ + payment_method_types: string[]; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email: string | null; + + /** + * ID of the review associated with this PaymentIntent, if any. [Expandable] + */ + review?: string | reviews.IReview | null; + + /** + * Shipping information for this PaymentIntent. + */ + shipping?: IShippingInformation | null; + + /** + * ID of the source used in this PaymentIntent. [Expandable] + */ + source: + | string + | cards.ICard + | bitcoinReceivers.IBitcoinReceiver + | bankAccounts.IBankAccount; + + /** + * Extra information about a PaymentIntent. This will appear on your customer’s statement when this PaymentIntent succeeds in creating a charge. + */ + statement_descriptor: string | null; + + /** + * The several states the PaymentIntent goes through until it it either canceled or succeeds. + */ + status: + | 'requires_payment_method' + | 'requires_action' + | 'processing' + | 'requires_authorization' + | 'requires_capture' + | 'canceled' + | 'succeeded'; + + /** + * The data with which to automatically create a Transfer when the payment is finalized. + */ + transfer_data: IPaymentIntentTransferData | null; + + /** + * A string that identifies the resulting payment as part of a group. + */ + transfer_group: string | null; + } + + interface IPaymentIntentTransferData { + /** + * The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to upon payment success. [Expandable] + */ + destination: + | string + | bankAccounts.IBankAccount + | cards.ICardHash + | accounts.IAccountCreationOptions; + } + + interface IPaymentIntentNextActionRedirectToUrl { + type: 'redirect_to_url'; + /** + * Contains instructions for authenticating a payment by redirecting your customer to another page or application. + */ + redirect_to_url: { return_url: string; url: string }; + } + + interface IPaymentIntentNextActionUseStripeSdk { + type: 'use_stripe_sdk'; + /** + * When confirming a PaymentIntent with js, js depends on the contents of this object to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by js. + */ + use_stripe_sdk: any; + } + + type PaymentIntentCancelationReason = 'duplicate' | 'fraudulent' | 'requested_by_customer' | 'failed_invoice'; + + interface IPaymentIntentCreationOptions { + /** + * Amount intended to be collected by this PaymentIntent (in cents). + */ + amount: number; + + /** + * Three-letter ISO currency code, in lowercase. Must be a supported currency. + */ + currency: string; + + /** + * The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. + */ + payment_method_types: string[]; + + /** + * The amount of the application fee in cents (if any) that will be applied to the payment and transferred to the application owner’s Stripe account. To use an application fee, the request must be made on behalf of another account, using the `Stripe-Account` header or an OAuth key. + */ + application_fee_amount?: number; + + /** + * Capture method of this PaymentIntent. + */ + capture_method?: 'automatic' | 'manual'; + + /** + * Attempt to confirm this PaymentIntent immediately. If the payment method attached is a card, a return_url must be provided in case additional authentication is required. + */ + confirm?: boolean; + + /** + * ID of the customer this PaymentIntent is for if one exists. + */ + customer?: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. This can be unset by updating the value to null and then saving. + */ + description?: string | null; + + /** + * A set of key/value pairs that you can attach to an object. It can be + * useful for storing additional information about the object in a structured + * format. You can unset an individual key by setting its value to null and + * then saving. To clear all keys, set metadata to null, then save. + */ + metadata?: IOptionsMetadata; + + /** + * The Stripe account ID for which these funds are intended. + */ + on_behalf_of?: string; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email?: string; + + /** + * The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method’s app or site. If you’d prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. This param can only be used if `confirm=true`. + */ + return_url?: string; + + /** + * Set to `true` to save this PaymentIntent’s payment method to the associated Customer, if the payment method is not already attached. This parameter only applies to the payment method passed in the same request or the current payment method attached to the PaymentIntent and must be specified again if a new payment method is added. + */ + save_payment_method?: boolean; + + /** + * Shipping information for this PaymentIntent. + */ + shipping?: IShippingInformation; + + /** + * ID of the Source object to attach to this PaymentIntent. + */ + source?: string; + + /** + * Extra information about a PaymentIntent. This will appear on your customer’s statement when this PaymentIntent succeeds in creating a charge. + */ + statement_descriptor?: string; + + /** + * The parameters used to automatically create a Transfer when the payment succeeds. + */ + transfer_data?: IPaymentIntentTransferData; + + /** + * A string that identifies the resulting payment as part of a group. + */ + transfer_group?: string; + } + + interface IPaymentIntentUpdateOptions { + /** + * Amount intended to be collected by this PaymentIntent (in cents). + */ + amount?: number; + + /** + * The amount of the application fee in cents (if any) that will be applied to the payment and transferred to the application owner’s Stripe account. To use an application fee, the request must be made on behalf of another account, using the `Stripe-Account` header or an OAuth key. + */ + application_fee_amount?: number; + + /** + * Three-letter ISO currency code, in lowercase. Must be a supported currency. + */ + currency?: string; + + /** + * ID of the customer this PaymentIntent is for if one exists. + */ + customer?: string; + + /** + * An arbitrary string attached to the object. Often useful for displaying to users. This can be unset by updating the value to null and then saving. + */ + description?: string | null; + + /** + * A set of key/value pairs that you can attach to an object. It can be + * useful for storing additional information about the object in a structured + * format. You can unset an individual key by setting its value to null and + * then saving. To clear all keys, set metadata to null, then save. + */ + metadata?: IOptionsMetadata; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email?: string; + + /** + * Set to `true` to save this PaymentIntent’s payment method to the associated Customer, if the payment method is not already attached. This parameter only applies to the payment method passed in the same request or the current payment method attached to the PaymentIntent and must be specified again if a new payment method is added. + */ + save_payment_method?: boolean; + + /** + * Shipping information for this PaymentIntent. + */ + shipping?: IShippingInformation; + + /** + * ID of the Source object to attach to this PaymentIntent. + */ + source?: string; + + /** + * A string that identifies the resulting payment as part of a group. + */ + transfer_group?: string; + } + + interface IPaymentIntentConfirmOptions { + /** + * The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key. Please refer to dynamic authentication guide on how client_secret should be handled. Required if using Publishable Key! + */ + client_secret?: string; + + /** + * Email address that the receipt for the resulting payment will be sent to. + */ + receipt_email?: string | null; + + /** + * The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method’s app or site. If you’d prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. This parameter is only used for cards and other redirect-based payment methods. + */ + return_url?: string; + + /** + * Set to `true` to save this PaymentIntent’s payment method to the associated Customer, if the payment method is not already attached. This parameter only applies to the payment method passed in the same request or the current payment method attached to the PaymentIntent and must be specified again if a new payment method is added. + */ + save_payment_method?: boolean; + + /** + * Shipping information for this PaymentIntent. + */ + shipping?: IShippingInformation | null; + + /** + * ID of the source used in this PaymentIntent. + */ + source?: string; + } + + interface IPaymentIntentRetrieveOptions { + /** + * The client secret of the PaymentIntent. Required if a publishable key is used to retrieve the source. + * + * REQUIRED IF USING PUBLISHABLE KEY! + */ + client_secret: string; + } + + interface IPaymentIntentCaptureOptions { + /** + * The amount to capture (in cents) from the PaymentIntent, which must be less than or equal to the original amount. Any additional amount will be automatically refunded. Defaults to the full `amount_capturable` if not provided. + */ + amount_to_capture?: number; + + /** + * The amount of the application fee (if any) that will be applied to the payment and transferred to the application owner’s Stripe account. To use an application fee, the request must be made on behalf of another account, using the `Stripe-Account` header or an OAuth key. + */ + application_fee_amount?: number; + } + + interface IPaymentIntentListOptions extends IListOptionsCreated { + /** + * Filter links by their expiration status. By default, all links are returned. + */ + expired?: boolean; + + /** + * Only return links for the given file. + */ + file?: boolean; + } + } + namespace plans { interface ITier { /** @@ -6816,6 +7229,170 @@ declare namespace Stripe { del(invoiceItemId: string, response?: IResponseFn): Promise; } + class PaymentIntents extends StripeResource { + /** + * Creates a PaymentIntent object. + */ + create( + data: paymentIntents.IPaymentIntentCreationOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + create( + data: paymentIntents.IPaymentIntentCreationOptions, + response?: IResponseFn, + ): Promise; + + /** + * Returns a list of PaymentIntents. + * + * @returns A object with a data property that contains an array of up to limit PaymentIntents, starting after PaymentIntent starting_after. Each entry in the array is a separate PaymentIntent object. If no more PaymentIntents are available, the resulting array will be empty. This request should never throw an error. + */ + list( + data: paymentIntents.IPaymentIntentListOptions, + options: HeaderOptions, + response?: IResponseFn>, + ): Promise>; + list( + data: paymentIntents.IPaymentIntentListOptions, + response?: IResponseFn>, + ): Promise>; + list( + options: HeaderOptions, + response?: IResponseFn>, + ): Promise>; + list( + response?: IResponseFn>, + ): Promise>; + + /** + * Updates a PaymentIntent object. + */ + update( + id: string, + data: paymentIntents.IPaymentIntentUpdateOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + update( + id: string, + data: paymentIntents.IPaymentIntentUpdateOptions, + response?: IResponseFn, + ): Promise; + + /** + * Retrieves the details of a PaymentIntent that has previously been created. + * Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string. + * When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the payment intent object reference for more details. + */ + retrieve( + id: string, + data: paymentIntents.IPaymentIntentRetrieveOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + retrieve( + id: string, + data: paymentIntents.IPaymentIntentRetrieveOptions, + response?: IResponseFn, + ): Promise; + retrieve( + id: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + retrieve( + id: string, + response?: IResponseFn, + ): Promise; + + /** + * Confirm that your customer intends to pay with current or provided `source`. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + * + * If the selected source requires additional authentication steps, the PaymentIntent will transition to the `requires_action` status and suggest additional actions via `next_source_action`. If payment fails, the PaymentIntent will transition to the `requires_payment_method` status. If payment succeeds, the PaymentIntent will transition to the `succeeded` status (or `requires_capture`, if `capture_method` is set to `manual`). + * + * When using a publishable key, the client_secret must be provided to confirm the PaymentIntent. + */ + confirm( + paymentIntentId: string, + data: paymentIntents.IPaymentIntentConfirmOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + confirm( + paymentIntentId: string, + data: paymentIntents.IPaymentIntentConfirmOptions, + response?: IResponseFn, + ): Promise; + confirm( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + confirm( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; + + /** + * Capture the funds of an existing uncaptured PaymentIntent where `required_action="requires_capture"`. + * Uncaptured PaymentIntents will be canceled exactly seven days after they are created. + * + * @returns Returns a PaymentIntent object with `status="succeeded"` if the PaymentIntent was capturable. Returns an error if the PaymentIntent was not capturable or an invalid amount to capture was provided. + */ + capture( + paymentIntentId: string, + data: paymentIntents.IPaymentIntentCaptureOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + capture( + paymentIntentId: string, + data: paymentIntents.IPaymentIntentCaptureOptions, + response?: IResponseFn, + ): Promise; + capture( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + capture( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; + + /** + * A PaymentIntent object can be canceled when it is in one of these statuses: `requires_payment_method`, `requires_capture`, `requires_confirmation`, `requires_action`. + * Once canceled, no additional charges will be made by the PaymentIntent and any operations on the PaymentIntent will fail with an error. For PaymentIntents with `status='requires_capture'`, the remaining `amount_capturable` will automatically be refunded. + * + * @returns Returns a PaymentIntent object if the cancellation succeeded. Returns an error if the PaymentIntent has already been canceled or is not in a cancelable state. + */ + cancel( + paymentIntentId: string, + data: { + cancellation_reason?: paymentIntents.PaymentIntentCancelationReason, + }, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + cancel( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + cancel( + paymentIntentId: string, + data: { + cancellation_reason?: paymentIntents.PaymentIntentCancelationReason, + }, + response?: IResponseFn, + ): Promise; + cancel( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; + } + class Payouts extends StripeResource { /** * To send funds to your own bank account, you create a new payout object. Your Stripe balance must be able to cover the payout amount, or you’ll receive an “Insufficient Funds” error. diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 154a5e0a58..bffadadb23 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1018,6 +1018,53 @@ stripe.invoices.retrieve("in_15fvyXEe31JkLCeQH7QbgZZb", { expand: ["subscription //#endregion +//#region Payment Intents test +// ################################################################################## +stripe.paymentIntents.create({ + amount: 2000, + currency: "eur", + payment_method_types: ["card"], +}, (err, intent) => {}); + +stripe.paymentIntents.create({ + amount: 2000, + currency: "eur", + payment_method_types: ["card"], +}).then((intent) => {}); + +stripe.paymentIntents.list({}, (err, intent) => {}); +stripe.paymentIntents.list({}).then((intent) => {}); +stripe.paymentIntents.list((err, intent) => {}); +stripe.paymentIntents.list().then((intent) => {}); +stripe.paymentIntents.list({ expired: true }, (err, intent) => {}); +stripe.paymentIntents.list({ expired: true }).then((intent) => {}); + +stripe.paymentIntents.update("pi_Aabcxyz01aDfoo", { + amount: 2001, + currency: 'usd', +}, (err, intent) => {}); +stripe.paymentIntents.update("pi_Aabcxyz01aDfoo", { + amount: 2001, + currency: 'usd', +}).then((intent) => {}); + +stripe.paymentIntents.retrieve("pi_Aabcxyz01aDfoo", (err, intent) => {}); +stripe.paymentIntents.retrieve("pi_Aabcxyz01aDfoo").then((intent) => {}); + +stripe.paymentIntents.confirm("pi_Aabcxyz01aDfoo", {}, (err, intent) => {}); +stripe.paymentIntents.confirm("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); + +stripe.paymentIntents.capture("pi_Aabcxyz01aDfoo", {}, (err, intent) => {}); +stripe.paymentIntents.capture("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); + +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", (err, intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo").then((intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", {}, (err, intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", { cancellation_reason: 'duplicate' }, (err, intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", { cancellation_reason: 'requested_by_customer' }).then((intent) => {}); +//#endregion + //#region Payouts tests // ################################################################################## stripe.payouts.create({ diff --git a/types/styled-components/index.d.ts b/types/styled-components/index.d.ts index c89b50c86d..2ab1970d44 100644 --- a/types/styled-components/index.d.ts +++ b/types/styled-components/index.d.ts @@ -6,6 +6,7 @@ // Jessica Franco // Jason Killian // Sebastian Silbermann +// David Ruisinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 diff --git a/types/styled-components/native.d.ts b/types/styled-components/native.d.ts index 0c1c520270..189e284525 100644 --- a/types/styled-components/native.d.ts +++ b/types/styled-components/native.d.ts @@ -2,24 +2,28 @@ import * as ReactNative from 'react-native'; import * as React from 'react'; export { - DefaultTheme, css, + DefaultTheme, isStyledComponent, - ThemeProps, - ThemeProvider, ThemeConsumer, ThemeContext, + ThemeProps, + ThemeProvider, withTheme, } from './index'; import { AnyStyledComponent, + DefaultTheme, + isStyledComponent, + StyledComponentInnerAttrs, StyledComponentInnerComponent, StyledComponentInnerOtherProps, - StyledComponentInnerAttrs, + ThemedCssFunction, ThemedStyledFunction, ThemedStyledInterface, - DefaultTheme + ThemeProviderComponent, + WithThemeFnInterface } from './index'; type AnyIfEmpty = keyof T extends never ? any : T; @@ -211,6 +215,23 @@ export interface ReactNativeStyledInterface extends ReactNativ >; } +export interface ReactNativeThemedStyledComponentsModule< + T extends object, + U extends object = T +> { + default: ReactNativeStyledInterface; + + css: ThemedCssFunction; + + withTheme: WithThemeFnInterface; + ThemeProvider: ThemeProviderComponent; + ThemeConsumer: React.Consumer; + ThemeContext: React.Context; + + // This could be made to assert `target is StyledComponent` instead, but that feels not type safe + isStyledComponent: typeof isStyledComponent; +} + declare const styled: ReactNativeStyledInterface; export default styled; diff --git a/types/styled-components/test/native.tsx b/types/styled-components/test/native.tsx index 66b0f975ce..da2ba83390 100644 --- a/types/styled-components/test/native.tsx +++ b/types/styled-components/test/native.tsx @@ -9,6 +9,7 @@ import styled, { ThemeProvider, withTheme, ThemeConsumer, + ReactNativeThemedStyledComponentsModule, } from "styled-components/native"; import {} from "styled-components/cssprop"; @@ -57,3 +58,141 @@ const TomatoButton = styled(MyButton)` // needs name prop, but not theme prop const tomatoElement = ; + +async function typedThemes() { + const theme = { + color: "green" + }; + + // abuse "await import(...)" to be able to reference the styled-components namespace + // without actually doing a top level namespace import + const { + default: styled, + css, + ThemeProvider, + ThemeConsumer + } = (await import("styled-components/native")) as any as ReactNativeThemedStyledComponentsModule< + typeof theme + >; + + const ThemedView = styled.View` + background: ${props => { + // $ExpectType string + props.theme.color; + // $ExpectType string | undefined + props.testID; + return props.theme.color; + }}; + `; + const ThemedView2 = styled.View(props => { + // $ExpectType string + props.theme.color; + // $ExpectType string | undefined + props.testID; + + return { + background: props.theme.color + }; + }); + const ThemedView3 = styled.View(props => { + // $ExpectType string + props.theme.color; + // $ExpectType string | undefined + props.testID; + + return css` + background: ${props.theme.color}; + `; +}); +const themedCss = css` + background: ${props => { + // $ExpectType string + props.theme.color; + // $ExpectType "theme" + type Keys = keyof typeof props; + return props.theme.color; + }}; +`; +// can't use a FlattenInterpolation as the first argument, would make broken css +// $ExpectError +const ThemedView4 = styled.View(themedCss); + +const themedCssWithNesting = css(props => ({ + color: props.theme.color, + [ThemedView3]: { + color: "green" + } +})); + +return ( + + <> + + + + + {theme => { + // $ExpectType string + theme.color; + return theme.color; + }} + + + + ); +} + +async function reexportCompatibility() { + const sc = await import("styled-components/native"); + const themed = sc as ReactNativeThemedStyledComponentsModule; + + let { ...scExports } = sc; + let { ...themedExports } = themed; + // both branches must be assignable to each other + if (Math.random()) { + scExports = themedExports; + } else { + themedExports = scExports; + } +} + +async function themeAugmentation() { + interface BaseTheme { + background: string; + } + interface ExtraTheme extends BaseTheme { + accent: string; + } + + const base = (await import("styled-components/native")) as any as ReactNativeThemedStyledComponentsModule< + BaseTheme + >; + const extra = (await import("styled-components/native")) as any as ReactNativeThemedStyledComponentsModule< + ExtraTheme, + BaseTheme + >; + + return ( + + <> + base} // $ExpectError + > + {() => null} + + ({ + ...base, + accent: "blue" + })} + > + {() => null} + + + + ); +} diff --git a/types/sunrise-sunset-js/index.d.ts b/types/sunrise-sunset-js/index.d.ts new file mode 100644 index 0000000000..b926ce6b50 --- /dev/null +++ b/types/sunrise-sunset-js/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for sunrise-sunset-js 2.0 +// Project: https://github.com/udivankin/sunrise-sunset +// Definitions by: Haseeb Majid +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function getSunrise( + latitude: number, + longitude: number, + date?: Date +): Date; + +export function getSunset( + latitude: number, + longitude: number, + date?: Date +): Date; diff --git a/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts b/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts new file mode 100644 index 0000000000..30fc19218a --- /dev/null +++ b/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts @@ -0,0 +1,4 @@ +import { getSunrise, getSunset } from "sunrise-sunset-js"; + +const sunset = getSunset(51.4541, -2.592); +const sunrise = getSunrise(51.1788, -1.8262, new Date("2000-06-21")); diff --git a/types/sunrise-sunset-js/tsconfig.json b/types/sunrise-sunset-js/tsconfig.json new file mode 100644 index 0000000000..4221b604c2 --- /dev/null +++ b/types/sunrise-sunset-js/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", "sunrise-sunset-js-tests.ts"] +} diff --git a/types/p-queue/v2/tslint.json b/types/sunrise-sunset-js/tslint.json similarity index 100% rename from types/p-queue/v2/tslint.json rename to types/sunrise-sunset-js/tslint.json diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index de09e3ae7b..3c6dbaec8c 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 3.8 +// Type definitions for SuperAgent 4.1 // Project: https://github.com/visionmedia/superagent // Definitions by: Nico Zelaya // Michael Ledin @@ -130,7 +130,7 @@ declare namespace request { ca(cert: Buffer): this; cert(cert: Buffer | string): this; clearTimeout(): this; - end(callback?: CallbackHandler): this; + end(callback?: CallbackHandler): void; field(name: string, val: MultipartValue): this; field(fields: { [fieldName: string]: MultipartValue }): this; get(field: string): string; diff --git a/types/supertest-as-promised/index.d.ts b/types/supertest-as-promised/index.d.ts index 1b12d57b0f..18047870a7 100644 --- a/types/supertest-as-promised/index.d.ts +++ b/types/supertest-as-promised/index.d.ts @@ -18,9 +18,11 @@ declare namespace supertestAsPromised { interface Response extends supertest.Response { } + type CallbackHandler = (err: any, res: Response) => void; interface Test extends supertest.Test, superagent.Request { toPromise(): PromiseBluebird; timeout(): Promise & this; + end(callback?: CallbackHandler): this; } function agent(app?: any): SuperTest; diff --git a/types/swag/package.json b/types/swag/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/swag/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/tabris-plugin-firebase/index.d.ts b/types/tabris-plugin-firebase/index.d.ts deleted file mode 100644 index 0ade0c9dcf..0000000000 --- a/types/tabris-plugin-firebase/index.d.ts +++ /dev/null @@ -1,147 +0,0 @@ -// Type definitions for tabris-plugin-firebase 1.0 -// Project: https://github.com/eclipsesource/tabris-plugin-firebase/ -// Definitions by: EclipseSource -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -declare global { - namespace firebase { - const Analytics: Analytics; - const Messaging: Messaging; - const MessagingEvents: MessagingEvents; - const MessageEvent: MessageEvent; - type AnalyticsProperties = Partial; - - interface Analytics extends NativeObject, PropertyMixins.Analytics { - logEvent(eventName: string, parameters?: {[key: string]: string}): void; - setUserProperty(propertyName: string, value: string): void; - set(properties: AnalyticsProperties): this; - set(property: string, value: any): this; - } - - interface Messaging extends NativeObject { - readonly instanceId: string; - readonly token: string; - readonly launchData: object; - resetInstanceId(): void; - on(type: string, listener: (event: any) => void, context?: object): this; - on(listeners: MessagingEvents): this; - off(type: string, listener: (event: any) => void, context?: object): this; - off(listeners: MessagingEvents): this; - once(type: string, listener: (event: any) => void, context?: object): this; - once(listeners: MessagingEvents): this; - } - - interface MessagingEvents { - instanceIdChanged?(event: PropertyChangedEvent): void; - tokenChanged?(event: PropertyChangedEvent): void; - message?(event: MessageEvent): void; - } - - interface MessageEvent extends EventObject { - data: any; - } - - namespace PropertyMixins { - interface Analytics { - analyticsCollectionEnabled: boolean; - screenName: string; - userId: string; - } - } - } -} - -// Tabris.js interfaces - -interface EventObject { - readonly target: T; - readonly timeStamp: number; - readonly type: string; -} - -/** - * Base class for all objects with a native implementation. - */ -declare class NativeObject { - protected constructor(properties?: object); - - /** - * Gets the current value of the given *property*. - */ - get(property: string): any; - - /** - * Removes all occurrences of *listener* that are bound to *type* and *context* from this widget. - * @param type The type of events to remove listeners for. - * @param listener The listener function to remove. - * @param context The context of the bound listener to remove. - */ - off(type: string, listener: (event: any) => void, context?: object): this; - - /** - * Removes all listeners in the given object from the event type indicated by their key. - * @param listeners A key-value map where the keys are event types and the values are the listeners to deregister from these events, e.g. `{tap: onTap, scroll: onScroll}`. - */ - off(listeners: object): this; - - /** - * Registers a *listener* function to be notified of events of the given *type*. - * @param type The type of events to listen for. - * @param listener The listener function to register. This function will be called with an event object. - * @param context In the listener function, `this` will point to this object. If not present, the listener will be called in the context of this object. - */ - on(type: string, listener: (event: any) => void, context?: object): this; - - /** - * Registers all listeners in the given object for the event type indicated by their key. - * @param listeners A key-value map where the keys are event types and the values are the listeners to register for these events, e.g. `{tap: onTap, scroll: onScroll}`. - */ - on(listeners: object): this; - - /** - * Same as `on`, but removes the listener after it has been invoked by an event. - * @param type The type of the event to listen for. - * @param listener The listener function to register. This function will be called with an event object. - * @param context In the listener function, `this` will point to this object. If not present, the listener will be called in the context of this object. - */ - once(type: string, listener: (event: any) => void, context?: object): this; - - /** - * Same as `on`, but removes the listener after it has been invoked by an event. - * @param listeners A key-value map where the keys are event types and the values are the listeners to register for these events, e.g. `{tap: onTap, scroll: onScroll}`. - */ - once(listeners: object): this; - - /** - * Sets the given property. - */ - set(property: string, value: any): this; - - /** - * Sets all key-value pairs in the properties object as widget properties. - */ - set(properties: object): this; - - /** - * Notifies all registered listeners for the given *type* and passes the *event* object to the - * listeners. - * @param type The type of event to trigger - * @param event The event object to pass to listener functions. - */ - trigger(type: string, event: EventObject): this; - - /** - * An application-wide unique identifier automatically assigned to all native objects on creation. - */ - static readonly cid: string; -} - -interface PropertyChangedEvent { - readonly target: T; - readonly timeStamp: number; - readonly type: string; - readonly value: U; -} - -export {}; diff --git a/types/tabris-plugin-firebase/tabris-plugin-firebase-tests.ts b/types/tabris-plugin-firebase/tabris-plugin-firebase-tests.ts deleted file mode 100644 index 8dff4f34a8..0000000000 --- a/types/tabris-plugin-firebase/tabris-plugin-firebase-tests.ts +++ /dev/null @@ -1,67 +0,0 @@ -function testAnalytics() { - // Properties - let analyticsCollectionEnabled: boolean; - let screenName: string; - let userId: string; - - analyticsCollectionEnabled = firebase.Analytics.analyticsCollectionEnabled; - screenName = firebase.Analytics.screenName; - userId = firebase.Analytics.userId; - - firebase.Analytics.analyticsCollectionEnabled = analyticsCollectionEnabled; - firebase.Analytics.screenName = screenName; - firebase.Analytics.userId = userId; - - const properties: firebase.AnalyticsProperties = {analyticsCollectionEnabled, screenName, userId}; - const partialProperties: firebase.AnalyticsProperties = {}; - firebase.Analytics.set(properties); - firebase.Analytics.set(partialProperties); - - // Methods - let thisReturnValue: firebase.Analytics; - const name = ''; - const property = ''; - - thisReturnValue = firebase.Analytics.set({analyticsCollectionEnabled, screenName, userId}); - firebase.Analytics.logEvent(name, {foo: property}); - firebase.Analytics.logEvent(name); - firebase.Analytics.setUserProperty(name, property); -} - -function testMessaging() { - // Properties - let instanceId: string; - let token: string; - let launchData: object; - - instanceId = firebase.Messaging.instanceId; - token = firebase.Messaging.token; - launchData = firebase.Messaging.launchData; - - // Methods - firebase.Messaging.resetInstanceId(); - - // Events - const target: firebase.Messaging = firebase.Messaging; - const timeStamp = 0; - const type = 'foo'; - const value = 'bar'; - const data: any = {}; - - const instanceIdChangedEvent: PropertyChangedEvent = {target, timeStamp, type, value}; - const tokenChangedEvent: PropertyChangedEvent = {target, timeStamp, type, value}; - const messageEvent: firebase.MessageEvent = {target, timeStamp, type, data}; - - firebase.Messaging.on({ - instanceIdChanged: (event: PropertyChangedEvent) => {}, - tokenChanged: (event: PropertyChangedEvent) => {}, - message: (event: firebase.MessageEvent) => {} - }); -} - -interface PropertyChangedEvent { - readonly target: T; - readonly timeStamp: number; - readonly type: string; - readonly value: U; -} diff --git a/types/tabris-plugin-firebase/tsconfig.json b/types/tabris-plugin-firebase/tsconfig.json deleted file mode 100644 index cac6477844..0000000000 --- a/types/tabris-plugin-firebase/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "tabris-plugin-firebase-tests.ts" - ] -} \ No newline at end of file diff --git a/types/tabulator-tables/index.d.ts b/types/tabulator-tables/index.d.ts new file mode 100644 index 0000000000..328cf80865 --- /dev/null +++ b/types/tabulator-tables/index.d.ts @@ -0,0 +1,1704 @@ +// Type definitions for tabulator-tables 4.2 +// Project: http://tabulator.info +// Definitions by: Josh Harris +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// tslint:disable:max-line-length +// tslint:disable:jsdoc-format +// tslint:disable:no-trailing-whitespace + +declare namespace Tabulator { + interface Options extends OptionsGeneral, OptionsHistory, OptionsLocale, OptionsDownload, OptionsColumns, OptionsRows, OptionsData, OptionsSorting, OptionsFiltering, OptionsRowGrouping, OptionsPagination, OptionsPersistentConfiguration, OptionsClipboard, OptionsDataTree, OptionsCell {} + + interface OptionsCells extends CellCallbacks { + /** The validationFailed event is triggered when the value entered into a cell during an edit fails to pass validation. */ + validationFailed?: (cell: CellComponent, value: any, validators: Validator[] | StandardValidatorType[]) => void; + } + interface OptionsDataTree { + /** To enable data trees in your table, set the dataTree property to true in your table constructor: */ + dataTree?: boolean; + /** By default the toggle element will be inserted into the first column on the table. If you want the toggle element to be inserted in a different column you can pass the feild name of the column to the dataTreeElementColumn setup option*/ + dataTreeElementColumn?: boolean | string; + /** Show tree branch icon */ + dataTreeBranchElement?: boolean | string; + /** Tree level indent in pixels */ + dataTreeChildIndent?: number; + /** By default Tabulator will look for child rows in the _children field of a row data object. You can change this to look in a different field using the dataTreeChildField property in your table constructor: */ + dataTreeChildField?: string; + /** The toggle button that allows users to collapse and expand the column can be customised to meet your needs. There are two options, dataTreeExpandElement and dataTreeCollapseElement, that can be set to replace the default toggle elements with your own. + + Both options can take either an html string representing the contents of the toggle element */ + dataTreeCollapseElement?: string | HTMLElement | boolean; + /** The toggle button that allows users to expand the column */ + dataTreeExpandElement?: string | HTMLElement | boolean; + /** By default all nodes on the tree will start collapsed, you can customize the initial expansion state of the tree using the dataTreeStartExpanded option.* + This option can take one of three possible value types, either a boolean to indicate whether all nodes should start expanded or collapsed: */ + dataTreeStartExpanded?: boolean | boolean[] | ((row: RowComponent, level: number) => boolean); + } + interface OptionsClipboard { + /** You can enable clipboard functionality using the clipboard config option. It can take one of four possible values: + + true - enable clipboard copy and paste + "copy" - enable only copy functionality + "paste" - enable only paste functionality + false - disable all clipboard functionality (default) */ + clipboard?: boolean | "copy" | "paste"; + /** * The copy selector is a function that is used to choose which data is copied into the clipboard. Tabulator comes with a few different selectors built in: + active - Copy all table data currently displayed in the table to the clipboard (default) + table - Copy all table data to the clipboard, including data that is currently filtered out + selected - Copy the currently selected rows to the clipboard, including data that is currently filtered out + Tabulator will try to use the best selector to match your table setup. If any text is selected on the table, then it will be that text which is copied. If the table has selectable rows enabled, the it will be the currently selected rows copied to the clipboard in the order in which they were selected. Otherwise the currently visible data in the table will be copied. + + These selectors can also be used when programatically triggering a copy event. in this case if the selector is not specified it will default to the value set in the clipboardCopySelector property (which is active by default). + */ + clipboardCopySelector?: "active" | "table" | "selected"; + /** The copy formatter is used to take the row data provided by the selector and turn it into a text string for the clipboard. + There is one built in copy formatter called table, if you have extended the clipboard module and want to change the default you can use the clipboardCopyFormatter property. you can also pass in a formatting function directly into this property.*/ + clipboardCopyFormatter?: "table" | ((rowData: any[]) => string); + /** By default Tabulator will include the column header titles in any clipboard data, this can be turned off by passing a value of false to the clipboardCopyHeader property: */ + clipboardCopyHeader?: boolean; + /** Tabulator has one built in paste parser, that is designed to take a table formatted text string from the clipboard and turn it into row data. it breaks the tada into rows on a newline character \n and breaks the rows down to columns on a tab character \t. + + It will then attempt to work out which columns in the data correspond to columns in the table. It tries three different ways to achieve this. First it checks the values of all columns in the first row of data to see if they match the titles of columns in the table. If any of the columns don't match it then tries the same approach but with the column fields. If either of those options match, Tabulator will map those columns to the incoming data and import it into rows. If there is no match then Tabulator will assume the columns in the data are in the same order as the visible columns in the table and import them that way. + + The inbuilt parser will reject any clipboard data that does not contain at least one row and two columns, in that case the clipboardPasteError will be triggered. + + If you extend the clipboard module to add your own parser, you can set it to be used as default with the clipboardPasteParser property.*/ + clipboardPasteParser?: string | ((clipboard: any) => any[]); + /** Once the data has been parsed into row data, it will be passed to a paste action to be added to the table. There are three inbuilt paste actions: + + insert - Inserts data into the table using the addRows function (default) + update - Updates data in the table using the updateOrAddData function + replace - replaces all data in the table using the setData function */ + clipboardPasteAction?: "insert" | "update" | "replace"; + + /** By default Tabulator will copy some of the tables styling along with the data to give a better visual appearance when pasted into other documents. + + If you want to only copy the unstyled data then you should set the clipboardCopyStyled option to false in the table options object: */ + clipboardCopyStyled?: boolean; + + /** By default Tabulator includes column headers, row groups and column calculations in the clipboard output. + + You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the clipboardCopyConfig option in the table definition: */ + clipboardCopyConfig?: + | { + columnHeaders?: boolean; + rowGroups?: boolean; + columnCalcs?: boolean; + } + | boolean; + + /** The clipboardCopied event is triggered whenever data is copied to the clipboard. */ + clipboardCopied: () => void; + /** The clipboardPasted event is triggered whenever data is successfuly pasted into the table. */ + clipboardPasted: () => void; + /** The clipboardPasteError event is triggered whenever an atempt to paste data into the table has failed because it was rejected by the paste parser. */ + clipboardPasteError: () => void; + } + + interface OptionsPersistentConfiguration { + /** ID tag used to identify persistent storage information */ + persistenceID?: string; + /** Persistence information can either be stored in a cookie or in the localSotrage object, you can use the persistenceMode to choose which. It can take three possible values: + + local - (string) Store the persistence information in the localStorage object + cookie - (string) Store the persistence information in a cookie + true - (boolean) check if localStorage is available and store persistence information, otherwise store in cookie (Default option) */ + persistenceMode?: "local" | "cookie" | true; + /** Enable persistsnt storage of column layout information */ + persistentLayout?: boolean; + /** You can ensure the data sorting is stored for the next page load by setting the persistentSort option to true */ + persistentSort?: boolean; + /** You can ensure the data filtering is stored for the next page load by setting the persistentFilter option to true*/ + persistentFilter?: boolean; + } + + interface OptionsPagination { + /** Choose pagination method, "local" or "remote" */ + pagination?: "remote" | "local"; + /** Set the number of rows in each page */ + paginationSize?: number; + /** Setting this option to true will cause Tabulator to create a list of page size options, that are multiples of the current page size. In the example below, the list will have the values of 5, 10, 15 and 20. + + When using the page size selector like this, if you use the setPageSize function to set the page size to a value not in the list, the list will be regenerated using the new page size as the starting valuer */ + paginationSizeSelector?: true | number[]; + /** By default the pagination controls are added to the footer of the table. If you wish the controls to be created in another element pass a DOM node or a CSS selector for that element to the paginationElement option.*/ + paginationElement?: HTMLElement | "string"; + /** Lookup list to link expected data feilds from the server to their function * default* { + "current_page":"current_page", + "last_page":"last_page", + "data":"data", + }* * + */ + paginationDataReceived?: Record; + /** Lookup list to link fields expected by the server to their function* default:* { + "page":"page", + "size":"size", + "sorters":"sorters", + "filters":"filters", + } + */ + paginationDataSent?: Record; + /** When using the addRow function on a paginated table, rows will be added relative to the current page (ie to the top or bottom of the current page), with overflowing rows being shifted onto the next page. + + If you would prefer rows to be added relative to the table (firs/last page) then you can use the paginationAddRow option. it can take one of two values: + + page - add rows relative to current page (default) + table - add rows relative to the table */ + paginationAddRow?: "table" | "page"; + /** The number of pagination page buttons shown in the footer using the paginationButtonCount option. By default this has a value of 5.*/ + paginationButtonCount?: number; + } + + interface OptionsRowGrouping { + /** String/function to select field to group rows by */ + groupBy?: string | ((data: any) => any); + /** By default Tabulator will create groups for rows based on the values contained in the row data. if you want to explicitly define which field values groups should be created for at each level, you can use the groupValues option. + + This option takes an array of value arrays, each item in the first array should be a list of acceptable field values for groups at that level */ + groupValues?: any[][]; + + /** You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + groupHeader?: ((value: any, count: number, data: any, group: GroupComponent) => string) | Array<(value: any, count: number, data: any) => string>; + + /** You can set the default open state of groups using the groupStartOpen property* * This can take one of three possible values: + + true - all groups start open (default value) + false - all groups start closed + function() - a callback to decide if a group should start open or closed + Group Open Function + If you want to decide on a group by group basis which should start open or closed then you can pass a function to the groupStartOpen property. This should return true if the group should start open or false if the group should start closed. + */ + groupStartOpen?: boolean | ((value: any, count: number, data: any, group: GroupComponent) => boolean); + + /** By default Tabulator allows users to toggle a group open or closed by clicking on the arrow icon in the left of the group header. If you would prefer a different behaviour you can use the groupToggleElement option to choose a different option:* * The option can take one of three values: + arrow - togggle group on arrow element click + header - toggle group on click anywhere on the group header element + false - prevent clicking anywhere in the group toggling the group + */ + groupToggleElement?: "arrow" | "header" | false; + + /** show/hide column calculations when group is closed */ + groupClosedShowCalcs?: boolean; + + /** The dataGrouping callback is triggered whenever a data grouping event occurs, before grouping happens. */ + dataGrouping?: () => void; + /** The dataGrouping callback is triggered whenever a data grouping event occurs, after grouping happens. */ + dataGrouped?: () => void; + /** The groupVisibilityChanged callback is triggered whenever a group changes between hidden and visible states. */ + groupVisibilityChanged?: (group: GroupComponent, visible: boolean) => void; + + /** The groupClick callback is triggered when a user clicks on a group header. */ + groupClick?: GroupEventCallback; + /** The groupDblClick callback is triggered when a user double clicks on a group header. */ + groupDblClick?: GroupEventCallback; + /** The groupContext callback is triggered when a user right clicks on a group header. + + If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ + groupContext?: GroupEventCallback; + /** The groupTap callback is triggered when a user taps on a group header on a touch display. */ + groupTap?: GroupEventCallback; + /** The groupDblTap callback is triggered when a user taps on a group header on a touch display twice in under 300ms. */ + groupDblTap?: GroupEventCallback; + /** The groupTapHold callback is triggered when a user taps on a group header on a touch display and holds their finger down for over 1 second */ + groupTapHold?: GroupEventCallback; + } + + interface Filter { + field: string; + type: FilterType; + value: any; + } + + type FilterFunction = (field: string, type: FilterType, value: any) => void; + + interface OptionsFiltering { + /** Array of filters to be applied on load. */ + initialFilter?: Filter[]; + + /** array of initial values for header filters. */ + initialHeaderFilter?: Array>; + + /** The dataFiltering callback is triggered whenever a filter event occurs, before the filter happens. */ + dataFiltering?: (filters: Filter[]) => void; + /** The dataFiltered callback is triggered after the table dataset is filtered. */ + dataFiltered?: (filters: Filter[], rows: RowComponent[]) => void; + } + interface OptionsSorting { + /** Array of sorters to be applied on load. */ + initialSort?: Sorter[]; + + /** reverse the order that multiple sorters are applied to the table. */ + sortOrderReverse?: boolean; + } + + interface Sorter { + column: string; + dir: SortDirection; + } + interface OptionsData { + /** A unique index value should be present for each row of data if you want to be able to programatically alter that data at a later point, this should be either numeric or a string. By default Tabulator will look for this value in the id field for the data. If you wish to use a different field as the index, set this using the index option parameter. */ + index?: number | string; + /** Array to hold data that should be loaded on table creation */ + data?: any[]; + + /** If you wish to retrieve your data from a remote source you can set the URL for the request in the ajaxURL option. */ + ajaxURL?: string; + + /** Parameters to be passed to remote Ajax data loading request */ + ajaxParams?: {}; + + /** The HTTP request type for Ajax requests or config object for the request */ + ajaxConfig?: HttpMethod | AjaxConfig; + + /** When using a request method other than "GET" Tabulator will send any parameters with a content type of form data. You can change the content type with the ajaxContentType option. This will ensure parameters are sent in the format you expect, with the correct headers. * * The ajaxContentType option can take one of two values: + "form" - send parameters as form data (default option) + "json" - send parameters as JSON encoded string + If you want to use a custom content type then you can pass a content type formatter object into the ajaxContentType option. this object must have two properties, the headers property should contain all headers that should be sent with the request and the body property should contain a function that returns the body content of the request + */ + + ajaxContentType?: "form" | "json" | AjaxContentType; + + /** If you need more control over the url of the request that you can get from the ajaxURL and ajaxParams properties, the you can use the ajaxURLGenerator property to pass in a callback that will generate the URL for you. + + The callback should return a string representing the URL to be requested. */ + ajaxURLGenerator?: (url: string, config: any, params: any) => string; + + /** callback function to replace inbuilt ajax request functionality */ + ajaxRequestFunc?: (url: string, config: any, params: any) => Promise; + + /** Send filter config to server instead of processing locally */ + ajaxFiltering?: boolean; + + /** Send sorter config to server instead of processing locally */ + ajaxSorting?: boolean; + + /** If you are loading a lot of data from a remote source into your table in one go, it can sometimes take a long time for the server to return the request, which can slow down the user experience. + + To speed things up in this situation Tabulator has a progressive load mode, this uses the pagination module to make a series of requests for part of the data set, one at a time, appending it to the table as the data arrives. This mode can be enable using the ajaxProgressiveLoad option. No pagination controls will be visible on screen, it just reusues the functionality of the pagination module to sequentially load the data. + + With this mode enabled, all of the settings outlined in the Ajax Documentation are still available + + There are two different progressive loading modes, to give you a choice of how data is loaded into the table. */ + ajaxProgressiveLoad?: "load" | "scroll"; + /** By default tabulator will make the requests to fill the table as quickly as possible. On some servers these repeates requests from the same client may trigger rate limiting or security systems. In this case you can use the ajaxProgressiveLoadDelay option to add a delay in milliseconds between each page request. */ + ajaxProgressiveLoadDelay?: number; + /** The ajaxProgressiveLoadScrollMargin property determines how close to the bottom of the table in pixels, the scroll bar must be before the next page worth of data is loaded, by default it is set to twice the height of the table. */ + ajaxProgressiveLoadScrollMargin?: number; + + /** Show loader while data is loading, can also take a function that must return a boolean */ + ajaxLoader?: boolean | (() => boolean); + + /** html for loader element */ + ajaxLoaderLoading?: string; + /** html for the loader element in the event of an error */ + ajaxLoaderError?: string; + + /** The ajaxRequesting callback is triggered when ever an ajax request is made. */ + ajaxRequesting?: (url: string, params: any) => boolean; + /** The ajaxResponse callback is triggered when a successful ajax request has been made. This callback can also be used to modify the received data before it is parsed by the table. If you use this callback it must return the data to be parsed by Tabulator, otherwise no data will be rendered */ + ajaxResponse?: (url: string, params: any, response: any) => any; + /** The ajaxError callback is triggered there is an error response to an ajax request. */ + ajaxError?: (xhr: any, textStatus: any, errorThrown: any) => void; + } + + interface AjaxContentType { + headers: JSONRecord; + body: (url: string, config: any, params: any) => any; + } + + type HttpMethod = "GET" | "POST"; + interface AjaxConfig { + method?: HttpMethod; + headers?: JSONRecord; + mode?: string; + credentials?: string; + } + + interface OptionsRows { + /** Tabulator also allows you to define a row level formatter using the rowFormatter option. this lets you alter each row of the table based on the data it contains. + + The function accepts one argument, the RowComponent for the row being formatted. */ + rowFormatter?: (row: RowComponent) => any; + + /** The position in the table for new rows to be added, "bottom" or "top" */ + addRowPos?: "bottom" | "top"; + + /** The selectable option can take one of a several values: + + false - selectable rows are disabled + true - selectable rows are enabled, and you can select as many as you want + integer - any integer value, this sets the maximum number of rows that can be selected (when the maximum number of selected rows is exeded, the first selected row will be deselected to allow the next row to be selected). + "highlight" (default) - rows have the same hover stylings as selectable rows but do not change state when clicked. This is great for when you want to show that a row is clickable but don't want it to be selectable. */ + selectable?: boolean | number | "highlight"; + + /** By default you can select a range of rows by holding down the shift key and click dragging over a number of rows to toggle the selected state state of all rows the cursor passes over. + + If you would prefere to select a range of row by clicking on the first row then holding down shift and clicking on the end row then you can acheive this by setting the selectableRangeMode to click */ + selectableRangeMode?: "click"; + + /** By default, row selection works on a rolling basis, if you set the selectable option to a numeric value then when you select past this number of rows, the first row to be selected will be deselected. If you want to disable this behaviour and instead prevent selection of new rows once the limit is reached you can set the selectableRollingSelection option to false. */ + selectableRollingSelection?: boolean; + + /** By default Tabulator will maintain selected rows when the table is filtered, sorted or paginated (but NOT when the setData function is used). If you want the selected rows to be cleared whenever the table view is updated then set the selectablePersistence option to false. */ + selectablePersistence?: boolean; + + /** You many want to exclude certain rows from being selected. The selectableCheck options allows you to pass a function to check if the current row should be selectable, returning true will allow row selection, false will result in nothing happening. The function should accept a RowComponent as its first argument. */ + selectableCheck?: (row: RowComponent) => boolean; + + /** To allow the user to move rows up and down the table, set the movableRows parameter in the options: */ + movableRows?: boolean; + + /** Tabulator also allows you to move rows between tables. To enable this you should supply either a valid CSS selector string a DOM node for the table or the Tabuator object for the table to the movableRowsConnectedTables option. if you want to connect to multple tables then you can pass in an array of values to this option. */ + movableRowsConnectedTables?: string | string[] | HTMLElement | HTMLElement[]; + + /** The movableRowsSender option should be set on the sending table, and sets the action that should be taken after the row has been successfuly dropped into the receiving table. + + There are several inbuilt sender functions: + + false - do nothing(default) + delete - deletes the row from the table + You can also pass a callback to the movableRowsSender option for custom sender functionality + */ + movableRowsSender?: false | "delete" | ((fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => any); + + /** The movableRowsReceiver option should be set on the receiving tables, and sets the action that should be taken when the row is dropped into the table. + There are several inbuilt receiver functions: + + insert - inserts row next to the row it was dropped on, if not dropped on a row it is added to the table (default) + add - adds row to the table + update - updates the row it is dropped on with the sent rows data + replace - replaces the row it is dropped on with the sent row*/ + movableRowsReceiver?: "insert" | "add" | "update" | "replace" | ((fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => any); + + /** You can allow the user to manually resize rows by dragging the top or bottom border of a row. To enable this functionality, set the resizableRows property to true */ + resizableRows?: boolean; + + /** * The default ScrollTo position can be set using the scrollToRowPosition option. It can take one of four possible values: + + top - position row with its top edge at the top of the table (default) + center - position row with its top edge in the center of the table + bottom - position row with its bottom edge at the bottom of the table + nearest - position row on the edge of the table it is closest to + */ + scrollToRowPosition?: ScrollToRowPostition; + + /** The default option for triggering a ScrollTo on a visible element can be set using the scrollToRowIfVisible option. It can take a boolean value: + + true - scroll to row, even if it is visible (default) + false - scroll to row, unless it is currently visible, then don't move */ + scrollToRowIfVisible?: boolean; + + /** The dataTreeRowExpanded callback is triggered when a row with child rows is expanded to reveal the children. */ + dataTreeRowExpanded?: (row: RowComponent, level: number) => void; + + /** The dataTreeRowCollapsed callback is triggered when a row with child rows is collapsed to hide its children.*/ + dataTreeRowCollapsed?: (row: RowComponent, level: number) => void; + + /** The movableRowsSendingStart callback is triggered on the sending table when a row is picked up from a sending table. */ + movableRowsSendingStart?: (toTables: any[]) => void; + + /** The movableRowsSent callback is triggered on the sending table when a row has been successfuly received by a receiving table. */ + movableRowsSent?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; + + /** The movableRowsSentFailed callback is triggered on the sending table when a row has failed to be received by the receiving table.*/ + movableRowsSentFailed?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; + + /** The movableRowsSendingStop callback is triggered on the sending table after a row has been dropped and any senders and receivers have been handled. */ + movableRowsSendingStop?: (toTables: any[]) => void; + + /** The movableRowsReceivingStart callback is triggered on a receiving table when a connection is established with a sending table. */ + movableRowsReceivingStart?: (fromRow: RowComponent, toTable: Tabulator) => void; + + /** The movableRowsReceived callback is triggered on a receiving table when a row has been successfuly received.*/ + movableRowsReceived?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; + + /** The movableRowsReceivedFailed callback is triggered on a receiving table when a row receiver has returned false.*/ + movableRowsReceivedFailed?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; + + /** The movableRowsReceivingStop callback is triggered on a receiving table after a row has been dropped and any senders and receivers have been handled.*/ + movableRowsReceivingStop?: (fromTable: Tabulator) => void; + + /** The rowClick callback is triggered when a user clicks on a row. */ + rowClick?: RowEventCallback; + /** The rowDblClick callback is triggered when a user double clicks on a row. */ + rowDblClick?: RowEventCallback; + /** The rowContext callback is triggered when a user right clicks on a row. + + If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ + rowContext?: RowEventCallback; + /** The rowTap callback is triggered when a user taps on a row on a touch display. */ + rowTap?: RowEventCallback; + /** The rowDblTap callback is triggered when a user taps on a row on a touch display twice in under 300ms. */ + rowDblTap?: RowEventCallback; + /** The rowTapHold callback is triggered when a user taps on a row on a touch display and holds their finger down for over 1 second. */ + rowTapHold?: RowEventCallback; + /** The rowMouseEnter callback is triggered when the mouse pointer enters a row. */ + rowMouseEnter?: RowEventCallback; + /** The rowMouseLeave callback is triggered when the mouse pointer leaves a row. */ + rowMouseLeave?: RowEventCallback; + /** The rowMouseOver callback is triggered when the mouse pointer enters a row or any of its child elements.*/ + rowMouseOver?: RowEventCallback; + /** The rowMouseOut callback is triggered when the mouse pointer leaves a row or any of its child elements. */ + rowMouseOut?: RowEventCallback; + /** The rowMouseMove callback is triggered when the mouse pointer moves over a row. */ + rowMouseMove?: RowEventCallback; + /** The rowAdded callback is triggered when a row is added to the table by the addRow and updateOrAddRow functions. */ + rowAdded?: RowChangedCallback; + /** The rowUpdated callback is triggered when a row is updated by the updateRow, updateOrAddRow, updateData or updateOrAddData, functions. */ + rowUpdated?: RowChangedCallback; + /** The rowDeleted callback is triggered when a row is deleted from the table by the deleteRow function. */ + rowDeleted?: RowChangedCallback; + /** The rowMoved callback will be triggered when a row has been successfuly moved. */ + rowMoved?: RowChangedCallback; + /** The rowResized callback will be triggered when a row has been resized by the user. */ + rowResized?: RowChangedCallback; + /** Whenever the number of selected rows changes, through selection or deselection, the rowSelectionChanged event is triggered. This passes an array of the data objects for each row in the order they were selected as the first argument, and an array of row components for each of the rows in order of selection as the second argument. */ + rowSelectionChanged?: (data: any[], rows: RowComponent[]) => void; + /** The rowSelected event is triggered when a row is selected, either by the user or programatically. */ + rowSelected?: RowChangedCallback; + /** The rowDeselected event is triggered when a row is deselected, either by the user or programatically. */ + rowDeselected?: RowChangedCallback; + } + + interface OptionsColumns { + /** The column definitions are provided to Tabluator in the columns property of the table constructor object and should take the format of an array of objects, with each object representing the configuration of one column. */ + columns?: ColumnDefinition[]; + + /** + * If you set the autoColumns option to true, every time data is loaded into the table through the data option or through the setData function, Tabulator will examine the first row of the data and build columns to match that data. + */ + autoColumns?: boolean; + + /** By default Tabulator will use the fitData layout mode, which will resize the tables columns to fit the data held in each column, unless you specify a width or minWidth in the column constructor. If the width of all columns exceeds the width of the containing element, a scroll bar will appear. */ + layout?: "fitData" | "fitColumns" | "fitDataFill"; + + /** To keep the layout of the columns consistent, once the column widths have been set on the first data load (either from the data property in the constructor or the setData function) they will not be changed when new data is loaded. + + If you would prefer that the column widths adjust to the data each time you load it into the table you can set the layoutColumnsOnNewData property to true. */ + layoutColumnsOnNewData?: boolean; + + /** Responsive layout will automatically hide/show columns to fit the width of the Tabulator element. This allows for clean rendering of tables on smaller mobile devices, showing important data while avoiding horizontal scroll bars. You can enable responsive layouts using the responsiveLayout option. + + There are two responsive layout modes available: + + hide - hide columns that no longer fit in the table + collapse - collapse columns that no longer fit on the table into a list under the row + + Hide Extra Columns + By default, columns will be hidden from right to left as the width of the table decreases. You can choose exactlyhow columns are hidden using the responsive property in the column definition object. + + When responsive layout is enabled, all columns are given a default responsive value of 1. The higher you set this value the sooner that column will be hidden as the table width decreases. If two columns have the same responsive value then they are hidden from right to left (as defined in the column definition array, ignoring user moving of the columns). If you set the value to 0 then the column will never be hidden regardless of how narrow the table gets. */ + responsiveLayout?: boolean | "hide" | "collapse"; + + /** Collapsed lists are displayed to the user by default, if you would prefer they start closed so the user can open them you can use the responsiveLayoutCollapseStartOpen option */ + responsiveLayoutCollapseStartOpen?: boolean; + + /** By default any formatter set on the column is applied to the value that will appear in the list. while this works for most formatters it can cause issues with the progress formatter which relies on being inside a cell. + + If you would like to disable column formatting in the collapsed list, you can use the responsiveLayoutCollapseUseFormatters option: */ + responsiveLayoutCollapseUseFormatters?: boolean; + + /** If you set the responsiveLayout option to collapse the values from hidden columns will be displayed in a title/value list under the row. + + In this mode an object containing the title of each hidden column and its value is generated and then used to generate a list displayed in a div .tabulator-responsive-collapse under the row data. + + The inbuilt collapse formatter creates a table to neatly display the hidden columns. If you would like to format the data in your own way you can use the responsiveLayoutCollapseFormatter, it take an object of the column values as an argument and must return the HTML content of the div. + + This function should return an empty string if there is no data to display. */ + responsiveLayoutCollapseFormatter?: (data: any[]) => any; + + /** It is possible to set a minimum column width to prevent resizing columns from becoming too small. + + This can be set globally, by setting the columnMinWidth option to the column width when you create your Tabulator. + + This option can be overridden on a per column basis by setting the minWidth property on the column definition. */ + columnMinWidth?: number; + + /** By default it is possible to manually resize columns by dragging the borders of the column in both the column headers and the cells of the column. + + If you want to alter this behaviour you can use the resizableColumns to choose where the resize handles are available. */ + resizableColumns?: true | false | "header" | "cell"; + + /** To allow the user to move columns along the table, set the movableColumns parameter in the options: */ + movableColumns?: boolean; + + /** Header tooltips can be set globally using the tooltipsHeader options parameter */ + tooltipsHeader?: boolean; + + /** You can use the columnVertAlign option to set how the text in your column headers should be vertically */ + columnVertAlign?: "top" | "middle" | "bottom"; + + /** The default placeholder text used for input elements can be set using the headerFilterPlaceholder option in the table definition */ + headerFilterPlaceholder?: string; + + /** The default ScrollTo position can be set using the scrollToColumnPosition option. It can take one of three possible values: + + left - position column with its left edge at the left of the table (default) + center - position column with its left edge in the center of the table + right - position column with its right edge at the right of the table */ + scrollToColumnPosition?: ScrollToColumnPosition; + + /** The default option for triggering a ScrollTo on a visible element can be set using the scrollToColumnIfVisible option. It can take a boolean value: + + true - scroll to column, even if it is visible (default) + false - scroll to column, unless it is currently visible, then don't move */ + scrollToColumnIfVisible?: boolean; + + /** By default column calculations are shown at the top and bottom of the table, unless row grouping is enabled, in which case they are shown at the top and bottom of each group. + + The columnCalcs option lets you decided where the calculations should be displayed, it can take one of four values: + + true - show calcs at top and bottom of the table, unless grouped, then show in groups (boolean, default) + both - show calcs at top and bottom of the table and show in groups + table - show calcs at top and bottom of the table only + group - show calcs in groups only */ + columnCalcs?: boolean | "both" | "table" | "group"; + + /** If you need to use the . character as part of your field name, you can change the separator to any other character using the nestedFieldSeparator option + * Set to false to disable nested data parsing + */ + nestedFieldSeparator?: string | boolean; + + /** multiple or single column sorting */ + columnHeaderSortMulti?: boolean; + + /** The columnMoved callback will be triggered when a column has been successfuly moved. */ + columnMoved?: (column: ColumnComponent, columns: any[]) => void; + columnResized?: (column: ColumnComponent) => void; + /** The columnVisibilityChanged callback is triggered whenever a column changes between hidden and visible states. */ + columnVisibilityChanged?: (column: ColumnComponent, visible: boolean) => void; + + /** The columnTitleChanged callback is triggered whenever a user edits a column title when the editableTitle parameter has been enabled in the column definition array. */ + columnTitleChanged?: (column: ColumnComponent) => void; + } + + interface OptionsCell { + /** The cellClick callback is triggered when a user left clicks on a cell, it can be set on a per column basis using the option in the columns definition object. */ + cellClick?: CellEventCallback; + cellDblClick?: CellEventCallback; + cellContext?: CellEventCallback; + cellTap?: CellEventCallback; + cellDblTap?: CellEventCallback; + cellTapHold?: CellEventCallback; + cellMouseEnter?: CellEventCallback; + cellMouseLeave?: CellEventCallback; + cellMouseOver?: CellEventCallback; + cellMouseOut?: CellEventCallback; + cellMouseMove?: CellEventCallback; + cellEditing?: CellEditEventCallback; + cellEdited?: CellEditEventCallback; + cellEditCancelled?: CellEditEventCallback; + } + + interface OptionsGeneral { + /** Sets the height of the containing element, can be set to any valid height css value. If set to false (the default), the height of the table will resize to fit the table data. */ + height?: string | number | false; + /** Enable rendering using the Virtual DOM engine */ + virtualDom?: boolean; + + /** Manually set the size of the virtual DOM buffer */ + virtualDomBuffer?: boolean; + /** placeholder element to display on empty table */ + placeholder?: string | HTMLElement; + + /** Footer element to display for the table */ + footerElement?: string | HTMLElement; + + /** Function to generate tooltips for cells */ + tooltips?: GlobalTooltipOption; + /** When to regenerate cell tooltip value */ + tooltipGenerationMode?: "load"; + + /** Keybinding configuration object */ + keybindings?: false | KeyBinding; + + /** * The reactivity systems allow Tabulator to watch arrays and objects passed into the table for changes and then automatically update the table. + + This approach means you no longer need to worry about calling a number of different functions on the table to make changes, you simply update the array or object you originally passed into the table and Tabulator will take care of the rest. + + You can enable reactive data by setting the reactiveData option to true in the table constructor, and then passing your data array to the data option. + + Once the table is built any changes to the array will automatically be replicated to the table without needing to call any functions on the table itself*/ + + reactiveData?: boolean; + + // Not listed in options-------------------- + /** Tabulator will automatically attempt to redraw the data contained in the table if the containing element for the table is resized. To disable this functionality, set the autoResize property to false */ + autoResize?: boolean; + + /** When a the tabulator constructor is called, the tableBuilding callback will triggered */ + tableBuilding?: () => void; + + /** When a the tabulator constructor is called and the table has finished being rendered, the tableBuilt callback will triggered: */ + tableBuilt?: () => void; + + /** The renderStarted callback is triggered whenever all the rows in the table are about to be rendered. This can include: + Data is loaded into the table when setData is called + A page is loaded through any form of pagination + Rows are added to the table during progressive rendering + Columns are changed by setColumns + The data is filtered + The data is sorted + The redraw function is called */ + renderStarted?: () => void; + + /** The renderComplete callback is triggered after the table has been rendered */ + renderComplete?: () => void; + + /** The htmlImporting callback is triggered when Tabulator starts importing data from an HTML table. */ + htmlImporting?: EmptyCallback; + + /** The htmlImported callback is triggered when Tabulator finishes importing data from an HTML table. */ + htmlImported?: EmptyCallback; + + /** The dataLoading callback is triggered whenever new data is loaded into the table. */ + dataLoading?: (data: any) => void; + /** The dataLoaded callback is triggered when a new set of data is loaded into the table. */ + dataLoaded?: (data: any) => void; + /** The dataEdited callback is triggered whenever the table data is changed by the user. Triggers for this include editing any cell in the table, adding a row and deleting a row. */ + dataEdited?: (data: any) => void; + + /** Whenever a page has been loaded, the pageLoaded callback is called, passing the current page number as an argument. */ + pageLoaded?: (pageno: number) => void; + + /** The dataSorting callback is triggered whenever a sort event occurs, before sorting happens. */ + dataSorting?: (sorters: Sorter[]) => void; + + /** The dataSorted callback is triggered after the table dataset is sorted. */ + dataSorted?: (sorters: Sorter[], rows: RowComponent[]) => void; + } + + type DownloadType = "csv" | "json" | "xlsx" | "pdf"; + + interface DownloadOptions extends DownloadCSV, DownloadXLXS, DownloadPDF { + downloadType: DownloadType; + fileName: string; + } + + interface DownloadCSV { + /** By default CSV files are created using a comma (,) delimiter. If you need to change this for any reason the you can pass the options object with a delimiter property to the download function which will then use this delimiter instead of the comma. */ + delimiter?: "string"; + /** If you need the output CSV to include a byte order mark (BOM) to ensure that output with UTF-8 characters can be correctly interpereted across didfferent applications, you should set the bom option to true */ + bom?: boolean; + } + + interface DownloadXLXS { + /** The sheet name must be a valid Excel sheet name, and cannot include any of the following characters \, /, *, [, ], :, */ + sheetName?: string; + } + + interface DownloadPDF { + orientation?: "portrait" | "landscape"; + title?: string; + rowGroupStyles?: any; + rowCalcStyles?: any; + jsPDF?: any; + autoTable?: {} | ((doc: any) => any); + } + + interface OptionsDownload { + /** If you want to make any bulk changes to the table data before it is parsed into the download file you can pass a mutator function to the downloadDataFormatter option in the table definition */ + downloadDataFormatter?: (data: any[]) => any; + + /** The downloadReady callback allows you to intercept the download file data before the users is prompted to save the file. + + In order for the download to proceed the downloadReady callback is expected to return a blob of file to be downloaded. + + If you would prefer to abort the download you can return false from this callback. This could be useful for example if you want to send the created file to a server via ajax rather than allowing the user to download the file. */ + downloadReady?: (fileContents: any, blob: any) => any; + + /** The downloadComplete callback is triggered when the user has been prompted to download the file. */ + downloadComplete?: () => void; + + /** By default Tabulator includes column headers, row groups and column calculations in the download output. + + You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the downloadConfig option in the table definition: */ + + downloadConfig?: { + columnGroups?: boolean; + rowGroups?: boolean; + columnCalcs?: boolean; + }; + } + + interface OptionsLocale { + /** You can set the current local in one of two ways. If you want to set it when the table is created, simply include the locale option in your Tabulator constructor. You can either pass in a string matching one of the language options you have defined, or pass in the boolean true which will cause Tabulator to auto-detect the browsers language settings from the navigator.language object. */ + locale?: boolean | string; + + /** You can store as many languages as you like, creating an object inside the langs object with a property of the locale code for that language. A list of locale codes can be found here. + + At present there are three parts of the table that can be localised, the column headers, the header filter placeholder text and the pagination buttons. To localize the pagination buttons, create a pagination property inside your language object and give it the properties outlined below. + + If you wish you can also localize column titles by adding a columns property to your language object. You should store a property of the field name of the column you wish to change, with a value of its title. Any fields that match this will use this title instead of the one provided by the column definition array. */ + langs?: any; + + /** When a localization event has occurred , the localized callback will triggered, passing the current locale code and language object: */ + localized?: (locale: string, lang: any) => void; + } + + type HistoryAction = "cellEdit" | "rowAdd" | "rowDelete" | "rowMoved"; + interface OptionsHistory { + /** Enable user interaction history functionality */ + history?: boolean; + + /** The historyUndo event is triggered when the undo action is triggered. */ + historyUndo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; + /** The historyRedo event is triggered when the redo action is triggered. */ + historyRedo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; + } + + interface ColumnLayout { + /** title - Required This is the title that will be displayed in the header for this column */ + title: string; + /** field - Required (not required in icon/button columns) this is the key for this column in the data array*/ + field?: string; + /** visible - (boolean, default - true) determines if the column is visible. (see Column Visibility for more details */ + visible?: boolean; + + /** sets the width of this column, this can be set in pixels or as a percentage of total table width (if not set the system will determine the best) */ + width?: number | string; + } + + interface ColumnDefinition extends ColumnLayout, CellCallbacks { + // Layout + /** sets the text alignment for this column */ + align?: "left" | "center" | "right"; // Align? + /** sets the minimum width of this column, this should be set in pixels (this takes priority over the global option of columnMinWidth) */ + minWidth?: number; + + /** The widthGrow property should be used on columns without a width property set. The value is used to work out what fraction of the available will be allocated to the column. The value should be set to a number greater than 0, by default any columns with no width set have a widthGrow value of 1 */ + widthGrow?: number; + + /** The widthShrink property should be used on columns with a width property set. The value is used to work out how to shrink columns with a fixed width when the table is too narrow to fit in all the columns. The value should be set to a number greater than 0, by default columns with a width set have a widthShrink value of 0, meaning they will not be shrunk if the table gets too narrow, and may cause the horizontal scrollbar to appear. */ + widthShrink?: number; + + /** set whether column can be resized by user dragging its edges */ + resizable?: boolean; + /** You can freeze the position of columns on the left and right of the table using the frozen property in the column definition array. This will keep the column still when the table is scrolled horizontally. */ + frozen?: boolean; + /** an integer to determine when the column should be hidden in responsive mode */ + responsive?: number; + /** sets the on hover tooltip for each cell in this column * * The tooltip parameter can take three different types of value + boolean - a value of false disables the tooltip, a value of true sets the tooltip of the cell to its value + string - a string that will be displayed for all cells in the matching column/table. + function - a callback function that returns the string for the cell + * Note: setting a tooltip value on a column will override the global setting. + */ + tooltip?: string | GlobalTooltipOption; + /** sets css classes on header and cells in this column. (value should be a string containing space separated class names) */ + cssClass?: string; + /** sets the column as a row handle, allowing it to be used to drag movable rows. */ + rowHandle?: boolean; + /** When the getHtml function is called, hide the column from the output. */ + hideInHtml?: boolean; + + // Data Manipulation + /** By default Tabulator will attempt to guess which sorter should be applied to a column based on the data contained in the first row. It can determine sorters for strings, numbers, alphanumeric sequences and booleans, anything else will be treated as a string. + +To specify a sorter to be used on a column use the sorter property in the columns definition object + +You can pass an optional additional property with sorter, sorterParams that should contain an object with additional information for configuring the sorter*/ + sorter?: "string" | "number" | "alphanum" | "boolean" | "exists" | "date" | "time" | "datetime" | "array" | ((a: any, b: any, aRow: RowComponent, bRow: RowComponent, column: ColumnComponent, dir: SortDirection, sorterParams: {}) => number); + /** If you want to dynamically generate the sorterParams at the time the sort is called you can pass a function into the property that should return the params object. */ + sorterParams?: ColumnDefinitionSorterParams | ColumnSorterParamLookupFunction; + /** set how you would like the data to be formatted*/ + formatter?: Formatter; + /** You can pass an optional additional parameter with the formatter, formatterParams that should contain an object with additional information for configuring the formatter.*/ + formatterParams?: FormatterParams; + /** alter the row height to fit the contents of the cell instead of hiding overflow */ + variableHeight?: boolean; + /** There are some circumstances where you may want to block editibility of a cell for one reason or another. To meet this need you can use the editable option. This lets you set a callback that is executed before the editor is built, if this callback returns true the editor is added, if it returns false the edit is aborted and the cell remains a non editable cell. The function is passed one parameter, the CellComponent of the cell about to be edited. You can also pass a boolean value instead of a function to this property.*/ + editable?: boolean | ((cell: CellComponent) => boolean); + /** When a user clicks on an editable column the will be able to edit the value for that cell. + + By default Tabulator will use an editor that matches the current formatter for that cell. if you wish to specify a specific editor, you can set them per column using the editor option in the column definition. Passing a value of true to this option will result in Tabulator applying the editor that best matches the columns formatter, if present. + + You can pass an optional additional parameter with the editor, editorParams that should contain an object with additional information for configuring the editor. */ + editor?: Editor; + /** additional parameters you can pass to the editor */ + editorParams?: EditorParams; + + /** Validators are used to ensure that any user input into your editable cells matches your requirements. + + Validators can be applied by using the validator property in a columns definition object (see Define Columns for more details). */ + validator?: StandardValidatorType | StandardValidatorType[] | Validator | Validator[]; + + /** Mutators are used to alter data as it is parsed into Tabulator. For example if you wanted to convert a numeric column into a boolean based on its value, before the data is used to build the table. + + You can set mutators on a per column basis using the mutator option in the column definition object. + + You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ + mutator?: CustomMutator; + /** You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ + mutatorParams?: CustomMutatorParams; + /** only called when data is loaded via a command {eg. setData). */ + mutatorData?: CustomMutator; + mutatorDataParams?: CustomMutatorParams; + + /** only called when data is changed via a user editing a cell. */ + mutatorEdit?: CustomMutator; + mutatorEditParams?: CustomMutatorParams; + + /** only called when data is changed via a user editing a cell. */ + mutatorClipboard?: CustomMutator; + mutatorClipboardParams?: CustomMutatorParams; + + /** Accessors are used to alter data as it is extracted from the table, through commands, the clipboard, or download. + + You can set accessors on a per column basis using the accessor option in the column definition object.*/ + accessor?: CustomAccessor; + /** Each accessor function has its own matching params option, for example accessorDownload has accessorDownloadParams.*/ + accessorParams?: CustomAccessorParams; + /** only called when data is being converted into a downloadable file. */ + accessorDownload?: CustomAccessor; + /** additional parameters you can pass to the accessorDownload */ + accessorDownloadParams?: CustomAccessorParams; + + /** only called when data is being copied into the clipboard. */ + accessorClipboard?: CustomAccessor; + /** additional parameters you can pass to the accessorClipboard*/ + accessorClipboardParams?: CustomAccessorParams; + + /** show or hide column in downloaded data */ + download?: boolean; + /** set custom title for column in download */ + downloadTitle?: string; + + /** the column calculation to be displayed at the top of this column(see Column Calculations for more details) */ + topCalc?: ColumnCalc; + /** additional parameters you can pass to the topCalc calculation function (see Column Calculations for more details) */ + topCalcParams?: ColumnCalcParams; + /** formatter for the topCalc calculation cell */ + topCalcFormatter?: Formatter; + /** additional parameters you can pass to the topCalcFormatter function */ + topCalcFormatterParams?: FormatterParams; + + bottomCalc?: ColumnCalc; + bottomCalcParams?: ColumnCalcParams; + bottomCalcFormatter?: Formatter; + /** additional parameters you can pass to the bottomCalcFormatter function */ + bottomCalcFormatterParams?: FormatterParams; + + // Column Header + /** By default all columns in a table are sortable by clicking on the column header, if you want to disable this behaviour, set the headerSort property to false in the column definition array: */ + headerSort?: boolean; + /** set the starting sort direction when a user first clicks on a header */ + headerSortStartingDir?: SortDirection; + + /** allow tristate toggling of column header sort direction */ + headerSortTristate?: boolean; + + /** callback for when user clicks on the header for this column*/ + headerClick?: ColumnEventCallback; + /** callback for when user double clicks on the header for this column */ + headerDblClick?: ColumnEventCallback; + /** callback for when user right clicks on the header for this column */ + headerContext?: ColumnEventCallback; + /** callback for when user taps on a header for this column, triggered in touch displays. */ + headerTap?: ColumnEventCallback; + /** callback for when user double taps on a header for this column, triggered in touch displays when a user taps the same header twice in under 300ms */ + headerDblTap?: ColumnEventCallback; + /** callback for when user taps and holds on a header for this column, triggered in touch displays when a user taps and holds the same header for 1 second. */ + headerTapHold?: ColumnEventCallback; + /** sets the on hover tooltip for the column header* * The tooltip headerTooltip can take three different types of value + + boolean - a value of false disables the tooltip, a value of true sets the tooltip of the column header to its title value. + string - a string that will be displayed for the tooltip. + function - a callback function that returns the string for the column header* + */ + headerTooltip?: boolean | string | ((column: ColumnComponent) => string); + /** change the orientation of the column header to vertical* * The headerVertical property can take one of three values: + + false - vertical columns disabled (default value) + true - vertical columns enabled + "flip" - vertical columns enabled, with text direction flipped by 180 degrees* + */ + headerVertical?: boolean | "flip"; + + /** allows the user to edit the header titles */ + editableTitle?: boolean; + /** formatter function for header title */ + titleFormatter?: Formatter; + + /** additional parameters you can pass to the header title formatter */ + titleFormatterParams?: FormatterParams; + /** filtering of columns from elements in the header */ + headerFilter?: Editor; + /** additional parameters you can pass to the header filter */ + headerFilterParams?: EditorParams; + + /** placeholder text for the header filter */ + headerFilterPlaceholder?: string; + + /** function to check when the header filter is empty */ + headerFilterEmptyCheck?: ValueBooleanCallback; + /** By default Tabulator will try and match the comparison type to the type of element used for the header filter. + + Standard input elements will use the "like" filter, this allows for the matches to be displayed as the user types. + + For all other element types (select boxes, check boxes, input elements of type number) an "=" filter type is used. + + If you want to specify the type of filter used you can pass it to the headerFilterFunc option in the column definition object. This will take any of the standard filters outlined above or a custom function*/ + headerFilterFunc?: FilterType | ((headerValue: any, rowValue: any, rowdata: any, filterparams: any) => boolean); + /** additional parameters object passed to the headerFilterFunc function */ + headerFilterFuncParams?: any; + + /** disable live filtering of the table */ + headerFilterLiveFilter?: boolean; + } + + interface CellCallbacks { + // Cell Events + /** callback for when user clicks on a cell in this column */ + cellClick?: CellEventCallback; + /** callback for when user double clicks on a cell in this column */ + cellDblClick?: CellEventCallback; + /** callback for when user right clicks on a cell in this column */ + cellContext?: CellEventCallback; + /** callback for when user taps on a cell in this column, triggered in touch displays. */ + cellTap?: CellEventCallback; + /** callback for when user double taps on a cell in this column, triggered in touch displays when a user taps the same cell twice in under 300ms. */ + cellDblTap?: CellEventCallback; + /** callback for when user taps and holds on a cell in this column, triggered in touch displays when a user taps and holds the same cell for 1 second.*/ + cellTapHold?: CellEventCallback; + + /** callback for when the mouse pointer enters a cell */ + cellMouseEnter?: CellEventCallback; + /** callback for when the mouse pointer leaves a cell */ + cellMouseLeave?: CellEventCallback; + + /** callback for when the mouse pointer enters a cell or one of its child elements */ + cellMouseOver?: CellEventCallback; + + /** callback for when the mouse pointer enters a cell or one of its child elements */ + cellMouseOut?: CellEventCallback; + + /** callback for when the mouse pointer moves over a cell */ + cellMouseMove?: CellEventCallback; + + // Cell editing + /** callback for when a cell in this column is being edited by the user */ + cellEditing?: CellEditEventCallback; + + /** callback for when a cell in this column has been edited by the user */ + cellEdited?: CellEditEventCallback; + + /** callback for when an edit on a cell in this column is aborted by the user */ + cellEditCancelled?: CellEditEventCallback; + } + + interface ColumnDefinitionSorterParams { + format?: string; + locale?: string | boolean; + alignEmptyValues?: "top" | "bottom"; + type?: "length" | "sum" | "max" | "min" | "avg"; + } + + type GlobalTooltipOption = boolean | ((cell: CellComponent) => string); + type CustomMutator = (value: any, data: any, type: "data" | "edit", mutatorParams: any, cell?: CellComponent) => any; + type CustomMutatorParams = {} | ((value: any, data: any, type: "data" | "edit", cell?: CellComponent) => any); + type CustomAccessor = (value: any, data: any, type: "data" | "download" | "clipboard", AccessorParams: any, column?: ColumnComponent) => any; + type CustomAccessorParams = {} | ((value: any, data: any, type: "data" | "download" | "clipboard", column?: ColumnComponent) => any); + type ColumnCalc = "avg" | "max" | "min" | "sum" | "concat" | "count" | ((values: any[], data: any[], calcParams: {}) => number); + type ColumnCalcParams = (values: any, data: any) => any; + type Formatter = "plaintext" | "textarea" | "html" | "money" | "image" | "datetime" | "datetimediff" | "link" | "tickCross" | "color" | "star" | "traffic" | "progress" | "lookup" | "buttonTick" | "buttonCross" | "rownum" | "handle" | ((cell: CellComponent, formatterParams: {}, onRendered: EmptyCallback) => string | HTMLElement); + type FormatterParams = MoneyParams | ImageParams | LinkParams | DateTimeParams | DateTimeDifferenceParams | TickCrossParams | TrafficParams | StarRatingParams | JSONRecord | ((cell: CellComponent) => {}); + + type Editor = true | "input" | "textarea" | "number" | "range" | "tick" | "star" | "select" | "autocomplete" | ((cell: CellComponent, onRendered: EmptyCallback, success: ValueVoidCallback, cancel: ValueVoidCallback, editorParams: {}) => HTMLElement | false); + + type EditorParams = NumberParams | CheckboxParams | SelectParams | AutoCompleteParams | ((cell: CellComponent) => {}); + + type ScrollToRowPostition = "top" | "center" | "bottom" | "nearest"; + type ScrollToColumnPosition = "left" | "center" | "middle" | "right"; + + interface MoneyParams { + // Money + decimal?: string; + thousand?: string; + symbol?: string; + symbolAfter?: boolean; + precision?: boolean | number; + } + interface ImageParams { + // Image + height?: string; + width?: string; + } + interface LinkParams { + // Link + labelField?: string; + label?: string; + urlPrefix?: string; + urlField?: string; + url?: string; + target?: string; + } + + interface DateTimeParams { + // datetime + inputFormat?: string; + outputFormat?: string; + invalidPlaceholder?: true | string | number | ValueStringCallback; + } + + interface DateTimeDifferenceParams extends DateTimeParams { + // Date Time Difference + date?: any; + humanize?: boolean; + unit?: "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds"; + suffix?: boolean; + } + interface TickCrossParams { + // Tick Cross + allowEmpty?: boolean; + allowTruthy?: boolean; + tickElement?: boolean | string; + crossElement?: boolean | string; + } + + interface TrafficParams { + // Traffic + min?: number; + max?: number; + color?: Color; + } + interface ProgressBarParams extends TrafficParams { + // Progress Bar + legend?: string | true | ValueStringCallback; + legendColor?: Color; + legendAlign?: Align; + } + + interface StarRatingParams { + // Star Rating + stars?: number; + } + + interface NumberParams { + // range,number + min?: number; + max?: number; + step?: number; + } + + interface CheckboxParams { + // tick + tristate?: boolean; + indeterminateValue?: string; + } + + interface SelectParams { + values: true | string[] | JSONRecord | SelectParamsGroup[]; + listItemFormatter?: (value: string, text: string) => string; + } + + interface SelectParamsGroup { + label: string; + value?: string | number | boolean; + options?: SelectLabelValue[]; + } + interface SelectLabelValue { + label: string; + value: string | number | boolean; + } + + interface AutoCompleteParams { + values: true | string[] | JSONRecord; + listItemFormatter?: (value: string, text: string) => string; + searchFunc: (term: string, values: string[]) => string[]; + allowEmpty?: boolean; + freetext?: boolean; + showListOnEmpty?: boolean; + } + + type ValueStringCallback = (value: any) => string; + type ValueBooleanCallback = (value: any) => boolean; + type ValueVoidCallback = (value: any) => void; + type EmptyCallback = (callback: () => void) => void; + type CellEventCallback = (e: any, cell: CellComponent) => void; + type CellEditEventCallback = (cell: CellComponent) => void; + type ColumnEventCallback = (e: any, column: ColumnComponent) => void; + type RowEventCallback = (e: any, row: RowComponent) => void; + type RowChangedCallback = (row: RowComponent) => void; + type GroupEventCallback = (e: any, group: GroupComponent) => void; + + type SortDirection = "asc" | "desc"; + type FilterType = "=" | "!=" | "like" | "<" | ">" | "<=" | ">=" | "in" | "regex"; + type Color = string | any[] | ValueStringCallback; + type Align = "center" | "left" | "right" | "justify"; + + type JSONRecord = Record; + + type StandardValidatorType = "required" | "unique" | "integer" | "float" | "numeric" | "string"; + interface Validator { + type: StandardValidatorType | ((cell: CellComponent, value: any, parameters?: any) => boolean); + parameters?: any; + } + + type ColumnSorterParamLookupFunction = (column: ColumnComponent, dir: SortDirection) => {}; + + type ColumnLookup = ColumnComponent | ColumnDefinition | HTMLElement | string; + type RowLookup = RowComponent | HTMLElement | string | number; + + interface KeyBinding { + navPrev?: string | boolean; + navNext?: string | boolean; + navLeft?: string | boolean; + navRight?: string | boolean; + navUp?: string | boolean; + navDown?: string | boolean; + undo?: string | boolean; + redo?: string | boolean; + scrollPageUp?: string | boolean; + scrollPageDown?: string | boolean; + scrollToStart?: string | boolean; + scrollToEnd?: string | boolean; + copyToClipboard?: string | boolean; + } + + // Components------------------------------------------------------------------- + + interface CellNavigation { + /** prev - next editable cell on the left, if none available move to the right most editable cell on the row above */ + prev: () => boolean; + /** next - next editable cell on the right, if none available move to left most editable cell on the row below */ + next: () => boolean; + /** left - next editable cell on the left, return false if none available on row */ + left: () => boolean; + /** right - next editable cell on the right, return false if none available on row */ + right: () => boolean; + /** up - move to the same cell in the row above */ + up: () => void; + /** down - move to the same cell in the row below */ + down: () => void; + } + + interface RowComponent { + /** The getData function returns the data object for the row.*/ + getData: () => {}; + /** The getElement function returns the DOM node for the row.*/ + getElement: () => HTMLElement; + + /** The getTable function returns the Tabulator object for the table containing the row. */ + getTable: () => Tabulator; + + /** The getNextRow function returns the Row Component for the next visible row in the table, if there is no next row it will return a value of false */ + getNextRow: () => RowComponent | false; + /** The getNextRow function returns the Row Component for the previous visible row in the table, if there is no next row it will return a value of false */ + getPrevRow: () => RowComponent | false; + + /** The getCells function returns an array of CellComponent objects, one for each cell in the row.*/ + getCells: () => CellComponent[]; + /** The getCell function returns the CellComponent for the specified column from this row.*/ + getCell: (column: ColumnComponent | HTMLElement | string) => CellComponent; + /** The getIndex function returns the index value for the row. (this is the value from the defined index column, NOT the row's position in the table)*/ + getIndex: () => any; + + /** Use the getPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + + If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional first argument of the function. */ + getPosition: (filteredPosition?: boolean) => number; + + /** When using grouped rows, you can retrieve the group component for the current row using the getGroup function. */ + getGroup: () => GroupComponent; + /** The delete function deletes the row, removing its data from the table + * + * The delete method returns a promise, this can be used to run any other commands that have to be run after the row has been deleted. By running them in the promise you ensure they are only run after the row has been deleted. + */ + delete: () => Promise; + /** The scrollTo function will scroll the table to the row if it passes the current filters.*/ + scrollTo: () => Promise; + + /** The pageTo function will load the page for the row if it passes the current filters.*/ + pageTo: () => Promise; + + /** You can move a row next to another row using the move function. + + The first argument should be the target row that you want to move to, and can be any of the standard row component look up options. + + The second argument determines whether the row is moved to above or below the target row. A value of false will cause to the row to be placed below the target row, a value of true will result in the row being placed above the target*/ + + move: (lookup: RowComponent | HTMLElement | number, belowTarget?: boolean) => void; + + /** You can update the data in the row using the update function. You should pass an object to the function containing any fields you wish to update. This object will not replace the row data, only the fields included in the object will be updated.*/ + update: (data: {}) => Promise; + /** The select function will select the current row.*/ + select: () => void; + /** The deselect function will deselect the current row.*/ + deselect: () => void; + /** The deselect function will toggle the current row.*/ + toggleSelect: () => void; + /** The isSelected function will return a boolean representing the current selected state of the row. */ + isSelected: () => boolean; + /** If you are making manual adjustments to elements contained within the row, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the normalizeHeight function to do this.*/ + normalizeHeight: () => void; + + /** If you want to re-format a row once it has been rendered to re-trigger the cell formatters and the rowFormatter callback, Call the reformat function. */ + reformat: () => void; + + /** You can freeze a row at the top of the table by calling the freeze function. This will insert the row above the scrolling portion of the table in the table header. */ + freeze: () => void; + + /** A frozen row can be unfrozen using the unfreeze function. This will remove the row from the table header and re-insert it back in the table. */ + unfreeze: () => void; + + /** When the tree structure is enabled the treeExpand function will expand current row and show its children. */ + treeExpand: () => void; + + /** When the tree structure is enabled the treeCollapse function will collapse current row and hide its children */ + treeCollapse: () => void; + + /** When the tree structure is enabled the treeToggle function will toggle the collapsed state of the current row. */ + treeToggle: () => void; + + /** When the tree structure is enabled the getTreeParent function will return the Row Component for the parent of this row. If no parent exists, a value of false will be returned. */ + getTreeParent: () => RowComponent | false; + /** When the tree structure is enabled the getTreeChildren function will return an array of Row Components for this rows children. */ + getTreeChildren: () => RowComponent[]; + } + + interface GroupComponent { + /** The getElement function returns the DOM node for the group header. */ + getElement: () => HTMLElement; + + /** The getTable function returns the Tabulator object for the table containing the group */ + getTable: () => Tabulator; + + /** The getKey function returns the unique key that is shared between all rows in this group. */ + getKey: () => any; + + /** The getRows function returns an array of RowComponent objects, one for each row in the group */ + getRows: () => RowComponent[]; + + /** The getSubGroups function returns an array of GroupComponent objects, one for each sub group of this group. */ + getSubGroups: () => GroupComponent[]; + + /** The getParentGroup function returns the GroupComponent for the parent group of this group. if no parent exists, this function will return false */ + getParentGroup: () => GroupComponent | false; + + /** The getVisibility function returns a boolean to show if the group is visible, a value of true means it is visible.*/ + getVisibility: () => boolean; + + /** The show function shows the group if it is hidden. */ + show: () => void; + /** The hide function hides the group if it is visible. */ + hide: () => void; + /** The toggle function toggles the visibility of the group, switching between hidden and visible. */ + toggle: () => void; + } + + interface ColumnComponent { + /*The getElement function returns the DOM node for the colum*/ + getElement: () => HTMLElement; + /** The getTable function returns the Tabulator object for the table containing the column */ + getTable: () => Tabulator; + /** The getDefinition function returns the column definition object for the column.*/ + getDefinition: () => ColumnDefinition; + /** The getField function returns the field name for the column.*/ + getField: () => string; + /** The getCells function returns an array of CellComponent objects, one for each cell in the column.*/ + getCells: () => CellComponent[]; + + /** The getNextColumn function returns the Column Component for the next visible column in the table, if there is no next column it will return a value of false. */ + getNextColumn: () => ColumnComponent | false; + /** The getPrevColumn function returns the Column Component for the previous visible column in the table, if there is no previous column it will return a value of false. */ + getPrevColumn: () => ColumnComponent | false; + /** The getVisibility function returns a boolean to show if the column is visible, a value of true means it is visible.*/ + getVisibility: () => boolean; + /** The show function shows the column if it is hidden.*/ + show: () => void; + /** The hide function hides the column if it is visible.*/ + hide: () => void; + /** The toggle function toggles the visibility of the column, switching between hidden and visible.*/ + toggle: () => void; + /** The delete function deletes the column, removing it from the table*/ + delete: () => void; + /** The scrollTo function will scroll the table to the column if it is visible. */ + scrollTo: () => Promise; + /** The getSubColumns function returns an array of ColumnComponent objects, one for each sub column of this column. */ + getSubColumns: () => ColumnComponent[]; + + /** The getParentColumn function returns the ColumnComponent for the parent column of this column. if no parent exists, this function will return false */ + getParentColumn: () => ColumnComponent | false; + /** The headerFilterFocus function will place focus on the header filter element for this column if it exists. */ + headerFilterFocus: () => void; + /** The setHeaderFilterValue function set the value of the columns header filter element to the value provided in the first argument. */ + setHeaderFilterValue: (value: any) => void; + /** The reloadHeaderFilter function rebuilds the header filter element, updating any params passed into the editor used to generate the filter. */ + reloadHeaderFilter: () => void; + } + + interface CellComponent { + /** The getValue function returns the current value for the cell. */ + getValue: () => any; + /** The getOldValue function returns the previous value of the cell. Very usefull in the event of cell update callbacks. */ + getOldValue: () => any; + /** The restoreOldValue reverts the value of the cell back to its previous value, without triggering any of the cell edit callbacks. */ + restoreOldValue: () => any; + /** The getElement function returns the DOM node for the cell. */ + + getElement: () => HTMLElement; + /** The getTable function returns the Tabulator object for the table containing the cell. */ + getTable: () => Tabulator; + /** The getRow function returns the RowComponent for the row that contains the cell. */ + getRow: () => RowComponent; + + /** The getColumn function returns the ColumnComponent for the column that contains the cell. */ + getColumn: () => ColumnComponent; + + /** The getData function returns the data for the row that contains the cell. */ + getData: () => {}; + /** The getField function returns the field name for the column that contains the cell. */ + getField: () => string; + /** You can change the value of the cell using the setValue function. The first parameter should be the new value for the cell, the second optional parameter will apply the column mutators to the value when set to true (default = true). */ + setValue: (value: any, mutate?: boolean) => void; + /** If you are making manual adjustments to elements contained withing the cell, or the cell itself, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the checkHeight function to check if the height of the cell has changed and normalize the row if it has. */ + checkHeight: () => void; + /** You and programatically cause a cell to open its editor element using the edit function */ + edit: (ignoreEditable?: boolean) => void; + /** You and programatically cancel a cell edit that is currently in progress by calling the cancelEdit function */ + cancelEdit: () => void; + /** When a cell is being edited it is possible to move the editor focus from the current cell to one if its neighbours. There are a number of functions that can be called on the nav function to move the focus in different directions. */ + nav: () => CellNavigation; + } +} + +// Tabulator.prototype.(?!registerModule|helpers|_)\w+ +declare class Tabulator { + constructor(selector: string | HTMLElement, options?: Tabulator.Options); + + columnManager: any; + rowManager: any; + footerManager: any; + browser: string; + browserSlow: boolean; + modules: any; + options: Tabulator.Options; + + /** You have a choice of four file types to choose from: + csv - Comma separated value file + json - JSON formatted text file + xlsx - Excel File (Requires the SheetJS Library) + pdf - PDF File (Requires the jsPDF Library and jsPDF-AutoTable Plugin) + To trigger a download, call the download function, passing the file type (from the above list) as the first argument, and an optional second argument of the file name for the download (if this is left out it will be "Tabulator.ext"). The optional third argument is an object containing any setup options for the formatter, such as the delimiter choice for CSV's). + + The PDF downloader requires that the jsPDF Library and jsPDF-AutoTable Plugin be included on your site, this can be included with the following script tags. + + If you want to create a custom file type from the table data then you can pass a function to the type argument, instead of a string value. At the end of this function you must call the setFileContents function, passing the formatted data and the mime type. + */ + download: (downloadType: Tabulator.DownloadType | ((columns: Tabulator.ColumnDefinition[], data: any, options: any, setFileContents: any) => any), fileName: string, params?: Tabulator.DownloadOptions) => void; + + /** If you want to open the generated file in a new browser tab rather than downloading it straight away, you can use the downloadToTab function. This is particularly useful with the PDF downloader, as it allows you to preview the resulting PDF in a new browser ta */ + downloadToTab: (downloadType: Tabulator.DownloadType, fileName: string, params?: Tabulator.DownloadOptions) => void; + + /** The copyToClipboard function allows you to copy the current table data to the clipboard. + + The first argument is the copy selector, you can choose from any of the built in options or pass a function in to the argument, that must return the selected row components. + + If you leave this argument undefined, Tabulator will use the value of the clipboardCopySelector property, which has a default value of table */ + copyToClipboard: (type: "selection" | "table") => void; + + /** With history enabled you can use the undo function to automatically undo a user action, the more times you call the function, the further up the history log you go. */ + undo: () => boolean; + + /** You can use the getHistoryUndoSize function to get a count of the number of history undo actions available. */ + getHistoryUndoSize: () => number | false; + + /** With history enabled you can use the redo function to automatically redo user action that has been undone, the more times you call the function, the further up the history log you go. once a user interacts with the table then can no longer redo any further actions until an undo is performe */ + redo: () => boolean; + + /** You can use the getHistoryRedoSize function to get a count of the number of history redo actions available.*/ + getHistoryRedoSize: () => number | false; + /** Deconstructor */ + destroy: () => void; + /** By default Tabulator will only allow files with a .json extension to be loaded into the table. + + You can allow any other type of file into the file picker by passing the extension or mime type into the first argument of the setDataFromLocalFile function as a comma separated list. This argument will accept any of the values valid for the accept field of an input element */ + setDataFromLocalFile: (extensions: string) => void; + setData: (data: any, params?: any, config?: any) => Promise; + /** You can remove all data from the table using clearData */ + clearData: () => void; + /** You can retrieve the data stored in the table using the getData function. */ + getData: (activeOnly?: boolean) => any[]; + getDataCount: (activeOnly?: boolean) => number; + /** The searchRows function allows you to retreive an array of row components that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + searchRows: Tabulator.FilterFunction; + /** The searchData function allows you to retreive an array of table row data that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + searchData: Tabulator.FilterFunction; + /** You can retrieve the table data as a simple HTML table using the getHtml function. */ + getHtml: (activeOnly?: boolean) => void; + /** You can retrieve the current AJAX URL of the table with the getAjaxUrl function. + * + * This will return a HTML encoded string of the table data. + + By default getHtml will return a table containing all the data held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. + */ + getAjaxUrl: () => string; + /** The replaceData function lets you silently replace all data in the table without updating scroll position, sort or filtering, and without triggering the ajax loading popup. This is great if you have a table you want to periodically update with new/updated information without alerting the user to a change. + + It takes the same arguments as the setData function, and behaves in the same way when loading data (ie, it can make ajax requests, parse JSON etc) */ + replaceData: (data?: Array<{}> | string, params?: any, config?: any) => Promise; + /** If you want to update an existing set of data in the table, without completely replacing the data as the setData method would do, you can use the updateData method. + + This function takes an array of row objects and will update each row based on its index value. (the index defaults to the "id" parameter, this can be set using the index option in the tabulator constructor). Options without an index will be ignored, as will items with an index that is not already in the table data. The addRow function should be used to add new data to the table. */ + updateData: (data: Array<{}>) => Promise; + /** The addData method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. */ + addData: (data?: Array<{}>, addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; + + /** If the data you are passng to the table contains a mix of existing rows to be updated and new rows to be added then you can call the updateOrAddData function. This will check each row object provided and update the existing row if available, or else create a new row with the data. */ + updateOrAddData: (data: Array<{}>) => Promise; + /** To rereive the DOM Node of a specific row, you can retrieve the RowComponent with the getRow function, then use the getElement function on the component. The first argument is the row you are looking for, it will take any of the standard row component look up options. */ + getRow: (row: Tabulator.RowLookup) => Tabulator.RowComponent; + + /** You can retrieve the Row Component of a row at a given position in the table using getRowFromPosition function. By default this will return the row based in its position in all table data, including data currently filtered out of the table. + + If you want to get a row based on its position in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. */ + getRowFromPosition: (position: number, activeOnly?: boolean) => void; + /** You can delete any row in the table using the deleteRow function. */ + deleteRow: (row: Tabulator.RowLookup) => void; + + /** You can add a row to the table using the addRow function. + + The first argument should be a row data object. If you do not pass data for a column, it will be left empty. To create a blank row (ie for a user to fill in), pass an empty object to the function. + + The second argument is optional and determines whether the row is added to the top or bottom of the table. A value of true will add the row to the top of the table, a value of false will add the row to the bottom of the table. If the parameter is not set the row will be placed according to the addRowPos global option. */ + addRow: (data?: {}, addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; + /** If you don't know whether a row already exists you can use the updateOrAddRow function. This will check if a row with a matching index exists, if it does it will update it, if not it will add a new row with that data. This takes the same arguments as the updateRow function. */ + updateOrAddRow: (row: Tabulator.RowLookup, data: {}) => Promise; + /** You can update any row in the table using the updateRow function. + + The first argument is the row you want to update, it will take any of the standard row component look up options. + + The second argument should be the updated data object for the row. As with the updateData function, this will not replace the existing row data object, it will only update any of the provided parameters. + + Once complete, this function will trigger the rowUpdated and dataEdited events. + + This function will return true if the update was successful or false if the requested row could not be found. If the new data matches the existing row data, no update will be performed. + */ + updateRow: (row: Tabulator.RowLookup, data: {}) => boolean; + /** If you want to trigger an animated scroll to a row then you can use the scrollToRow function. + + The first argument should be any of the standard row component look up options for the row you want to scroll to. + + The second argument is optional, and is used to set the position of the row, it should be a string with a value of either top, center, bottom or nearest, if omitted it will be set to the value of the scrollToRowPosition option which has a default value of top. + + The third argument is optional, and is a boolean used to set if the table should scroll if the row is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToRowIfVisible option, which defaults to true */ + scrollToRow: (row: Tabulator.RowLookup, position?: Tabulator.ScrollToRowPostition, ifVisible?: boolean) => Promise; + /** If you want to programmatically move a row to a new position you can use the moveRow function. + + The first argument should be the row you want to move, and can be any of the standard row component look up options. + + The second argument should be the target row that you want to move to, and can be any of the standard row component look up options. + + The third argument determines whether the row is moved to above or below the target row. A value of false will cause to the row to be placed below the target row, a value of true will result in the row being placed above the target */ + moveRow: (fromRow: Tabulator.RowLookup, toRow: Tabulator.RowLookup, placeAboveTarget?: boolean) => void; + /** You can retrieve all the row components in the table using the getRows function.* By default getRows will return an array containing all the Row Component's held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. + */ + getRows: (activeOnly?: boolean) => Tabulator.RowComponent[]; + /** Use the getRowPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + + The first argument is the row you are looking for, it will take any of the standard row component look up options. If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. + + Note: If the row is not found, a value of -1 will be returned, row positions start at 0 + */ + getRowPosition: (row: Tabulator.RowLookup, activeOnly?: boolean) => number; + /** To replace the current column definitions for a table use the setColumns function. This function takes a column definition array as its only argument. */ + setColumns: (definitions: Tabulator.ColumnDefinition[]) => void; + /** To get an array of Column Components for the current table setup, call the getColumns function. This will only return actual data columns not column groups. + ** To get a structured array of Column Components that includes column groups, pass a value of true as an argument. + */ + getColumns: (includeColumnGroups?: boolean) => Tabulator.ColumnComponent[] | Tabulator.GroupComponent[]; + /** Using the getColumn function you can retrieve the Column Component */ + getColumn: (column: Tabulator.ColumnLookup) => Tabulator.ColumnComponent; + /** To get the current column definition array (including any changes made through user actions, such as resizing or re-ordering columns), call the getColumnDefinitions function. this will return the current columns definition array. */ + getColumnDefinitions: () => Tabulator.ColumnDefinition[]; + /** If you want to handle column layout persistence manually, for example storing it in a database to use elsewhere, you can use the getColumnLayout function to retrieve a layout object for the current table. */ + getColumnLayout: () => Tabulator.ColumnLayout[]; + /** If you have previously used the getColumnLayout function to retrieve a tables layout, you can use the setColumnLayout function to apply it to a table. */ + setColumnLayout: (layout: Tabulator.ColumnLayout) => void; + /** You can show a hidden column at any point using the showColumn function. */ + showColumn: (column?: Tabulator.ColumnLookup) => void; + /** You can hide a visible column at any point using the hideColumn function. */ + hideColumn: (column?: Tabulator.ColumnLookup) => void; + /** You can toggle the visibility of a column at any point using the toggleColumn function. */ + toggleColumn: (column?: Tabulator.ColumnLookup) => void; + /** If you wish to add a single column to the table, you can do this using the addColumn function. + * This function takes three arguments: + + Columns Definition - The column definition object for the column you want to add. + Before (optional) - Determines how to position the new column. A value of true will insert the column to the left of existing columns, a value of false will insert it to the right. If a Position argument is supplied then this will determine whether the new colum is inserted before or after this column. + Position (optional) - The field to insert the new column next to, this can be any of the standard column component look up options. +* + */ + addColumn: (definition: Tabulator.ColumnDefinition, insertRightOfTarget?: boolean, positionTarget?: Tabulator.ColumnLookup) => void; + /** To permanently remove a column from the table deleteColumn function. This function takes any of the standard column component look up options as its first parameter */ + deleteColumn: (column: Tabulator.ColumnLookup) => void; + /** If you want to trigger an animated scroll to a column then you can use the scrollToColumn function. The first argument should be any of the standard column component look up options for the column you want to scroll to. + + The second argument is optional, and is used to set the position of the column, it should be a string with a value of either left, middle or right, if omitted it will be set to the value of the scrollToColumnPosition option which has a default value of left. + + The third argument is optional, and is a boolean used to set if the table should scroll if the column is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToColumnIfVisible option, which defaults to true + */ + scrollToColumn: (column: Tabulator.ColumnLookup, position?: Tabulator.ScrollToColumnPosition, ifVisible?: boolean) => Promise; + /** You can also set the language at any point after the table has loaded using the setLocale function, which takes the same range of values as the locale setup option mentioned above. */ + setLocale: (locale: string | boolean) => void; + /** It is possible to retrieve the locale code currently being used by Tabulator using the getLocale function: */ + getLocale: () => string; + /** You can then access these at any point using the getLang function, which will return the language object for the currently active locale. */ + getLang: (locale?: string) => any; + /** If the size of the element containing the Tabulator changes (and you are not able to use the in built auto-resize functionality) or you create a table before its containing element is visible, it will necessary to redraw the table to make sure the rows and columns render correctly. + + This can be done by calling the redraw method. For example, to trigger a redraw whenever the viewport width is changed. + + The redraw function also has an optional boolean argument that when set to true triggers a full rerender of the table including all data on all rows.*/ + redraw: (force?: boolean) => void; + /** If you want to manually change the height of the table at any time, you can use the setHeight function, which will also redraw the virtual DOM if necessary. */ + setHeight: (height: number) => void; + /** You can trigger sorting using the setSort function */ + setSort: (sortList: string | Tabulator.Sorter[], dir?: Tabulator.SortDirection) => void; + getSorters: () => void; + /** To remove all sorting from the table, call the clearSort function. */ + clearSort: () => void; + /** To set a filter you need to call the setFilter method, passing the field you wish to filter, the comparison type and the value to filter for. + + This function will replace any exiting filters on the table with the specified filter + + If you want to perform a more complicated filter then you can pass a callback function to the setFilter method, you can also pass an optional second argument, an object with parameters to be passed to the filter function. + */ + setFilter: (p1: string | Tabulator.Filter[] | any[] | ((data: any, filterParams: any) => boolean), p2?: Tabulator.FilterType | {}, value?: any) => void; + /** If you want to add another filter to the existing filters then you can call the addFilter function: */ + addFilter: Tabulator.FilterFunction; + /** You can retrieve an array of the current programtic filters using the getFilters function, this will not include any of the header filters: */ + getFilters: (includeHeaderFilters: boolean) => Tabulator.Filter[]; + /** You can programatically set the header filter value of a column by calling the setHeaderFilterValue function, This function takes any of the standard column component look up options as its first parameter, with the value for the header filter as the second option */ + setHeaderFilterValue: (column: Tabulator.ColumnLookup, value: string) => void; + + /** You can programatically set the focus on a header filter element by calling the setHeaderFilterFocus function, This function takes any of the standard column component look up options as its first parameter */ + setHeaderFilterFocus: (column: Tabulator.ColumnLookup) => void; + /** If you just want to retrieve the current header filters, you can use the getHeaderFilters function: */ + getHeaderFilters: () => Tabulator.Filter[]; + /** If you want to remove one filter from the current list of filters you can use the removeFilter function: */ + removeFilter: Tabulator.FilterFunction; + /** To remove all filters from the table, use the clearFilter function. */ + clearFilter: (includeHeaderFilters: boolean) => void; + /** To remove just the header filters, leaving the programatic filters in place, use the clearHeaderFilter function. */ + clearHeaderFilter: () => void; + /** To programmatically select a row you can use the selectRow function. + + To select a specific row you can pass the any of the standard row component look up options into the first argument of the function. If you leave the argument blank you will select all rows (if you have set the selectable option to a numeric value, it will be ignored when selecting all rows). */ + selectRow: (row?: Tabulator.RowLookup) => void; + deselectRow: (row?: Tabulator.RowLookup) => void; + toggleSelectRow: (row?: Tabulator.RowLookup) => void; + /** To get the RowComponent's for the selected rows at any time you can use the getSelectedRows function. + + This will return an array of RowComponent's for the selected rows in the order in which they were selected. */ + getSelectedRows: () => Tabulator.RowComponent[]; + /** To get the data objects for the selected rows you can use the getSelectedData function. + + This will return an array of the selected rows data objects in the order in which they were selected */ + getSelectedData: () => any[]; + /** set the maxmum page */ + setMaxPage: (max: number) => void; + /** When pagination is enabled the table footer will contain a number of pagination controls for navigating through the data. + + In addition to these controls it is possible to change page using the setPage function + The setPage function takes one parameter, which should be an integer representing the page you wish to see. There are also four strings that you can pass into the parameter for special functions. + + "first" - show the first page + "prev" - show the previous page + "next" - show the next page + "last" - show the last page + The setPage method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. + */ + setPage: (page: number | "first" | "prev" | "next" | "last") => Promise; + /** You can load the page for a specific row using the setPageToRow function and passing in any of the standard row component look up options for the row you want to scroll to. + ** The setPageToRow method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. + */ + setPageToRow: (row: Tabulator.RowLookup) => Promise; + + /** You can change the page size at any point by using the setPageSize function. (this setting will be ignored if using remote pagination with the page size set by the server) */ + setPageSize: (size: number) => void; + /** To retrieve the number of rows allowed per page you can call the getPageSize function: */ + getPageSize: () => number; + /** You can change to show the previous page using the previousPage function. */ + previousPage: () => Promise; + /** You can change to show the next page using the previousPage function. */ + + nextPage: () => Promise; + /** To retrieve the current page use the getPage function. this will return the number of the current page. If pagination is disabled this will return false. */ + getPage: () => number | false; + /** To retrieve the maximum available page use the getPageMax function. this will return the number of the maximum available page. If pagination is disabled this will return false. */ + getPageMax: () => number | false; + /** You can use the setGroupBy function to change the fields that rows are grouped by. This function has one argument and takes the same values as passed to the groupBy setup option. */ + setGroupBy: (groups: string | ((data: any) => any)) => void; + /** You can use the setGroupStartOpen function to change the default open state of groups. This function has one argument and takes the same values as passed to the groupStartOpen setup option. + ** Note: If you use the setGroupStartOpen or setGroupHeader before you have set any groups on the table, the table will not update until the setGroupBy function is called. + */ + setGroupStartOpen: (values: boolean | ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => boolean)) => void; + /** You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + setGroupHeader: (values: ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => string) | Array<(value: any, count: number, data: any) => string>) => void; + /** You can use the getGroups function to retrieve an array of all the first level Group Components in the table. */ + getGroups: () => Tabulator.GroupComponent[]; + /** get grouped table data in the same format as getData() */ + getGroupedData: (activeOnly?: boolean) => any; + /** You can retrieve the results of the column calculations at any point using the getCalcResults function.* For a table without grouped rows, this will return an object with top and bottom properties, that contain a row data object for all the columns in the table for the top calculations and bottom calculations respectively. + */ + getCalcResults: () => any; + /** Use the navigatePrev function to shift focus to the next editable cell on the left, if none available move to the right most editable cell on the row above. + * + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigatePrev: () => void; + /** Use the navigateNext function to shift focus to the next editable cell on the right, if none available move to left most editable cell on the row below.* + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateNext: () => void; + /** Use the navigateLeft function to shift focus to next editable cell on the left, return false if none available on row.* + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateLeft: () => void; + /** Use the navigateRight function to shift focus to next editable cell on the right, return false if none available on row.* + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateRight: () => void; + /** Use the navigateUp function to shift focus to the same cell in the row above. + + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateUp: () => void; + + /*Use the navigateDown function to shift focus to the same cell in the row below. + + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateDown: () => void; + + /** A lot of the modules come with a range of default settings to make setting up your table easier, for example the sorters, formatters and editors that ship with Tabulator as standard. + + If you are using a lot of custom settings over and over again (for example a custom sorter). you can end up re-delcaring it several time for different tables. To make your life easier Tabulator allows you to extend the default setup of each module to make your custom options as easily accessible as the defaults. + + Using the extendModule function on the global Tabulator variable allows you to globally add these options to all tables. + + The function takes three arguments, the name of the module, the name of the property you want to extend, and an object containing the elements you want to add in your module. In the example below we extend the format module to add two new default formatters: */ + extendModule: (name: string, property: string, values: {}) => void; +} diff --git a/types/tabulator-tables/tabulator-tables-tests.ts b/types/tabulator-tables/tabulator-tables-tests.ts new file mode 100644 index 0000000000..3a33817b4f --- /dev/null +++ b/types/tabulator-tables/tabulator-tables-tests.ts @@ -0,0 +1,433 @@ +// tslint:disable:no-object-literal-type-assertion +// tslint:disable:whitespace + +// constructor +let table = new Tabulator("#test"); +table.copyToClipboard("selection"); +table.searchRows("name", "<", 3); +table.setFilter("name", "<=", 3); +table.setFilter([ + { field: "age", type: ">", value: 52 }, // filter by age greater than 52 + { field: "height", type: "<", value: 142 }, // and by height less than 142 + { field: "name", type: "in", value: ["steve", "bob", "jim"] } // name must be steve, bob or jim +]); +table.setFilter( + (data, filterParams) => { + // data - the data for the row being filtered + // filterParams - params object passed to the filter + return data.name === "bob" && data.height < filterParams.height; // must return a boolean, true if it passes the filter. + }, + { height: 3 } +); +table.setFilter("age", "in", ["steve", "bob", "jim"]); +table.setFilter([ + { field: "age", type: ">", value: 52 }, // filter by age greater than 52 + [ + { field: "height", type: "<", value: 142 }, // with a height of less than 142 + { field: "name", type: "=", value: "steve" } // or a name of steve + ] +]); + +table + .setPageToRow(12) + .then(() => { + // run code after table has been successfuly updated + }) + .catch(error => { + // handle error loading data + }); + +table.setGroupBy("gender"); +table.setGroupStartOpen(true); + +table.setGroupHeader((value, count, data, group) => { + return ""; +}); +table.setGroupHeader((value, count, data) => { + return ""; +}); + +table.setSort([ + { column: "age", dir: "asc" }, // sort by this first + { column: "height", dir: "desc" } // then sort by this second +]); + +table + .scrollToColumn("age", "middle", false) + .then(() => { + // run code after column has been scrolled to + }) + .catch(error => { + // handle error scrolling to column + }); + +table + .updateOrAddData([{ id: 1, name: "bob" }, { id: 3, name: "steve" }]) + .then(rows => { + // rows - array of the row components for the rows updated or added + // run code after data has been updated + }) + .catch(error => { + // handle error updating data + }); + +table.updateData([{ id: 1, name: "bob", gender: "male" }, { id: 2, name: "Jenny", gender: "female" }]); +table + .updateData([{ id: 1, name: "bob" }]) + .then(() => { + // run code after data has been updated + }) + .catch(error => { + // handle error updating data + }); + +let row1: Tabulator.RowComponent; +let row2: Tabulator.RowComponent; + +// column definitions +let colDef: Tabulator.ColumnDefinition = { title: "title" }; +colDef.sorter = customSorter; + +// prettier-ignore +function customSorter(a: any, b: any, aRow: Tabulator.RowComponent, + bRow: Tabulator.RowComponent, column: Tabulator.ColumnComponent, + dir: Tabulator.SortDirection, sorterParams: Tabulator.ColumnDefinitionSorterParams): number { + return 1; +} + +colDef.sorterParams = (col: Tabulator.ColumnComponent, dir: Tabulator.SortDirection) => { + return {}; +}; +colDef.sorterParams = { format: "DD/MM/YY" }; +colDef.formatterParams = { + invalidPlaceholder: val => { + return ""; + } +}; + +colDef.formatterParams = cell => { + // cell - the cell component + + // do some processing and return the param object + return { param1: "green" }; +}; + +// List lookup +colDef.formatterParams = { + small: "Cute", + medium: "Fine", + big: 2, + huge: true +}; +// Custom Formatter +colDef.formatter = (cell: Tabulator.CellComponent, formatterParams: {}, onRendered) => { + onRendered = () => {}; + return ""; +}; + +colDef.editor = true; +colDef.editor = "number"; +colDef.editor = (cell, onRendered, success, cancel, editorParams) => { + // cell - the cell component for the editable cell + // onRendered - function to call when the editor has been rendered + // success - function to call to pass the successfuly updated value to Tabulator + // cancel - function to call to abort the edit and return to a normal cell + // editorParams - params object passed into the editorParams column definition property + + // create and style editor + const editor = document.createElement("input"); + + editor.setAttribute("type", "date"); + + // create and style input + editor.style.padding = "3px"; + editor.style.width = "100%"; + editor.style.boxSizing = "border-box"; + + // Set value of editor to the current value of the cell + editor.value = moment(cell.getValue(), "DD/MM/YYYY"); + + // set focus on the select box when the editor is selected (timeout allows for editor to be added to DOM) + onRendered(() => { + editor.focus(); + editor.style.cssText = "100%"; + }); + + // when the value has been set, trigger the cell to update + function successFunc() { + success(moment(editor.value, "YYYY-MM-DD")); + } + + editor.addEventListener("change", successFunc); + editor.addEventListener("blur", successFunc); + + // return the editor element + return editor; +}; +// Dummy function +function moment(a: any, b: any) { + return ""; +} + +colDef.cellClick = (_e, cell) => { + console.log(cell.checkHeight); +}; + +colDef.formatterParams = { stars: 3 }; + +colDef.editorParams = {}; +colDef.editorParams = { + values: [ + { + // option group + label: "Men", + options: [ + // options in option group + { + label: "Steve Boberson", + value: "steve" + }, + { + label: "Bob Jimmerson", + value: "bob" + } + ] + }, + { + // option group + label: "Women", + options: [ + // options in option group + { + label: "Jenny Jillerson", + value: "jenny" + }, + { + label: "Jill Betterson", + value: "jill" + } + ] + }, + { + // ungrouped option + label: "Other", + value: "other" + } + ] +}; + +let selectParamValues: Tabulator.JSONRecord; +selectParamValues = { + steve: "Steve Boberson", + bob: "Bob Jimmerson", + jim: true +}; +colDef.editorParams = { + values: selectParamValues +}; + +colDef.editorParams = cell => { + return {}; +}; + +let autoComplete: Tabulator.AutoCompleteParams = { + showListOnEmpty: true, // show all values when the list is empty, + freetext: true, // allow the user to set the value of the cell to a free text entry + allowEmpty: true, // allow empty string values + searchFunc: (term, values) => { + // search for exact matches + const matches: string[] = []; + return matches; + }, + listItemFormatter: (value, title) => { + // prefix all titles with the work "Mr" + return "Mr " + title; + }, + values: true // create list of values from all values contained in this column +}; +colDef.editorParams = autoComplete; + +colDef.editorParams = { + values: [ + { + // option group + label: "Men", + options: [ + // options in option group + { + label: "Steve Boberson", + value: "steve" + }, + { + label: "Bob Jimmerson", + value: "bob" + } + ] + }, + { + // option group + label: "Women", + options: [ + // options in option group + { + label: "Jenny Jillerson", + value: "jenny" + }, + { + label: "Jill Betterson", + value: "jill" + } + ] + }, + { + // ungrouped option + label: "Other", + value: "other" + } + ] +}; + +// Validators +colDef.validator = { + type: (cell, value, parameters) => { + return true; + }, + parameters: { + divisor: 5 + } +}; +colDef.validator = "float"; +colDef.validator = { type: "float", parameters: {} }; + +let validators: Tabulator.Validator[] = [ + { type: "integer", parameters: {} }, + { + type: (cell, value, parameters) => { + return true; + }, + parameters: {} + } +]; + +colDef.headerFilterFunc = "!="; +colDef.headerFilterFunc = (headerValue, rowValue, rowData, filterParams) => { + return rowData.name === filterParams.name && rowValue < headerValue; // must return a boolean, true if it passes the filter. +}; + +// Cell Component + +let cell = {}; +cell.nav().down(); + +let data = cell.getData(); +table = cell.getTable(); + +// Row Component +let row = {}; +row.delete() + .then(() => { + // run code after row has been deleted + }) + .catch(error => { + // handle error deleting row + }); + +// Options +let options = {}; +options.keybindings = { + navPrev: "ctrl + 1", + navNext: false +}; + +options.downloadDataFormatter = data => { + // data.forEach(function(row){ + // row.age = row.age >= 18 ? "adult" : "child"; +}; + +options.downloadConfig = { + columnGroups: false, // include column groups in column headers for download + rowGroups: false, // do not include row groups in download + columnCalcs: false // do not include column calculation rows in download +}; + +options.ajaxConfig = "GET"; +options.ajaxConfig = { + mode: "cors", // set request mode to cors + credentials: "same-origin", // send cookies with the request from the matching origin + headers: { + Accept: "application/json", // tell the server we need JSON back + "X-Requested-With": "XMLHttpRequest", // fix to help some frameworks respond correctly to request + "Content-type": "application/json; charset=utf-8", // set the character encoding of the request + "Access-Control-Allow-Origin": "http:// yout-site.com" // the URL origin of the site making the request + } +}; +options.ajaxConfig = { + method: "POST", // set request type to Position + headers: { + "Content-type": "application/json; charset=utf-8" // set specific content type + } +}; + +options.ajaxContentType = { + headers: { + "Content-Type": "text/html" + }, + body: (url, config, params) => { + // url - the url of the request + // config - the fetch config object + // params - the request parameters + + // return comma list of params:values + const output = []; + + for (const key in params) { + output.push(`${key} ":" ${params[key]}`); + } + + return output.join(","); + } +}; + +options.initialSort = [{ column: "name", dir: "asc" }, { column: "name2", dir: "desc" }]; +options.initialFilter = [{ field: "color", type: "=", value: "red" }]; +options.initialHeaderFilter = [ + { field: "color", value: "red" } // set the initial value of the header filter to "red" +]; + +options.groupValues = [ + ["red", "blue", "green"], // create groups for color values of "red", "blue", and "green", + [10, 20, 30] // create sub groups for ages of 10, 20 and 30 +]; + +options.groupHeader = (value, count, data, group) => { + // value - the value all members of this group share + // count - the number of rows in this group + // data - an array of all the row data objects in this group + // group - the group component for the group + + return `${value} (${count}item)`; +}; + +options.groupHeader = [ + (value, count, data) => { + // generate header contents for gender groups + return `${value} (${count}item)`; + }, + (value, count, data) => { + // generate header contents for color groups + return `${value} (${count}item)`; + } +]; + +options.paginationDataReceived = { + last_page: "max_pages", + a: "b" +}; + +options.clipboardPasteParser = clipboard => { + return []; // return array +}; + +options.cellEditing = cell => { + console.log(cell); +}; diff --git a/types/tabulator-tables/tsconfig.json b/types/tabulator-tables/tsconfig.json new file mode 100644 index 0000000000..7f97e421b8 --- /dev/null +++ b/types/tabulator-tables/tsconfig.json @@ -0,0 +1,16 @@ +{ + "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", "tabulator-tables-tests.ts"] +} diff --git a/types/pkg-conf/tslint.json b/types/tabulator-tables/tslint.json similarity index 100% rename from types/pkg-conf/tslint.json rename to types/tabulator-tables/tslint.json diff --git a/types/tape-async/.editorconfig b/types/tape-async/.editorconfig new file mode 100644 index 0000000000..a0207fa43b --- /dev/null +++ b/types/tape-async/.editorconfig @@ -0,0 +1,3 @@ +# This package uses tabs +[*] +indent_style = tab diff --git a/types/tape-async/index.d.ts b/types/tape-async/index.d.ts new file mode 100644 index 0000000000..c3ce0801d6 --- /dev/null +++ b/types/tape-async/index.d.ts @@ -0,0 +1,69 @@ +// Type definitions for tape-async 2.3 +// Project: https://github.com/parro-it/tape-async +// Definitions by: ExE Boss +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import tapeSync = require("tape"); +export = tape; + +declare function tape(name: string | tape.TestOptions, cb: tape.TestCase): void; +declare function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; +declare function tape(cb: tape.TestCase): void; + +declare namespace tape { + interface TestCase { + (test: Test): void | Iterator | PromiseLike; + } + + /** + * Available opts options for the tape function. + */ + type TestOptions = tapeSync.TestOptions; + + /** + * Options for the createStream function. + */ + type StreamOptions = tapeSync.StreamOptions; + + /** + * Generate a new test that will be skipped over. + */ + function skip(name: string | TestOptions, cb: TestCase): void; + function skip(name: string, opts: TestOptions, cb: TestCase): void; + function skip(cb: TestCase): void; + + /** + * The onFinish hook will get invoked when ALL tape tests have finished right before tape is about to print the test summary. + */ + function onFinish(cb: () => void): void; + + /** + * Like test(name?, opts?, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored. + */ + function only(name: string | TestOptions, cb: TestCase): void; + function only(name: string, opts: TestOptions, cb: TestCase): void; + function only(cb: TestCase): void; + + /** + * Create a new test harness instance, which is a function like test(), but with a new pending stack and test state. + */ + function createHarness(): typeof tape; + /** + * Create a stream of output, bypassing the default output stream that writes messages to console.log(). + * By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true. + */ + function createStream(opts?: StreamOptions): NodeJS.ReadableStream; + + interface Test extends tapeSync.Test { + /** + * Create a subtest with a new test handle st from cb(st) inside the current test. + * cb(st) will only fire when t finishes. + * Additional tests queued up after t will not be run until all subtests finish. + */ + test(name: string, cb: TestCase): void; + test(name: string, opts: TestOptions, cb: TestCase): void; + } +} diff --git a/types/tape-async/test/tape-async.async.test.ts b/types/tape-async/test/tape-async.async.test.ts new file mode 100644 index 0000000000..64b740de28 --- /dev/null +++ b/types/tape-async/test/tape-async.async.test.ts @@ -0,0 +1,35 @@ +import tape = require("tape-async"); + +const name: string = undefined; +const cb = async (test: tape.Test) => {}; +const opts: tape.TestOptions = {}; +let t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, async (test: tape.Test) => { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape(name, async (test: tape.Test) => { + test.test(name, async (st) => { + t = st; + }); + + test.test(name, opts, async (st) => { + t = st; + }); +}); diff --git a/types/tape-async/test/tape-async.generators.test.ts b/types/tape-async/test/tape-async.generators.test.ts new file mode 100644 index 0000000000..7b6cc09eb4 --- /dev/null +++ b/types/tape-async/test/tape-async.generators.test.ts @@ -0,0 +1,35 @@ +import tape = require("tape-async"); + +const name: string = undefined; +const cb = function*(test: tape.Test): IterableIterator {}; +const opts: tape.TestOptions = {}; +let t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, function*(test: tape.Test): IterableIterator { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape(name, function*(test: tape.Test): IterableIterator { + test.test(name, function*(st: tape.Test): IterableIterator { + t = st; + }); + + test.test(name, opts, function*(st: tape.Test): IterableIterator { + t = st; + }); +}); diff --git a/types/tape-async/test/tape-async.test.ts b/types/tape-async/test/tape-async.test.ts new file mode 100644 index 0000000000..c2ed921938 --- /dev/null +++ b/types/tape-async/test/tape-async.test.ts @@ -0,0 +1,178 @@ +import tape = require("tape-async"); + +const name: string = undefined; +const cb = (test: tape.Test) => {}; +const opts: tape.TestOptions = {}; +let t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, (test: tape.Test) => { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape.onFinish(() => {}); + +const sopts: tape.StreamOptions = undefined; +let rs: NodeJS.ReadableStream; +rs = tape.createStream(); +rs = tape.createStream(sopts); + +let htest: typeof tape; +htest = tape.createHarness(); + +class CustomException extends Error { + constructor(message?: string) { + super(message); + } +} + +tape(name, (test: tape.Test) => { + const num: number = undefined; + const ms: number = undefined; + const value: any = undefined; + const actual: any = undefined; + const expected: any = undefined; + const err: any = undefined; + const fn = () => {}; + const msg: string = undefined; + + const exceptionExpected: RegExp | (() => void) = undefined; + + test.plan(num); + test.end(); + test.end(err); + + test.fail(msg); + test.pass(msg); + test.timeoutAfter(ms); + test.skip(msg); + + test.ok(value); + test.ok(value, msg); + test.true(value); + test.true(value, msg); + test.assert(value); + test.assert(value, msg); + + test.notOk(value); + test.notOk(value, msg); + test.false(value); + test.false(value, msg); + test.notok(value); + test.notok(value, msg); + + test.error(err, msg); + test.ifError(err, msg); + test.ifErr(err, msg); + test.iferror(err, msg); + + test.equal(actual, expected); + test.equal(actual, expected, msg); + test.equals(actual, expected); + test.equals(actual, expected, msg); + test.isEqual(actual, expected); + test.isEqual(actual, expected, msg); + test.is(actual, expected); + test.is(actual, expected, msg); + test.strictEqual(actual, expected); + test.strictEqual(actual, expected, msg); + test.strictEquals(actual, expected); + test.strictEquals(actual, expected, msg); + + test.notEqual(actual, expected); + test.notEqual(actual, expected, msg); + test.notEquals(actual, expected); + test.notEquals(actual, expected, msg); + test.notStrictEqual(actual, expected); + test.notStrictEqual(actual, expected, msg); + test.notStrictEquals(actual, expected); + test.notStrictEquals(actual, expected, msg); + test.isNotEqual(actual, expected); + test.isNotEqual(actual, expected, msg); + test.isNot(actual, expected); + test.isNot(actual, expected, msg); + test.not(actual, expected); + test.not(actual, expected, msg); + test.doesNotEqual(actual, expected); + test.doesNotEqual(actual, expected, msg); + test.isInequal(actual, expected); + test.isInequal(actual, expected, msg); + + test.deepEqual(actual, expected); + test.deepEqual(actual, expected, msg); + test.deepEquals(actual, expected); + test.deepEquals(actual, expected, msg); + test.isEquivalent(actual, expected); + test.isEquivalent(actual, expected, msg); + test.same(actual, expected); + test.same(actual, expected, msg); + + test.notDeepEqual(actual, expected); + test.notDeepEqual(actual, expected, msg); + test.notEquivalent(actual, expected); + test.notEquivalent(actual, expected, msg); + test.notDeeply(actual, expected); + test.notDeeply(actual, expected, msg); + test.notSame(actual, expected); + test.notSame(actual, expected, msg); + test.isNotDeepEqual(actual, expected); + test.isNotDeepEqual(actual, expected, msg); + test.isNotDeeply(actual, expected); + test.isNotDeeply(actual, expected, msg); + test.isNotEquivalent(actual, expected); + test.isNotEquivalent(actual, expected, msg); + test.isInequivalent(actual, expected); + test.isInequivalent(actual, expected, msg); + + test.deepLooseEqual(actual, expected); + test.deepLooseEqual(actual, expected, msg); + test.looseEqual(actual, expected); + test.looseEqual(actual, expected, msg); + test.looseEquals(actual, expected); + test.looseEquals(actual, expected, msg); + + test.notDeepLooseEqual(actual, expected); + test.notDeepLooseEqual(actual, expected, msg); + test.notLooseEqual(actual, expected); + test.notLooseEqual(actual, expected, msg); + test.notLooseEquals(actual, expected); + test.notLooseEquals(actual, expected, msg); + + test.throws(fn); + test.throws(fn, msg); + test.throws(fn, exceptionExpected); + test.throws(fn, exceptionExpected, msg); + test.throws(fn, CustomException); + test.throws(fn, CustomException, msg); + + test.doesNotThrow(fn); + test.doesNotThrow(fn, msg); + test.doesNotThrow(fn, exceptionExpected); + test.doesNotThrow(fn, exceptionExpected, msg); + test.doesNotThrow(fn, CustomException); + test.doesNotThrow(fn, CustomException, msg); + + test.test(name, st => { + t = st; + }); + + test.test(name, opts, st => { + t = st; + }); + + test.comment(msg); +}); diff --git a/types/tape-async/tsconfig.json b/types/tape-async/tsconfig.json new file mode 100644 index 0000000000..c5b3e90053 --- /dev/null +++ b/types/tape-async/tsconfig.json @@ -0,0 +1,25 @@ +{ + "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/tape-async.async.test.ts", + "test/tape-async.generators.test.ts", + "test/tape-async.test.ts" + ] +} diff --git a/types/tape-async/tslint.json b/types/tape-async/tslint.json new file mode 100644 index 0000000000..a541931a86 --- /dev/null +++ b/types/tape-async/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "indent": [ + true, + "tabs" + ] + } +} diff --git a/types/tarantool-driver/index.d.ts b/types/tarantool-driver/index.d.ts new file mode 100644 index 0000000000..25d0e04a09 --- /dev/null +++ b/types/tarantool-driver/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for tarantool-driver 3.0 +// Project: https://github.com/tarantool/node-tarantool-driver +// Definitions by: Evgeni Zharkov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { EventEmitter } from "events"; + +declare namespace TarantoolConnection { + interface TarantoolOptions { + host?: string; + port?: number; + username?: string; + password?: string; + reserveHosts?: string[]; + beforeReserve?: number; + timeout?: number; + retryStrategy?: (times: number) => number; + lazyConnect?: boolean; + } +} + +declare class TarantoolConnection extends EventEmitter { + constructor(options: TarantoolConnection.TarantoolOptions); + + /* Connection */ + + connect(): Promise; + + flushQueue(cb: (err: Error) => void): void; + + destroy(): void; + + disconnect(reconnect?: boolean): void; + + /* Commands */ + + select(spaceId: number | string, + indexId: number | string, + limit: number, offset: number, + iterator: string, key: any[]): Promise; + + delete(spaceId: number | string, + indexId: number | string, + key: any[]): Promise; + + update(spaceId: number | string, + indexId: number | string, + key: any[], ops: any[]): Promise; + + upsert(spaceId: number | string, + ops: any[], tuple: any[]): Promise; + + eval(expression: string, ...args: any[]): Promise; + + call(functionName: string, ...args: any[]): Promise; + + insert(spaceId: number | string, tuple: any[]): Promise; + + replace(spaceId: number | string, tuple: any[]): Promise; +} + +export = TarantoolConnection; diff --git a/types/tarantool-driver/tarantool-driver-tests.ts b/types/tarantool-driver/tarantool-driver-tests.ts new file mode 100644 index 0000000000..e7fe424afb --- /dev/null +++ b/types/tarantool-driver/tarantool-driver-tests.ts @@ -0,0 +1,3 @@ +import TarantoolDriver = require("tarantool-driver"); + +new TarantoolDriver({}).connect(); // $ExpectedType Promise diff --git a/types/log-update/tsconfig.json b/types/tarantool-driver/tsconfig.json similarity index 92% rename from types/log-update/tsconfig.json rename to types/tarantool-driver/tsconfig.json index 888455297b..c49fafed46 100644 --- a/types/log-update/tsconfig.json +++ b/types/tarantool-driver/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "log-update-tests.ts" + "tarantool-driver-tests.ts" ] } \ No newline at end of file diff --git a/types/tarantool-driver/tslint.json b/types/tarantool-driver/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/tarantool-driver/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/tern/index.d.ts b/types/tern/index.d.ts index ef01c0e289..7ef634e6a6 100644 --- a/types/tern/index.d.ts +++ b/types/tern/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for tern 0.22 +// Type definitions for tern 0.23 // Project: https://github.com/ternjs/tern // Definitions by: Nikolaj Kappler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,5 +11,5 @@ // thus if you want to use undocumented APIs, you should extends these definitions with // ambient declaration merging: https://www.typescriptlang.org/docs/handbook/declaration-merging.html -export * from "./lib/tern"; export * from "./lib/infer"; +export * from "./lib/tern"; diff --git a/types/tern/lib/infer/index.d.ts b/types/tern/lib/infer/index.d.ts index 58e83ea1c7..b8cc01e68f 100644 --- a/types/tern/lib/infer/index.d.ts +++ b/types/tern/lib/infer/index.d.ts @@ -1,12 +1,14 @@ import * as ESTree from "estree"; +import { Server } from "../tern"; export { }; // #### Context #### interface ContextConstructor { - new(defs: any[]): Context; + new(defs: any[], parent: Server): Context; } export const Context: ContextConstructor; export interface Context { + parent?: Server; topScope: Scope; /** The primitive number type. */ num: Type; @@ -15,8 +17,10 @@ export interface Context { /** The primitive boolean type. */ bool: Type; } +/** Returns the current context object. */ export function cx(): Context; -export function withContext(context: Context, f: () => void): void; +/** Calls f with the current context bound to context. Basically, all code that does something with the inference engine should be wrapped in such a call. */ +export function withContext(context: Context, f: () => R): R; // #### Analysis #### /** Parse a piece of code for use by Tern. Will automatically fall back to the error-tolerant parser if the regular parser can’t parse the code. */ @@ -59,6 +63,7 @@ export interface Obj extends Type { hasProp(prop: string): AVal | null; /** Looks up the given property, or defines it if it did not yet exist (in which case it will be associated with the given AST node). */ defProp(prop: string, originNode?: ESTree.Node): AVal; + getType(): Obj; } interface FnConstructor { @@ -66,18 +71,27 @@ interface FnConstructor { } /** Constructor for the type that implements functions. Inherits from `Obj`. The `AVal` types are used to track the input and output types of the function. */ export const Fn: FnConstructor; -export type Fn = Obj; +export interface Fn extends Obj { + readonly args?: AVal[]; + readonly argNames?: string[]; + self?: Type; + readonly retval: AVal; + isArrowFn(): boolean; + getType(): Fn; +} interface ArrConstructor { /** Constructor that creates an array type with the given content type. */ - new(contentType: AVal): Arr; + new(contentType?: AVal): Arr; } export const Arr: ArrConstructor; -export type Arr = Obj; +export interface Arr extends Obj { + getType(): Arr; +} export interface Type extends AVal { /** The name of the type, if any. */ - name: string; + name: string | undefined; /** The origin file of the type. */ origin: string; /** @@ -88,10 +102,9 @@ export interface Type extends AVal { originNode?: ESTree.Node; /** Return a string that describes the type. maxDepth indicates the depth to which inner types should be shown. */ toString(maxDepth: number): string; - /** Get an `AVal` that represents the named property of this type. */ - getProp(prop: string): AVal; /** Call the given function for all properties of the object, including properties that are added in the future. */ forAllProps(f: (prop: string, val: AVal, local: boolean) => void): void; + getType(): Type; } // #### Abstract Values #### @@ -131,13 +144,23 @@ export interface AVal { * Asks the AVal if it contains a function type. Useful when * you aren’t interested in other kinds of types. */ - getFunctionType(): Type | undefined; + getFunctionType(): Fn | undefined; + /** Get an `AVal` that represents the named property of this type. */ + getProp(prop: string): AVal; + /** + * Asks the AVal if it contains an Object type. Useful when + * you aren’t interested in other kinds of types. + */ + getObjType(): Obj | null; /** * Abstract values that are used to represent variables * or properties will have, when possible, an `originNode` * property pointing to an AST node. */ originNode?: ESTree.Node; + + readonly types: Type[]; + readonly propertyOf?: Obj; } export const ANull: ANull; @@ -170,7 +193,8 @@ export interface Constraint extends AVal { // #### Scopes #### interface ScopeConstructor { - new(parent?: Scope): Scope; + new(): Scope; + new(parent: Scope, originNode: ESTree.Node): Scope; } export const Scope: ScopeConstructor; export interface Scope extends Obj { @@ -199,7 +223,7 @@ export function findExpressionAround(ast: ESTree.Program, start: number | undefi /** Similar to `findExpressionAround`, except that it use the same AST walker as `findExpressionAt`. */ export function findClosestExpression(ast: ESTree.Program, start: number | undefined, end: number, scope?: Scope): { node: ESTree.Node, state: Scope } | null; /** Determine an expression for the given node and scope (as returned by the functions above). Will return an `AVal` or plain `Type`. */ -export function expressionType(expr: { node: ESTree.Node, state: Scope }): AVal | Type; +export function expressionType(expr: { node: ESTree.Node, state: Scope | null }): AVal | Type; /** Find the scope at a given position in the syntax tree. The `scope` parameter can be used to override the scope used for code that isn’t wrapped in any function. */ export function scopeAt(ast: ESTree.Program, pos: number, scope?: Scope): Scope; /** diff --git a/types/tern/lib/tern/index.d.ts b/types/tern/lib/tern/index.d.ts index 7ecb4ac73e..22001ed075 100644 --- a/types/tern/lib/tern/index.d.ts +++ b/types/tern/lib/tern/index.d.ts @@ -1,5 +1,5 @@ import * as ESTree from "estree"; -import { Scope, Type } from "../infer"; +import { Context, Scope, Type } from "../infer"; export { }; @@ -48,6 +48,10 @@ interface TernConstructor { export const Server: TernConstructor; export interface Server { + readonly cx: Context; + readonly options: ConstructorOptions; + readonly files: File[]; + readonly plugins: any; /** * Add a set of type definitions to the server. If `atFront` is true, they will be added before all other * existing definitions. Otherwise, they are added at the back. @@ -93,10 +97,12 @@ export interface Server { request( doc: D & { query?: Q }, callback: ( - error: Error | undefined, + error: string | null, response: (D extends { query: undefined } ? {} : D extends { query: Query } ? QueryResult : {}) | undefined ) => void ): void; + reset(): void; + signal(event: keyof Events, file: File): void; } // #### JSON Protocol #### @@ -156,6 +162,7 @@ export interface File { scope: Scope; ast: ESTree.Program; type?: "full" | "part" | "delete"; + asLineChar?(nodePosition: number): Position; } export interface BaseQuery { diff --git a/types/three/index.d.ts b/types/three/index.d.ts index f929ef2383..ac754b4575 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -3,68 +3,65 @@ // Definitions by: Kon , // Satoru Kimura , // Florent Poujol , -// SereznoKot , // HouChunlei , // Ivo , // David Asmuth , // Brandon Roberge, // Qinsi ZHU , // Toshiya Nakakura , -// Poul Kjeldager Sørensen , // Stefan Profanter , // Edmund Fokschaner , // Roelof Jooste , -// Daniel Hritzkiv , // Apurva Ojas , // Tiger Oakes , -// Ethan Kay , // Methuselah96 // Dilip Ramirez // Julian Strecker // Zhang Hao // Konstantin Lukaschenko // Daniel Yim +// Saransh Kataria // Philippe Suter // Definitions: https://github.com//DefinitelyTyped // TypeScript Version: 2.8 -export * from "./three-core"; +export * from './three-core'; -export * from "./three-canvasrenderer"; -export * from "./three-colladaLoader"; -export * from "./three-copyshader"; -export * from "./three-css3drenderer"; -export * from "./three-ctmloader"; -export * from "./three-ddsloader"; -export * from "./three-tdsloader"; -export * from "./three-dragcontrols"; -export * from "./three-editorcontrols"; -export * from "./three-effectcomposer"; -export * from "./three-examples"; -export * from "./three-fbxloader"; -export * from "./three-FirstPersonControls"; -export * from "./three-gltfexporter"; -export * from "./three-gltfloader"; -export * from "./three-lensflare"; -export * from "./three-mapcontrols"; -export * from "./three-maskpass"; -export * from "./three-mtlloader"; -export * from "./three-objloader"; -export * from "./three-octree"; -export * from "./three-orbitcontrols"; -export * from "./three-orthographictrackballcontrols"; -export * from "./three-outlinepass"; -export * from "./three-projector"; -export * from "./three-renderpass"; -export * from "./three-shaderpass"; -export * from "./three-smaapass"; -export * from "./three-ssaapass"; -export * from "./three-filmpass"; -export * from "./three-tgaloader"; -export * from "./three-trackballcontrols"; -export * from "./three-transformcontrols"; -export * from "./three-unrealbloompass"; -export * from "./three-vrcontrols"; -export * from "./three-vreffect"; +export * from './three-canvasrenderer'; +export * from './three-colladaLoader'; +export * from './three-copyshader'; +export * from './three-css3drenderer'; +export * from './three-ctmloader'; +export * from './three-ddsloader'; +export * from './three-tdsloader'; +export * from './three-dragcontrols'; +export * from './three-editorcontrols'; +export * from './three-effectcomposer'; +export * from './three-examples'; +export * from './three-fbxloader'; +export * from './three-FirstPersonControls'; +export * from './three-gltfexporter'; +export * from './three-gltfloader'; +export * from './three-lensflare'; +export * from './three-mapcontrols'; +export * from './three-maskpass'; +export * from './three-mtlloader'; +export * from './three-objloader'; +export * from './three-octree'; +export * from './three-orbitcontrols'; +export * from './three-orthographictrackballcontrols'; +export * from './three-outlinepass'; +export * from './three-projector'; +export * from './three-renderpass'; +export * from './three-shaderpass'; +export * from './three-smaapass'; +export * from './three-ssaapass'; +export * from './three-filmpass'; +export * from './three-tgaloader'; +export * from './three-trackballcontrols'; +export * from './three-transformcontrols'; +export * from './three-unrealbloompass'; +export * from './three-vrcontrols'; +export * from './three-vreffect'; export as namespace THREE; diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index e7291b9402..96c40c7496 100755 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -3115,7 +3115,7 @@ export interface ShaderMaterialParameters extends MaterialParameters { uniforms?: any; vertexShader?: string; fragmentShader?: string; - lineWidth?: number; + linewidth?: number; wireframe?: boolean; wireframeLinewidth?: number; lights?: boolean; diff --git a/types/three/three-mtlloader.d.ts b/types/three/three-mtlloader.d.ts index 33b4822432..c2dbd40c84 100644 --- a/types/three/three-mtlloader.d.ts +++ b/types/three/three-mtlloader.d.ts @@ -3,16 +3,48 @@ import { Material } from "./three-core"; import {LoadingManager} from "./three-core"; +import {Mapping} from "./three-core"; import {EventDispatcher} from "./three-core"; import {BufferGeometry} from "./three-core"; +import {Side} from "./three-core"; import {Texture} from "./three-core"; +import {Vector2} from "./three-core"; +import {Wrapping} from "./three-core"; + +export interface MaterialCreatorOptions { + /** + * side: Which side to apply the material + * THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide + */ + side?: Side; + /* + * wrap: What type of wrapping to apply for textures + * THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping + */ + wrap?: Wrapping; + /* + * normalizeRGB: RGBs need to be normalized to 0-1 from 0-255 + * Default: false, assumed to be already normalized + */ + normalizeRGB?: boolean; + /* + * ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's + * Default: false + */ + ignoreZeroRGBs?: boolean; + /* + * invertTrProperty: Use values 1 of Tr field for fully opaque. This option is useful for obj + * exported from 3ds MAX, vcglib or meshlab. + * Default: false + */ + invertTrProperty?: boolean; +} export class MTLLoader extends EventDispatcher { constructor(manager?: LoadingManager); manager: LoadingManager; - materialOptions: {}; - materials: Material[]; + materialOptions: MaterialCreatorOptions; path: string; texturePath: string; crossOrigin: boolean; @@ -23,32 +55,54 @@ export class MTLLoader extends EventDispatcher { setTexturePath(path: string) : void; setBaseUrl(path: string) : void; setCrossOrigin(value: boolean) : void; - setMaterialOptions(value: any) : void; + setMaterialOptions(value: MaterialCreatorOptions) : void; +} + +export interface MaterialInfo { + ks?: number[]; + kd?: number[]; + ke?: number[]; + map_kd?: string; + map_ks?: string; + map_ke?: string; + norm?: string; + map_bump?: string; + bump?: string; + map_d?: string; + ns?: number; + d?: number; + tr?: number; +} + +export interface TexParams { + scale: Vector2; + offset: Vector2; + url: string; } export class MaterialCreator { - constructor(baseUrl?: string, options?: any); + constructor(baseUrl?: string, options?: MaterialCreatorOptions); baseUrl : string; - options : any; - materialsInfo : any; - materials : any; - materialsArray : Material[]; - nameLookup : any; - side : number; - wrap : number; + options : MaterialCreatorOptions; + materialsInfo : {[key: string]: MaterialInfo}; + materials : {[key: string]: Material}; + private materialsArray : Material[]; + nameLookup : {[key: string]: number}; + side : Side; + wrap : Wrapping; setCrossOrigin( value: boolean ) : void; - setManager( value: any ) : void; - setMaterials( materialsInfo: any ) : void; - convert( materialsInfo: any ) : any; + setManager( value: LoadingManager ) : void; + setMaterials( materialsInfo: {[key: string]: MaterialInfo} ) : void; + convert( materialsInfo: {[key: string]: MaterialInfo} ) : {[key: string]: MaterialInfo}; preload() : void; getIndex( materialName: string ) : Material; getAsArray() : Material[]; create( materialName: string ) : Material; createMaterial_( materialName: string ) : Material; - getTextureParams( value: string, matParams: any ) : any; - loadTexture(url: string, mapping: any, onLoad: (bufferGeometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): Texture; + getTextureParams( value: string, matParams: any ) : TexParams; + loadTexture(url: string, mapping?: Mapping, onLoad?: (bufferGeometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): Texture; } diff --git a/types/throttle-debounce/index.d.ts b/types/throttle-debounce/index.d.ts index 34bfbbdb5b..5b1f197a31 100644 --- a/types/throttle-debounce/index.d.ts +++ b/types/throttle-debounce/index.d.ts @@ -1,8 +1,17 @@ // Type definitions for throttle-debounce 1.1 // Project: https://github.com/niksy/throttle-debounce -// Definitions by: Marek Buchar , Frank Li +// Definitions by: Marek Buchar , Frank Li , Thomas Oddsund // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export {}; + +interface Cancel { + cancel: () => void; +} + +export type throttle = T & Cancel; +export type debounce = throttle; + /** * Throttle execution of a function. Especially useful for rate limiting * execution of handlers on events like resize and scroll. @@ -34,8 +43,8 @@ export function throttle any>( delay: number, noTrailing: boolean, callback: T, - debounceMode?: boolean, -): T; + debounceMode?: boolean +): throttle; /** * Throttle execution of a function. Especially useful for rate limiting @@ -60,8 +69,8 @@ export function throttle any>( export function throttle any>( delay: number, callback: T, - debounceMode?: boolean, -): T; + debounceMode?: boolean +): throttle; /** * Debounce execution of a function. Debouncing, unlike throttling, @@ -87,7 +96,11 @@ export function throttle any>( * @return * A new, debounced function. */ -export function debounce any>(delay: number, atBegin: boolean, callback: T): T; +export function debounce any>( + delay: number, + atBegin: boolean, + callback: T +): debounce; /** * Debounce execution of a function. Debouncing, unlike throttling, @@ -106,4 +119,7 @@ export function debounce any>(delay: number, atBeg * @return * A new, debounced function. */ -export function debounce any>(delay: number, callback: T): T; +export function debounce any>( + delay: number, + callback: T +): debounce; diff --git a/types/throttle-debounce/throttle-debounce-tests.ts b/types/throttle-debounce/throttle-debounce-tests.ts index 0090eb1039..ff4f757dbc 100644 --- a/types/throttle-debounce/throttle-debounce-tests.ts +++ b/types/throttle-debounce/throttle-debounce-tests.ts @@ -1,15 +1,30 @@ -import throttleDebounce = require('throttle-debounce'); - -const { throttle, debounce } = throttleDebounce; +import { throttle, debounce } from "throttle-debounce"; type Func = () => void; const func: Func = () => {}; -const throttle1: Func = throttle(42, true, func, true); -const throttle2: Func = throttle(42, true, func); -const throttle3: Func = throttle(42, func, true); -const throttle4: Func = throttle(42, func); +const throttleWithoutCancel1: Func = throttle(42, true, func, true); +const throttleWithoutCancel2: Func = throttle(42, true, func); +const throttleWithoutCancel3: Func = throttle(42, func, true); +const throttleWithoutCancel4: Func = throttle(42, func); -const debounce1: Func = debounce(42, true, func); -const debounce2: Func = debounce(42, func); +throttleWithoutCancel1(); +// $ExpectError +throttleWithoutCancel1.cancel(); +const throttleWithCancel1: throttle = throttle(42, true, func, true); +const throttleWithCancel2: throttle = throttle(42, true, func); +const throttleWithCancel3: throttle = throttle(42, func, true); +const throttleWithCancel4: throttle = throttle(42, func); +throttleWithCancel1(); +throttleWithCancel1.cancel(); + +const debounceWithoutCancel1: Func = debounce(42, true, func); +const debounceWithoutCancel2: Func = debounce(42, func); +debounceWithoutCancel1(); +// $ExpectError +debounceWithoutCancel1.cancel(); +const debounceWithCancel1: debounce = debounce(42, true, func); +const debounceWithCancel2: debounce = debounce(42, func); +debounceWithCancel1(); +debounceWithCancel1.cancel(); diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index b38d96d45c..e50feb0b5d 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -394,7 +394,7 @@ export class Editor extends util.Observable { addCommand(name: string, callback: (ui: boolean, value: {}) => boolean, scope?: {}): void; - addContextToolbar(predicate: () => void, items: string): void; + addContextToolbar(predicate: () => boolean, items: string): void; addMenuItem(name: string, settings: {}): void; @@ -414,7 +414,7 @@ export class Editor extends util.Observable { execCallback(name: string): {}; - execCommand(cmd: string, ui: boolean, value?: any, args?: {}): void; + execCommand(cmd: string, ui?: boolean, value?: any, args?: {}): void; focus(skipFocus: boolean): void; @@ -838,7 +838,7 @@ export namespace dom { insertAfter(node: Element, referenceNode: Element): Element | T[]; - is(elm: Node, selector: string): void; + is(elm: Node, selector: string): boolean; isBlock(node: Node): boolean; @@ -1072,7 +1072,7 @@ export namespace dom { setContent(content: string, args?: {}): void; - setCursorLocation(node?: html.Node, offset?: number): void; + setCursorLocation(node?: Node, offset?: number): void; setNode(elm: Element): Element; diff --git a/types/tmi.js/index.d.ts b/types/tmi.js/index.d.ts new file mode 100644 index 0000000000..0363842148 --- /dev/null +++ b/types/tmi.js/index.d.ts @@ -0,0 +1,356 @@ +// Type definitions for tmi.js 1.4 +// Project: https://github.com/tmijs/tmi.js +// Definitions by: William Papsco +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +// Twitch IRC docs: https://dev.twitch.tv/docs/irc/ +// Last updated: 2019/3/06 + +import { StrictEventEmitter } from "./strict-event-emitter-types"; + +export interface Actions { + action(channel: string, message: string): Promise<[string]>; + ban(channel: string, username: string, reason?: string): Promise<[string, string, string]>; + clear(channel: string): Promise<[string]>; + color(color: string): Promise<[string]>; + commercial(channel: string, seconds: number): Promise<[string, number]>; + connect(): Promise<[string, number]>; + deletemessage(channel: string, messageUUID: string): Promise<[string]>; + disconnect(): Promise<[string, number]>; + emoteonly(channel: string): Promise<[string]>; + emoteonlyoff(channel: string): Promise<[string]>; + followersonly(channel: string, length?: number): Promise<[string, number]>; + followersonlyoff(channel: string): Promise<[string]>; + host(channel: string, target: string): Promise<[string, string]>; + join(channel: string): Promise<[string]>; + mod(channel: string, username: string): Promise<[string, string]>; + mods(channel: string): Promise; + part(channel: string): Promise<[string]>; + ping(): Promise<[number]>; + r9kbeta(channel: string): Promise<[string]>; + r9kbetaoff(channel: string): Promise<[string]>; + raw(message: string): Promise<[string]>; + say(channel: string, message: string): Promise<[string]>; + slow(channel: string, length?: number): Promise<[string]>; + slowoff(channel: string): Promise<[string]>; + subscribers(channel: string): Promise<[string]>; + subscribersoff(channel: string): Promise<[string]>; + timeout(channel: string, username: string, length?: number, reason?: string): Promise<[string, string, number, string]>; + unban(channel: string, username: string): Promise<[string, string]>; + unhost(channel: string): Promise<[string]>; + unmod(channel: string, username: string): Promise<[string, string]>; + unvip(channel: string, username: string): Promise<[string, string]>; + vip(channel: string, username: string): Promise<[string, string]>; + vips(channel: string): Promise; + whisper(username: string, message: string): Promise<[string, string]>; +} + +export interface Events { + action(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; + anongiftpaidupgrade(channel: string, username: string, userstate: AnonSubGiftUpgradeUserstate): void; + ban(channel: string, username: string, reason: string): void; + chat(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; + cheer(channel: string, userstate: ChatUserstate, message: string): void; + clearchat(channel: string): void; + connected(address: string, port: number): void; + connecting(address: string, port: number): void; + disconnected(reason: string): void; + emoteonly(channel: string, enabled: boolean): void; + emotesets(sets: string, obj: EmoteObj): void; + followersonly(channel: string, enabled: boolean, length: number): void; + giftpaidupgrade(channel: string, username: string, sender: string, userstate: SubGiftUpgradeUserstate): void; + hosted(channel: string, username: string, viewers: number, autohost: boolean): void; + hosting(channel: string, target: string, viewers: number): void; + join(channel: string, username: string, self: boolean): void; + logon(): void; + message(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; + messagedeleted(channel: string, username: string, deletedMessage: string, userstate: DeleteUserstate): void; + mod(channel: string, username: string): void; + mods(channel: string, mods: string[]): void; + notice(channel: string, msgid: MsgID, message: string): void; + part(channel: string, username: string, self: boolean): void; + ping(): void; + pong(latency: number): void; + r9kbeta(channel: string, enabled: boolean): void; + raided(channel: string, username: string, viewers: number): void; + "raw_message": (messageCloned: { [property: string]: any }, message: { [property: string]: any }) => void; + reconnect(): void; + resub(channel: string, username: string, months: number, message: string, userstate: SubUserstate, methods: SubMethods): void; + roomstate(channel: string, state: RoomState): void; + serverchange(channel: string): void; + slowmode(channel: string, enabled: boolean, length: number): void; + subgift(channel: string, username: string, streakMonths: number, recipient: string, methods: SubMethods, userstate: SubGiftUserstate): void; + submysterygift(channel: string, username: string, numbOfSubs: number, methods: SubMethods, userstate: SubMysteryGiftUserstate): void; + subscribers(channel: string, enabled: boolean): void; + subscription(channel: string, username: string, methods: SubMethods, message: string, userstate: SubUserstate): void; + timeout(channel: string, username: string, reason: string, duration: number): void; + unhost(channel: string, viewers: number): void; + unmod(channel: string, username: string): void; + vips(channel: string, vips: string[]): void; + whisper(from: string, userstate: ChatUserstate, message: string, self: boolean): void; +} + +export interface ClientBase { + getChannels(): string[]; + getOptions(): Options; + getUsername(): string; + isMod(channel: string, username: string): boolean; + readyState(): "CONNECTING" | "OPEN" | "CLOSING" | "CLOSED"; + on(event: any, listener: any): Client; + addListener(event: any, listener: any): Client; + removeListener(event: any, listener: any): Client; + removeAllListeners(event?: keyof Events): Client; + setMaxListeners(n: number): Client; + emits(events: Array, values: any[][]): void; // wish this could work better but either I'm just not smart enough or it's not possible + emit: (event: any) => boolean; + once(event: any, listener: any): Client; + listenerCount(event: keyof Events): number; +} + +export interface Badges { + admin?: string; + bits?: string; + broadcaster?: string; + global_mod?: string; + moderator?: string; + subscriber?: string; + staff?: string; + turbo?: string; + premium?: string; +} + +export interface SubMethods { + prime?: boolean; + plan?: SubMethod; + planName?: string; +} + +export interface DeleteUserstate { + login?: string; + message?: string; + "target-msg-id"?: string; +} + +export interface CommonUserstate { + badges?: Badges; + color?: string; + "display-name"?: string; + emotes?: { [emoteid: string]: string[] }; + id?: string; + mod?: boolean; + turbo?: boolean; + 'emotes-raw'?: string; + 'badges-raw'?: string; + "room-id"?: string; + subscriber?: boolean; + 'user-type'?: "" | "mod" | "global_mod" | "admin" | "staff"; + "user-id"?: string; + "tmi-sent-ts"?: string; + flags?: string; + [paramater: string]: any; +} + +export interface UserNoticeState extends CommonUserstate { + login?: string; + message?: string; + "system-msg"?: string; +} + +export interface CommonSubUserstate extends UserNoticeState { + "msg-param-sub-plan"?: SubMethod; + "msg-param-sub-plan-name"?: string; +} + +export interface CommonGiftSubUserstate extends CommonSubUserstate { + "msg-param-recipient-display-name"?: string; + "msg-param-recipient-id"?: string; + "msg-param-recipient-user-name"?: string; + "msg-param-months"?: boolean | string; +} + +export interface ChatUserstate extends CommonUserstate { + 'message-type'?: "chat" | "action" | "whisper"; + username?: string; + bits?: string; +} + +export interface SubUserstate extends CommonSubUserstate { + 'message-type'?: "sub" | "resub"; + "msg-param-cumulative-months"?: string | boolean; + "msg-param-should-share-streak"?: boolean; + "msg-param-streak-months"?: string | boolean; +} + +export interface SubMysteryGiftUserstate extends CommonSubUserstate { + 'message-type'?: "submysterygift"; + "msg-param-sender-count"?: string | boolean; +} + +export interface SubGiftUserstate extends CommonGiftSubUserstate { + 'message-type'?: "subgift"; + "msg-param-sender-count"?: string | boolean; +} + +export interface AnonSubGiftUserstate extends CommonGiftSubUserstate { + "message-type"?: "anonsubgift"; +} + +export interface SubGiftUpgradeUserstate extends CommonSubUserstate { + "message-type"?: "giftpaidupgrade"; + "msg-param-sender-name"?: string; + "msg-param-sender-login"?: string; +} + +export interface AnonSubGiftUpgradeUserstate extends CommonSubUserstate { + "message-type"?: "anongiftpaidupgrade"; +} + +export interface RaidUserstate extends UserNoticeState { + "message-type"?: "raid"; + "msg-param-displayName"?: string; + "msg-param-login"?: string; + "msg-param-viewerCount"?: string; +} + +export interface RitualUserstate extends UserNoticeState { + "message-type"?: "ritual"; + "msg-param-ritual-name"?: "new_chatter"; +} + +export type Userstate = ChatUserstate | + SubUserstate | + SubGiftUserstate | + SubGiftUpgradeUserstate | + AnonSubGiftUserstate | + SubMysteryGiftUserstate | + AnonSubGiftUpgradeUserstate | + RaidUserstate | + RitualUserstate; + +export interface EmoteObj { + [id: string]: [{ + code: string; + id: number; + }]; +} + +export type MsgID = "already_banned" | + "already_emote_only_on" | + "already_emote_only_off" | + "already_subs_on" | + "already_subs_off" | + "bad_ban_admin" | + "bad_ban_broadcaster" | + "bad_ban_global_mod" | + "bad_ban_self" | + "bad_ban_staff" | + "bad_commercial_error" | + "bad_host_hosting" | + "bad_host_rate_exceeded" | + "bad_mod_mod" | + "bad_mod_banned" | + "bad_timeout_admin" | + "bad_timeout_global_mod" | + "bad_timeout_self" | + "bad_timeout_staff" | + "bad_unban_no_ban" | + "bad_unmod_mod" | + "ban_success" | + "cmds_available" | + "color_changed" | + "commercial_success" | + "emote_only_on" | + "emote_only_off" | + "hosts_remaining" | + "host_target_went_offline" | + "mod_success" | + "msg_banned" | + "msg_censored_broadcaster" | + "msg_channel_suspended" | + "msg_duplicate" | + "msg_emoteonly" | + "msg_ratelimit" | + "msg_subsonly" | + "msg_timedout" | + "msg_verified_email" | + "no_help" | + "no_permission" | + "not_hosting" | + "timeout_success" | + "unban_success" | + "unmod_success" | + "unrecognized_cmd" | + "usage_ban" | + "usage_clear" | + "usage_color" | + "usage_commercial" | + "usage_disconnect" | + "usage_emote_only_on" | + "usage_emote_only_off" | + "usage_help" | + "usage_host" | + "usage_me" | + "usage_mod" | + "usage_mods" | + "usage_r9k_on" | + "usage_r9k_off" | + "usage_slow_on" | + "usage_slow_off" | + "usage_subs_on" | + "usage_subs_off" | + "usage_timeout" | + "usage_unban" | + "usage_unhost" | + "usage_unmod" | + "whisper_invalid_self" | + "whisper_limit_per_min" | + "whisper_limit_per_sec" | + "whisper_restricted_recipient"; + +export type SubMethod = "Prime" | "1000" | "2000" | "3000"; + +export interface RoomState { + "broadcaster-lang"?: string; + "emote-only"?: boolean; + "followers-only"?: string | boolean; + "r9k"?: boolean; + "rituals"?: boolean; + "room-id"?: string; + "slow"?: string | boolean; + "subs-only"?: boolean; + "channel"?: string; +} + +export type Client = StrictEventEmitter & Actions; + +export interface Options { + options?: { + clientId?: string; + debug?: boolean; + }; + connection?: { + server?: string; + port?: number; + reconnect?: boolean; + maxReconnectAttempts?: number; + maxReconnectInverval?: number; + reconnectDecay?: number; + reconnectInterval?: number; + secure?: boolean; + timeout?: number; + }; + identity?: { + username?: string; + password?: string; + }; + channels?: string[]; + logger?: { + info?: (message: string) => any; + warn?: (message: string) => any; + error?: (message: string) => any; + }; +} + +export function client(opts: Options): Client; +export function Client(opts: Options): Client; diff --git a/types/tmi.js/strict-event-emitter-types/index.d.ts b/types/tmi.js/strict-event-emitter-types/index.d.ts new file mode 100644 index 0000000000..d5d09a5d3a --- /dev/null +++ b/types/tmi.js/strict-event-emitter-types/index.d.ts @@ -0,0 +1,67 @@ +/** + * Copyright 2018 bterlson + * + * Permission to use, copy, modify, and/or distribute this software for any purpose + * with or without fee is hereby granted, provided that the above copyright notice + * and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + +declare const assignmentCompatibilityHack: unique symbol; +export type MatchingKeys = K extends (TRecord[K] extends TMatch ? K : never) ? K : never; +export type VoidKeys = MatchingKeys; +export interface TypeRecord { + ' _emitterType'?: T; + ' _eventsType'?: U; + ' _emitType'?: V; +} +export type ReturnTypeOfMethod = T extends (...args: any[]) => any ? ReturnType : never; +export type ReturnTypeOfMethodIfExists = S extends keyof T ? ReturnTypeOfMethod : never; +export type InnerEEMethodReturnType = T extends (...args: any[]) => any ? ReturnType extends never | undefined ? FValue : TValue : FValue; +export type EEMethodReturnType = S extends keyof T ? InnerEEMethodReturnType : FValue; +type ListenerType = [T] extends [(...args: infer U) => any] ? U : [T] extends [never] ? [] : [T]; +export interface OverriddenMethods { + on

(this: T, event: P, listener: (...args: ListenerType) => void): EEMethodReturnType; + on(event: typeof assignmentCompatibilityHack, listener: (...args: any[]) => any): void; + addListener

(this: T, event: P, listener: (...args: ListenerType) => void): EEMethodReturnType; + addListener(event: typeof assignmentCompatibilityHack, listener: (...args: any[]) => any): void; + addEventListener

(this: T, event: P, listener: (...args: ListenerType) => void): EEMethodReturnType; + addEventListener(event: typeof assignmentCompatibilityHack, listener: (...args: any[]) => any): void; + removeListener(this: T, event: keyof TEventRecord, listener: (...args: any[]) => any): EEMethodReturnType; + removeListener(event: typeof assignmentCompatibilityHack, listener: (...args: any[]) => any): void; + removeEventListener(this: T, event: keyof TEventRecord, listener: (...args: any[]) => any): EEMethodReturnType; + removeEventListener(event: typeof assignmentCompatibilityHack, listener: (...args: any[]) => any): void; + once

(this: T, event: P, listener: (...args: ListenerType) => void): EEMethodReturnType; + once(event: typeof assignmentCompatibilityHack, listener: (...args: any[]) => any): void; + emit

(this: T, event: P, ...args: ListenerType): EEMethodReturnType; + emit(event: typeof assignmentCompatibilityHack, ...args: any[]): void; +} +export type OverriddenKeys = keyof OverriddenMethods; +export type StrictEventEmitter = + Exclude, NeededMethods extends Exclude = Exclude> = + TypeRecord & Pick> & + Pick, NeededMethods>; +export default StrictEventEmitter; +export type NoUndefined = T extends undefined ? never : T; +export interface StrictBroadcast, + TEmitRecord extends NoUndefined = NoUndefined, + VK extends VoidKeys = VoidKeys, NVK extends Exclude = Exclude> { + (event: E, request: TEmitRecord[E]): any; + (event: VK): any; +} +export type EventNames, + TEventRecord extends NoUndefined = NoUndefined, + TEmitRecord extends NoUndefined = NoUndefined> = keyof TEmitRecord | keyof TEventRecord; +export type OnEventNames, + TEventRecord extends NoUndefined = NoUndefined, + TEmitRecord extends NoUndefined = NoUndefined> = keyof TEventRecord; +export type EmitEventNames, + TEventRecord extends NoUndefined = NoUndefined, + TEmitRecord extends NoUndefined = NoUndefined> = keyof TEmitRecord; diff --git a/types/tmi.js/tmi.js-tests.ts b/types/tmi.js/tmi.js-tests.ts new file mode 100644 index 0000000000..28a380088b --- /dev/null +++ b/types/tmi.js/tmi.js-tests.ts @@ -0,0 +1,108 @@ +import * as tmi from "tmi.js"; + +const options: tmi.Options = { + channels: ['#channel1', '#channel2'], + connection: { + maxReconnectAttempts: 2, + maxReconnectInverval: 10, + port: 100, + reconnect: true, + reconnectDecay: 20, + reconnectInterval: 10, + secure: true, + timeout: 20 + }, + identity: { + password: "oauth:xxxOAuthIDHerexxx", + username: "yourusernamehere" + }, + logger: { + warn: (message) => { }, + error: (message) => { }, + info: (message) => { }, + }, + options: { + clientId: "xxxapiidherexxx", + debug: true + } +}; + +const client: tmi.Client = tmi.Client(options); + +client.connect().then(() => { + client.on("subscription", (channel: string, username: string, methods: tmi.SubMethods, msg: string, userstate: tmi.SubUserstate) => { + client.say(channel, `Thank you to ${userstate["display-name"]} for subscribing!`); + client.ping(); + client.r9kbeta(channel); + client.r9kbetaoff(channel); + client.raw("xxxRawIRCHere"); + switch (client.readyState()) { + case "CLOSED": + case "CLOSING": + case "CONNECTING": + case "OPEN": + break; + } + client.slow(channel, 5); + client.slowoff(channel); + client.subscribers(channel); + client.subscribersoff(channel); + client.timeout(channel, username, 600, "timeoutreason"); + client.ban(channel, username, "reason"); + client.unban(channel, username); + client.host(channel, "tohost"); + client.unhost(channel); + client.mod(channel, username); + client.unmod(channel, username); + client.whisper(username, "whisper"); + client.part(channel); + switch (methods.plan) { + case "1000": + case "2000": + case "3000": + case "Prime": + break; + } + const { badges, color, emotes, flags, id, login, message, mod, subscriber, turbo } = userstate; + if (emotes) { + emotes.test.forEach(element => { }); + } + if (badges) { + const { admin, turbo, subscriber, bits, broadcaster, global_mod, moderator, premium, staff } = badges; + } + userstate["display-name"]; + userstate["emotes-raw"]; + userstate["badges-raw"]; + userstate["message-type"]; + userstate["msg-param-cumulative-months"]; + userstate["msg-param-should-share-streak"]; + userstate["msg-param-streak-months"]; + userstate["msg-param-sub-plan"]; + userstate["msg-param-sub-plan-name"]; + userstate["room-id"]; + userstate["system-msg"]; + userstate["tmi-sent-ts"]; + userstate["user-id"]; + userstate["user-type"]; + }).on("roomstate", (chnl: string, roomstate: tmi.RoomState) => { + const { channel, r9k, rituals, slow } = roomstate; + roomstate["broadcaster-lang"]; + roomstate["emote-only"]; + roomstate["followers-only"]; + roomstate["room-id"]; + roomstate["subs-only"]; + }).once("chat", (channel: string, userstate: tmi.ChatUserstate, message: string, self: boolean) => { + const { badges, bits, color, emotes, flags, id, mod, subscriber, turbo, username } = userstate; + userstate["badges-raw"]; + userstate["display-name"]; + userstate["emotes-raw"]; + userstate["message-type"]; + userstate["room-id"]; + userstate["tmi-sent-ts"]; + userstate["user-id"]; + userstate["user-type"]; + }).once("emotesets", (sets: string, emotes: tmi.EmoteObj) => { + emotes.test[0].code; + emotes.test[0].id; + }); +}); diff --git a/types/p-limit/tsconfig.json b/types/tmi.js/tsconfig.json similarity index 94% rename from types/p-limit/tsconfig.json rename to types/tmi.js/tsconfig.json index 4634bf6300..70fffac476 100644 --- a/types/p-limit/tsconfig.json +++ b/types/tmi.js/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "p-limit-tests.ts" + "tmi.js-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/tmi.js/tslint.json b/types/tmi.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tmi.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/trim-newlines/index.d.ts b/types/trim-newlines/index.d.ts new file mode 100644 index 0000000000..7abe323fe2 --- /dev/null +++ b/types/trim-newlines/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for trim-newlines 2.0 +// Project: https://github.com/sindresorhus/trim-newlines#readme +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function trimNewlines(input: string): string; + +declare namespace trimNewlines { + function start(input: string): string; + function end(input: string): string; +} + +export = trimNewlines; diff --git a/types/trim-newlines/trim-newlines-tests.ts b/types/trim-newlines/trim-newlines-tests.ts new file mode 100644 index 0000000000..e3bc17661a --- /dev/null +++ b/types/trim-newlines/trim-newlines-tests.ts @@ -0,0 +1,10 @@ +import trimNewlines = require("trim-newlines"); + +// $ExpectType string +trimNewlines('\nunicorn\r\n'); + +// $ExpectType string +trimNewlines.start("\n\npony\n"); + +// $ExpectType string +trimNewlines.end("\ndonk\n\n"); diff --git a/types/trim-newlines/tsconfig.json b/types/trim-newlines/tsconfig.json new file mode 100644 index 0000000000..8dbcfef306 --- /dev/null +++ b/types/trim-newlines/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", + "trim-newlines-tests.ts" + ] +} diff --git a/types/trim-newlines/tslint.json b/types/trim-newlines/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/trim-newlines/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/twitch-ext/index.d.ts b/types/twitch-ext/index.d.ts index 4cac514539..6c3126c049 100644 --- a/types/twitch-ext/index.d.ts +++ b/types/twitch-ext/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for non-npm package twitch-ext 1.15 +// Type definitions for non-npm package twitch-ext 1.20 // Project: https://dev.twitch.tv/docs/extensions/reference/#javascript-helper // Definitions by: Benedict Etzel +// Federico Della Rovere // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -29,6 +30,11 @@ interface TwitchExt { */ actions: TwitchExtActions; + /** + * @see https://dev.twitch.tv/docs/extensions/reference/#helper-configuration + */ + configuration: TwitchExtConfiguration; + /** * @see https://dev.twitch.tv/docs/extensions/reference/#twitch-extension-feature-flags */ @@ -170,6 +176,44 @@ interface TwitchExtActions { requestIdShare(): void; } +/** + * @see TwitchExt.configuration + */ +interface TwitchExtConfiguration { + /** + * This property returns the record for the broadcaster segment if one is found; otherwise, undefined. + */ + broadcaster?: { version: string; content: string }; + + /** + * This property returns the record for the developer segment if one is found; otherwise, undefined. + */ + developer?: { version: string; content: string }; + + /** + * This property returns the record for the global segment if one is found; otherwise, undefined. + */ + global?: { version: string; content: string }; + + /** + * This function registers a callback that is called whenever an extension configuration is received. + * The callback function takes no input and returns nothing. After this is called for the first time, + * the records for the global, developer and broadcaster segments will be set if the data is available. + * @param callback The callback that is fired. + */ + onChanged( + callback: () => void + ): void; + + /** + * This function can be called by the front end to set an extension configuration. + * @param segment The configuration segment to set. Valid value. "broadcaster". + * @param version The version of configuration with which the segment is stored. + * @param content The string-encoded configuration. + */ + set(segment: "broadcaster", version: string, content: string): void; +} + interface TwitchExtFeatureFlags { /** * If this flag is true, you can send a chat message to the current channel using Send Extension Chat Message diff --git a/types/twitch-ext/twitch-ext-tests.ts b/types/twitch-ext/twitch-ext-tests.ts index f6a70f86cb..f3b16517d2 100644 --- a/types/twitch-ext/twitch-ext-tests.ts +++ b/types/twitch-ext/twitch-ext-tests.ts @@ -36,6 +36,28 @@ window.Twitch.ext.actions.minimize(); window.Twitch.ext.actions.followChannel("hearthsim"); window.Twitch.ext.actions.requestIdShare(); +// Twitch Extension Configuration +window.Twitch.ext.configuration.onChanged(() => { + console.log('Configuration changed'); + if (window.Twitch.ext.configuration.broadcaster) { + console.log('Caster configuration'); + console.log('version: ', window.Twitch.ext.configuration.broadcaster.version); + console.log('content: ', window.Twitch.ext.configuration.broadcaster.content); + } + if (window.Twitch.ext.configuration.developer) { + console.log('Developer configuration'); + console.log('version:', window.Twitch.ext.configuration.developer.version); + console.log('content: ', window.Twitch.ext.configuration.developer.content); + } + if (window.Twitch.ext.configuration.global) { + console.log('Global configuration'); + console.log('version: ', window.Twitch.ext.configuration.global.version); + console.log('content: ', window.Twitch.ext.configuration.global.content); + } +}); + +window.Twitch.ext.configuration.set('broadcaster', '0.0.1', '{"test": "test"}'); + // Twitch Extension Feature flags window.Twitch.ext.features.onChanged(changed => { if (changed.indexOf("isChatEnabled") !== -1) { diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index f7c73db4c0..209f660277 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -70,6 +70,10 @@ declare module _ { [index: string]: T; } + interface Predicate { + (value: T): boolean; + } + interface ListIterator { (value: T, index: number, list: List): TResult; } @@ -3787,7 +3791,7 @@ declare module _ { * @param attrs Object with key values pair * @return Predicate function **/ - matches(attrs: T): _.ListIterator; + matches(attrs: T): _.Predicate; /** * Returns a predicate function that will tell you if a passed in object contains all of the key/value properties present in attrs. @@ -3795,7 +3799,7 @@ declare module _ { * @param attrs Object with key values pair * @return Predicate function **/ - matcher(attrs: T): _.ListIterator; + matcher(attrs: T): _.Predicate; /** * Returns a function that will itself return the key property of any passed-in object. diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 6ef7fcb168..bd5a871545 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -220,6 +220,8 @@ interface Family { } var isUncleMoe = _.matches({ name: 'moe', relation: 'uncle' }); _.filter([{ name: 'larry', relation: 'father' }, { name: 'moe', relation: 'uncle' }], isUncleMoe); +var uncleMoe: Family = { name: 'moe', relation: 'uncle' }; +isUncleMoe(uncleMoe); diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts new file mode 100644 index 0000000000..8eb6222778 --- /dev/null +++ b/types/unsplash-js/index.d.ts @@ -0,0 +1,243 @@ +// Type definitions for unsplash-js 5.0 +// Project: https://github.com/unsplash/unsplash-js#readme +// Definitions by: Andrew Malikov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export default class Unsplash { + auth: UnsplashApi.Auth; + categories: UnsplashApi.Categories; + collections: UnsplashApi.Collections; + currentUser: UnsplashApi.CurrentUser; + users: UnsplashApi.Users; + photos: UnsplashApi.Photo; + search: UnsplashApi.Search; + stats: UnsplashApi.Stats; + + constructor(options: { + apiUrl?: string; + apiVersion?: string; + applicationId: string; + secret: string; + callbackUrl?: string; + bearerToken?: string; + headers?: { [key: string]: string }; + }); + + request(requestOptions: { + url: string; + method: string; + query: object; + headers: object; + body: object; + oauth: boolean; + }): Promise; +} + +export function toJson(response: any): any; + +export namespace UnsplashApi { + interface Photo { + listPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + listCuratedPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + searchPhotos( + query: string, + categories: ReadonlyArray, + page: number, + perPage: number + ): Promise; + + getPhoto( + id: string, + width?: number, + height?: number, + rectangle?: ReadonlyArray + ): Promise; + + getPhotoStats(id: string): Promise; + + getRandomPhoto(options: { + width?: number; + height?: number; + query?: string; + username?: string; + featured?: boolean; + collections?: ReadonlyArray; + count?: number; + }): Promise; + + uploadPhoto(photo: object): void; + + likePhoto(id: string): Promise; + + unlikePhoto(id: string): Promise; + + downloadPhoto(photo: { + links: { download_location: string }; + }): Promise; + } + + interface Collections { + listCollections( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + listCuratedCollections( + page?: number, + perPage?: number + ): Promise; + + listFeaturedCollections( + page?: number, + perPage?: number + ): Promise; + + getCollection(id: number): Promise; + + getCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + getCuratedCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + createCollection( + title: string, + description?: string, + private?: boolean + ): Promise; + + updateCollection( + id: number, + title?: string, + description?: string, + private?: boolean + ): Promise; + + deleteCollection(id: number): Promise; + + addPhotoToCollection( + collectionId: number, + photoId: string + ): Promise; + + removePhotoFromCollection( + collectionId: number, + photoId: string + ): Promise; + + listRelatedCollections(collectionId: number): Promise; + } + + interface Search { + all(keyword: string, page: number, per_page: number): Promise; + + photos( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + users( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + collections( + keyword: string, + page?: number, + per_page?: number + ): Promise; + } + + interface Stats { + total(): Promise; + } + + interface CurrentUser { + profile(): Promise; + + updateProfile(options: { + username?: string; + firstName?: string; + lastName?: string; + email?: string; + url?: string; + location?: string; + bio?: string; + instagramUsername?: string; + }): Promise; + } + + interface Users { + profile(username: string): Promise; + + statistics( + username: string, + resolution?: string, + quantity?: number + ): Promise; + + photos( + username: string, + page?: number, + perPage?: number, + orderBy?: string, + stats?: boolean + ): Promise; + + likes( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + collections( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + } + + interface Categories { + listCategories(): Promise; + + category(id: any): Promise; + + categoryPhotos( + id: any, + page?: number, + perPage?: number + ): Promise; + } + + interface Auth { + getAuthenticationUrl(scopes?: ReadonlyArray): string; + + userAuthentication(code: string): Promise; + + setBearerToken(accessToken: string): void; + } +} diff --git a/types/unsplash-js/tsconfig.json b/types/unsplash-js/tsconfig.json new file mode 100644 index 0000000000..8d04d7480f --- /dev/null +++ b/types/unsplash-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", + "unsplash-js-tests.ts" + ] +} diff --git a/types/unsplash-js/tslint.json b/types/unsplash-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/unsplash-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/unsplash-js/unsplash-js-tests.ts b/types/unsplash-js/unsplash-js-tests.ts new file mode 100644 index 0000000000..262d4c5e02 --- /dev/null +++ b/types/unsplash-js/unsplash-js-tests.ts @@ -0,0 +1,100 @@ +import Unsplash, { toJson } from "unsplash-js"; + +const unsplash = new Unsplash({ + applicationId: "{APP_ACCESS_KEY}", + secret: "{APP_SECRET}" +}); + +const authenticationUrl = unsplash.auth.getAuthenticationUrl([ + "public", + "read_user", + "write_user", + "read_photos", + "write_photos" +]); + +unsplash.auth + .userAuthentication("{OAUTH_CODE}") + .then(toJson) + .then(json => { + unsplash.auth.setBearerToken(json.access_token); + }); + +unsplash.currentUser.profile(); + +unsplash.currentUser.updateProfile({ + username: "drizzy", + firstName: "Aubrey", + lastName: "Graham", + email: "drizzy@octobersveryown.com", + url: "http://octobersveryown.com", + location: "Toronto, Ontario, Canada", + bio: "Views from the 6", + instagramUsername: "champagnepapi" +}); + +unsplash.users.profile("naoufal"); + +unsplash.users.statistics("naoufal", "days", 30); + +unsplash.users.photos("naoufal", 1, 10, "popular", false); + +unsplash.users.likes("naoufal", 2, 15, "popular"); + +unsplash.users.collections("naoufal", 2, 15, "updated"); + +unsplash.photos.listPhotos(2, 15, "latest"); + +unsplash.photos.getPhoto("mtNweauBsMQ", 1920, 1080, [0, 0, 1920, 1080]); + +unsplash.photos.getPhotoStats("mtNweauBsMQ"); + +unsplash.photos.getRandomPhoto({ username: "naoufal" }); + +unsplash.photos.likePhoto("mtNweauBsMQ"); + +unsplash.photos.unlikePhoto("mtNweauBsMQ"); + +unsplash.photos + .getPhoto("mtNweauBsMQ") + .then(toJson) + .then(json => { + unsplash.photos.downloadPhoto(json); + }); + +unsplash.collections.listCollections(1, 10, "popular"); + +unsplash.collections.listFeaturedCollections(1, 10); + +unsplash.collections.getCollection(123456); + +unsplash.collections.getCollectionPhotos(123456, 1, 10, "popular"); + +unsplash.collections.createCollection( + "Birds", + "Wild birds from 'round the world", + true +); + +unsplash.collections.updateCollection( + 12345, + "Wild Birds", + "Wild birds from around the world", + false +); + +unsplash.collections.deleteCollection(42); + +unsplash.collections.addPhotoToCollection(88, "abc1234"); + +unsplash.collections.removePhotoFromCollection(88, "abc1234"); + +unsplash.collections.listRelatedCollections(88); + +unsplash.search.photos("dogs", 1); + +unsplash.search.users("steve", 1); + +unsplash.search.collections("dogs", 1); + +unsplash.stats.total(); diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index f5c67995da..4fc95db8f1 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Alexey Svetliakov // snerks // Krzysztof Cebula -// Vitaliy Polyanskiy +// Vitaliy Polyanskiy // James Lismore // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -16,7 +16,7 @@ declare module "victory" { /** * Single animation object to interpolate */ - export type AnimationStyle = { [key: string ]: string | number }; + export type AnimationStyle = { [key: string]: string | number }; /** * Animation styles to interpolate @@ -32,6 +32,20 @@ declare module "victory" { "expIn" | "expOut" | "expInOut" | "poly" | "polyIn" | "polyOut" | "polyInOut" | "quad" | "quadIn" | "quadOut" | "quadInOut" | "sin" | "sinIn" | "sinOut" | "sinInOut"; + /** + * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html + */ + type Omit = Pick>; + + type BlockProps = { + top?: number; + bottom?: number; + left?: number; + right?: number; + }; + + type PaddingProps = number | BlockProps; + // Many victory components accept string or number or callback which returns string or number type StringOrNumberOrCallback = | string @@ -44,9 +58,9 @@ declare module "victory" { * Style interface used in components/themeing */ export interface VictoryStyleInterface { - parent?: VictoryStyleObject; - data?: VictoryStyleObject; - labels?: VictoryStyleObject; + parent?: VictoryStyleObject; + data?: VictoryStyleObject; + labels?: VictoryStyleObject; } export interface VictoryAnimationProps { @@ -420,6 +434,81 @@ declare module "victory" { export class VictoryBrushContainer extends React.Component {} + export interface VictoryVoronoiContainerProps extends VictoryContainerProps { + /** + * When the activateData prop is set to true, the active prop will be set to true on all + * data components within a voronoi area. When this prop is set to false, the onActivated + * and onDeactivated callbacks will still fire, but no mutations to data components will + * occur via Victory’s event system. + */ + activateData?: boolean; + /** + * When the activateLabels prop is set to true, the active prop will be set to true on all + * labels corresponding to points within a voronoi area. When this prop is set to false, + * the onActivated and onDeactivated callbacks will still fire, but no mutations to label + * components will occur via Victory’s event system. Labels defined directly on + * VictoryVoronoiContainer via the labels prop will still appear when this prop is set to false. + */ + activateLabels?: boolean; + /** + * When the disable prop is set to true, VictoryVoronoiContainer events will not fire. + */ + disable?: boolean; + /** + * When a labels prop is provided to VictoryVoronoiContainer it will render a label component + * rather than activating labels on the child components it renders. This is useful for + * creating multi- point tooltips. This prop should be given as a function which will be called + * once for each active point. The labels function will be called with the arguments point, + * index, and points, where point refers to a single active point, index refers to the position + * of that point in the array of active points, and points is an array of all active points. + */ + labels?: (point: any, index: number, points: any[]) => string; + /** + * The labelComponent prop specified the component that will be rendered when labels are defined + * on VictoryVoronoiContainer. If the labels prop is omitted, no label component will be rendered. + */ + labelComponent?: React.ReactElement; + /** + * The onActivated prop accepts a function to be called whenever new data points are activated. + * The function is called with the parameters points (an array of active data objects) and props + * (the props used by VictoryVoronoiContainer). + */ + onActivated?: (points: any[], props: VictoryVoronoiContainerProps) => void; + /** + * The onDeactivated prop accepts a function to be called whenever points are deactivated. The + * function is called with the parameters points (an array of the newly-deactivated data objects) + * and props (the props used by VictoryVoronoiContainer). + */ + onDeactivated?: (points: any[], props: VictoryVoronoiContainerProps) => void; + /** + * When the radius prop is set, the voronoi areas associated with each data point will be no larger + * than the given radius. This prop should be given as a number. + */ + radius?: number; + /** + * The voronoiBlacklist prop is used to specify a list of components to ignore when calculating a + * shared voronoi diagram. Components with a name prop matching an element in the voronoiBlacklist + * array will be ignored by VictoryVoronoiContainer. Ignored components will never be flagged as + * active, and will not contribute date to shared tooltips or labels. + */ + voronoiBlacklist?: string[]; + /** + * When the voronoiDimension prop is set, voronoi selection will only take the given dimension into + * account. For example, when dimension is set to “x”, all data points matching a particular x mouse + * position will be activated regardless of y value. When this prop is not given, voronoi selection + * is determined by both x any y values. + */ + voronoiDimension?: "x" | "y"; + /** + * When the voronoiPadding prop is given, the area of the chart that will trigger voronoi events is + * reduced by the given padding on every side. By default, no padding is applied, and the entire range + * of a given chart may trigger voronoi events. This prop should be given as a number. + */ + voronoiPadding?: number; + } + + export class VictoryVoronoiContainer extends React.Component { } + export interface VictoryZoomContainerProps extends VictoryContainerProps { /** * The optional allowPan prop accepts a boolean that enables the panning @@ -774,8 +863,10 @@ declare module "victory" { */ eventHandlers: { [key: string]: { - (event: React.SyntheticEvent): EventCallbackInterface } | - { (event: React.SyntheticEvent): EventCallbackInterface[] + (event: React.SyntheticEvent): EventCallbackInterface + } | + { + (event: React.SyntheticEvent): EventCallbackInterface[] } }; } @@ -791,8 +882,8 @@ declare module "victory" { * Domain padding */ type DomainPaddingPropType = number | { - x?: number | [ number, number]; - y?: number | [ number, number]; + x?: number | [number, number]; + y?: number | [number, number]; }; /** @@ -858,12 +949,7 @@ declare module "victory" { * and right. * @default 50 */ - padding?: number | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; + padding?: PaddingProps; /** * The scale prop determines which scales your chart should use. This prop can be * given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), @@ -1030,66 +1116,66 @@ declare module "victory" { } export interface VictoryAreaProps - extends VictoryCommonProps, - VictoryDatableProps, - VictorySingleLabableProps { - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryArea events. - * Since VictoryArea only renders a single element, the eventKey property is not used. - * The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. an area), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @example - * events={[ - * { - * target: "data", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; - /** - * The interpolation prop determines how data points should be connected when plotting a line - * @default "linear" - */ - interpolation?: InterpolationPropType; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - * @default 50 - */ - samples?: number; - /** - * The style prop specifies styles for your VictoryArea. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. - * @example {data: {fill: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; + extends VictoryCommonProps, + VictoryDatableProps, + VictorySingleLabableProps { + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryArea events. + * Since VictoryArea only renders a single element, the eventKey property is not used. + * The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. an area), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @example + * events={[ + * { + * target: "data", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; + /** + * The interpolation prop determines how data points should be connected when plotting a line + * @default "linear" + */ + interpolation?: InterpolationPropType; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + * @default 50 + */ + samples?: number; + /** + * The style prop specifies styles for your VictoryArea. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. + * @example {data: {fill: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; } /** @@ -1341,13 +1427,13 @@ declare module "victory" { */ cornerRadius?: NumberOrCallback | { - top?: number | (NumberOrCallback), - topLeft?: number | (NumberOrCallback), - topRight?: number | (NumberOrCallback), - bottom?: number | (NumberOrCallback), - bottomLeft?: number | (NumberOrCallback), - bottomRight?: number | (NumberOrCallback) - }; + top?: number | (NumberOrCallback), + topLeft?: number | (NumberOrCallback), + topRight?: number | (NumberOrCallback), + bottom?: number | (NumberOrCallback), + bottomLeft?: number | (NumberOrCallback), + bottomRight?: number | (NumberOrCallback) + }; /** * The event prop take an array of event objects. Event objects are composed of * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace @@ -1418,917 +1504,924 @@ declare module "victory" { */ export class VictoryBar extends React.Component {} - export interface VictoryBoxPlotStyleInterface - extends VictoryStyleInterface { - max?: VictoryStyleObject; - maxLabels?: VictoryStyleObject; - min?: VictoryStyleObject; - minLabels?: VictoryStyleObject; - median?: VictoryStyleObject; - medianLabels?: VictoryStyleObject; - q1?: VictoryStyleObject; - q1Labels?: VictoryStyleObject; - q3?: VictoryStyleObject; - q3Labels?: VictoryStyleObject; - } - - export interface VictoryBoxPlotProps - extends VictoryCommonProps, - VictoryDatableProps { - /** - * The boxWidth prop specifies how wide each box should be. If the whiskerWidth - * prop is not set, this prop will also determine the width of the whisker crosshair. - */ - boxWidth?: number; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryChart, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The labelOrientation prop determines where labels are placed relative to their - * corresponding data. If this prop is not set, it will be set to “top” for - * horizontal charts, and “right” for vertical charts. - */ - labelOrientation?: "top" | "bottom" | "left" | "right"; - /** - * When the boolean labels prop is set to true, the values for min, max, median, - * q1, and q3 will be displayed for each box. For more granular label control, use - * the individual minLabels, maxLabels, medianLabels, q1Labels, and q3Labels props. - */ - labels?: boolean; - /** - * Use the max data accessor prop to define the max value of a box plot. - */ - max?: StringOrNumberOrCallback; - /** - * Use the median data accessor prop to define the median value of a box plot. - */ - median?: StringOrNumberOrCallback; - /** - * Use the min data accessor prop to define the min value of a box plot. - */ - min?: StringOrNumberOrCallback; - /** - * Use the q1 data accessor prop to define the q1 value of a box plot. - */ - q1?: StringOrNumberOrCallback; - /** - * Use the q3 data accessor prop to define the q1 value of a box plot. - */ - q3?: StringOrNumberOrCallback; - /** - * The style prop defines the style of the component. The style prop - * should be given as an object with styles defined for parent, max, - * maxLabels, min, minLabels,median, medianLabels,q1, q1Labels,q3, - * q3Labels. Any valid svg styles are supported, but width, height, a - * nd padding should be specified via props as they determine relative - * layout for components in VictoryChart. Functional styles may be - * defined for style properties, and they will be evaluated with each datum. - */ - style?: VictoryBoxPlotStyleInterface; - /** - * The whiskerWidth prop specifies how wide each whisker crosshair should be. If the - * whiskerWidth prop is not set, the width of the whisker crosshair will match - * the width of the box. - */ - whiskerWidth?: number; - } - - /** - * VictoryBoxPlot renders a box plot to describe the distribution of a set of data. Data for - * VictoryBoxPlot may be given with summary statistics pre-calculated (min, median, max, q1, q3), - * or as an array of raw data. VictoryBoxPlot can be composed with VictoryChart to create box plot charts. - */ - export class VictoryBoxPlot extends React.Component< - VictoryBoxPlotProps, - any - > {} - - export interface VictoryChartProps extends VictoryCommonProps { - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryChart, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The style prop specifies styles for your chart. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. - * @example {border: "1px solid #ccc", margin: "2%", maxWidth: "40%"} - */ - style?: Pick; - } - - /** - * A flexible charting component for React. - * VictoryChart composes other Victory components into reusable charts. - * Acting as a coordinator rather than a stand-alone component, VictoryChart reconciles props such as domain and scale for child components, - * and provides a set of sensible defaults. This component works with: - * - VictoryAxis - * - VictoryLine - * - VictoryScatter - * - VictoryBar - */ - export class VictoryChart extends React.Component {} - - export interface VictoryGroupProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The categories prop specifies how categorical data for a chart should be ordered. - * This prop should be given as an array of string values, or an object with - * these values for x and y. When categories are not given as an object - * When this prop is set on a wrapper component, it will dictate the categories of - * its the children. If this prop is not set, any categories on child component - * or categorical data, will be merged to create a shared set of categories. - * @example ["dogs", "cats", "mice"] - */ - categories?: CategoryPropType; - /** - * The colorScale prop is an optional prop that defines the color scale the chart's bars - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryBar will automatically assign - * values from this color scale to the bars unless colors are explicitly provided in the - * `dataAttributes` prop. - */ - colorScale?: ColorScalePropType; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @examples: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryGroup, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The offset prop determines the number of pixels each element in a group should - * be offset from its original position of the on the independent axis. In the - * case of groups of bars, this number should be equal to the width of the bar - * plus the desired spacing between bars. - */ - offset?: number; - /** - * The style prop specifies styles for your grouped chart. These styles will be - * applied to all grouped children - */ - style?: VictoryStyleInterface; - } - - export class VictoryGroup extends React.Component {} - - export interface VictoryLineProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryLine events. - * Since VictoryLine only renders a single element, the eventKey property is not used. - * The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a line), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * mutation: (props) => { - * return {style: merge({}, props.style, {stroke: "orange"})}; - * } - * }, { - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; - /** - * The interpolation prop determines how data points should be connected - * when plotting a line - */ - interpolation?: InterpolationPropType; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - */ - samples?: number; - /** - * The labels prop defines the labels that will appear above each point. - * This prop should be given as an array or as a function of data. - */ - labels?: string[]|number[]|Function; - /** - * Use the sortKey prop to indicate how data should be sorted. This prop - * is given directly to the lodash sortBy function to be executed on the - * final dataset. - */ - sortKey?: string|string[]|Function; - /** - * The style prop specifies styles for your VictoryLine. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. in addition to normal style properties, angle and verticalAnchor - * may also be specified via the labels object, and they will be passed as props to - * VictoryLabel, or any custom labelComponent. - * @examples{data: {stroke: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; - } - - /** - * VictoryLine creates a line based on data. VictoryLine is a composable component, so it does not include an axis. - * Check out VictoryChart for easy to use line charts and more. - */ - export class VictoryLine extends React.Component {} - - export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { - /** - * The colorScale prop defines a color scale to be applied to each data - * symbol in VictoryLegend. This prop should be given as an array of CSS - * colors, or as a string corresponding to one of the built in color - * scales: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", - * "green", "blue". VictoryLegend will assign a color to each symbol by - * index, unless they are explicitly specified in the data object. - * Colors will repeat when there are more symbols than colors in the - * provided colorScale. - */ - colorScale?: ColorScalePropType; - /** - * The style prop defines the style of the VictoryLegend component. - * The style prop should be given as an object with styles defined for data, labels and - * parent. Any valid svg styles are supported, but width, height, and - * padding should be specified via props as they determine relative - * layout for components in VictoryLegend. - */ - style?: VictoryStyleInterface; - /** - * The containerComponent prop takes a component instance which will be - * used to create a container element for standalone legends. The new - * element created from the passed containerComponent will be provided - * with the following props: height, width, children (the legend itself) - * and style. If a containerComponent is not provided, the default - * VictoryContainer component will be used. VictoryContainer supports - * title and desc props, which are intended to add accessibility to - * Victory components. The more descriptive these props are, the more - * accessible your data will be for people using screen readers. These - * props may be set by passing them directly to the supplied component. - * By default, VictoryContainer renders a responsive svg using the - * viewBox attribute. To render a static container, set - * responsive={false} directly on the instance of VictoryContainer - * supplied via the containerComponent prop. VictoryContainer also - * renders a Portal element that may be used in conjunction with - * VictoryPortal to force components to render above other children. - * @default - */ - containerComponent?: React.ReactElement; - /** - * Specify data via the data prop. VictoryLegend expects data as an - * array of objects with name (required), symbol, and labels properties. - * The data prop must be given as an array. - */ - data?: Array<{ - name?: string; - symbol?: { - fill?: string; - type?: string; - }; - }>; - /** - * The itemsPerRow prop determines how many items to render in each row - * of a horizontal legend, or in each column of a vertical legend. This - * prop should be given as an integer. When this prop is not given, - * legend items will be rendered in a single row or column. - */ - itemsPerRow?: number; - /** - * The dataComponent prop takes a component instance which will be - * responsible for rendering a data element used to associate a symbol - * or color with each data series. The new element created from the - * passed dataComponent will be provided with the following properties - * calculated by VictoryLegend: x, y, size, style, and symbol. Any of - * these props may be overridden by passing in props to the supplied - * component, or modified or ignored within the custom component itself. - * If a dataComponent is not provided, VictoryLegend will use its - * default Point component. - */ - dataComponent?: React.ReactElement; - /** - * The groupComponent prop takes an entire component which will be used to - * create group elements for use within container elements. This prop defaults - * to a tag on web, and a react-native-svg tag on mobile - * @default - */ - groupComponent?: React.ReactElement; - /** - * The gutter prop defines the number of pixels between legend rows or - * columns, depending on orientation. When orientation is horizontal, - * gutters are between columns. When orientation is vertical, gutters - * are the space between rows. - */ - gutter?: number; - /** - * The labelComponent prop takes a component instance which will be used - * to render each legend label. The new element created from the passed - * labelComponent will be supplied with the following properties: x, y, - * style, and text. Any of these props may be overridden by passing in - * props to the supplied component, or modified or ignored within the - * custom component itself. If labelComponent is omitted, a new - * VictoryLabel will be created with the props described above. - */ - labelComponent?: React.ReactElement; - /** - * The orientation prop takes a string that defines whether legend data - * are displayed in a row or column. When orientation is "horizontal", - * legend items will be displayed in a single row. When orientation is - * "vertical", legend items will be displayed in a single column. Line - * and text-wrapping is not currently supported, so "vertical" - * orientation is both the default setting and recommended for - * displaying many series of data. - * @default 'vertical' - */ - orientation?: 'horizontal'|'vertical'; - /** - * The padding prop specifies the amount of padding in pixels between - * the edge of the legend and any rendered child components. This prop - * can be given as a number or as an object with padding specified for - * top, bottom, left and right. As with width and height, the absolute - * padding will depend on whether the component is rendered in a - * responsive container. When a component is nested within - * VictoryLegend, setting padding on the child component will have no - * effect. - */ - padding?: number | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; - /** - * The standalone props specifies whether the component should be - * rendered in an independent element or in a tag. This prop - * defaults to true, and renders an svg. - */ - standalone?: boolean; - /** - * The symbolSpacer prop defines the number of pixels between data - * components and label components. - */ - symbolSpacer?: number; - /** - * The width and height props define the width and height of the legend. - * These props may be given as positive numbers or functions of data. If - * these props are not set, width and height will be determined based on - * an approximate text size calculated from the text and style props - * provided to VictoryLegend. - */ - width?: number; - height?: number; - /** - * The x and y props define the base position of the legend element. - */ - x?: number; - y?: number; - } - - /** - * VictoryLegend renders a chart legend component. - */ - export class VictoryLegend extends React.Component {} - - type ScatterSymbolType = "circle" | "diamond" | "plus" | "square" | "star" | "triangleDown" | "triangleUp"; - - export interface VictoryScatterProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabeableProps { - /** - * The bubbleProperty prop indicates which property of the data object should be used - * to scale data points in a bubble chart - */ - bubbleProperty?: string; - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryScatter - * events. The eventKey may optionally be used to select a single element by index rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventKey: "thisOne", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * eventKey: "theOtherOne", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * eventKey: "theOtherOne", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The maxBubbleSize prop sets an upper limit for scaling data points in a bubble chart - */ - maxBubbleSize?: number; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - */ - samples?: number; - /** - * The size prop determines how to scale each data point - */ - size?: number | { (data: any): number }; - /** - * The style prop specifies styles for your VictoryScatter. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. In addition to normal style properties, angle and verticalAnchor - * may also be specified via the labels object, and they will be passed as props to - * VictoryLabel, or any custom labelComponent. - * @example {data: {fill: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; - /** - * The symbol prop determines which symbol should be drawn to represent data points. - */ - symbol?: ScatterSymbolType | { (data: any): ScatterSymbolType }; - } - - /** - * VictoryScatter creates a scatter of points from data. VictoryScatter is a composable component, so it does not include an axis. - * Check out VictoryChart for easy to use scatter plots and more. - */ - export class VictoryScatter extends React.Component {} - - export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The categories prop specifies how categorical data for a chart should be ordered. - * This prop should be given as an array of string values, or an object with - * these values for x and y. When categories are not given as an object - * When this prop is set on a wrapper component, it will dictate the categories of - * its the children. If this prop is not set, any categories on child component - * or catigorical data, will be merged to create a shared set of categories. - * @example ["dogs", "cats", "mice"] - */ - categories?: CategoryPropType; - /** - * The colorScale prop is an optional prop that defines the color scale the chart's bars - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryBar will automatically assign - * values from this color scale to the bars unless colors are explicitly provided in the - * `dataAttributes` prop. - */ - colorScale?: ColorScalePropType; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryStack, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The style prop specifies styles for your grouped chart. These styles will be - * applied to all grouped children - */ - style?: VictoryStyleInterface; - /** - * The xOffset prop is used for grouping stacks of bars. This prop will be set - * by the VictoryGroup component wrapper, or can be set manually. - */ - xOffset?: number; - } - - export class VictoryStack extends React.Component {} - - export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The colorScale prop is an optional prop that defines the color scale the pie - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryPie will automatically assign - * values from this color scale to the pie slices unless colors are explicitly provided in the - * data object - */ - colorScale?: ColorScalePropType; - /** - * The data prop specifies the data to be plotted, - * where data X-value is the slice label (string or number), - * and Y-value is the corresponding number value represented by the slice - * Data should be in the form of an array of data points. - * Each data point may be any format you wish (depending on the `x` and `y` accessor props), - * but by default, an object with x and y properties is expected. - * @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], - * [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]] - */ - data?: any[]; - /** - * The dataComponent prop takes an entire, HTML-complete data component which will be used to - * create slices for each datum in the pie chart. The new element created from the passed - * dataComponent will have the property datum set by the pie chart for the point it renders; - * properties style and pathFunction calculated by VictoryPie; an index property set - * corresponding to the location of the datum in the data provided to the pie; events bound to - * the VictoryPie; and the d3 compatible slice object. - * If a dataComponent is not provided, VictoryPie's Slice component will be used. - */ - dataComponent?: React.ReactElement; - /** - * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. - * If this prop is not set, the label radius will default to the radius of the pie + label padding. - */ - labelRadius?: number; - /** - * The overall end angle of the pie in degrees. This prop is used in conjunction with - * startAngle to create a pie that spans only a segment of a circle. - */ - endAngle?: number; - /** - * The event prop takes an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryPie - * events. The eventKey may optionally be used to select a single element by index rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventKey: 1, - * eventHandlers: { - * onClick: () => { - * return [ - * { - * eventKey: 2, - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * eventKey: 2, - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * Specifies the radius of the chart. If this property is not provided it is computed - * from width, height, and padding props - * - */ - radius?: number; - /** - * When creating a donut chart, this prop determines the number of pixels between - * the center of the chart and the inner edge of a donut. When this prop is set to zero - * a regular pie chart is rendered. - */ - innerRadius?: number; - /** - * Set the cornerRadius for every dataComponent (Slice by default) within VictoryPie - */ - cornerRadius?: number; - /** - * The padAngle prop determines the amount of separation between adjacent data slices - * in number of degrees - */ - padAngle?: number; - /** - * The overall start angle of the pie in degrees. This prop is used in conjunction with - * endAngle to create a pie that spans only a segment of a circle. - */ - startAngle?: number; - /** - * The style prop specifies styles for your pie. VictoryPie relies on Radium, - * so valid Radium style objects should work for this prop. Height, width, and - * padding should be specified via the height, width, and padding props. - * @example {data: {stroke: "black"}, label: {fontSize: 10}} - */ - style?: VictoryStyleInterface; - /** - * The x prop specifies how to access the X value of each data point. - * If given as a function, it will be run on each data point, and returned value will be used. - * If given as an integer, it will be used as an array index for array-type data points. - * If given as a string, it will be used as a property key for object-type data points. - * If given as an array of strings, or a string containing dots or brackets, - * it will be used as a nested object property path (for details see Lodash docs for _.get). - * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). - * @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d) - */ - x?: DataGetterPropType; - /** - * The y prop specifies how to access the Y value of each data point. - * If given as a function, it will be run on each data point, and returned value will be used. - * If given as an integer, it will be used as an array index for array-type data points. - * If given as a string, it will be used as a property key for object-type data points. - * If given as an array of strings, or a string containing dots or brackets, - * it will be used as a nested object property path (for details see Lodash docs for _.get). - * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). - * @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d) - */ - y?: DataGetterPropType; - } - - /** - * victory-pie draws an SVG pie or donut chart with React. - * Styles and data can be customized by passing in your own values as properties to the component. - * Data changes are animated with VictoryAnimation. - */ - export class VictoryPie extends React.Component {} + export interface VictoryBoxPlotStyleInterface extends VictoryStyleInterface { + max?: VictoryStyleObject; + maxLabels?: VictoryStyleObject; + min?: VictoryStyleObject; + minLabels?: VictoryStyleObject; + median?: VictoryStyleObject; + medianLabels?: VictoryStyleObject; + q1?: VictoryStyleObject; + q1Labels?: VictoryStyleObject; + q3?: VictoryStyleObject; + q3Labels?: VictoryStyleObject; } + + export interface VictoryBoxPlotProps extends VictoryCommonProps, VictoryDatableProps { + /** + * The boxWidth prop specifies how wide each box should be. If the whiskerWidth + * prop is not set, this prop will also determine the width of the whisker crosshair. + */ + boxWidth?: number; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryChart, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The labelOrientation prop determines where labels are placed relative to their + * corresponding data. If this prop is not set, it will be set to “top” for + * horizontal charts, and “right” for vertical charts. + */ + labelOrientation?: "top" | "bottom" | "left" | "right"; + /** + * When the boolean labels prop is set to true, the values for min, max, median, + * q1, and q3 will be displayed for each box. For more granular label control, use + * the individual minLabels, maxLabels, medianLabels, q1Labels, and q3Labels props. + */ + labels?: boolean; + /** + * Use the max data accessor prop to define the max value of a box plot. + */ + max?: StringOrNumberOrCallback; + /** + * Use the median data accessor prop to define the median value of a box plot. + */ + median?: StringOrNumberOrCallback; + /** + * Use the min data accessor prop to define the min value of a box plot. + */ + min?: StringOrNumberOrCallback; + /** + * Use the q1 data accessor prop to define the q1 value of a box plot. + */ + q1?: StringOrNumberOrCallback; + /** + * Use the q3 data accessor prop to define the q1 value of a box plot. + */ + q3?: StringOrNumberOrCallback; + /** + * The style prop defines the style of the component. The style prop + * should be given as an object with styles defined for parent, max, + * maxLabels, min, minLabels,median, medianLabels,q1, q1Labels,q3, + * q3Labels. Any valid svg styles are supported, but width, height, a + * nd padding should be specified via props as they determine relative + * layout for components in VictoryChart. Functional styles may be + * defined for style properties, and they will be evaluated with each datum. + */ + style?: VictoryBoxPlotStyleInterface; + /** + * The whiskerWidth prop specifies how wide each whisker crosshair should be. If the + * whiskerWidth prop is not set, the width of the whisker crosshair will match + * the width of the box. + */ + whiskerWidth?: number; + } + + /** + * VictoryBoxPlot renders a box plot to describe the distribution of a set of data. Data for + * VictoryBoxPlot may be given with summary statistics pre-calculated (min, median, max, q1, q3), + * or as an array of raw data. VictoryBoxPlot can be composed with VictoryChart to create box plot charts. + */ + export class VictoryBoxPlot extends React.Component< + VictoryBoxPlotProps, + any + > {} + + export interface VictoryChartProps extends VictoryCommonProps { + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryChart, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The style prop specifies styles for your chart. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. + * @example {border: "1px solid #ccc", margin: "2%", maxWidth: "40%"} + */ + style?: Pick; + } + + /** + * A flexible charting component for React. + * VictoryChart composes other Victory components into reusable charts. + * Acting as a coordinator rather than a stand-alone component, VictoryChart reconciles props such as domain and scale for child components, + * and provides a set of sensible defaults. This component works with: + * - VictoryAxis + * - VictoryLine + * - VictoryScatter + * - VictoryBar + */ + export class VictoryChart extends React.Component {} + + export interface VictoryGroupProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The categories prop specifies how categorical data for a chart should be ordered. + * This prop should be given as an array of string values, or an object with + * these values for x and y. When categories are not given as an object + * When this prop is set on a wrapper component, it will dictate the categories of + * its the children. If this prop is not set, any categories on child component + * or categorical data, will be merged to create a shared set of categories. + * @example ["dogs", "cats", "mice"] + */ + categories?: CategoryPropType; + /** + * The colorScale prop is an optional prop that defines the color scale the chart's bars + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryBar will automatically assign + * values from this color scale to the bars unless colors are explicitly provided in the + * `dataAttributes` prop. + */ + colorScale?: ColorScalePropType; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @examples: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryGroup, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The offset prop determines the number of pixels each element in a group should + * be offset from its original position of the on the independent axis. In the + * case of groups of bars, this number should be equal to the width of the bar + * plus the desired spacing between bars. + */ + offset?: number; + /** + * The style prop specifies styles for your grouped chart. These styles will be + * applied to all grouped children + */ + style?: VictoryStyleInterface; + } + + export class VictoryGroup extends React.Component {} + + export interface VictoryLineProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryLine events. + * Since VictoryLine only renders a single element, the eventKey property is not used. + * The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a line), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * mutation: (props) => { + * return {style: merge({}, props.style, {stroke: "orange"})}; + * } + * }, { + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; + /** + * The interpolation prop determines how data points should be connected + * when plotting a line + */ + interpolation?: InterpolationPropType; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + */ + samples?: number; + /** + * The labels prop defines the labels that will appear above each point. + * This prop should be given as an array or as a function of data. + */ + labels?: string[] | number[] | Function; + /** + * Use the sortKey prop to indicate how data should be sorted. This prop + * is given directly to the lodash sortBy function to be executed on the + * final dataset. + */ + sortKey?: string | string[] | Function; + /** + * The style prop specifies styles for your VictoryLine. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. in addition to normal style properties, angle and verticalAnchor + * may also be specified via the labels object, and they will be passed as props to + * VictoryLabel, or any custom labelComponent. + * @examples{data: {stroke: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; + } + + /** + * VictoryLine creates a line based on data. VictoryLine is a composable component, so it does not include an axis. + * Check out VictoryChart for easy to use line charts and more. + */ + export class VictoryLine extends React.Component {} + + export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { + /** + * The borderComponent prop takes a component instance which will be responsible + * for rendering a border around the legend. The new element created from the passed + * borderComponent will be provided with the following properties calculated by + * VictoryLegend: x, y, width, height, and style. Any of these props may be + * overridden by passing in props to the supplied component, or modified or ignored + * within the custom component itself. If a borderComponent + * is not provided, VictoryLegend will use its default Border component. + * Please note that the default width and height calculated + * for the border component is based on approximated + * text measurements, and may need to be adjusted. + * @default + */ + borderComponent?: React.ReactElement; + /** + * The borderPadding specifies the amount of padding that should + * be added between the legend items and the border. This prop may be given as + * a number, or asanobject with values specified for top, bottom, left, and right. + * Please note that the default width and height calculated for the border + * component is based on approximated text measurements, so padding may need to be adjusted. + */ + borderPadding?: PaddingProps; + /** + * The centerTitle boolean prop specifies whether a legend title should be centered. + */ + centerTitle?: boolean; + /** + * The colorScale prop defines a color scale to be applied to each data + * symbol in VictoryLegend. This prop should be given as an array of CSS + * colors, or as a string corresponding to one of the built in color + * scales: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", + * "green", "blue". VictoryLegend will assign a color to each symbol by + * index, unless they are explicitly specified in the data object. + * Colors will repeat when there are more symbols than colors in the + * provided colorScale. + */ + colorScale?: ColorScalePropType; + /** + * Specify data via the data prop. VictoryLegend expects data as an + * array of objects with name (required), symbol, and labels properties. + * The data prop must be given as an array. + */ + data?: Array<{ + name?: string; + symbol?: { + fill?: string; + type?: string; + }; + }>; + /** + * The dataComponent prop takes a component instance which will be + * responsible for rendering a data element used to associate a symbol + * or color with each data series. The new element created from the + * passed dataComponent will be provided with the following properties + * calculated by VictoryLegend: x, y, size, style, and symbol. Any of + * these props may be overridden by passing in props to the supplied + * component, or modified or ignored within the custom component itself. + * If a dataComponent is not provided, VictoryLegend will use its + * default Point component. + */ + dataComponent?: React.ReactElement; + /** + * VictoryLegend uses the standard eventKey prop to specify how event targets + * are addressed. This prop is not commonly used. + */ + eventKey?: StringOrNumberOrCallback | string[]; + /** + * VictoryLegend uses the standard events prop. + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * VictoryLegend uses the standard externalEventMutations prop. + */ + externalEventMutations?: any[]; + /** + * The gutter prop defines the number of pixels between legend rows or + * columns, depending on orientation. When orientation is horizontal, + * gutters are between columns. When orientation is vertical, gutters + * are the space between rows. + */ + gutter?: number; + /** + * The itemsPerRow prop determines how many items to render in each row + * of a horizontal legend, or in each column of a vertical legend. This + * prop should be given as an integer. When this prop is not given, + * legend items will be rendered in a single row or column. + */ + itemsPerRow?: number; + /** + * The labelComponent prop takes a component instance which will be used + * to render each legend label. The new element created from the passed + * labelComponent will be supplied with the following properties: x, y, + * style, and text. Any of these props may be overridden by passing in + * props to the supplied component, or modified or ignored within the + * custom component itself. If labelComponent is omitted, a new + * VictoryLabel will be created with the props described above. + */ + labelComponent?: React.ReactElement; + /** + * The orientation prop takes a string that defines whether legend data + * are displayed in a row or column. When orientation is "horizontal", + * legend items will be displayed in a single row. When orientation is + * "vertical", legend items will be displayed in a single column. Line + * and text-wrapping is not currently supported, so "vertical" + * orientation is both the default setting and recommended for + * displaying many series of data. + * @default 'vertical' + */ + orientation?: 'horizontal' | 'vertical'; + /** + * The rowGutter prop defines the number of pixels between legend rows. + * This prop may be given as a number, or as an object with values + * specified for “top” and “bottom” gutters. To set spacing between columns, + * use the gutter prop. + */ + rowGutter?: number | Omit; + /** + * The style prop defines the style of the VictoryLegend component. + * The style prop should be given as an object with styles defined for data, labels and + * parent. Any valid svg styles are supported, but width, height, and + * padding should be specified via props as they determine relative + * layout for components in VictoryLegend. + */ + style?: VictoryStyleInterface; + /** + * The symbolSpacer prop defines the number of pixels between data + * components and label components. + */ + symbolSpacer?: number; + /** + * The title prop specifies a title to render with the legend. + * This prop should be given as a string, or an array of strings for multi-line titles. + */ + title?: string | string[]; + /** + * The titleComponent prop takes a component instance which will be used to render + * a title for the component. The new element created from the passed + * labelComponent will be supplied with the following properties: x, y, index, data, + * datum, verticalAnchor, textAnchor, style, text, and events. Any of these props + * may be overridden by passing in props to the supplied component, or modified + * or ignored within the custom component itself. If labelComponent is omitted, + * a new VictoryLabel will be created with the props described above. + */ + titleComponent?: React.ReactElement; + /** + * The titleOrientation prop specifies where the a title should be rendered + * in relation to the rest of the legend. Possible values + * for this prop are “top”, “bottom”, “left”, and “right”. + * @default (provided by default theme): titleOrientation="top" + */ + titleOrientation?: OrientationTypes; + /** + * The x and y props define the base position of the legend element. + */ + x?: number; + y?: number; + } + + /** + * VictoryLegend renders a chart legend component. + */ + export class VictoryLegend extends React.Component {} + + type ScatterSymbolType = "circle" | "diamond" | "plus" | "square" | "star" | "triangleDown" | "triangleUp"; + + export interface VictoryScatterProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabeableProps { + /** + * The bubbleProperty prop indicates which property of the data object should be used + * to scale data points in a bubble chart + */ + bubbleProperty?: string; + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryScatter + * events. The eventKey may optionally be used to select a single element by index rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventKey: "thisOne", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * eventKey: "theOtherOne", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * eventKey: "theOtherOne", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The maxBubbleSize prop sets an upper limit for scaling data points in a bubble chart + */ + maxBubbleSize?: number; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + */ + samples?: number; + /** + * The size prop determines how to scale each data point + */ + size?: number | { (data: any): number }; + /** + * The style prop specifies styles for your VictoryScatter. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. In addition to normal style properties, angle and verticalAnchor + * may also be specified via the labels object, and they will be passed as props to + * VictoryLabel, or any custom labelComponent. + * @example {data: {fill: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; + /** + * The symbol prop determines which symbol should be drawn to represent data points. + */ + symbol?: ScatterSymbolType | { (data: any): ScatterSymbolType }; + } + + /** + * VictoryScatter creates a scatter of points from data. VictoryScatter is a composable component, so it does not include an axis. + * Check out VictoryChart for easy to use scatter plots and more. + */ + export class VictoryScatter extends React.Component {} + + export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The categories prop specifies how categorical data for a chart should be ordered. + * This prop should be given as an array of string values, or an object with + * these values for x and y. When categories are not given as an object + * When this prop is set on a wrapper component, it will dictate the categories of + * its the children. If this prop is not set, any categories on child component + * or catigorical data, will be merged to create a shared set of categories. + * @example ["dogs", "cats", "mice"] + */ + categories?: CategoryPropType; + /** + * The colorScale prop is an optional prop that defines the color scale the chart's bars + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryBar will automatically assign + * values from this color scale to the bars unless colors are explicitly provided in the + * `dataAttributes` prop. + */ + colorScale?: ColorScalePropType; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryStack, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The style prop specifies styles for your grouped chart. These styles will be + * applied to all grouped children + */ + style?: VictoryStyleInterface; + /** + * The xOffset prop is used for grouping stacks of bars. This prop will be set + * by the VictoryGroup component wrapper, or can be set manually. + */ + xOffset?: number; + } + + export class VictoryStack extends React.Component {} + + export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The colorScale prop is an optional prop that defines the color scale the pie + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryPie will automatically assign + * values from this color scale to the pie slices unless colors are explicitly provided in the + * data object + */ + colorScale?: ColorScalePropType; + /** + * The data prop specifies the data to be plotted, + * where data X-value is the slice label (string or number), + * and Y-value is the corresponding number value represented by the slice + * Data should be in the form of an array of data points. + * Each data point may be any format you wish (depending on the `x` and `y` accessor props), + * but by default, an object with x and y properties is expected. + * @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], + * [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]] + */ + data?: any[]; + /** + * The dataComponent prop takes an entire, HTML-complete data component which will be used to + * create slices for each datum in the pie chart. The new element created from the passed + * dataComponent will have the property datum set by the pie chart for the point it renders; + * properties style and pathFunction calculated by VictoryPie; an index property set + * corresponding to the location of the datum in the data provided to the pie; events bound to + * the VictoryPie; and the d3 compatible slice object. + * If a dataComponent is not provided, VictoryPie's Slice component will be used. + */ + dataComponent?: React.ReactElement; + /** + * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. + * If this prop is not set, the label radius will default to the radius of the pie + label padding. + */ + labelRadius?: number; + /** + * The overall end angle of the pie in degrees. This prop is used in conjunction with + * startAngle to create a pie that spans only a segment of a circle. + */ + endAngle?: number; + /** + * The event prop takes an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryPie + * events. The eventKey may optionally be used to select a single element by index rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventKey: 1, + * eventHandlers: { + * onClick: () => { + * return [ + * { + * eventKey: 2, + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * eventKey: 2, + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * Specifies the radius of the chart. If this property is not provided it is computed + * from width, height, and padding props + * + */ + radius?: number; + /** + * When creating a donut chart, this prop determines the number of pixels between + * the center of the chart and the inner edge of a donut. When this prop is set to zero + * a regular pie chart is rendered. + */ + innerRadius?: number; + /** + * Set the cornerRadius for every dataComponent (Slice by default) within VictoryPie + */ + cornerRadius?: number; + /** + * The padAngle prop determines the amount of separation between adjacent data slices + * in number of degrees + */ + padAngle?: number; + /** + * The overall start angle of the pie in degrees. This prop is used in conjunction with + * endAngle to create a pie that spans only a segment of a circle. + */ + startAngle?: number; + /** + * The style prop specifies styles for your pie. VictoryPie relies on Radium, + * so valid Radium style objects should work for this prop. Height, width, and + * padding should be specified via the height, width, and padding props. + * @example {data: {stroke: "black"}, label: {fontSize: 10}} + */ + style?: VictoryStyleInterface; + /** + * The x prop specifies how to access the X value of each data point. + * If given as a function, it will be run on each data point, and returned value will be used. + * If given as an integer, it will be used as an array index for array-type data points. + * If given as a string, it will be used as a property key for object-type data points. + * If given as an array of strings, or a string containing dots or brackets, + * it will be used as a nested object property path (for details see Lodash docs for _.get). + * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). + * @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d) + */ + x?: DataGetterPropType; + /** + * The y prop specifies how to access the Y value of each data point. + * If given as a function, it will be run on each data point, and returned value will be used. + * If given as an integer, it will be used as an array index for array-type data points. + * If given as a string, it will be used as a property key for object-type data points. + * If given as an array of strings, or a string containing dots or brackets, + * it will be used as a nested object property path (for details see Lodash docs for _.get). + * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). + * @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d) + */ + y?: DataGetterPropType; + } + + /** + * victory-pie draws an SVG pie or donut chart with React. + * Styles and data can be customized by passing in your own values as properties to the component. + * Data changes are animated with VictoryAnimation. + */ + export class VictoryPie extends React.Component {} +} diff --git a/types/victory/victory-tests.tsx b/types/victory/victory-tests.tsx index fcd18571e3..32c9b3160d 100644 --- a/types/victory/victory-tests.tsx +++ b/types/victory/victory-tests.tsx @@ -197,9 +197,9 @@ test = ( tick.x }, - ticks: { stroke: tick => tick.color }, - tickLabels: { fontSize: tick => tick.y }, + grid: { strokeWidth: (tick: any) => tick.x }, + ticks: { stroke: (tick: any) => tick.color }, + tickLabels: { fontSize: (tick: any) => tick.y }, }} tickValues={[ new Date(1980, 1, 1), @@ -611,8 +611,8 @@ test = ( ]} style={{ data: { - fill: d => d.x, - stroke: (datum, active) => active ? datum.x : datum.y, + fill: (d: any) => d.x, + stroke: (datum: any, active: boolean) => active ? datum.x : datum.y, strokeWidth: 3 } }} @@ -642,6 +642,19 @@ test = ( /> ); +test = ( + 5} + /> +); + // VictoryPie test test = ( ([ + { + eventKey: "theOtherOne", + mutation: props => ({ style: { ...props.style, fill: "orange" } }) + }, + { + eventKey: "theOtherOne", + target: "labels", + mutation: () => ({ text: "hey" }) + } + ]) + } + }]} /> ); diff --git a/types/vinyl-paths/vinyl-paths-tests.ts b/types/vinyl-paths/vinyl-paths-tests.ts index 3e66d44e3a..4c2c7d940e 100644 --- a/types/vinyl-paths/vinyl-paths-tests.ts +++ b/types/vinyl-paths/vinyl-paths-tests.ts @@ -1,7 +1,8 @@ import gulp = require('gulp'); -import del = require('del'); import paths = require('vinyl-paths'); +const del: (pattern: string | string[]) => any = (pattern) => { }; + gulp.task('delete', function () { return gulp.src('app/*') .pipe(paths(del)); diff --git a/types/vision/package.json b/types/vision/package.json new file mode 100644 index 0000000000..b6f5204c9a --- /dev/null +++ b/types/vision/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} \ No newline at end of file diff --git a/types/voucher-code-generator/index.d.ts b/types/voucher-code-generator/index.d.ts new file mode 100644 index 0000000000..7f0cd7efdc --- /dev/null +++ b/types/voucher-code-generator/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for voucher-code-generator 1.1 +// Project: http://www.voucherify.io/ +// Definitions by: João Moura +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*~ If this module has methods, declare them as functions like so. + */ +export function charset(name: "numbers" | "alphabetic" | "alphanumeric"): string; +export function generate(config?: generatorConfig): string[]; + +/*~ You can declare types that are available via importing the module */ +export interface generatorConfig { + length?: number; + count?: number; + charset?: string; + prefix?: string; + postfix?: string; + pattern?: string; +} diff --git a/types/voucher-code-generator/tsconfig.json b/types/voucher-code-generator/tsconfig.json new file mode 100644 index 0000000000..dc5d0025be --- /dev/null +++ b/types/voucher-code-generator/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", + "voucher-code-generator-tests.ts" + ] +} diff --git a/types/voucher-code-generator/tslint.json b/types/voucher-code-generator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/voucher-code-generator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/voucher-code-generator/voucher-code-generator-tests.ts b/types/voucher-code-generator/voucher-code-generator-tests.ts new file mode 100644 index 0000000000..3232be37aa --- /dev/null +++ b/types/voucher-code-generator/voucher-code-generator-tests.ts @@ -0,0 +1,18 @@ +import voucherGenerator = require('voucher-code-generator'); +import { generatorConfig } from 'voucher-code-generator'; + +const config: generatorConfig = { + length: 6, + count: 3, + charset: "0123456789", + prefix: "offer-", + postfix: "-2019", + pattern: "######" +}; + +voucherGenerator.charset('numbers'); +voucherGenerator.charset('alphabetic'); +voucherGenerator.charset('alphanumeric'); + +voucherGenerator.generate(); +voucherGenerator.generate(config); diff --git a/types/watchpack/package.json b/types/watchpack/package.json new file mode 100644 index 0000000000..a0e2ec3c5c --- /dev/null +++ b/types/watchpack/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chokidar": "^2.1.2" + } +} diff --git a/types/webappsec-credential-management/index.d.ts b/types/webappsec-credential-management/index.d.ts index 580f86facb..7fc8c73d37 100644 --- a/types/webappsec-credential-management/index.d.ts +++ b/types/webappsec-credential-management/index.d.ts @@ -42,7 +42,7 @@ interface CMRequestInit { referrer?: string; referrerPolicy?: string; mode?: string; - credentials?: PasswordCredential|string; + credentials?: PasswordCredential|FederatedCredential|string; cache?: string; redirect?: string; integrity?: string; diff --git a/types/webappsec-credential-management/webappsec-credential-management-tests.ts b/types/webappsec-credential-management/webappsec-credential-management-tests.ts index 15ae1c6b9e..e9d8540e4f 100644 --- a/types/webappsec-credential-management/webappsec-credential-management-tests.ts +++ b/types/webappsec-credential-management/webappsec-credential-management-tests.ts @@ -135,6 +135,9 @@ function federatedSignIn() { // ... any other providers you care about ... default: + fetch( + 'https://example.com/loginEndpoint', + { credentials: credential, method: 'POST' }); break; } } else { @@ -206,6 +209,12 @@ function formEncodedPost(credential: PasswordCredential, token: string) { { credentials: credential, method: 'POST' }); } +function federatedCredentialPost(credential: FederatedCredential) { + fetch( + 'https://example.com/loginEndpoint', + { credentials: credential, method: 'POST' }); +} + // requireUserMediation example: not included in the spec, but included here // to ensure it typechecks correctly. function signOutDeprecated() { diff --git a/types/webpack-dev-server/index.d.ts b/types/webpack-dev-server/index.d.ts index 30fd2482e7..64c0d81bb7 100644 --- a/types/webpack-dev-server/index.d.ts +++ b/types/webpack-dev-server/index.d.ts @@ -28,7 +28,7 @@ declare namespace WebpackDevServer { type ProxyConfigArrayItem = { path?: string | string[]; - context?: string | string[] + context?: string | string[] | httpProxyMiddleware.Filter } & httpProxyMiddleware.Config; type ProxyConfigArray = ProxyConfigArrayItem[]; @@ -52,11 +52,11 @@ declare namespace WebpackDevServer { interface Configuration { /** Provides the ability to execute custom middleware after all other middleware internally within the server. */ - after?: (app: express.Application) => void; + after?: (app: express.Application, server: WebpackDevServer) => void; /** This option allows you to whitelist services that are allowed to access the dev server. */ allowedHosts?: string[]; /** Provides the ability to execute custom middleware prior to all other middleware internally within the server. */ - before?: (app: express.Application) => void; + before?: (app: express.Application, server: WebpackDevServer) => void; /** This option broadcasts the server via ZeroConf networking on start. */ bonjour?: boolean; /** @@ -150,7 +150,7 @@ declare namespace WebpackDevServer { */ quiet?: boolean; /** @deprecated Here you can access the Express app object and add your own custom middleware to it. */ - setup?: (app: express.Application) => void; + setup?: (app: express.Application, server: WebpackDevServer) => void; /** The Unix socket to listen to (instead of a host). */ socket?: string; /** It is possible to configure advanced options for serving static files from contentBase. */ diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index 755245b035..f73d470f10 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -46,7 +46,7 @@ const config: WebpackDevServer.Configuration = { "**": "http://localhost:9090" }, - setup: (app: Application) => { + setup: (app: Application, server: WebpackDevServer) => { // Here you can access the Express app object and add your own custom middleware to it. // For example, to define custom handlers for some paths: app.get('/some/path', (req, res) => { @@ -87,6 +87,9 @@ const c3: WebpackDevServer.Configuration = { const c4: WebpackDevServer.Configuration = { writeToDisk: (filePath: string) => true, }; +const c5: WebpackDevServer.Configuration = { + proxy: [{context: (pathname: string) => true}] +}; // API example server = new WebpackDevServer(compiler, config); diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 705e776c1e..3677523927 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -122,13 +122,13 @@ declare namespace __WebpackModuleApi { * @param dependencies * @param callback */ - accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void; + accept(dependencies: string[], callback?: (updatedDependencies: ModuleId[]) => void): void; /** * Accept code updates for the specified dependencies. The callback is called when dependencies were replaced. * @param dependency * @param callback */ - accept(dependency: string, callback: () => void): void; + accept(dependency: string, callback?: () => void): void; /** * Accept code updates for this module without notification of parents. * This should only be used if the module doesn’t export anything. diff --git a/types/webpack-env/webpack-env-tests.ts b/types/webpack-env/webpack-env-tests.ts index 61fb3f6c55..b07a3b632a 100644 --- a/types/webpack-env/webpack-env-tests.ts +++ b/types/webpack-env/webpack-env-tests.ts @@ -19,6 +19,9 @@ require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: // check if HMR is enabled if(module.hot) { + // accept update of dependency without a callback + module.hot.accept("./handler.js"); + // accept update of dependency module.hot.accept("./handler.js", function() { //... diff --git a/types/webpack-watched-glob-entries-plugin/index.d.ts b/types/webpack-watched-glob-entries-plugin/index.d.ts new file mode 100644 index 0000000000..7c6110413e --- /dev/null +++ b/types/webpack-watched-glob-entries-plugin/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for webpack-watched-glob-entries-plugin 2.1 +// Project: https://github.com/Milanzor/webpack-watched-glob-entries-plugin#readme +// Definitions by: Joel Spadin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { IOptions } from 'glob'; +import { EntryFunc, Plugin } from 'webpack'; + +interface PluginOptions { + basename_as_entry_name?: boolean; +} + +declare class WebpackWatchedGlobEntries extends Plugin { + static getEntries(globs: string[], globOptions?: IOptions, pluginOptions?: PluginOptions): EntryFunc; + static getFiles(globString: string, globOptions?: IOptions, basename_as_entry_name?: boolean): Record; +} + +export = WebpackWatchedGlobEntries; diff --git a/types/webpack-watched-glob-entries-plugin/tsconfig.json b/types/webpack-watched-glob-entries-plugin/tsconfig.json new file mode 100644 index 0000000000..20777e1cef --- /dev/null +++ b/types/webpack-watched-glob-entries-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", + "webpack-watched-glob-entries-plugin-tests.ts" + ] +} diff --git a/types/webpack-watched-glob-entries-plugin/tslint.json b/types/webpack-watched-glob-entries-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-watched-glob-entries-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-watched-glob-entries-plugin/webpack-watched-glob-entries-plugin-tests.ts b/types/webpack-watched-glob-entries-plugin/webpack-watched-glob-entries-plugin-tests.ts new file mode 100644 index 0000000000..f689c11c7b --- /dev/null +++ b/types/webpack-watched-glob-entries-plugin/webpack-watched-glob-entries-plugin-tests.ts @@ -0,0 +1,29 @@ +import GlobEntriesPlugin = require('webpack-watched-glob-entries-plugin'); + +new GlobEntriesPlugin(); // $ExpectType WebpackWatchedGlobEntries + +GlobEntriesPlugin.getEntries(['']); // $ExpectType EntryFunc + +// $ExpectType EntryFunc +GlobEntriesPlugin.getEntries([''], { + ignore: '' +}); + +// $ExpectType EntryFunc +GlobEntriesPlugin.getEntries([''], { + ignore: '', +}, { + basename_as_entry_name: true, +}); + +GlobEntriesPlugin.getFiles(''); // $ExpectType Record + +// $ExpectType Record +GlobEntriesPlugin.getFiles('', { + ignore: '', +}); + +// $ExpectType Record +GlobEntriesPlugin.getFiles('', { + ignore: '', +}, true); diff --git a/types/wordwrap/index.d.ts b/types/wordwrap/index.d.ts new file mode 100644 index 0000000000..63f700df13 --- /dev/null +++ b/types/wordwrap/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for wordwrap 1.0 +// Project: https://github.com/substack/node-wordwrap#readme +// Definitions by: ark120202 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type Wrap = (text: string) => string; + +/** + * Wrap lines until column `stop`. If a word is longer than `stop` characters + * it will overflow. + */ +declare function wordwrap(stop: number, params?: { mode?: wordwrap.Mode }): Wrap; + +/** + * Pad out lines with spaces out to column `start` and then wrap until column + * `stop`. If a word is longer than `stop - start` characters it will overflow. + */ +declare function wordwrap(start: number, stop: number, params?: { mode?: wordwrap.Mode }): Wrap; + +/** + * Pad out lines with spaces out to column `start` and then wrap until column + * `stop`. If a word is longer than `stop - start` characters it will overflow. + */ +declare function wordwrap(params: wordwrap.Options): Wrap; + +declare namespace wordwrap { + interface Options { + stop: number; + start: number; + mode?: Mode; + } + + /** + * Wrap lines until column `stop`. Break up chunks longer than `stop`. + */ + function hard(stop: number): Wrap; + + /** + * Wrap lines until column `stop`. Break up chunks longer than `stop - start`. + */ + function hard(start: number, stop: number): Wrap; // tslint:disable-line:unified-signatures + + /** + * In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks + * which are longer than `stop - start`, in "hard" mode, split chunks with + * `/\b/` and break up chunks longer than `stop - start`. + */ + type Mode = "soft" | "hard"; +} + +export = wordwrap; diff --git a/types/move-file/tsconfig.json b/types/wordwrap/tsconfig.json similarity index 94% rename from types/move-file/tsconfig.json rename to types/wordwrap/tsconfig.json index bcd3f7550e..5444f259f7 100644 --- a/types/move-file/tsconfig.json +++ b/types/wordwrap/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "move-file-tests.ts" + "wordwrap-tests.ts" ] } diff --git a/types/wordwrap/tslint.json b/types/wordwrap/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/wordwrap/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/wordwrap/wordwrap-tests.ts b/types/wordwrap/wordwrap-tests.ts new file mode 100644 index 0000000000..d9661bdac0 --- /dev/null +++ b/types/wordwrap/wordwrap-tests.ts @@ -0,0 +1,19 @@ +import wordwrap = require("wordwrap"); + +// $ExpectType Wrap +wordwrap(80); + +// $ExpectType string +wordwrap(80)(""); + +// $ExpectType string +wordwrap(20, 80)(""); + +// $ExpectType string +wordwrap({ start: 20, stop: 80 })(""); + +// $ExpectType string +wordwrap(80, { mode: "hard" })(""); + +// $ExpectType string +wordwrap.hard(80)(""); diff --git a/types/yog2-kernel/index.d.ts b/types/yog2-kernel/index.d.ts index 0a6d1abc1e..dfe474b0b1 100644 --- a/types/yog2-kernel/index.d.ts +++ b/types/yog2-kernel/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/fex-team/yog2-kernel // Definitions by: ssddi456 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 import * as express from "express"; import * as _ from "lodash"; diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index 58067b926b..f29fe60d23 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -296,7 +296,7 @@ export interface SchemaDescription { type: string; label: string; meta: object; - tests: string[]; + tests: Array<{ name: string, params: object }>; fields: object; } diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 0c515ef78c..152fdd25e4 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -420,7 +420,7 @@ const description: SchemaDescription = { type: "type", label: "label", meta: { key: "value" }, - tests: ["test1", "test2"], + tests: [{ name: "test1", params: {} }, { name: "test2", params: {} }], fields: { key: "value" } }; diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index d1088aba8f..e40e5cc3aa 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -58,21 +58,79 @@ export interface SocketOptions { zap_domain: number; } -export class Socket { +/** + * Export all option names at the global level + */ +export const ZMQ_HWM: number; +export const ZMQ_SWAP: number; +export const ZMQ_AFFINITY: number; +export const ZMQ_IDENTITY: number; +export const ZMQ_SUBSCRIBE: number; +export const ZMQ_UNSUBSCRIBE: number; +export const ZMQ_RATE: number; +export const ZMQ_RECOVERY_IVL: number; +export const ZMQ_MCAST_LOOP: number; +export const ZMQ_SNDBUF: number; +export const ZMQ_RCVBUF: number; +export const ZMQ_RCVMORE: number; +export const ZMQ_FD: number; +export const ZMQ_EVENTS: number; +export const ZMQ_TYPE: number; +export const ZMQ_LINGER: number; +export const ZMQ_RECONNECT_IVL: number; +export const ZMQ_BACKLOG: number; +export const ZMQ_RECOVERY_IVL_MSEC: number; +export const ZMQ_RECONNECT_IVL_MAX: number; +export const ZMQ_MAXMSGSIZE: number; +export const ZMQ_SNDHWM: number; +export const ZMQ_RCVHWM: number; +export const ZMQ_MULTICAST_HOPS: number; +export const ZMQ_RCVTIMEO: number; +export const ZMQ_SNDTIMEO: number; +export const ZMQ_IPV4ONLY: number; +export const ZMQ_LAST_ENDPOINT: number; +export const ZMQ_ROUTER_MANDATORY: number; +export const ZMQ_TCP_KEEPALIVE: number; +export const ZMQ_TCP_KEEPALIVE_CNT: number; +export const ZMQ_TCP_KEEPALIVE_IDLE: number; +export const ZMQ_TCP_KEEPALIVE_INTVL: number; +export const ZMQ_TCP_ACCEPT_FILTER: number; +export const ZMQ_DELAY_ATTACH_ON_CONNECT: number; +export const ZMQ_XPUB_VERBOSE: number; +export const ZMQ_ROUTER_RAW: number; +export const ZMQ_IPV6: number; +export const ZMQ_MECHANISM: number; +export const ZMQ_PLAIN_SERVER: number; +export const ZMQ_PLAIN_USERNAME: number; +export const ZMQ_PLAIN_PASSWORD: number; +export const ZMQ_CURVE_SERVER: number; +export const ZMQ_CURVE_PUBLICKEY: number; +export const ZMQ_CURVE_SECRETKEY: number; +export const ZMQ_CURVE_SERVERKEY: number; +export const ZMQ_ZAP_DOMAIN: number; +export const ZMQ_HEARTBEAT_IVL: number; +export const ZMQ_HEARTBEAT_TTL: number; +export const ZMQ_HEARTBEAT_TIMEOUT: number; +export const ZMQ_CONNECT_TIMEOUT: number; +export const ZMQ_IO_THREADS: number; +export const ZMQ_MAX_SOCKETS: number; +export const ZMQ_ROUTER_HANDOVER: number; + +export class Socket extends NodeJS.EventEmitter { /** * Set `opt` to `val`. * * @param opt Option * @param val Value */ - setsocketopt(opt: number|string, val: any): Socket; + setsockopt(opt: number|string, val: any): Socket; /** * Get socket `opt`. * * @param opt Option number */ - getsocketopt(opt: number|string): any; + getsockopt(opt: number|string): any; /** * Async bind. @@ -156,17 +214,20 @@ export class Socket { */ monitor(interval?: number, numOfEvents?: number): Socket; + /** + * Disable monitoring of a Socket release idle handler + * and close the socket + * + * @return for chaining + */ + unmonitor(): Socket; + /** * Close the socket. * */ close(): Socket; - /** - * Socket event - 'message' - */ - on(eventName: string, callback: (...buffer: Buffer[]) => void): void; - pause(): void; resume(): void;