diff --git a/.eslintrc.json b/.eslintrc.json index 0cc3e774..48aa23da 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,7 @@ "extends": "eslint:recommended", "parserOptions": { "sourceType": "module", - "ecmaVersion": 2018 + "ecmaVersion": 2020 }, "env": { "es6": true, diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 9036d1d4..7db0d8fa 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - node-version: [14.x, 16.x] + node-version: [14.x, 16.x, 18.x] runs-on: ${{ matrix.os }} diff --git a/LICENSE b/LICENSE index 3e80c800..dfa2847a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2018-2021 Observable, Inc. +Copyright 2018-2022 Observable, Inc. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice diff --git a/README.md b/README.md index 28003118..dafee0ae 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For examples, see https://observablehq.com/@observablehq/stdlib. ### DOM -# DOM.canvas(width, height) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/canvas.mjs "Source") +# DOM.canvas(width, height) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/canvas.js "Source") Returns a new canvas element with the specified *width* and *height*. For example, to create a 960×500 canvas: @@ -41,7 +41,7 @@ html`` If you are using [2D Canvas](https://www.w3.org/TR/2dcontext/) (rather than [WebGL](https://webglfundamentals.org/)), you should use [DOM.context2d](#DOM_context2d) instead of DOM.canvas for automatic pixel density scaling. -# DOM.context2d(width, height[, dpi]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/context2d.mjs "Source") +# DOM.context2d(width, height[, dpi]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/context2d.js "Source") Returns a new canvas context with the specified *width* and *height* and the specified device pixel ratio *dpi*. If *dpi* is not specified, it defaults to [*window*.devicePixelRatio](https://developer.mozilla.org/docs/Web/API/Window/devicePixelRatio). To access the context’s canvas, use [*context*.canvas](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/canvas). For example, to create a 960×500 canvas: @@ -54,7 +54,7 @@ Returns a new canvas context with the specified *width* and *height* and the spe If you are using [WebGL](https://webglfundamentals.org/) (rather than [2D Canvas](https://www.w3.org/TR/2dcontext/)), you should use [DOM.canvas](#DOM_canvas) or the [html](#html) tagged template literal instead of DOM.context2d. -# DOM.download(object\[, name\]\[, value\]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/download.mjs "Source") +# DOM.download(object\[, name\]\[, value\]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/download.js "Source") Returns an anchor element containing a button that when clicked will download a file representing the specified *object*. The *object* should be anything supported by [URL.createObjectURL](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL) such as a [file](https://developer.mozilla.org/docs/Web/API/File) or a [blob](https://developer.mozilla.org/docs/Web/API/Blob). For example, to create a button to download a Canvas element as a PNG: @@ -70,7 +70,7 @@ DOM.download(() => new Promise(resolve => canvas.toBlob(resolve))) If the *object* is a promise, or if it is a function that returns a promise, the promise will be awaited before downloading. If necessary, an additional click may be required to download the asynchronous value. -# DOM.element(name[, attributes]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/element.mjs "Source") +# DOM.element(name[, attributes]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/element.js "Source") Returns a new element with the specified *name*. For example, to create an empty H1 element: @@ -110,7 +110,7 @@ svg`` In general, you probably want to use the [html](#html) or [svg](#svg) tagged template literal instead of DOM.element. -# DOM.input([type]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/input.mjs "Source") +# DOM.input([type]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/input.js "Source") Returns a new input element with the specified *type*. If *type* is not specified or null, a text input is created. For example, to create a new file input: @@ -126,7 +126,7 @@ html`` In general, you probably want to use the [html](#html) tagged template literal instead of DOM.input. -# DOM.range(\[min, \]\[max\]\[, step\]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/range.mjs "Source") +# DOM.range(\[min, \]\[max\]\[, step\]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/range.js "Source") Returns a new range input element. (See also [DOM.input](#input).) If *max* is specified, sets the maximum value of the range to the specified number; if *max* is not specified or null, sets the maximum value of the range to 1. If *min* is specified, sets the minimum value of the range to the specified number; if *min* is not specified or null, sets the minimum value of the range to 0. If *step* is specified, sets the step value of the range to the specified number; if *step* is not specified or null, sets the step value of the range to `any`. For example, to create a slider that ranges the integers from -180 to +180, inclusive: @@ -142,7 +142,7 @@ html`` In general, you probably want to use the [html](#html) tagged template literal instead of DOM.input. -# DOM.select(values) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/select.mjs "Source") +# DOM.select(values) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/select.js "Source") Returns a new select element with an option for each string in the specified *values* array. For example, to create a drop-down menu of three colors: @@ -170,7 +170,7 @@ html`