From b55c6b92b333dbf8301ce5317dea2cc0e3e9cfa3 Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Sat, 21 May 2022 20:55:30 -0600 Subject: [PATCH 1/8] Initial types --- package.json | 6 +- src/plot.d.ts | 136 +++++++++++ test-d/plot.test-d.ts | 83 +++++++ yarn.lock | 516 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 724 insertions(+), 17 deletions(-) create mode 100644 src/plot.d.ts create mode 100644 test-d/plot.test-d.ts diff --git a/package.json b/package.json index afd54781ee..5495226395 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "type": "module", "main": "src/index.js", "module": "src/index.js", + "types": "src/index.d.ts", "jsdelivr": "dist/plot.umd.min.js", "unpkg": "dist/plot.umd.min.js", "exports": { @@ -22,10 +23,12 @@ }, "files": [ "dist/**/*.js", - "src/**/*.js" + "src/**/*.js", + "src/**/*.d.ts" ], "scripts": { "test": "mkdir -p test/output && mocha -r module-alias/register 'test/**/*-test.js' test/plot.js && eslint src test", + "test-types": "npx tsd", "prepublishOnly": "rm -rf dist && rollup -c", "postpublish": "git push && git push --tags", "dev": "vite" @@ -46,6 +49,7 @@ "module-alias": "2", "rollup": "2", "rollup-plugin-terser": "7", + "tsd": "^0.20.0", "vite": "2" }, "dependencies": { diff --git a/src/plot.d.ts b/src/plot.d.ts new file mode 100644 index 0000000000..e04878b97f --- /dev/null +++ b/src/plot.d.ts @@ -0,0 +1,136 @@ +// "Polyfill" for `ariaDescription`. +interface SVGElement { + ariaDescription: string; +} + +/** + * Base types for mark properties. + * + * These specify the type to which a constant or channel option must resolve. + * + * TODO Add all possible mark properties. + */ +type MarkProperties = { + fill: CSSStyleDeclaration["fill"]; + fillOpacity: CSSStyleDeclaration["fillOpacity"]; + stroke: CSSStyleDeclaration["stroke"]; + strokeOpacity: CSSStyleDeclaration["strokeOpacity"]; + strokeWidth: CSSStyleDeclaration["strokeWidth"]; + opacity: CSSStyleDeclaration["opacity"]; + + strokeLinejoin: CSSStyleDeclaration["strokeLinejoin"]; + strokeLinecap: CSSStyleDeclaration["strokeLinecap"]; + strokeMiterlimit: CSSStyleDeclaration["strokeMiterlimit"]; + strokeDasharray: CSSStyleDeclaration["strokeDasharray"]; + strokeDashoffset: CSSStyleDeclaration["strokeDashoffset"]; + mixBlendMode: CSSStyleDeclaration["mixBlendMode"]; + shapeRendering: CSSStyleDeclaration["shapeRendering"]; + paintOrder: CSSStyleDeclaration["paintOrder"]; + dx: number; + dy: number; + target: "_blank" | "_parent" | "_self" | "_top"; + ariaDescription: SVGElement["ariaDescription"]; + ariaHidden: SVGGraphicsElement["ariaHidden"]; + clip: boolean; + + title: SVGTitleElement["textContent"]; + href: SVGAElement["href"]; + ariaLabel: SVGGraphicsElement["ariaLabel"]; +}; + +/** + * Options which can be either constants or channels. + * + * @see https://github.com/observablehq/plot#marks + */ +type ConstantsOrChannels = + | "fill" + | "fillOpacity" + | "stroke" + | "strokeOpacity" + | "strokeWidth" + | "opacity"; + +/** + * Options which can *only* be a channel. + * + * @see https://github.com/observablehq/plot#marks + */ +type Channels = "title" | "href" | "ariaLabel"; + +/** + * Utility type to extract names of properties which match a given type. + */ +export type ExtractKeysByType = keyof { + [Key in keyof Datum as (Datum[Key] extends T ? Key : never)]: Datum[Key] +} + +export type ChannelOption : string> = + | ColumnName + | ((d?: Datum) => PropertyType | null | undefined); + +export type ConstantOrChannelOption = + | PropertyType + | ChannelOption; + +export interface ChannelDefinition { + name: string; + value: unknown; + scale?: "x" | "y"; + optional?: boolean; +} + +/** + * Standard mark options. + * + * @see https://github.com/observablehq/plot#marks + */ +type MarkOptions = + { + [Key in keyof Omit]?: MarkProperties[Key] + } + & { + [Key in ConstantsOrChannels]?: ConstantOrChannelOption + } + & { + [Key in Channels]?: ChannelOption + }; + +export function plot(options?: Record): SVGSVGElement; +export function marks(...marks: any[]): any[]; + +export class Mark { + constructor( + data: Data, + channels: ChannelDefinition[], + options: MarkOptions, + defaults: object + ); + data: Data; + sort: any; + facet: string; + transform: any; + channels: any[]; + dx: number; + dy: number; + clip: string | boolean; + initialize( + facetIndex: any, + facetChannels: any + ): { + index: any; + channels: ( + | string + | { + scale: any; + type: any; + value: any; + label: any; + filter: any; + hint: any; + } + )[][]; + }; + filter(index: any, channels: any, values: any): any; + plot({ marks, ...options }?: { marks?: any[] }): SVGSVGElement; +} diff --git a/test-d/plot.test-d.ts b/test-d/plot.test-d.ts new file mode 100644 index 0000000000..c86bd0fb3c --- /dev/null +++ b/test-d/plot.test-d.ts @@ -0,0 +1,83 @@ +import { expectError } from "tsd"; +import { ChannelOption, ConstantOrChannelOption, ExtractKeysByType, MarkOptions } from "../src/plot"; + +//#region Setup --------------- + +type Datum = { + colString1: string, + colNum1: number, + colString2: string, + colNum2: number, + colDate: Date, +} + +//#endregion Setup + + +//#region Building blocks --------------- + +let colString: ExtractKeysByType; + +// Correct property keys. +colString = "colString1"; +colString = "colString2"; + +// Incorrect property keys. +expectError(colString = "colNum1"); +expectError(colString = "colDate"); + +let colNum: ExtractKeysByType; + +// Correct property keys. +colNum = "colNum1"; +colNum = "colNum2"; + +// Incorrect property keys. +expectError(colNum = "colString1"); +expectError(colNum = "colDate"); + +let colDate: ExtractKeysByType; + +// Correct property keys. +colDate = "colDate"; + +// Incorrect property keys. +expectError(colDate = "colString1"); +expectError(colDate = "colNum1"); + +let channelString: ChannelOption; + +// As column name, auto column names. +channelString = "colString1"; + +// As function. +channelString = (d?: Datum) => d ? d.colString1 : ""; + +// As function, coerced return type. +channelString = (d?: Datum) => d ? d.colDate.toString() : ""; +channelString = (d?: Datum) => d ? String(d.colNum1) : ""; + +// As constant that is not a known column name. +expectError(channelString = "arbitraryString"); + +// As wrong type constant. +expectError(channelString = 1); + +// As function, wrong return type. +expectError(channelString = (d?: Datum) => d ? d.colNum1 : 0); + +// As function, wrong datum column name. +expectError(channelString = (d?: Datum) => d ? d.missingCol : ""); + +// As function, wrong param type. +expectError(channelString = (d?: { colOtherString: string }) => d ? d.colOtherString : ""); + + +//#region Building blocks + + + +//#region MarkOptions --------------- + + +//#endregion MarkOptions diff --git a/yarn.lock b/yarn.lock index 7dd5f0542e..a3bba6351e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@babel/code-frame@^7.10.4": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== @@ -67,6 +67,27 @@ semver "^7.3.5" tar "^6.1.11" +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + "@rollup/plugin-json@4": version "4.1.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3" @@ -100,16 +121,49 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== +"@tsd/typescript@~4.6.3": + version "4.6.4" + resolved "https://registry.yarnpkg.com/@tsd/typescript/-/typescript-4.6.4.tgz#2d49c111c32d15651c9ebe0e6f19a5df04d53f5f" + integrity sha512-+9o716aWbcjKLbV4bCrGlJKJbS0UZNogfVk9U7ffooYSf/9GOJ6wwahTSrRjW7mWQdywQ/sIg9xxbuPLnkmhwg== + +"@types/eslint@^7.2.13": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.29.0.tgz#e56ddc8e542815272720bb0b4ccc2aff9c3e1c78" + integrity sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*": + version "0.0.51" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" + integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== + "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== +"@types/json-schema@*": + version "7.0.11" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + +"@types/minimist@^1.2.0": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" + integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== + "@types/node@*": version "17.0.31" resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.31.tgz#a5bb84ecfa27eec5e1c802c6bbf8139bdb163a5d" integrity sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q== +"@types/normalize-package-data@^2.4.0": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" + integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw== + "@types/resolve@1.17.1": version "1.17.1" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" @@ -182,6 +236,13 @@ ansi-colors@4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== +ansi-escapes@^4.2.1: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -227,6 +288,16 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -250,7 +321,7 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@~3.0.2: +braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -282,6 +353,20 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== +camelcase-keys@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" + integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== + dependencies: + camelcase "^5.3.1" + map-obj "^4.0.0" + quick-lru "^4.0.1" + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + camelcase@^6.0.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" @@ -699,6 +784,19 @@ debug@4.3.3: dependencies: ms "2.1.2" +decamelize-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" + integrity sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk= + dependencies: + decamelize "^1.1.0" + map-obj "^1.0.0" + +decamelize@^1.1.0, decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + decamelize@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" @@ -753,6 +851,13 @@ diff@5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" @@ -782,6 +887,13 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + esbuild-android-64@0.14.38: version "0.14.38" resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.38.tgz#5b94a1306df31d55055f64a62ff6b763a47b7f64" @@ -935,6 +1047,25 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" +eslint-formatter-pretty@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz#7a6877c14ffe2672066c853587d89603e97c7708" + integrity sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ== + dependencies: + "@types/eslint" "^7.2.13" + ansi-escapes "^4.2.1" + chalk "^4.1.0" + eslint-rule-docs "^1.1.5" + log-symbols "^4.0.0" + plur "^4.0.0" + string-width "^4.2.0" + supports-hyperlinks "^2.0.0" + +eslint-rule-docs@^1.1.5: + version "1.1.231" + resolved "https://registry.yarnpkg.com/eslint-rule-docs/-/eslint-rule-docs-1.1.231.tgz#648b978bc5a1bb740be5f28d07470f0926b9cdf1" + integrity sha512-egHz9A1WG7b8CS0x1P6P/Rj5FqZOjray/VjpJa14tMZalfRKvpE2ONJ3plCM7+PcinmU4tcmbPLv0VtwzSdLVA== + eslint-scope@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" @@ -1049,6 +1180,17 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-glob@^3.2.9: + version "3.2.11" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" + integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -1059,6 +1201,13 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fastq@^1.6.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" + integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== + dependencies: + reusify "^1.0.4" + file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -1081,6 +1230,14 @@ find-up@5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" +find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -1155,6 +1312,13 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + glob-parent@^6.0.1: version "6.0.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" @@ -1162,13 +1326,6 @@ glob-parent@^6.0.1: dependencies: is-glob "^4.0.3" -glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - glob@7.2.0, glob@^7.1.3: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -1188,11 +1345,28 @@ globals@^13.6.0, globals@^13.9.0: dependencies: type-fest "^0.20.2" +globby@^11.0.1: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + growl@1.10.5: version "1.10.5" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== +hard-rejection@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" + integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -1220,6 +1394,18 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +hosted-git-info@^2.1.4: + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== + +hosted-git-info@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224" + integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA== + dependencies: + lru-cache "^6.0.0" + htl@0.3: version "0.3.1" resolved "https://registry.yarnpkg.com/htl/-/htl-0.3.1.tgz#13c5a32fa46434f33b84d4553dd37e58a80e8d8a" @@ -1274,6 +1460,11 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -1297,6 +1488,16 @@ ini@^1.3.4: resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== +irregular-plurals@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-3.3.0.tgz#67d0715d4361a60d9fd9ee80af3881c631a31ee2" + integrity sha512-MVBLKUTangM3EfRPFROhmWQQKRDsrgI83J8GS3jXy+OwYqiR2/aoWndYQ5416jLE3uaGgLH7ncme3X9y09gZ3g== + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" @@ -1311,7 +1512,7 @@ is-builtin-module@^3.1.0: dependencies: builtin-modules "^3.0.0" -is-core-module@^2.8.1: +is-core-module@^2.5.0, is-core-module@^2.8.1: version "2.9.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== @@ -1345,6 +1546,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-plain-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" @@ -1434,6 +1640,11 @@ jsdom@19: ws "^8.2.3" xml-name-validator "^4.0.0" +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -1444,6 +1655,11 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= +kind-of@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + levn@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" @@ -1460,6 +1676,18 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -1477,7 +1705,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -log-symbols@4.1.0: +log-symbols@4.1.0, log-symbols@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -1507,11 +1735,52 @@ make-dir@^3.1.0: dependencies: semver "^6.0.0" +map-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= + +map-obj@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" + integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== + +meow@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-9.0.0.tgz#cd9510bc5cac9dee7d03c73ee1f9ad959f4ea364" + integrity sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ== + dependencies: + "@types/minimist" "^1.2.0" + camelcase-keys "^6.2.2" + decamelize "^1.2.0" + decamelize-keys "^1.1.0" + hard-rejection "^2.1.0" + minimist-options "4.1.0" + normalize-package-data "^3.0.0" + read-pkg-up "^7.0.1" + redent "^3.0.0" + trim-newlines "^3.0.0" + type-fest "^0.18.0" + yargs-parser "^20.2.3" + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + mime-db@1.52.0: version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" @@ -1529,6 +1798,11 @@ mimic-response@^2.0.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43" integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== +min-indent@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" + integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== + minimatch@4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-4.2.1.tgz#40d9d511a46bdc4e563c22c3080cde9c0d8299b4" @@ -1543,6 +1817,15 @@ minimatch@^3.0.4, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" +minimist-options@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" + integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A== + dependencies: + arrify "^1.0.1" + is-plain-obj "^1.1.0" + kind-of "^6.0.3" + minipass@^3.0.0: version "3.1.6" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" @@ -1642,6 +1925,26 @@ nopt@^5.0.0: dependencies: abbrev "1" +normalize-package-data@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-package-data@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" + integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== + dependencies: + hosted-git-info "^4.0.1" + is-core-module "^2.5.0" + semver "^7.3.4" + validate-npm-package-license "^3.0.1" + normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" @@ -1698,6 +2001,13 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + p-limit@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" @@ -1705,6 +2015,13 @@ p-limit@^3.0.2: dependencies: yocto-queue "^0.1.0" +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + p-locate@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" @@ -1712,6 +2029,11 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -1719,6 +2041,16 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" +parse-json@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + parse5@6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" @@ -1744,16 +2076,28 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2: +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +plur@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/plur/-/plur-4.0.0.tgz#729aedb08f452645fe8c58ef115bf16b0a73ef84" + integrity sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg== + dependencies: + irregular-plurals "^3.2.0" + postcss@^8.4.13: version "8.4.13" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.13.tgz#7c87bc268e79f7f86524235821dfdf9f73e5d575" @@ -1793,6 +2137,16 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +quick-lru@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" + integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== + randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -1800,6 +2154,25 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" +read-pkg-up@^7.0.0, read-pkg-up@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" + integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== + dependencies: + find-up "^4.1.0" + read-pkg "^5.2.0" + type-fest "^0.8.1" + +read-pkg@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" + readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" @@ -1816,6 +2189,14 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +redent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" + integrity sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg== + dependencies: + indent-string "^4.0.0" + strip-indent "^3.0.0" + regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" @@ -1831,7 +2212,7 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== -resolve@^1.19.0, resolve@^1.22.0: +resolve@^1.10.0, resolve@^1.19.0, resolve@^1.22.0: version "1.22.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== @@ -1840,6 +2221,11 @@ resolve@^1.19.0, resolve@^1.22.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -1869,6 +2255,13 @@ rollup@2, rollup@^2.59.0: optionalDependencies: fsevents "~2.3.2" +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + rw@1: version "1.3.3" resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" @@ -1891,7 +2284,7 @@ saxes@^5.0.1: dependencies: xmlchars "^2.2.0" -semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -1901,7 +2294,7 @@ semver@^6.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.3.5: +semver@^7.3.4, semver@^7.3.5: version "7.3.7" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== @@ -1963,6 +2356,11 @@ simple-get@^3.0.3: once "^1.3.1" simple-concat "^1.0.0" +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" @@ -1988,6 +2386,32 @@ source-map@~0.8.0-beta.0: dependencies: whatwg-url "^7.0.0" +spdx-correct@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" + integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.11" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz#50c0d8c40a14ec1bf449bae69a0ea4685a9d9f95" + integrity sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g== + "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -2011,6 +2435,13 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" +strip-indent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" + integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== + dependencies: + min-indent "^1.0.0" + strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -2037,6 +2468,14 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-hyperlinks@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb" + integrity sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ== + dependencies: + has-flag "^4.0.0" + supports-color "^7.0.0" + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -2109,6 +2548,23 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= +trim-newlines@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" + integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== + +tsd@^0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/tsd/-/tsd-0.20.0.tgz#0346321ee3c506545486227e488e753109164248" + integrity sha512-iba/JlyT3qtnA9t8VrX2Fipu3L31U48oRIf1PNs+lIwQ7n63GTkt9eQlB5bLtfb7nYfy9t8oZzs+K4QEoEIS8Q== + dependencies: + "@tsd/typescript" "~4.6.3" + eslint-formatter-pretty "^4.1.0" + globby "^11.0.1" + meow "^9.0.0" + path-exists "^4.0.0" + read-pkg-up "^7.0.0" + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -2123,11 +2579,31 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.18.0: + version "0.18.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" + integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== + type-fest@^0.20.2: version "0.20.2" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + universalify@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" @@ -2150,6 +2626,14 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + vite@2: version "2.9.8" resolved "https://registry.yarnpkg.com/vite/-/vite-2.9.8.tgz#2c2cb0790beb0fbe4b8c0995b80fe691a91c2545" @@ -2309,7 +2793,7 @@ yargs-parser@20.2.4: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== -yargs-parser@^20.2.2: +yargs-parser@^20.2.2, yargs-parser@^20.2.3: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== From 69b4d85c8916fdecb03c9132f0409e10fd460144 Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Thu, 26 May 2022 02:15:54 -0600 Subject: [PATCH 2/8] Add utility types and tests --- src/misc.d.ts | 73 +++++++++++++++++++++++ src/plot.d.ts | 133 +++++++++++++++++++++++------------------- test-d/misc.test-d.ts | 78 +++++++++++++++++++++++++ test-d/plot.test-d.ts | 67 ++++++++++++--------- 4 files changed, 262 insertions(+), 89 deletions(-) create mode 100644 src/misc.d.ts create mode 100644 test-d/misc.test-d.ts diff --git a/src/misc.d.ts b/src/misc.d.ts new file mode 100644 index 0000000000..845a5e4b9a --- /dev/null +++ b/src/misc.d.ts @@ -0,0 +1,73 @@ +/** + * Utility type to extract names of properties which match a given type. + */ +export type ExtractKeysByType = keyof { + [Key in keyof Datum as (Datum[Key] extends T ? Key : never)]: Datum[Key] +} + +/** + * Utility type to create a type for a mark channel option. + */ +export type ChannelOption : string> = + | ColumnName + | ((d: Datum, i: number) => PropertyType | null | undefined); + +/** + * Utility type to create a type for a mark option which can be a + * constant or a channel. + * + */ +export type ConstantOrChannelOption = + | PropertyType + | ChannelOption; + +/** + * Utility type that constructs a type for the `channels` argument of + * `render()` functions and methods. + */ +export type RenderFunctionChannels = { + [Key in ConstantsOrChannels | Channels]?: MarkProperties[Key][] +} + +/** + * `dimensions` parameter in `render()` functions and methods. + */ +export type RenderFunctionDimensions = { + width: number, + height: number, + marginTop: number, + marginRight: number, + marginBottom: number, + marginLeft: number, + facetMarginTop: number, + facetMarginRight: number, + facetMarginBottom: number, + facetMarginLeft: number +} + +/** + * Utility type that generates types for `x1`, `x2`, `y1`, `y2` + */ +export type MixinExpandXYOptions = { + [V in ("1" | "2") as `${XorY}${V}`]?: StandardMarkOptions[XorY] +} + +/** + * Utility type for adding `inset` properties. + */ +export type MixinInsetOptions = { + inset?: number, + insetTop?: number, + insetRight?: number, + insetBottom?: number, + insetLeft?: number, + rx?: number, + ry?: number +} + +import { + Channels, + ConstantsOrChannels, + MarkProperties, + StandardMarkOptions +} from "./plot"; diff --git a/src/plot.d.ts b/src/plot.d.ts index e04878b97f..9c730dd339 100644 --- a/src/plot.d.ts +++ b/src/plot.d.ts @@ -1,42 +1,49 @@ -// "Polyfill" for `ariaDescription`. -interface SVGElement { - ariaDescription: string; -} - /** * Base types for mark properties. * - * These specify the type to which a constant or channel option must resolve. + * These specify the type to which a constant or channel option must _resolve_. * - * TODO Add all possible mark properties. + * TODO Include all possible mark properties. + * TODO Use `csstype`? */ type MarkProperties = { - fill: CSSStyleDeclaration["fill"]; - fillOpacity: CSSStyleDeclaration["fillOpacity"]; - stroke: CSSStyleDeclaration["stroke"]; - strokeOpacity: CSSStyleDeclaration["strokeOpacity"]; - strokeWidth: CSSStyleDeclaration["strokeWidth"]; - opacity: CSSStyleDeclaration["opacity"]; - - strokeLinejoin: CSSStyleDeclaration["strokeLinejoin"]; - strokeLinecap: CSSStyleDeclaration["strokeLinecap"]; - strokeMiterlimit: CSSStyleDeclaration["strokeMiterlimit"]; - strokeDasharray: CSSStyleDeclaration["strokeDasharray"]; - strokeDashoffset: CSSStyleDeclaration["strokeDashoffset"]; - mixBlendMode: CSSStyleDeclaration["mixBlendMode"]; - shapeRendering: CSSStyleDeclaration["shapeRendering"]; - paintOrder: CSSStyleDeclaration["paintOrder"]; - dx: number; - dy: number; - target: "_blank" | "_parent" | "_self" | "_top"; - ariaDescription: SVGElement["ariaDescription"]; - ariaHidden: SVGGraphicsElement["ariaHidden"]; - clip: boolean; - - title: SVGTitleElement["textContent"]; - href: SVGAElement["href"]; - ariaLabel: SVGGraphicsElement["ariaLabel"]; -}; + fill: CSSStyleDeclaration["fill"], + fillOpacity: CSSStyleDeclaration["fillOpacity"], + stroke: CSSStyleDeclaration["stroke"], + strokeOpacity: number, + strokeWidth: number, + opacity: number, + + strokeLinejoin: CSSStyleDeclaration["strokeLinejoin"], + strokeLinecap: CSSStyleDeclaration["strokeLinecap"], + strokeMiterlimit: CSSStyleDeclaration["strokeMiterlimit"], + strokeDasharray: CSSStyleDeclaration["strokeDasharray"], + strokeDashoffset: CSSStyleDeclaration["strokeDashoffset"], + mixBlendMode: CSSStyleDeclaration["mixBlendMode"], + shapeRendering: CSSStyleDeclaration["shapeRendering"], + paintOrder: CSSStyleDeclaration["paintOrder"], + dx: number, + dy: number, + target: "_self" | "_blank" | "_parent" | "_top", + // `ariaDescription` is not _currently_ supported by TypeScript + // because it is not supported by two or more major browser engines. + // @see https://github.com/microsoft/TypeScript-DOM-lib-generator#why-is-my-fancy-api-still-not-available-here + ariaDescription: string, + ariaHidden: boolean, + clip: boolean | null, + + title: SVGTitleElement["textContent"], + href: SVGAElement["href"], + ariaLabel: SVGGraphicsElement["ariaLabel"], + + // TODO Get types from scales? + x: any, + y: any, + z: any, + + facet: "auto" | "include" | "exclude" | false | null, + sort: any, +} /** * Options which can be either constants or channels. @@ -49,7 +56,9 @@ type ConstantsOrChannels = | "stroke" | "strokeOpacity" | "strokeWidth" - | "opacity"; + | "opacity" + | "x" + | "y"; /** * Options which can *only* be a channel. @@ -58,26 +67,11 @@ type ConstantsOrChannels = */ type Channels = "title" | "href" | "ariaLabel"; -/** - * Utility type to extract names of properties which match a given type. - */ -export type ExtractKeysByType = keyof { - [Key in keyof Datum as (Datum[Key] extends T ? Key : never)]: Datum[Key] -} - -export type ChannelOption : string> = - | ColumnName - | ((d?: Datum) => PropertyType | null | undefined); - -export type ConstantOrChannelOption = - | PropertyType - | ChannelOption; - export interface ChannelDefinition { - name: string; - value: unknown; - scale?: "x" | "y"; - optional?: boolean; + name: string, + value: unknown, + scale?: "x" | "y", + optional?: boolean, } /** @@ -85,7 +79,7 @@ export interface ChannelDefinition { * * @see https://github.com/observablehq/plot#marks */ -type MarkOptions = +type StandardMarkOptions = { [Key in keyof Omit]?: MarkProperties[Key] } @@ -94,26 +88,34 @@ type MarkOptions = } & { [Key in Channels]?: ChannelOption - }; + } export function plot(options?: Record): SVGSVGElement; export function marks(...marks: any[]): any[]; -export class Mark { +/** + * Abstract base class for marks. + * + * @see https://github.com/observablehq/plot#marks + */ +export abstract class Mark { constructor( data: Data, channels: ChannelDefinition[], - options: MarkOptions, + options: StandardMarkOptions, defaults: object ); + data: Data; sort: any; - facet: string; + facet: StandardMarkOptions["facet"]; transform: any; channels: any[]; - dx: number; - dy: number; - clip: string | boolean; + dx: StandardMarkOptions["dx"]; + dy: StandardMarkOptions["dy"]; + // Internally, the `clip` property is a different type than the mark option. + clip: "frame" | false | null; + initialize( facetIndex: any, facetChannels: any @@ -131,6 +133,15 @@ export class Mark { } )[][]; }; + filter(index: any, channels: any, values: any): any; + plot({ marks, ...options }?: { marks?: any[] }): SVGSVGElement; + + abstract render(...args: any[]): SVGElement; } + +import { + ChannelOption, + ConstantOrChannelOption +} from "./misc"; diff --git a/test-d/misc.test-d.ts b/test-d/misc.test-d.ts new file mode 100644 index 0000000000..7c128653fe --- /dev/null +++ b/test-d/misc.test-d.ts @@ -0,0 +1,78 @@ +//#region -------- Setup -------- + +type Datum = { + colString1: string, + colNum1: number, + colString2: string, + colNum2: number, + colDate: Date, +} + +//#endregion Setup + +//#region -------- ChannelOption -------- + +let channelString: ChannelOption; + +// As column name, auto column names. +channelString = "colString1"; + +// As function. +channelString = () => "arbitraryStringConstant"; +channelString = (d) => d.colString1; + +// As function, coerced return type. +channelString = (d) => d.colDate.toString(); +channelString = (d) => String(d.colNum1); +channelString = (d, i) => i.toString(); + +// As constant that is not a known column name. +expectError(channelString = "arbitraryStringConstant"); + +// Incorrect constant type. +expectError(channelString = 1); + +// As function, incorrect return type. +expectError(channelString = (d) => d.colNum1); + +// As function, incorrect datum column name. +expectError(channelString = (d) => d.unknownCol); + +// As function, incorrect param type. +expectError(channelString = (d: { unknownCol: string }) => d.unknownCol); + +//#endregion ChannelOption + +//#region -------- ConstantOrChannelOption -------- + +let constantOrChannelString: ConstantOrChannelOption; + +// As column name, auto column names. +constantOrChannelString = "colString1"; + +// As function. +constantOrChannelString = (d) => d.colString1; + +// As function, coerced return type. +constantOrChannelString = (d) => d.colDate.toString(); +constantOrChannelString = (d) => String(d.colNum1); + +// As constant that is not a known column name. +constantOrChannelString = "arbitraryStringConstant"; + +// Incorrect constant type. +expectError(constantOrChannelString = 1); + +// As function, incorrect return type. +expectError(constantOrChannelString = (d) => d.colNum1); + +// As function, incorrect datum column name. +expectError(constantOrChannelString = (d) => d.unknownCol); + +// As function, incorrect param type. +expectError(constantOrChannelString = (d: { unknownCol: string }) => d.unknownCol); + +//#endregion ConstantOrChannelOption + +import { expectError } from "tsd"; +import { ChannelOption, ConstantOrChannelOption, ExtractKeysByType } from "../src/misc"; diff --git a/test-d/plot.test-d.ts b/test-d/plot.test-d.ts index c86bd0fb3c..b80d4adba7 100644 --- a/test-d/plot.test-d.ts +++ b/test-d/plot.test-d.ts @@ -1,7 +1,4 @@ -import { expectError } from "tsd"; -import { ChannelOption, ConstantOrChannelOption, ExtractKeysByType, MarkOptions } from "../src/plot"; - -//#region Setup --------------- +//#region -------- Setup -------- type Datum = { colString1: string, @@ -14,7 +11,7 @@ type Datum = { //#endregion Setup -//#region Building blocks --------------- +//#region -------- Building blocks -------- let colString: ExtractKeysByType; @@ -45,39 +42,53 @@ colDate = "colDate"; expectError(colDate = "colString1"); expectError(colDate = "colNum1"); -let channelString: ChannelOption; - -// As column name, auto column names. -channelString = "colString1"; +//#endregion Building blocks -// As function. -channelString = (d?: Datum) => d ? d.colString1 : ""; +//#region -------- StandardMarkOptions -------- -// As function, coerced return type. -channelString = (d?: Datum) => d ? d.colDate.toString() : ""; -channelString = (d?: Datum) => d ? String(d.colNum1) : ""; +const options: StandardMarkOptions = {}; -// As constant that is not a known column name. -expectError(channelString = "arbitraryString"); +// Constant or channel option. +options.fill = "#ccc"; +options.fill = (d) => d.colString2; -// As wrong type constant. -expectError(channelString = 1); +// As function, incorrect return type. +expectError(options.fill = (d) => d.colNum1); -// As function, wrong return type. -expectError(channelString = (d?: Datum) => d ? d.colNum1 : 0); +options.x = "100"; +options.x = (d: Datum) => d.colNum1; -// As function, wrong datum column name. -expectError(channelString = (d?: Datum) => d ? d.missingCol : ""); +// As function, incorrect return type. +expectError(options.opacity = (d) => d.colString1); -// As function, wrong param type. -expectError(channelString = (d?: { colOtherString: string }) => d ? d.colOtherString : ""); +// Channel-only option. +options.title = "colString1"; +options.title = (d) => d.colString1; +options.title = () => "stringConstant"; +// As constant. +expectError(options.title = "stringConstant"); -//#region Building blocks +// Incorrect return type. +expectError(options.title = () => 1); +// Constant-only option. +options.dx = 1; +options.target = "_self"; +options.target = "_blank"; +options.target = "_parent"; +options.target = "_top"; +options.clip = true; +options.clip = false; +options.clip = null; +expectError(options.dx = "stringConstant"); +expectError(options.target = "_unknown"); +expectError(options.clip = "true"); +expectError(options.clip = "frame"); -//#region MarkOptions --------------- +//#endregion StandardMarkOptions - -//#endregion MarkOptions +import { expectError } from "tsd"; +import { StandardMarkOptions } from "../src/plot"; +import { ExtractKeysByType } from "../src/misc"; From bdc5d61eeb357838f32314a6eb98a88eed2c0847 Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Thu, 26 May 2022 02:21:38 -0600 Subject: [PATCH 3/8] Add tests --- test-d/plot.test-d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test-d/plot.test-d.ts b/test-d/plot.test-d.ts index b80d4adba7..fb2b4a559d 100644 --- a/test-d/plot.test-d.ts +++ b/test-d/plot.test-d.ts @@ -45,6 +45,7 @@ expectError(colDate = "colNum1"); //#endregion Building blocks //#region -------- StandardMarkOptions -------- +// TODO Exhaustive testing? const options: StandardMarkOptions = {}; @@ -82,11 +83,16 @@ options.clip = true; options.clip = false; options.clip = null; +// Incorrect constant types. expectError(options.dx = "stringConstant"); expectError(options.target = "_unknown"); expectError(options.clip = "true"); expectError(options.clip = "frame"); +// Any channel values. +expectError(options.dx = () => 1); +expectError(options.dx = (d) => d.colNum1); + //#endregion StandardMarkOptions import { expectError } from "tsd"; From 86ba52f737c2ca9e939497daad7149b226f32e4c Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Tue, 31 May 2022 19:46:37 -0600 Subject: [PATCH 4/8] WIP: Rect and bin --- src/index.d.ts | 31 +++++++++++++++++++ src/marks/rect.d.ts | 47 +++++++++++++++++++++++++++++ src/misc.d.ts | 23 ++++++++------ src/plot.d.ts | 63 +++++++++++++++++++++++++++++++++------ src/transforms/bin.d.ts | 29 ++++++++++++++++++ src/transforms/index.d.ts | 33 ++++++++++++++++++++ 6 files changed, 208 insertions(+), 18 deletions(-) create mode 100644 src/index.d.ts create mode 100644 src/marks/rect.d.ts create mode 100644 src/transforms/bin.d.ts create mode 100644 src/transforms/index.d.ts diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000000..3bdc25eb17 --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,31 @@ +export { scale } from "./scales.js"; +export { legend } from "./legends.js"; +export { plot, Mark, marks, MarkChannelDefinition, StandardMarkOptions } from "./plot.js"; +export { Area, area, areaX, areaY } from "./marks/area.js"; +export { Arrow, arrow } from "./marks/arrow.js"; +export { BarX, BarY, barX, barY } from "./marks/bar.js"; +export { boxX, boxY } from "./marks/box.js"; +export { Cell, cell, cellX, cellY } from "./marks/cell.js"; +export { Dot, dot, dotX, dotY } from "./marks/dot.js"; +export { Frame, frame } from "./marks/frame.js"; +export { Image, image } from "./marks/image.js"; +export { Line, line, lineX, lineY } from "./marks/line.js"; +export { Link, link } from "./marks/link.js"; +export { Rect, rect, rectX, rectY, RectOptions } from "./marks/rect.js"; +export { RuleX, RuleY, ruleX, ruleY } from "./marks/rule.js"; +export { Text, text, textX, textY } from "./marks/text.js"; +export { TickX, TickY, tickX, tickY } from "./marks/tick.js"; +export { tree, cluster } from "./marks/tree.js"; +export { Vector, vector, vectorX, vectorY } from "./marks/vector.js"; +export { valueof, column } from "./options.js"; +export { Reducer } from "./transforms"; +export { filter, reverse, sort, shuffle, basic as transform } from "./transforms/basic.js"; +export { bin, binX, binY, BinOptions } from "./transforms/bin.js"; +export { group, groupX, groupY, groupZ } from "./transforms/group.js"; +export { normalize, normalizeX, normalizeY } from "./transforms/normalize.js"; +export { map, mapX, mapY } from "./transforms/map.js"; +export { window, windowX, windowY } from "./transforms/window.js"; +export { select, selectFirst, selectLast, selectMaxX, selectMaxY, selectMinX, selectMinY } from "./transforms/select.js"; +export { stackX, stackX1, stackX2, stackY, stackY1, stackY2 } from "./transforms/stack.js"; +export { treeNode, treeLink } from "./transforms/tree.js"; +export { formatIsoDate, formatWeekday, formatMonth } from "./format.js"; diff --git a/src/marks/rect.d.ts b/src/marks/rect.d.ts new file mode 100644 index 0000000000..c73bd5a632 --- /dev/null +++ b/src/marks/rect.d.ts @@ -0,0 +1,47 @@ +export type RectOptions = + StandardMarkOptions + & MixinExpandXYOptions<"x", Datum> + & MixinExpandXYOptions<"y", Datum> + & MixinInsetOptions + & { + interval: unknown, + }; + +export function rect(data: Data, options: RectOptions): Rect; + +export function rectX(data: Data, options: RectOptions): Rect; + +export function rectY(data: Data, options: RectOptions): Rect; + +/** + * Rect mark. + * + * @template Datum The type of a single datum in the mark dataset. + * @template [Data=Datum[]] The type of the entire mark dataset. + * + * @see https://github.com/observablehq/plot#rect + */ +export class Rect extends Mark { + constructor(data: Data, options: RectOptions); + + insetTop: RectOptions["insetTop"]; + insetRight: RectOptions["insetRight"]; + insetBottom: RectOptions["insetBottom"]; + insetLeft: RectOptions["insetLeft"]; + rx: RectOptions["rx"]; + ry: RectOptions["ry"]; + + render(index: number[], { x, y }: { x: any, y: any }, channels: RenderFunctionChannels, dimensions: RenderFunctionDimensions): SVGElement; +} + +import { + Mark, + StandardMarkOptions +} from "../plot"; + +import { + MixinExpandXYOptions, + MixinInsetOptions, + RenderFunctionChannels, + RenderFunctionDimensions +} from "../misc"; diff --git a/src/misc.d.ts b/src/misc.d.ts index 845a5e4b9a..e06c254ba8 100644 --- a/src/misc.d.ts +++ b/src/misc.d.ts @@ -5,28 +5,30 @@ export type ExtractKeysByType = keyof { [Key in keyof Datum as (Datum[Key] extends T ? Key : never)]: Datum[Key] } +// TODO Accommodate columnar data. + /** * Utility type to create a type for a mark channel option. */ -export type ChannelOption : string> = +export type ChannelOption = | ColumnName - | ((d: Datum, i: number) => PropertyType | null | undefined); + | ((d: Datum, i: number) => OptionPrimitive | undefined); /** * Utility type to create a type for a mark option which can be a * constant or a channel. * */ -export type ConstantOrChannelOption = - | PropertyType - | ChannelOption; +export type ConstantOrChannelOption = + | OptionPrimitive + | ChannelOption; /** * Utility type that constructs a type for the `channels` argument of * `render()` functions and methods. */ export type RenderFunctionChannels = { - [Key in ConstantsOrChannels | Channels]?: MarkProperties[Key][] + [Key in ConstantsOrChannels | Channels]?: OptionPrimitive[] } /** @@ -47,9 +49,12 @@ export type RenderFunctionDimensions = { /** * Utility type that generates types for `x1`, `x2`, `y1`, `y2` + * + * @template XY The option to expand. Either "x" or "y". + * @template Datum The type of a single datum in the mark dataset. */ -export type MixinExpandXYOptions = { - [V in ("1" | "2") as `${XorY}${V}`]?: StandardMarkOptions[XorY] +export type MixinExpandXYOptions = { + [V in ("1" | "2") as `${XY}${V}`]?: StandardMarkOptions[XY] } /** @@ -68,6 +73,6 @@ export type MixinInsetOptions = { import { Channels, ConstantsOrChannels, - MarkProperties, + OptionPrimitive, StandardMarkOptions } from "./plot"; diff --git a/src/plot.d.ts b/src/plot.d.ts index 9c730dd339..bcb15f2256 100644 --- a/src/plot.d.ts +++ b/src/plot.d.ts @@ -45,6 +45,18 @@ type MarkProperties = { sort: any, } +/** + * Primitive types allowed for an option. + * + * @see {@link https://github.com/observablehq/plot/blob/8757c028e12ba434ff2f199f8789e338140170fd/src/options.js#L11|valueof()} + */ + export type OptionPrimitive = + | string + | number + | Date + | boolean + | null; + /** * Options which can be either constants or channels. * @@ -67,27 +79,57 @@ type ConstantsOrChannels = */ type Channels = "title" | "href" | "ariaLabel"; -export interface ChannelDefinition { +// TODO Move to scales file. +export type ScaleName = + | "x" + | "y" + | "r" + | "color" + | "opacity" + | "length" + | "symbol"; + +// TODO Move to scales file. +export type ScaleType = + | "linear" + | "pow" + | "sqrt" + | "log" + | "symlog" + | "utc" + | "time" + | "ordinal" + | "point" + | "band" + | "categorical" + | "identity"; + +// TODO Move to channels file. +export type MarkChannelDefinition = { name: string, value: unknown, - scale?: "x" | "y", + scale?: ScaleName, + type?: ScaleType, + filter?: Function, optional?: boolean, } /** * Standard mark options. * + * @template Datum The type of a single datum in the mark dataset. + * * @see https://github.com/observablehq/plot#marks */ type StandardMarkOptions = { - [Key in keyof Omit]?: MarkProperties[Key] + [Key in keyof Omit]?: OptionPrimitive } & { - [Key in ConstantsOrChannels]?: ConstantOrChannelOption + [Key in ConstantsOrChannels]?: ConstantOrChannelOption } & { - [Key in Channels]?: ChannelOption + [Key in Channels]?: ChannelOption } export function plot(options?: Record): SVGSVGElement; @@ -96,21 +138,24 @@ export function marks(...marks: any[]): any[]; /** * Abstract base class for marks. * + * @template Datum The type of a single datum in the mark dataset. + * @template [Data=Datum[]] The type of the entire mark dataset. + * * @see https://github.com/observablehq/plot#marks */ export abstract class Mark { constructor( data: Data, - channels: ChannelDefinition[], - options: StandardMarkOptions, - defaults: object + channels?: MarkChannelDefinition[], + options?: StandardMarkOptions, + defaults?: Record ); data: Data; sort: any; facet: StandardMarkOptions["facet"]; transform: any; - channels: any[]; + channels: MarkChannelDefinition[]; dx: StandardMarkOptions["dx"]; dy: StandardMarkOptions["dy"]; // Internally, the `clip` property is a different type than the mark option. diff --git a/src/transforms/bin.d.ts b/src/transforms/bin.d.ts new file mode 100644 index 0000000000..caf320d89e --- /dev/null +++ b/src/transforms/bin.d.ts @@ -0,0 +1,29 @@ +export type BinOptions = + Options + & { + thresholds?: + | "auto" // (default) - Scott’s rule, capped at 200 + | "freedman-diaconis" + | "scott" + | "sturges" + | number // a count (hint) representing the desired number of bins + | unknown[] // an array of n threshold values for n + 1 bins + | number // an interval or time interval (for temporal binning; see below) + // a function that returns an array, count, or time interval + | (() => unknown[] | number | unknown) + } + +export function binX(outputs?: object, options?: BinOptions): MarkOptions; + +export function binY(outputs?: { + x: string; +}, options?: BinOptions): MarkOptions; + +export function bin(outputs?: { + fill: string; +}, options?: BinOptions): MarkOptions; + +export function maybeDenseIntervalX(options: any): any; +export function maybeDenseIntervalY(options: any): any; + +import { StandardMarkOptions } from "../plot"; diff --git a/src/transforms/index.d.ts b/src/transforms/index.d.ts new file mode 100644 index 0000000000..16e7a15951 --- /dev/null +++ b/src/transforms/index.d.ts @@ -0,0 +1,33 @@ +export type AggregationMethod = + | "first" + | "last" + | "count" + | "distinct" + | "sum" + | "proportion" + | "proportion-facet" + | "min" + | "min-index" + | "max" + | "max-index" + | "mean" + | "median" + | "mode" + | "pXX" + | "deviation" + | "variance" + | "x" + | "x1" + | "x2" + | "y" + | "y1" + | "y2"; + +export interface ReducerObject { + reduce: (d: Datum[]) => OutputType; +} + +export type Reducer = + | AggregationMethod + | ReducerObject + From 2fd562bb05d81312af02f05f219a0ee723e0e4e9 Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Sat, 18 Jun 2022 19:57:38 -0600 Subject: [PATCH 5/8] Add base declaration files Adds basic declaration files generated by `tsc`. --- src/axes.d.ts | 45 ++++++++ src/axis.d.ts | 97 ++++++++++++++++ src/channel.d.ts | 25 +++++ src/curve.d.ts | 1 + src/defined.d.ts | 8 ++ src/dimensions.d.ts | 44 ++++++++ src/format.d.ts | 6 + src/legends.d.ts | 9 ++ src/legends/ramp.d.ts | 16 +++ src/legends/swatches.d.ts | 9 ++ src/marks/area.d.ts | 14 +++ src/marks/arrow.d.ts | 21 ++++ src/marks/bar.d.ts | 99 +++++++++++++++++ src/marks/box.d.ts | 22 ++++ src/marks/cell.d.ts | 22 ++++ src/marks/dot.d.ts | 26 +++++ src/marks/frame.d.ts | 10 ++ src/marks/image.d.ts | 18 +++ src/marks/line.d.ts | 27 +++++ src/marks/link.d.ts | 18 +++ src/marks/marker.d.ts | 12 ++ src/marks/rule.d.ts | 21 ++++ src/marks/text.d.ts | 34 ++++++ src/marks/tick.d.ts | 70 ++++++++++++ src/marks/tree.d.ts | 21 ++++ src/marks/vector.d.ts | 26 +++++ src/math.d.ts | 1 + src/memoize.d.ts | 1 + src/options.d.ts | 71 ++++++++++++ src/scales.d.ts | 139 +++++++++++++++++++++++ src/scales/diverging.d.ts | 46 ++++++++ src/scales/index.d.ts | 7 ++ src/scales/ordinal.d.ts | 40 +++++++ src/scales/quantitative.d.ts | 113 +++++++++++++++++++ src/scales/schemes.d.ts | 4 + src/scales/temporal.d.ts | 14 +++ src/style.d.ts | 94 ++++++++++++++++ src/transforms/basic.d.ts | 27 +++++ src/transforms/group.d.ts | 203 ++++++++++++++++++++++++++++++++++ src/transforms/identity.d.ts | 2 + src/transforms/inset.d.ts | 18 +++ src/transforms/interval.d.ts | 5 + src/transforms/map.d.ts | 12 ++ src/transforms/normalize.d.ts | 11 ++ src/transforms/select.d.ts | 28 +++++ src/transforms/stack.d.ts | 16 +++ src/transforms/tree.d.ts | 33 ++++++ src/transforms/window.d.ts | 11 ++ src/warnings.d.ts | 2 + 49 files changed, 1619 insertions(+) create mode 100644 src/axes.d.ts create mode 100644 src/axis.d.ts create mode 100644 src/channel.d.ts create mode 100644 src/curve.d.ts create mode 100644 src/defined.d.ts create mode 100644 src/dimensions.d.ts create mode 100644 src/format.d.ts create mode 100644 src/legends.d.ts create mode 100644 src/legends/ramp.d.ts create mode 100644 src/legends/swatches.d.ts create mode 100644 src/marks/area.d.ts create mode 100644 src/marks/arrow.d.ts create mode 100644 src/marks/bar.d.ts create mode 100644 src/marks/box.d.ts create mode 100644 src/marks/cell.d.ts create mode 100644 src/marks/dot.d.ts create mode 100644 src/marks/frame.d.ts create mode 100644 src/marks/image.d.ts create mode 100644 src/marks/line.d.ts create mode 100644 src/marks/link.d.ts create mode 100644 src/marks/marker.d.ts create mode 100644 src/marks/rule.d.ts create mode 100644 src/marks/text.d.ts create mode 100644 src/marks/tick.d.ts create mode 100644 src/marks/tree.d.ts create mode 100644 src/marks/vector.d.ts create mode 100644 src/math.d.ts create mode 100644 src/memoize.d.ts create mode 100644 src/options.d.ts create mode 100644 src/scales.d.ts create mode 100644 src/scales/diverging.d.ts create mode 100644 src/scales/index.d.ts create mode 100644 src/scales/ordinal.d.ts create mode 100644 src/scales/quantitative.d.ts create mode 100644 src/scales/schemes.d.ts create mode 100644 src/scales/temporal.d.ts create mode 100644 src/style.d.ts create mode 100644 src/transforms/basic.d.ts create mode 100644 src/transforms/group.d.ts create mode 100644 src/transforms/identity.d.ts create mode 100644 src/transforms/inset.d.ts create mode 100644 src/transforms/interval.d.ts create mode 100644 src/transforms/map.d.ts create mode 100644 src/transforms/normalize.d.ts create mode 100644 src/transforms/select.d.ts create mode 100644 src/transforms/stack.d.ts create mode 100644 src/transforms/tree.d.ts create mode 100644 src/transforms/window.d.ts create mode 100644 src/warnings.d.ts diff --git a/src/axes.d.ts b/src/axes.d.ts new file mode 100644 index 0000000000..2226f264b7 --- /dev/null +++ b/src/axes.d.ts @@ -0,0 +1,45 @@ +export function Axes({ x: xScale, y: yScale, fx: fxScale, fy: fyScale }: { + x: any; + y: any; + fx: any; + fy: any; +}, { x, y, fx, fy, axis, grid, line, label, facet: { axis: facetAxis, grid: facetGrid, label: facetLabel } }?: { + x?: {}; + y?: {}; + fx?: {}; + fy?: {}; + axis?: boolean; + grid: any; + line: any; + label: any; + facet?: { + axis?: any; + grid: any; + label?: any; + }; +}): { + fy: AxisY; + fx: AxisX; + y: AxisY; + x: AxisX; +}; +export function autoAxisTicks({ x, y, fx, fy }: { + x: any; + y: any; + fx: any; + fy: any; +}, { x: xAxis, y: yAxis, fx: fxAxis, fy: fyAxis }: { + x: any; + y: any; + fx: any; + fy: any; +}): void; +export function autoScaleLabels(channels: any, scales: any, { x, y, fx, fy }: { + x: any; + y: any; + fx: any; + fy: any; +}, dimensions: any, options: any): void; +export function inferFontVariant(scale: any): string; +import { AxisY } from "./axis.js"; +import { AxisX } from "./axis.js"; diff --git a/src/axis.d.ts b/src/axis.d.ts new file mode 100644 index 0000000000..042c09a453 --- /dev/null +++ b/src/axis.d.ts @@ -0,0 +1,97 @@ +export function maybeAutoTickFormat(tickFormat: any, domain: any): any; +export class AxisX { + constructor({ name, axis, ticks, tickSize, tickPadding, tickFormat, fontVariant, grid, label, labelAnchor, labelOffset, line, tickRotate, ariaLabel, ariaDescription }?: { + name?: string; + axis: any; + ticks: any; + tickSize?: number; + tickPadding?: number; + tickFormat: any; + fontVariant: any; + grid: any; + label: any; + labelAnchor: any; + labelOffset: any; + line: any; + tickRotate: any; + ariaLabel: any; + ariaDescription: any; + }); + name: any; + axis: string; + ticks: any; + tickSize: any; + tickPadding: any; + tickFormat: any; + fontVariant: any; + grid: any; + label: any; + labelAnchor: string; + labelOffset: any; + line: any; + tickRotate: any; + ariaLabel: any; + ariaDescription: any; + render(index: any, { [this.name]: x, fy }: { + fy: any; + }, { width, height, marginTop, marginRight, marginBottom, marginLeft, offsetLeft, facetMarginTop, facetMarginBottom, labelMarginLeft, labelMarginRight }: { + width: any; + height: any; + marginTop: any; + marginRight: any; + marginBottom: any; + marginLeft: any; + offsetLeft?: number; + facetMarginTop: any; + facetMarginBottom: any; + labelMarginLeft?: number; + labelMarginRight?: number; + }): any; +} +export class AxisY { + constructor({ name, axis, ticks, tickSize, tickPadding, tickFormat, fontVariant, grid, label, labelAnchor, labelOffset, line, tickRotate, ariaLabel, ariaDescription }?: { + name?: string; + axis: any; + ticks: any; + tickSize?: number; + tickPadding?: number; + tickFormat: any; + fontVariant: any; + grid: any; + label: any; + labelAnchor: any; + labelOffset: any; + line: any; + tickRotate: any; + ariaLabel: any; + ariaDescription: any; + }); + name: any; + axis: string; + ticks: any; + tickSize: any; + tickPadding: any; + tickFormat: any; + fontVariant: any; + grid: any; + label: any; + labelAnchor: string; + labelOffset: any; + line: any; + tickRotate: any; + ariaLabel: any; + ariaDescription: any; + render(index: any, { [this.name]: y, fx }: { + fx: any; + }, { width, height, marginTop, marginRight, marginBottom, marginLeft, offsetTop, facetMarginLeft, facetMarginRight }: { + width: any; + height: any; + marginTop: any; + marginRight: any; + marginBottom: any; + marginLeft: any; + offsetTop?: number; + facetMarginLeft: any; + facetMarginRight: any; + }): any; +} diff --git a/src/channel.d.ts b/src/channel.d.ts new file mode 100644 index 0000000000..eb42769a20 --- /dev/null +++ b/src/channel.d.ts @@ -0,0 +1,25 @@ +export declare function Channel(data: string | any[], { scale, type, value, filter, hint }: { + value: any; + scale: string; +}): { + scale: string; + type: any; + value: any; + label: undefined; + filter: any; + hint: any; +}; +export declare function channelSort(channels: { + find: (arg0: ([, { scale }]: [any, { + scale: any; + }]) => boolean) => any; +}, facetChannels: { + find: (arg0: ([, { scale }]: [any, { + scale: any; + }]) => boolean) => any; +}, data: any, options: { + [x: string]: any; + reverse?: any; + reduce?: any; + limit?: any; +}): void; diff --git a/src/curve.d.ts b/src/curve.d.ts new file mode 100644 index 0000000000..2c7ee282f6 --- /dev/null +++ b/src/curve.d.ts @@ -0,0 +1 @@ +export function Curve(curve: any, tension: any): any; diff --git a/src/defined.d.ts b/src/defined.d.ts new file mode 100644 index 0000000000..386650f665 --- /dev/null +++ b/src/defined.d.ts @@ -0,0 +1,8 @@ +export function defined(x: any): boolean; +export function ascendingDefined(a: any, b: any): any; +export function descendingDefined(a: any, b: any): any; +export function nonempty(x: any): boolean; +export function finite(x: any): any; +export function positive(x: any): any; +export function negative(x: any): any; +export function firstof(...values: any[]): any; diff --git a/src/dimensions.d.ts b/src/dimensions.d.ts new file mode 100644 index 0000000000..4d7778dcb5 --- /dev/null +++ b/src/dimensions.d.ts @@ -0,0 +1,44 @@ +export declare function Dimensions(scales: { + y?: any; + fy?: any; + fx?: any; +}, { x: { axis: xAxis }, y: { axis: yAxis }, fx: { axis: fxAxis }, fy: { axis: fyAxis } }: { + x?: { + axis: any; + }; + y?: { + axis: any; + }; + fx?: { + axis: any; + }; + fy?: { + axis: any; + }; +}, { width, height, facet: { margin: facetMargin, marginTop: facetMarginTop, marginRight: facetMarginRight, marginBottom: facetMarginBottom, marginLeft: facetMarginLeft }, margin, marginTop, marginRight, marginBottom, marginLeft }?: { + width?: number; + height?: number; + facet?: { + margin: any; + marginTop?: any; + marginRight?: any; + marginBottom?: any; + marginLeft?: any; + }; + margin: any; + marginTop?: any; + marginRight?: any; + marginBottom?: any; + marginLeft?: any; +}): { + width: number; + height: number; + marginTop: any; + marginRight: any; + marginBottom: any; + marginLeft: any; + facetMarginTop: any; + facetMarginRight: any; + facetMarginBottom: any; + facetMarginLeft: any; +}; diff --git a/src/format.d.ts b/src/format.d.ts new file mode 100644 index 0000000000..1c37eaac42 --- /dev/null +++ b/src/format.d.ts @@ -0,0 +1,6 @@ +export function formatNumber(locale?: string): (i: any) => any; +export function formatMonth(locale?: string, month?: string): (i: any) => any; +export function formatWeekday(locale?: string, weekday?: string): (i: any) => any; +export function formatIsoDate(date: any): any; +export function formatAuto(locale?: string): (v: any) => any; +export function formatDefault(v: any): any; diff --git a/src/legends.d.ts b/src/legends.d.ts new file mode 100644 index 0000000000..4f1cb17678 --- /dev/null +++ b/src/legends.d.ts @@ -0,0 +1,9 @@ +export declare function legend(options?: {}): any; +export declare function exposeLegends(scales: { + [x: string]: any; +}, defaults?: {}): (key: string, options: {} | undefined) => any; +export declare function Legends(scales: { + [x: string]: any; +}, options: { + [x: string]: any; +}): any[]; diff --git a/src/legends/ramp.d.ts b/src/legends/ramp.d.ts new file mode 100644 index 0000000000..3ee899eab6 --- /dev/null +++ b/src/legends/ramp.d.ts @@ -0,0 +1,16 @@ +export function legendRamp(color: any, { label, tickSize, width, height, marginTop, marginRight, marginBottom, marginLeft, style, ticks, tickFormat, fontVariant, round, className }: { + label?: any; + tickSize?: number; + width?: number; + height?: any; + marginTop?: number; + marginRight?: number; + marginBottom?: any; + marginLeft?: number; + style: any; + ticks?: number; + tickFormat: any; + fontVariant?: string; + round?: boolean; + className: any; +}): any; diff --git a/src/legends/swatches.d.ts b/src/legends/swatches.d.ts new file mode 100644 index 0000000000..3ab4669ef6 --- /dev/null +++ b/src/legends/swatches.d.ts @@ -0,0 +1,9 @@ +export function legendSwatches(color: any, options: any): any; +export function legendSymbols(symbol: any, { fill, fillOpacity, stroke, strokeOpacity, strokeWidth, r, ...options }: { + fill?: any; + fillOpacity?: number; + stroke?: any; + strokeOpacity?: number; + strokeWidth?: number; + r?: number; +}, scale: any): any; diff --git a/src/marks/area.d.ts b/src/marks/area.d.ts new file mode 100644 index 0000000000..da7c9b38f4 --- /dev/null +++ b/src/marks/area.d.ts @@ -0,0 +1,14 @@ +export function area(data: any, options: any): Area; +export function areaX(data: any, options: any): Area; +export function areaY(data: any, options: any): Area; +export class Area extends Mark { + constructor(data: any, options?: {}); + z: any; + curve: any; + filter(index: any): any; + render(I: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/arrow.d.ts b/src/marks/arrow.d.ts new file mode 100644 index 0000000000..3915c8829f --- /dev/null +++ b/src/marks/arrow.d.ts @@ -0,0 +1,21 @@ +export function arrow(data: any, { x, x1, x2, y, y1, y2, ...options }?: { + x: any; + x1: any; + x2: any; + y: any; + y1: any; + y2: any; +}): Arrow; +export class Arrow extends Mark { + constructor(data: any, options?: {}); + bend: number; + headAngle: number; + headLength: number; + insetStart: number; + insetEnd: number; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/bar.d.ts b/src/marks/bar.d.ts new file mode 100644 index 0000000000..a56354e287 --- /dev/null +++ b/src/marks/bar.d.ts @@ -0,0 +1,99 @@ +export function barX(data: any, options?: { + y: (d: any, i: any) => any; + x2: { + transform: (d: any) => any; + }; +}): BarX; +export function barY(data: any, options?: { + x: (d: any, i: any) => any; + y2: { + transform: (d: any) => any; + }; +}): BarY; +export class AbstractBar extends Mark { + constructor(data: any, channels: any, options: {}, defaults: any); + insetTop: any; + insetRight: any; + insetBottom: any; + insetLeft: any; + rx: any; + ry: any; + render(index: any, scales: any, channels: any, dimensions: any): any; + _x(scales: any, { x: X }: { + x: any; + }, { marginLeft }: { + marginLeft: any; + }): any; + _y(scales: any, { y: Y }: { + y: any; + }, { marginTop }: { + marginTop: any; + }): any; + _width({ x }: { + x: any; + }, { x: X }: { + x: any; + }, { marginRight, marginLeft, width }: { + marginRight: any; + marginLeft: any; + width: any; + }): number; + _height({ y }: { + y: any; + }, { y: Y }: { + y: any; + }, { marginTop, marginBottom, height }: { + marginTop: any; + marginBottom: any; + height: any; + }): number; +} +export class BarX extends AbstractBar { + constructor(data: any, options?: {}); + _transform(selection: any, { x }: { + x: any; + }, dx: any, dy: any): void; + _x({ x }: { + x: any; + }, { x1: X1, x2: X2 }: { + x1: any; + x2: any; + }, { marginLeft }: { + marginLeft: any; + }): any; + _width({ x }: { + x: any; + }, { x1: X1, x2: X2 }: { + x1: any; + x2: any; + }, { marginRight, marginLeft, width }: { + marginRight: any; + marginLeft: any; + width: any; + }): number | ((i: any) => number); +} +export class BarY extends AbstractBar { + constructor(data: any, options?: {}); + _transform(selection: any, { y }: { + y: any; + }, dx: any, dy: any): void; + _y({ y }: { + y: any; + }, { y1: Y1, y2: Y2 }: { + y1: any; + y2: any; + }, { marginTop }: { + marginTop: any; + }): any; + _height({ y }: { + y: any; + }, { y1: Y1, y2: Y2 }: { + y1: any; + y2: any; + }, { marginTop, marginBottom, height }: { + marginTop: any; + marginBottom: any; + height: any; + }): number | ((i: any) => number); +} +import { Mark } from "../plot.js"; diff --git a/src/marks/box.d.ts b/src/marks/box.d.ts new file mode 100644 index 0000000000..564a7457b5 --- /dev/null +++ b/src/marks/box.d.ts @@ -0,0 +1,22 @@ +export function boxX(data: any, { x, y, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, ...options }?: { + x?: { + transform: (x: any) => any; + }; + y?: any; + fill?: string; + fillOpacity: any; + stroke?: string; + strokeOpacity: any; + strokeWidth?: number; +}): any[]; +export function boxY(data: any, { y, x, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, ...options }?: { + y?: { + transform: (y: any) => any; + }; + x?: any; + fill?: string; + fillOpacity: any; + stroke?: string; + strokeOpacity: any; + strokeWidth?: number; +}): any[]; diff --git a/src/marks/cell.d.ts b/src/marks/cell.d.ts new file mode 100644 index 0000000000..f36d0675d9 --- /dev/null +++ b/src/marks/cell.d.ts @@ -0,0 +1,22 @@ +export function cell(data: any, { x, y, ...options }?: { + x: any; + y: any; +}): Cell; +export function cellX(data: any, { x, fill, stroke, ...options }?: { + x?: (d: any, i: any) => any; + fill: any; + stroke: any; +}): Cell; +export function cellY(data: any, { y, fill, stroke, ...options }?: { + y?: (d: any, i: any) => any; + fill: any; + stroke: any; +}): Cell; +export class Cell extends AbstractBar { + constructor(data: any, { x, y, ...options }?: { + x: any; + y: any; + }); + _transform(): void; +} +import { AbstractBar } from "./bar.js"; diff --git a/src/marks/dot.d.ts b/src/marks/dot.d.ts new file mode 100644 index 0000000000..c86b86be13 --- /dev/null +++ b/src/marks/dot.d.ts @@ -0,0 +1,26 @@ +export function dot(data: any, { x, y, ...options }?: { + x: any; + y: any; +}): Dot; +export function dotX(data: any, { x, ...options }?: { + x?: { + transform: (d: any) => any; + }; +}): Dot; +export function dotY(data: any, { y, ...options }?: { + y?: { + transform: (d: any) => any; + }; +}): Dot; +export class Dot extends Mark { + constructor(data: any, options?: {}); + r: any; + rotate: any; + symbol: any; + frameAnchor: string; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/frame.d.ts b/src/marks/frame.d.ts new file mode 100644 index 0000000000..6894b76ab6 --- /dev/null +++ b/src/marks/frame.d.ts @@ -0,0 +1,10 @@ +export function frame(options: any): Frame; +export class Frame extends Mark { + constructor(options?: {}); + insetTop: any; + insetRight: any; + insetBottom: any; + insetLeft: any; + render(I: any, scales: any, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/image.d.ts b/src/marks/image.d.ts new file mode 100644 index 0000000000..d0bdb91c2f --- /dev/null +++ b/src/marks/image.d.ts @@ -0,0 +1,18 @@ +export function image(data: any, { x, y, ...options }?: { + x: any; + y: any; +}): Image; +export class Image extends Mark { + constructor(data: any, options?: {}); + src: any; + width: any; + height: any; + preserveAspectRatio: any; + crossOrigin: any; + frameAnchor: string; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/line.d.ts b/src/marks/line.d.ts new file mode 100644 index 0000000000..09abfcab91 --- /dev/null +++ b/src/marks/line.d.ts @@ -0,0 +1,27 @@ +export function line(data: any, { x, y, ...options }?: { + x: any; + y: any; +}): Line; +export function lineX(data: any, { x, y, ...options }?: { + x?: { + transform: (d: any) => any; + }; + y?: (d: any, i: any) => any; +}): Line; +export function lineY(data: any, { x, y, ...options }?: { + x?: (d: any, i: any) => any; + y?: { + transform: (d: any) => any; + }; +}): Line; +export class Line extends Mark { + constructor(data: any, options?: {}); + z: any; + curve: any; + filter(index: any): any; + render(I: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/link.d.ts b/src/marks/link.d.ts new file mode 100644 index 0000000000..3b9840a140 --- /dev/null +++ b/src/marks/link.d.ts @@ -0,0 +1,18 @@ +export function link(data: any, { x, x1, x2, y, y1, y2, ...options }?: { + x: any; + x1: any; + x2: any; + y: any; + y1: any; + y2: any; +}): Link; +export function maybeSameValue(x: any, x1: any, x2: any): any[]; +export class Link extends Mark { + constructor(data: any, options?: {}); + curve: any; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/marker.d.ts b/src/marks/marker.d.ts new file mode 100644 index 0000000000..871b59e558 --- /dev/null +++ b/src/marks/marker.d.ts @@ -0,0 +1,12 @@ +export function markers(mark: any, { marker, markerStart, markerMid, markerEnd }?: { + marker: any; + markerStart?: any; + markerMid?: any; + markerEnd?: any; +}): void; +export function applyMarkers(path: any, mark: any, { stroke: S }: { + stroke: any; +}): void; +export function applyGroupedMarkers(path: any, mark: any, { stroke: S }: { + stroke: any; +}): void; diff --git a/src/marks/rule.d.ts b/src/marks/rule.d.ts new file mode 100644 index 0000000000..b32ef7f753 --- /dev/null +++ b/src/marks/rule.d.ts @@ -0,0 +1,21 @@ +export function ruleX(data: any, options: any): RuleX; +export function ruleY(data: any, options: any): RuleY; +export class RuleX extends Mark { + constructor(data: any, options?: {}); + insetTop: any; + insetBottom: any; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +export class RuleY extends Mark { + constructor(data: any, options?: {}); + insetRight: any; + insetLeft: any; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/text.d.ts b/src/marks/text.d.ts new file mode 100644 index 0000000000..ac5d43552c --- /dev/null +++ b/src/marks/text.d.ts @@ -0,0 +1,34 @@ +export function text(data: any, { x, y, ...options }?: { + x: any; + y: any; +}): Text; +export function textX(data: any, { x, ...options }?: { + x?: { + transform: (d: any) => any; + }; +}): Text; +export function textY(data: any, { y, ...options }?: { + y?: { + transform: (d: any) => any; + }; +}): Text; +export class Text extends Mark { + constructor(data: any, options?: {}); + rotate: any; + textAnchor: any; + lineAnchor: string; + lineHeight: number; + lineWidth: number; + monospace: boolean; + fontFamily: any; + fontSize: any; + fontStyle: any; + fontVariant: any; + fontWeight: any; + frameAnchor: string; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/marks/tick.d.ts b/src/marks/tick.d.ts new file mode 100644 index 0000000000..4e3c61d572 --- /dev/null +++ b/src/marks/tick.d.ts @@ -0,0 +1,70 @@ +export function tickX(data: any, { x, ...options }?: { + x?: { + transform: (d: any) => any; + }; +}): TickX; +export function tickY(data: any, { y, ...options }?: { + y?: { + transform: (d: any) => any; + }; +}): TickY; +export class TickX extends AbstractTick { + constructor(data: any, options?: {}); + insetTop: any; + insetBottom: any; + _transform(selection: any, { x }: { + x: any; + }, dx: any, dy: any): void; + _x1(scales: any, { x: X }: { + x: any; + }): (i: any) => any; + _x2(scales: any, { x: X }: { + x: any; + }): (i: any) => any; + _y1(scales: any, { y: Y }: { + y: any; + }, { marginTop }: { + marginTop: any; + }): any; + _y2({ y }: { + y: any; + }, { y: Y }: { + y: any; + }, { height, marginBottom }: { + height: any; + marginBottom: any; + }): number | ((i: any) => number); +} +export class TickY extends AbstractTick { + constructor(data: any, options?: {}); + insetRight: any; + insetLeft: any; + _transform(selection: any, { y }: { + y: any; + }, dx: any, dy: any): void; + _x1(scales: any, { x: X }: { + x: any; + }, { marginLeft }: { + marginLeft: any; + }): any; + _x2({ x }: { + x: any; + }, { x: X }: { + x: any; + }, { width, marginRight }: { + width: any; + marginRight: any; + }): number | ((i: any) => number); + _y1(scales: any, { y: Y }: { + y: any; + }): (i: any) => any; + _y2(scales: any, { y: Y }: { + y: any; + }): (i: any) => any; +} +declare class AbstractTick extends Mark { + constructor(data: any, channels: any, options: any); + render(index: any, scales: any, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; +export {}; diff --git a/src/marks/tree.d.ts b/src/marks/tree.d.ts new file mode 100644 index 0000000000..1d489561d9 --- /dev/null +++ b/src/marks/tree.d.ts @@ -0,0 +1,21 @@ +export function tree(data: any, { fill, stroke, strokeWidth, strokeOpacity, strokeLinejoin, strokeLinecap, strokeMiterlimit, strokeDasharray, strokeDashoffset, marker, markerStart, markerEnd, dot: dotDot, text: textText, textStroke, title, dx, dy, ...options }?: { + fill: any; + stroke: any; + strokeWidth: any; + strokeOpacity: any; + strokeLinejoin: any; + strokeLinecap: any; + strokeMiterlimit: any; + strokeDasharray: any; + strokeDashoffset: any; + marker: any; + markerStart?: any; + markerEnd?: any; + dot?: boolean; + text?: string; + textStroke?: string; + title?: string; + dx: any; + dy: any; +}): any[]; +export function cluster(data: any, options: any): any[]; diff --git a/src/marks/vector.d.ts b/src/marks/vector.d.ts new file mode 100644 index 0000000000..6025fa5d8b --- /dev/null +++ b/src/marks/vector.d.ts @@ -0,0 +1,26 @@ +export function vector(data: any, { x, y, ...options }?: { + x: any; + y: any; +}): Vector; +export function vectorX(data: any, { x, ...options }?: { + x?: { + transform: (d: any) => any; + }; +}): Vector; +export function vectorY(data: any, { y, ...options }?: { + y?: { + transform: (d: any) => any; + }; +}): Vector; +export class Vector extends Mark { + constructor(data: any, options?: {}); + length: any; + rotate: any; + anchor: string; + frameAnchor: string; + render(index: any, { x, y }: { + x: any; + y: any; + }, channels: any, dimensions: any): any; +} +import { Mark } from "../plot.js"; diff --git a/src/math.d.ts b/src/math.d.ts new file mode 100644 index 0000000000..3661242fa4 --- /dev/null +++ b/src/math.d.ts @@ -0,0 +1 @@ +export const radians: number; diff --git a/src/memoize.d.ts b/src/memoize.d.ts new file mode 100644 index 0000000000..3e8b7605db --- /dev/null +++ b/src/memoize.d.ts @@ -0,0 +1 @@ +export function memoize1(compute: any): (...keys: any[]) => any; diff --git a/src/options.d.ts b/src/options.d.ts new file mode 100644 index 0000000000..6059707d97 --- /dev/null +++ b/src/options.d.ts @@ -0,0 +1,71 @@ +export function valueof(data: any, value: any, arrayType: any): any; +export function percentile(reduce: any): (I: any, f: any) => any; +export function maybeColorChannel(value: any, defaultValue: any): any[]; +export function maybeNumberChannel(value: any, defaultValue: any): any[]; +export function maybeKeyword(input: any, name: any, allowed: any): string; +export function keyword(input: any, name: any, allowed: any): string; +export function arrayify(data: any, type: any): any; +export function map(values: any, f: any, type?: ArrayConstructor): any[]; +export function isTypedArray(values: any): boolean; +export function isObject(option: any): boolean; +export function isScaleOptions(option: any): boolean; +export function isOptions(option: any): boolean; +export function maybeZero(x: any, x1: any, x2: any, x3?: { + transform: (d: any) => any; +}): any[]; +export function maybeTuple(x: any, y: any): any[]; +export function maybeZ({ z, fill, stroke }?: { + z: any; + fill: any; + stroke: any; +}): any; +export function range(data: any): Uint32Array; +export function where(data: any, test: any): Uint32Array; +export function take(values: any, index: any): any[]; +export function keyof(value: any): any; +export function maybeInput(key: any, options: any): any; +export function column(source: any): (((v: any) => any) | { + transform: () => any; + label: any; +})[]; +export function maybeColumn(source: any): any[]; +export function labelof(value: any, defaultValue: any): any; +export function mid(x1: any, x2: any): { + transform(data: any): Float64Array | Date[]; + label: any; +}; +export function maybeValue(value: any): any; +export function numberChannel(source: any): { + transform: (data: any) => any; + label: any; +}; +export function isTextual(values: any): boolean; +export function isOrdinal(values: any): boolean; +export function isTemporal(values: any): boolean; +export function isTemporalString(values: any): any; +export function isNumericString(values: any): boolean; +export function isNumeric(values: any): boolean; +export function isFirst(values: any, is: any): any; +export function isEvery(values: any, is: any): boolean; +export function isColor(value: any): any; +export function isNoneish(value: any): boolean; +export function isNone(value: any): boolean; +export function isRound(value: any): boolean; +export function isSymbol(value: any): boolean; +export function maybeSymbol(symbol: any): any; +export function maybeSymbolChannel(symbol: any): any[]; +export function maybeFrameAnchor(value?: string): string; +export function order(values: any): any; +export function field(name: any): (d: any) => any; +export function indexOf(d: any, i: any): any; +export namespace identity { + function transform(d: any): any; +} +export function zero(): number; +export function one(): number; +export function string(x: any): any; +export function number(x: any): any; +export function boolean(x: any): any; +export function first(x: any): any; +export function second(x: any): any; +export function constant(x: any): () => any; diff --git a/src/scales.d.ts b/src/scales.d.ts new file mode 100644 index 0000000000..d958622c8f --- /dev/null +++ b/src/scales.d.ts @@ -0,0 +1,139 @@ +export function Scales(channels: any, { inset: globalInset, insetTop: globalInsetTop, insetRight: globalInsetRight, insetBottom: globalInsetBottom, insetLeft: globalInsetLeft, round, nice, clamp, align, padding, ...options }?: { + inset?: number; + insetTop?: any; + insetRight?: any; + insetBottom?: any; + insetLeft?: any; + round: any; + nice: any; + clamp: any; + align: any; + padding: any; +}): {}; +export function ScaleFunctions(scales: any): { + [k: string]: any; +}; +export function autoScaleRange({ x, y, fx, fy }: { + x: any; + y: any; + fx: any; + fy: any; +}, dimensions: any): void; +export function normalizeScale(key: any, scale: any, hint: any): any; +export function isTemporalScale({ type }: { + type: any; +}): boolean; +export function isOrdinalScale({ type }: { + type: any; +}): boolean; +export function isDivergingScale({ type }: { + type: any; +}): boolean; +export function scaleOrder({ range, domain }: { + range: any; + domain?: any; +}): number; +export function applyScales(channels: any, scales: any): any; +export function isCollapsed(scale: any): boolean; +export function coerceNumber(x: any): number; +export function coerceDate(x: any): any; +export function scale(options?: {}): { + type: string; + apply: (d: any) => any; + invert: (d: any) => any; +} | { + invert: (t: any) => any; + apply: (t: any) => any; + bandwidth: any; + step: any; + paddingInner: any; + paddingOuter: any; + align: any; + round: any; + constant: any; + exponent: any; + base: any; + pivot: any; + symmetric: boolean; + clamp: any; + interpolate: any; + unknown: any; + label: any; + percent: any; + transform: any; + range: any[]; + type: any; + domain: any[]; +} | { + invert: (t: any) => any; + apply: (t: any) => any; + bandwidth: any; + step: any; + padding: any; + align: any; + round: any; + constant: any; + exponent: any; + base: any; + pivot: any; + symmetric: boolean; + clamp: any; + interpolate: any; + unknown: any; + label: any; + percent: any; + transform: any; + range: any[]; + type: any; + domain: any[]; +}; +export function exposeScales(scaleDescriptors: any): (key: any) => { + type: string; + apply: (d: any) => any; + invert: (d: any) => any; +} | { + invert: (t: any) => any; + apply: (t: any) => any; + bandwidth: any; + step: any; + paddingInner: any; + paddingOuter: any; + align: any; + round: any; + constant: any; + exponent: any; + base: any; + pivot: any; + symmetric: boolean; + clamp: any; + interpolate: any; + unknown: any; + label: any; + percent: any; + transform: any; + range: any[]; + type: any; + domain: any[]; +} | { + invert: (t: any) => any; + apply: (t: any) => any; + bandwidth: any; + step: any; + padding: any; + align: any; + round: any; + constant: any; + exponent: any; + base: any; + pivot: any; + symmetric: boolean; + clamp: any; + interpolate: any; + unknown: any; + label: any; + percent: any; + transform: any; + range: any[]; + type: any; + domain: any[]; +}; diff --git a/src/scales/diverging.d.ts b/src/scales/diverging.d.ts new file mode 100644 index 0000000000..be6ee0f481 --- /dev/null +++ b/src/scales/diverging.d.ts @@ -0,0 +1,46 @@ +export function ScaleDiverging(key: any, channels: any, options: any): { + type: any; + domain: any[]; + pivot: number; + interpolate: any; + scale: any; +}; +export function ScaleDivergingSqrt(key: any, channels: any, options: any): { + type: any; + domain: any[]; + pivot: number; + interpolate: any; + scale: any; +}; +export function ScaleDivergingPow(key: any, channels: any, { exponent, ...options }: { + [x: string]: any; + exponent?: number; +}): { + type: any; + domain: any[]; + pivot: number; + interpolate: any; + scale: any; +}; +export function ScaleDivergingLog(key: any, channels: any, { base, pivot, domain, ...options }: { + [x: string]: any; + base?: number; + pivot?: number; + domain?: any[]; +}): { + type: any; + domain: any[]; + pivot: number; + interpolate: any; + scale: any; +}; +export function ScaleDivergingSymlog(key: any, channels: any, { constant, ...options }: { + [x: string]: any; + constant?: number; +}): { + type: any; + domain: any[]; + pivot: number; + interpolate: any; + scale: any; +}; diff --git a/src/scales/index.d.ts b/src/scales/index.d.ts new file mode 100644 index 0000000000..f295fa8318 --- /dev/null +++ b/src/scales/index.d.ts @@ -0,0 +1,7 @@ +export const position: unique symbol; +export const color: unique symbol; +export const radius: unique symbol; +export const length: unique symbol; +export const opacity: unique symbol; +export const symbol: unique symbol; +export const registry: Map; diff --git a/src/scales/ordinal.d.ts b/src/scales/ordinal.d.ts new file mode 100644 index 0000000000..b112b9b989 --- /dev/null +++ b/src/scales/ordinal.d.ts @@ -0,0 +1,40 @@ +export function ScaleO(scale: any, channels: any, { type, domain, range, reverse, hint }: { + type: any; + domain?: any; + range: any; + reverse: any; + hint: any; +}): { + type: any; + domain: any; + range: any; + scale: any; + hint: any; +}; +export function ScaleOrdinal(key: any, channels: any, { type, domain, range, scheme, unknown, ...options }: { + [x: string]: any; + type: any; + domain?: any; + range: any; + scheme: any; + unknown: any; +}): { + type: any; + domain: any; + range: any; + scale: any; + hint: any; +}; +export function ScalePoint(key: any, channels: any, { align, padding, ...options }: { + [x: string]: any; + align?: number; + padding?: number; +}): any; +export function ScaleBand(key: any, channels: any, { align, padding, paddingInner, paddingOuter, ...options }: { + [x: string]: any; + align?: number; + padding?: number; + paddingInner?: any; + paddingOuter?: any; +}): any; +export const ordinalImplicit: unique symbol; diff --git a/src/scales/quantitative.d.ts b/src/scales/quantitative.d.ts new file mode 100644 index 0000000000..0e7124e657 --- /dev/null +++ b/src/scales/quantitative.d.ts @@ -0,0 +1,113 @@ +export function Interpolator(interpolate: any): any; +export function ScaleQ(key: any, scale: any, channels: any, { type, nice, clamp, zero, domain, unknown, round, scheme, range, interpolate, reverse }: { + type: any; + nice: any; + clamp: any; + zero: any; + domain?: any[]; + unknown: any; + round: any; + scheme: any; + range?: any; + interpolate?: any; + reverse: any; +}): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; +export function ScaleLinear(key: any, channels: any, options: any): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; +export function ScaleSqrt(key: any, channels: any, options: any): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; +export function ScalePow(key: any, channels: any, { exponent, ...options }: { + [x: string]: any; + exponent?: number; +}): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; +export function ScaleLog(key: any, channels: any, { base, domain, ...options }: { + [x: string]: any; + base?: number; + domain?: any[]; +}): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; +export function ScaleSymlog(key: any, channels: any, { constant, ...options }: { + [x: string]: any; + constant?: number; +}): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; +export function ScaleQuantile(key: any, channels: any, { range, quantiles, n, scheme, domain, interpolate, reverse }: { + range: any; + quantiles?: number; + n?: any; + scheme?: string; + domain?: any[]; + interpolate: any; + reverse: any; +}): { + type: string; + scale: any; + domain: any; + range: any; +}; +export function ScaleQuantize(key: any, channels: any, { range, n, scheme, domain, interpolate, reverse }: { + range: any; + n?: number; + scheme?: string; + domain?: any[]; + interpolate: any; + reverse: any; +}): { + type: string; + scale: any; + domain: any; + range: any; +}; +export function ScaleThreshold(key: any, channels: any, { domain, unknown, scheme, interpolate, range, reverse }: { + domain?: number[]; + unknown: any; + scheme?: string; + interpolate: any; + range?: any; + reverse: any; +}): { + type: string; + scale: any; + domain: any; + range: any; +}; +export function ScaleIdentity(): { + type: string; + scale: any; +}; +export function inferDomain(channels: any, f?: typeof finite): any[]; +export function interpolatePiecewise(interpolate: any): (i: any, j: any) => (t: any) => any; +export function flip(i: any): (t: any) => any; +import { finite } from "../defined.js"; diff --git a/src/scales/schemes.d.ts b/src/scales/schemes.d.ts new file mode 100644 index 0000000000..95dcedb7e7 --- /dev/null +++ b/src/scales/schemes.d.ts @@ -0,0 +1,4 @@ +export function ordinalScheme(scheme: any): any; +export function ordinalRange(scheme: any, length: any): any; +export function maybeBooleanRange(domain: any, scheme?: string): any[]; +export function quantitativeScheme(scheme: any): any; diff --git a/src/scales/temporal.d.ts b/src/scales/temporal.d.ts new file mode 100644 index 0000000000..1c9876fa79 --- /dev/null +++ b/src/scales/temporal.d.ts @@ -0,0 +1,14 @@ +export function ScaleTime(key: any, channels: any, options: any): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; +export function ScaleUtc(key: any, channels: any, options: any): { + type: any; + domain: any; + range: any; + scale: any; + interpolate: any; +}; diff --git a/src/style.d.ts b/src/style.d.ts new file mode 100644 index 0000000000..7a2a09268f --- /dev/null +++ b/src/style.d.ts @@ -0,0 +1,94 @@ +export function styles(mark: any, { title, href, ariaLabel: variaLabel, ariaDescription, ariaHidden, target, fill, fillOpacity, stroke, strokeWidth, strokeOpacity, strokeLinejoin, strokeLinecap, strokeMiterlimit, strokeDasharray, strokeDashoffset, opacity, mixBlendMode, paintOrder, shapeRendering }: { + title: any; + href: any; + ariaLabel: any; + ariaDescription: any; + ariaHidden: any; + target: any; + fill: any; + fillOpacity: any; + stroke: any; + strokeWidth: any; + strokeOpacity: any; + strokeLinejoin: any; + strokeLinecap: any; + strokeMiterlimit: any; + strokeDasharray: any; + strokeDashoffset: any; + opacity: any; + mixBlendMode: any; + paintOrder: any; + shapeRendering: any; +}, channels: any, { ariaLabel: cariaLabel, fill: defaultFill, fillOpacity: defaultFillOpacity, stroke: defaultStroke, strokeOpacity: defaultStrokeOpacity, strokeWidth: defaultStrokeWidth, strokeLinecap: defaultStrokeLinecap, strokeLinejoin: defaultStrokeLinejoin, strokeMiterlimit: defaultStrokeMiterlimit, paintOrder: defaultPaintOrder }: { + ariaLabel: any; + fill?: string; + fillOpacity: any; + stroke?: string; + strokeOpacity: any; + strokeWidth: any; + strokeLinecap: any; + strokeLinejoin: any; + strokeMiterlimit: any; + paintOrder: any; +}): any[]; +export function applyTitle(selection: any, L: any): void; +export function applyTitleGroup(selection: any, L: any): void; +export function applyText(selection: any, T: any): void; +export function applyTextGroup(selection: any, T: any): void; +export function applyChannelStyles(selection: any, { target }: { + target: any; +}, { ariaLabel: AL, title: T, fill: F, fillOpacity: FO, stroke: S, strokeOpacity: SO, strokeWidth: SW, opacity: O, href: H }: { + ariaLabel: any; + title: any; + fill: any; + fillOpacity: any; + stroke: any; + strokeOpacity: any; + strokeWidth: any; + opacity: any; + href: any; +}): void; +export function applyGroupedChannelStyles(selection: any, { target }: { + target: any; +}, { ariaLabel: AL, title: T, fill: F, fillOpacity: FO, stroke: S, strokeOpacity: SO, strokeWidth: SW, opacity: O, href: H }: { + ariaLabel: any; + title: any; + fill: any; + fillOpacity: any; + stroke: any; + strokeOpacity: any; + strokeWidth: any; + opacity: any; + href: any; +}): void; +export function groupIndex(I: any, position: any, { z }: { + z: any; +}, channels: any): Generator; +export function maybeClip(clip: any): false | "frame"; +export function applyIndirectStyles(selection: any, mark: any, { width, height, marginLeft, marginRight, marginTop, marginBottom }: { + width: any; + height: any; + marginLeft: any; + marginRight: any; + marginTop: any; + marginBottom: any; +}): void; +export function applyDirectStyles(selection: any, mark: any): void; +export function applyAttr(selection: any, name: any, value: any): void; +export function applyStyle(selection: any, name: any, value: any): void; +export function applyTransform(selection: any, x: any, y: any, tx: any, ty: any): void; +export function impliedString(value: any, impliedValue: any): any; +export function impliedNumber(value: any, impliedValue: any): any; +export function maybeClassName(name: any): any; +export function applyInlineStyles(selection: any, style: any): void; +export function applyFrameAnchor({ frameAnchor }: { + frameAnchor: any; +}, { width, height, marginTop, marginRight, marginBottom, marginLeft }: { + width: any; + height: any; + marginTop: any; + marginRight: any; + marginBottom: any; + marginLeft: any; +}): any[]; +export const offset: 0 | 0.5; diff --git a/src/transforms/basic.d.ts b/src/transforms/basic.d.ts new file mode 100644 index 0000000000..357b649a39 --- /dev/null +++ b/src/transforms/basic.d.ts @@ -0,0 +1,27 @@ +export function basic({ filter: f1, sort: s1, reverse: r1, transform: t1, ...options }: { + filter: any; + sort: any; + reverse: any; + transform: any; +}, t2: any): { + transform: any; + sort: any; +}; +export function filter(value: any, options: any): { + transform: any; + sort: any; +}; +export function reverse(options: any): { + transform: any; + sort: any; +}; +export function shuffle({ seed, ...options }?: { + seed: any; +}): { + transform: any; + sort: any; +}; +export function sort(value: any, options: any): { + transform: any; + sort: any; +}; diff --git a/src/transforms/group.d.ts b/src/transforms/group.d.ts new file mode 100644 index 0000000000..328975db43 --- /dev/null +++ b/src/transforms/group.d.ts @@ -0,0 +1,203 @@ +export function groupZ(outputs: any, options: any): { + y: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +}; +export function groupX(outputs?: { + y: string; +}, options?: {}): { + y: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +}; +export function groupY(outputs?: { + x: string; +}, options?: {}): { + y: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +}; +export function group(outputs?: { + fill: string; +}, options?: {}): { + y: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +} | { + y1: any; + y2: any; + x1: any; + x2: any; + transform: any; + sort: any; + stroke: any; + fill: any; + z: any; +}; +export function hasOutput(outputs: any, ...names: any[]): boolean; +export function maybeOutputs(outputs: any, inputs: any): ({ + name: any; + output: ((v: any) => any) | { + transform: () => any; + label: any; + }; + initialize(data: any): void; + scope(scope: any, I: any): void; + reduce(I: any, extent: any): void; +} | { + name: string; + initialize(): void; + scope(): void; + reduce(): void; +})[]; +export function maybeOutput(name: any, reduce: any, inputs: any): { + name: any; + output: ((v: any) => any) | { + transform: () => any; + label: any; + }; + initialize(data: any): void; + scope(scope: any, I: any): void; + reduce(I: any, extent: any): void; +}; +export function maybeEvaluator(name: any, reduce: any, inputs: any): { + label: any; + initialize(data: any): void; + scope(scope: any, I: any): void; + reduce(I: any, extent: any): any; +}; +export function maybeGroup(I: any, X: any): any; +export function maybeReduce(reduce: any, value: any): any; +export function maybeSubgroup(outputs: any, Z: any, F: any, S: any): any; +export function maybeSort(facets: any, sort: any, reverse: any): void; +export namespace reduceIdentity { + function reduce(I: any, X: any): any[]; + function reduce(I: any, X: any): any[]; +} +export namespace reduceFirst { + function reduce(I: any, X: any): any; + function reduce(I: any, X: any): any; +} +export namespace reduceCount { + const label: string; + function reduce(I: any): any; + function reduce(I: any): any; +} diff --git a/src/transforms/identity.d.ts b/src/transforms/identity.d.ts new file mode 100644 index 0000000000..f10e06ddd3 --- /dev/null +++ b/src/transforms/identity.d.ts @@ -0,0 +1,2 @@ +export function maybeIdentityX(options?: {}): {}; +export function maybeIdentityY(options?: {}): {}; diff --git a/src/transforms/inset.d.ts b/src/transforms/inset.d.ts new file mode 100644 index 0000000000..5ff86b9432 --- /dev/null +++ b/src/transforms/inset.d.ts @@ -0,0 +1,18 @@ +export function maybeInsetX({ inset, insetLeft, insetRight, ...options }?: { + inset: any; + insetLeft: any; + insetRight: any; +}): { + inset: any; + insetLeft: any; + insetRight: any; +}; +export function maybeInsetY({ inset, insetTop, insetBottom, ...options }?: { + inset: any; + insetTop: any; + insetBottom: any; +}): { + inset: any; + insetTop: any; + insetBottom: any; +}; diff --git a/src/transforms/interval.d.ts b/src/transforms/interval.d.ts new file mode 100644 index 0000000000..27ba82b2d8 --- /dev/null +++ b/src/transforms/interval.d.ts @@ -0,0 +1,5 @@ +export function maybeInterval(interval: any): any; +export function maybeTrivialIntervalX(options?: {}): any; +export function maybeTrivialIntervalY(options?: {}): any; +export function maybeIntervalX(options?: {}): any; +export function maybeIntervalY(options?: {}): any; diff --git a/src/transforms/map.d.ts b/src/transforms/map.d.ts new file mode 100644 index 0000000000..ab47952f53 --- /dev/null +++ b/src/transforms/map.d.ts @@ -0,0 +1,12 @@ +export function mapX(m: any, options?: {}): { + transform: any; + sort: any; +}; +export function mapY(m: any, options?: {}): { + transform: any; + sort: any; +}; +export function map(outputs?: {}, options?: {}): { + transform: any; + sort: any; +}; diff --git a/src/transforms/normalize.d.ts b/src/transforms/normalize.d.ts new file mode 100644 index 0000000000..10b42cd95b --- /dev/null +++ b/src/transforms/normalize.d.ts @@ -0,0 +1,11 @@ +export function normalizeX(basis: any, options: any, ...args: any[]): { + transform: any; + sort: any; +}; +export function normalizeY(basis: any, options: any, ...args: any[]): { + transform: any; + sort: any; +}; +export function normalize(basis: any): { + map(I: any, S: any, T: any): void; +}; diff --git a/src/transforms/select.d.ts b/src/transforms/select.d.ts new file mode 100644 index 0000000000..a641d8d20a --- /dev/null +++ b/src/transforms/select.d.ts @@ -0,0 +1,28 @@ +export function select(selector: any, options?: {}): { + transform: any; + sort: any; +}; +export function selectFirst(options: any): { + transform: any; + sort: any; +}; +export function selectLast(options: any): { + transform: any; + sort: any; +}; +export function selectMinX(options: any): { + transform: any; + sort: any; +}; +export function selectMinY(options: any): { + transform: any; + sort: any; +}; +export function selectMaxX(options: any): { + transform: any; + sort: any; +}; +export function selectMaxY(options: any): { + transform: any; + sort: any; +}; diff --git a/src/transforms/stack.d.ts b/src/transforms/stack.d.ts new file mode 100644 index 0000000000..9aa954a834 --- /dev/null +++ b/src/transforms/stack.d.ts @@ -0,0 +1,16 @@ +export function stackX(stackOptions?: {}, options?: {}, ...args: any[]): any; +export function stackX1(stackOptions?: {}, options?: {}, ...args: any[]): any; +export function stackX2(stackOptions?: {}, options?: {}, ...args: any[]): any; +export function stackY(stackOptions?: {}, options?: {}, ...args: any[]): any; +export function stackY1(stackOptions?: {}, options?: {}, ...args: any[]): any; +export function stackY2(stackOptions?: {}, options?: {}, ...args: any[]): any; +export function maybeStackX({ x, x1, x2, ...options }?: { + x: any; + x1: any; + x2: any; +}): any; +export function maybeStackY({ y, y1, y2, ...options }?: { + y: any; + y1: any; + y2: any; +}): any; diff --git a/src/transforms/tree.d.ts b/src/transforms/tree.d.ts new file mode 100644 index 0000000000..f5aaee435e --- /dev/null +++ b/src/transforms/tree.d.ts @@ -0,0 +1,33 @@ +export function treeNode({ path, delimiter, frameAnchor, treeLayout, treeSort, treeSeparation, treeAnchor, ...options }?: { + path?: { + transform: (d: any) => any; + }; + delimiter: any; + frameAnchor: any; + treeLayout?: any; + treeSort: any; + treeSeparation: any; + treeAnchor: any; +}): any; +export function treeLink({ path, delimiter, curve, stroke, strokeWidth, strokeOpacity, treeLayout, treeSort, treeSeparation, treeAnchor, ...options }?: { + path?: { + transform: (d: any) => any; + }; + delimiter: any; + curve?: string; + stroke?: string; + strokeWidth?: number; + strokeOpacity?: number; + treeLayout?: any; + treeSort: any; + treeSeparation: any; + treeAnchor: any; +}): any; +export function maybeTreeAnchor(anchor?: string): { + frameAnchor: string; + dx: number; + position({ x, y }: { + x: any; + y: any; + }, i: any, X: any, Y: any): void; +}; diff --git a/src/transforms/window.d.ts b/src/transforms/window.d.ts new file mode 100644 index 0000000000..1771637578 --- /dev/null +++ b/src/transforms/window.d.ts @@ -0,0 +1,11 @@ +export function windowX(windowOptions: {}, options: any, ...args: any[]): { + transform: any; + sort: any; +}; +export function windowY(windowOptions: {}, options: any, ...args: any[]): { + transform: any; + sort: any; +}; +export function window(options?: {}): { + map(I: any, S: any, T: any): void; +}; diff --git a/src/warnings.d.ts b/src/warnings.d.ts new file mode 100644 index 0000000000..3a97bcd0dd --- /dev/null +++ b/src/warnings.d.ts @@ -0,0 +1,2 @@ +export function consumeWarnings(): number; +export function warn(message: any): void; From 40f9777e24f23f886087e8639b0c0dd4d35e3c5c Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Sun, 19 Jun 2022 11:14:35 -0600 Subject: [PATCH 6/8] Fix Rect interval option --- src/marks/rect.d.ts | 16 ++++++++-------- src/misc.d.ts | 4 ++-- src/transforms/interval.d.ts | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/marks/rect.d.ts b/src/marks/rect.d.ts index c73bd5a632..cdc65f026d 100644 --- a/src/marks/rect.d.ts +++ b/src/marks/rect.d.ts @@ -1,11 +1,9 @@ export type RectOptions = StandardMarkOptions - & MixinExpandXYOptions<"x", Datum> - & MixinExpandXYOptions<"y", Datum> - & MixinInsetOptions - & { - interval: unknown, - }; + & ExpandXYOptions<"x", Datum> + & ExpandXYOptions<"y", Datum> + & InsetOptions + & IntervalOptions; export function rect(data: Data, options: RectOptions): Rect; @@ -40,8 +38,10 @@ import { } from "../plot"; import { - MixinExpandXYOptions, - MixinInsetOptions, + ExpandXYOptions, + InsetOptions, RenderFunctionChannels, RenderFunctionDimensions } from "../misc"; + +import { IntervalOptions } from "../transforms/interval"; diff --git a/src/misc.d.ts b/src/misc.d.ts index e06c254ba8..fe66f8af98 100644 --- a/src/misc.d.ts +++ b/src/misc.d.ts @@ -53,14 +53,14 @@ export type RenderFunctionDimensions = { * @template XY The option to expand. Either "x" or "y". * @template Datum The type of a single datum in the mark dataset. */ -export type MixinExpandXYOptions = { +export type ExpandXYOptions = { [V in ("1" | "2") as `${XY}${V}`]?: StandardMarkOptions[XY] } /** * Utility type for adding `inset` properties. */ -export type MixinInsetOptions = { +export type InsetOptions = { inset?: number, insetTop?: number, insetRight?: number, diff --git a/src/transforms/interval.d.ts b/src/transforms/interval.d.ts index 27ba82b2d8..cec5721b05 100644 --- a/src/transforms/interval.d.ts +++ b/src/transforms/interval.d.ts @@ -3,3 +3,17 @@ export function maybeTrivialIntervalX(options?: {}): any; export function maybeTrivialIntervalY(options?: {}): any; export function maybeIntervalX(options?: {}): any; export function maybeIntervalY(options?: {}): any; + +// TODO: Generic based on scale? +export type Interval = +TimeInterval +| { + floor: (v: any) => any, + offset: (v: any) => any, +} + +export type IntervalOptions = { + interval?: number | Interval +}; + +import { TimeInterval } from "d3"; From 569aeeb609ab5f31fcd7aaa77f331b8cf059d0c2 Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Sun, 19 Jun 2022 14:33:03 -0600 Subject: [PATCH 7/8] Improve thresholds & interval types --- src/transforms/bin.d.ts | 14 ++++++++----- src/transforms/interval.d.ts | 40 ++++++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/transforms/bin.d.ts b/src/transforms/bin.d.ts index caf320d89e..c84747db5e 100644 --- a/src/transforms/bin.d.ts +++ b/src/transforms/bin.d.ts @@ -6,11 +6,14 @@ export type BinOptions = | "freedman-diaconis" | "scott" | "sturges" - | number // a count (hint) representing the desired number of bins - | unknown[] // an array of n threshold values for n + 1 bins - | number // an interval or time interval (for temporal binning; see below) + // a count (hint) representing the desired number of bins + | number + // an array of n threshold values for n + 1 bins + | unknown[] + // an interval or time interval (for temporal binning; see below) + | Required // a function that returns an array, count, or time interval - | (() => unknown[] | number | unknown) + | ((values: unknown[], domainMin: unknown, domainMax: unknown) => unknown[] | number | TimeInterval) } export function binX(outputs?: object, options?: BinOptions): MarkOptions; @@ -26,4 +29,5 @@ export function bin(outputs?: { export function maybeDenseIntervalX(options: any): any; export function maybeDenseIntervalY(options: any): any; -import { StandardMarkOptions } from "../plot"; +import { TimeInterval } from "d3"; +import { Interval } from "./interval"; diff --git a/src/transforms/interval.d.ts b/src/transforms/interval.d.ts index cec5721b05..b849fcbdc8 100644 --- a/src/transforms/interval.d.ts +++ b/src/transforms/interval.d.ts @@ -4,13 +4,41 @@ export function maybeTrivialIntervalY(options?: {}): any; export function maybeIntervalX(options?: {}): any; export function maybeIntervalY(options?: {}): any; +export type NumberInterval = { + /** + * Returns a new number representing the latest interval boundary number before or equal to `v`. + * + * @param v A number. + */ + floor: (v: number) => number, + + /** + * Returns a new number equal to `v` plus a desired interval. + * + * This method is used to derive `x2` from `x1` or `y2` from `y2`. + * + * @param v A number. + */ + offset: (v: number) => number, + + /** + * Returns a new number representing the earliest interval boundary number after or equal to `v`. + * + * @param v A number. + */ + ceil?: (v: number) => number, + + /** + * Returns an array of numbers representing every interval boundary after or equal to start (inclusive) and before stop (exclusive). + * + * @param start A start number for the range. + * @param stop A stop number for the range. + */ + range?: (start: number, stop: number) => number[] +}; + // TODO: Generic based on scale? -export type Interval = -TimeInterval -| { - floor: (v: any) => any, - offset: (v: any) => any, -} +export type Interval = NumberInterval | TimeInterval; export type IntervalOptions = { interval?: number | Interval From ed3e8eca33245572eb271b8426a841da0109b5bd Mon Sep 17 00:00:00 2001 From: Kent Richards Date: Sun, 17 Jul 2022 13:53:31 -0600 Subject: [PATCH 8/8] Misc for transforms --- src/index.d.ts | 14 +++- src/plot.d.ts | 2 +- src/transforms/bin.d.ts | 156 ++++++++++++++++++++++++++++++++------ src/transforms/index.d.ts | 17 +++-- 4 files changed, 155 insertions(+), 34 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 3bdc25eb17..3db20719fa 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,6 +1,6 @@ export { scale } from "./scales.js"; export { legend } from "./legends.js"; -export { plot, Mark, marks, MarkChannelDefinition, StandardMarkOptions } from "./plot.js"; +export { plot, Mark, marks, MarkProperties, MarkChannelDefinition, StandardMarkOptions } from "./plot.js"; export { Area, area, areaX, areaY } from "./marks/area.js"; export { Arrow, arrow } from "./marks/arrow.js"; export { BarX, BarY, barX, barY } from "./marks/bar.js"; @@ -18,9 +18,17 @@ export { TickX, TickY, tickX, tickY } from "./marks/tick.js"; export { tree, cluster } from "./marks/tree.js"; export { Vector, vector, vectorX, vectorY } from "./marks/vector.js"; export { valueof, column } from "./options.js"; -export { Reducer } from "./transforms"; +export { AggregationMethod } from "./transforms"; export { filter, reverse, sort, shuffle, basic as transform } from "./transforms/basic.js"; -export { bin, binX, binY, BinOptions } from "./transforms/bin.js"; +export { + bin, + binX, + binY, + BinOptions, + ReduceMethod as BinReduceMethod, + ReduceMethodWithScope as BinReduceMethodWithScope, + ReducerObject as BinReducerObject, + ReduceMethodExtent as BinReduceMethodExtent } from "./transforms/bin.js"; export { group, groupX, groupY, groupZ } from "./transforms/group.js"; export { normalize, normalizeX, normalizeY } from "./transforms/normalize.js"; export { map, mapX, mapY } from "./transforms/map.js"; diff --git a/src/plot.d.ts b/src/plot.d.ts index bcb15f2256..60506d042a 100644 --- a/src/plot.d.ts +++ b/src/plot.d.ts @@ -6,7 +6,7 @@ * TODO Include all possible mark properties. * TODO Use `csstype`? */ -type MarkProperties = { +export type MarkProperties = { fill: CSSStyleDeclaration["fill"], fillOpacity: CSSStyleDeclaration["fillOpacity"], stroke: CSSStyleDeclaration["stroke"], diff --git a/src/transforms/bin.d.ts b/src/transforms/bin.d.ts index c84747db5e..c6f7ce877a 100644 --- a/src/transforms/bin.d.ts +++ b/src/transforms/bin.d.ts @@ -1,33 +1,145 @@ -export type BinOptions = - Options - & { - thresholds?: - | "auto" // (default) - Scott’s rule, capped at 200 - | "freedman-diaconis" - | "scott" - | "sturges" - // a count (hint) representing the desired number of bins - | number - // an array of n threshold values for n + 1 bins - | unknown[] - // an interval or time interval (for temporal binning; see below) - | Required - // a function that returns an array, count, or time interval - | ((values: unknown[], domainMin: unknown, domainMax: unknown) => unknown[] | number | TimeInterval) - } +export type BinOptions = Options & { + thresholds?: + | "auto" // (default) - Scott’s rule, capped at 200 + | "freedman-diaconis" + | "scott" + | "sturges" + // a count (hint) representing the desired number of bins + | number + // an array of n threshold values for n + 1 bins + | unknown[] + // an interval or time interval (for temporal binning; see below) + | Required + // a function that returns an array, count, or time interval + | (( + values: unknown[], + domainMin: unknown, + domainMax: unknown + ) => unknown[] | number | TimeInterval); +}; -export function binX(outputs?: object, options?: BinOptions): MarkOptions; +export function binX( + outputs?: object, + options?: BinOptions +): MarkOptions; -export function binY(outputs?: { +export function binY( + outputs?: { x: string; -}, options?: BinOptions): MarkOptions; + }, + options?: BinOptions +): MarkOptions; -export function bin(outputs?: { +export function bin( + outputs?: { fill: string; -}, options?: BinOptions): MarkOptions; + }, + options?: BinOptions +): MarkOptions; export function maybeDenseIntervalX(options: any): any; export function maybeDenseIntervalY(options: any): any; +/** + * The reduce method is repeatedly passed three arguments: the index for + * each bin (an array of integers), the input channel’s array of values, + * and the extent of the bin (an object {x1, x2, y1, y2}); it must then + * return the corresponding aggregate value for the bin. + * + * TODO: Generic binding to input channel? + * + * @param index The index for each bin. + * @param values The input channel’s array of values. + * @param extent The extent of the bin. + */ +type ReduceMethod = ( + index: number[], + values: Datum[], + extent: ReduceMethodExtent +) => Output | null | undefined; + +/** + * The reduce method is repeatedly passed three arguments: the index for + * each bin (an array of integers), the input channel’s array of values, + * and the extent of the bin (an object {x1, x2, y1, y2}); it must then + * return the corresponding aggregate value for the bin. + * + * If the reducer object’s scope is “data”, then the reduce method is + * first invoked for the full data; the return value of the reduce + * method is then made available as a third argument (making the extent + * the fourth argument). + * + * Similarly if the scope is “facet”, then the reduce method is invoked + * for each facet, and the resulting reduce value is made available + * while reducing the facet’s bins. (This optional scope is used by the + * proportion and proportion-facet reducers.) + * + * TODO: Generic binding to input channel? + * + * @param index In the first invocation this is the `index` of the full + * dataset or on the facet, (as specified by the `scope` property of + * the parent object). + * + * In subsequent invocations on each bin, this contains the index for + * each bin. + * + * @param values The input channel’s array of values. + * + * @param basis In the first invocation (on the data as specified by the + * `scope` property) `basis` is undefined. + * + * In subsequent invocations on each bin, this contains the result from + * the first invocation. + * + * @param extent In the first invocation (on the data as specified by + * the `scope` property of the parent object) `extent` is undefined. + * + * In subsequent invocations on each bin, this contains the extent of + * the bin (an object {x1, x2, y1, y2}). + */ +export type ReduceMethodWithScope = ( + index: number[], + values: Datum[], + basis?: Basis, + extent?: ReduceMethodExtent +) => Output | Basis | null | undefined; + +export type ReducerObject = + | { + reduce: ReduceMethod; + } + | { + reduce: ReduceMethodWithScope; + scope: "data" | "facet"; + /** + * Optional label for axis. + */ + label?: string; + }; + +/** + * Type of a `reduce` option value that is used for a transform output. + * + * @template Datum The type of a single datum. + * @template Output The output type for the reducer. + * + * For simple cases, this should be the type that is required by the + * underlying SVG document. + * + * When the output channel is bound to a scale, this should be the type + * that is required by the scale. + */ +export type ReduceOption = + | AggregationMethod + | ReducerObject; + +export type ReduceMethodExtent = { + x1: number; + x2: number; + y1: number; + y2: number; +}; + import { TimeInterval } from "d3"; +import { AggregationMethod } from "."; import { Interval } from "./interval"; diff --git a/src/transforms/index.d.ts b/src/transforms/index.d.ts index 16e7a15951..4ed12fd646 100644 --- a/src/transforms/index.d.ts +++ b/src/transforms/index.d.ts @@ -13,7 +13,7 @@ export type AggregationMethod = | "mean" | "median" | "mode" - | "pXX" + | PXX | "deviation" | "variance" | "x" @@ -23,11 +23,12 @@ export type AggregationMethod = | "y1" | "y2"; -export interface ReducerObject { - reduce: (d: Datum[]) => OutputType; -} - -export type Reducer = - | AggregationMethod - | ReducerObject +/** + * Union of strings `"p[00-99]"`. + */ +type PXX = `p${Digit}${Digit}`; +/** + * Digits 0-9 for deriving `PXX` type. + */ +type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;