Skip to content

Commit 23475c0

Browse files
devoncarewkevmoodependabot[bot]
authored
Include MDN API documentation as class and member dartdoc comments (#143)
* scrape MDN for API documentation * commit the parsed documentation information * review feedback * Update tool/scrape_mdn.dart Co-authored-by: Kevin Moore <[email protected]> * switch to reading from markdown files from the git repo * regenerate the mdn.json file * update copyright * Bump actions/stale from 8.0.0 to 9.0.0 (#132) Bumps [actions/stale](https://github.com/actions/stale) from 8.0.0 to 9.0.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/stale/releases">actions/stale's releases</a>.</em></p> <blockquote> <h2>v9.0.0</h2> <h2>Breaking Changes</h2> <ol> <li>Action is now stateful: If the action ends because of <a href="https://github.com/actions/stale#operations-per-run">operations-per-run</a> then the next run will start from the first unprocessed issue skipping the issues processed during the previous run(s). The state is reset when all the issues are processed. This should be considered for scheduling workflow runs.</li> <li>Version 9 of this action updated the runtime to Node.js 20. All scripts are now run with Node.js 20 instead of Node.js 16 and are affected by any breaking changes between Node.js 16 and 20.</li> </ol> <h2>What Else Changed</h2> <ol> <li>Performance optimization that removes unnecessary API calls by <a href="https://github.com/dsame"><code>@â��dsame</code></a> <a href="https://redirect.github.com/actions/stale/pull/1033/">#1033</a> fixes <a href="https://redirect.github.com/actions/stale/issues/792">#792</a></li> <li>Logs displaying current github API rate limit by <a href="https://github.com/dsame"><code>@â��dsame</code></a> <a href="https://redirect.github.com/actions/stale/pull/1032">#1032</a> addresses <a href="https://redirect.github.com/actions/stale/issues/1029">#1029</a></li> </ol> <p>For more information, please read the <a href="https://github.com/actions/stale#readme">action documentation</a> and its <a href="https://github.com/actions/stale#statefulness">section about statefulness</a></p> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/jmeridth"><code>@â��jmeridth</code></a> made their first contribution in <a href="https://redirect.github.com/actions/stale/pull/984">actions/stale#984</a></li> <li><a href="https://github.com/nikolai-laevskii"><code>@â��nikolai-laevskii</code></a> made their first contribution in <a href="https://redirect.github.com/actions/stale/pull/1020">actions/stale#1020</a></li> <li><a href="https://github.com/dusan-trickovic"><code>@â��dusan-trickovic</code></a> made their first contribution in <a href="https://redirect.github.com/actions/stale/pull/1056">actions/stale#1056</a></li> <li><a href="https://github.com/aparnajyothi-y"><code>@â��aparnajyothi-y</code></a> made their first contribution in <a href="https://redirect.github.com/actions/stale/pull/1110">actions/stale#1110</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/stale/compare/v8...v9.0.0">https://github.com/actions/stale/compare/v8...v9.0.0</a></p> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/actions/stale/commit/28ca1036281a5e5922ead5184a1bbf96e5fc984e"><code>28ca103</code></a> Upgrade Node to v20 (<a href="https://redirect.github.com/actions/stale/issues/1110">#1110</a>)</li> <li><a href="https://github.com/actions/stale/commit/b69b346013879cedbf50c69f572cd85439a41936"><code>b69b346</code></a> build(deps-dev): bump <code>@â��types/node</code> from 18.16.18 to 20.5.1 (<a href="https://redirect.github.com/actions/stale/issues/1079">#1079</a>)</li> <li><a href="https://github.com/actions/stale/commit/88a6f4f6cbe6984b66da80d3d448d5f0c4d1a42d"><code>88a6f4f</code></a> build(deps-dev): bump typescript from 5.1.3 to 5.2.2 (<a href="https://redirect.github.com/actions/stale/issues/1083">#1083</a>)</li> <li><a href="https://github.com/actions/stale/commit/796531a7b39835671cd9f436d7205b1556bbcff6"><code>796531a</code></a> Merge pull request <a href="https://redirect.github.com/actions/stale/issues/1080">#1080</a> from akv-platform/fix-delete-cache</li> <li><a href="https://github.com/actions/stale/commit/8986f6218b4935e254d5b844e8c36b4d953f2643"><code>8986f62</code></a> Don not try to delete cache if it does not exists</li> <li><a href="https://github.com/actions/stale/commit/cab99b362baa5afbbd8c7c78234e6b071b80687d"><code>cab99b3</code></a> fix typo proceeded/processed</li> <li><a href="https://github.com/actions/stale/commit/184e7afe930f6b5c7ce52c4b3f087692c6e912f3"><code>184e7af</code></a> Merge pull request <a href="https://redirect.github.com/actions/stale/issues/1064">#1064</a> from actions/dependabot/npm_and_yarn/typescript-esli...</li> <li><a href="https://github.com/actions/stale/commit/523885cf3c115dcdcbed573c7eaf0f5621f124e2"><code>523885c</code></a> chore: update eslint-plugin, parser and eslint-plugin-jest</li> <li><a href="https://github.com/actions/stale/commit/2487a1dc2b501176ca975d2d8b4d3293d72180a2"><code>2487a1d</code></a> build(deps-dev): bump <code>@â��typescript-eslint/eslint-plugin</code></li> <li><a href="https://github.com/actions/stale/commit/60c722ee97faafece819a7c41b03ec113f99717d"><code>60c722e</code></a> Merge pull request <a href="https://redirect.github.com/actions/stale/issues/1063">#1063</a> from actions/dependabot/npm_and_yarn/jest-29.6.2</li> <li>Additional commits viewable in <a href="https://github.com/actions/stale/compare/1160a2240286f5da8ec72b1c0816ce2481aabf84...28ca1036281a5e5922ead5184a1bbf96e5fc984e">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/stale&package-manager=github_actions&previous-version=8.0.0&new-version=9.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> * write additional version info into the readme (#126) * generate mdn docs as library dartdoc * re-generate package:web w/ dartdoc comments * update changelog * regenerate lib/src/dom * update changelog * refactor mdn.json into a third_party directory * Add docs for added trusted-types, fix changelog * update the changelog * review comments * add a todo to improve dartdoc comment formatting --------- Co-authored-by: Kevin Moore <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kevin Moore <[email protected]>
1 parent fa4280c commit 23475c0

File tree

132 files changed

+26559
-9279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+26559
-9279
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
## 0.5.1-wip
22

33
- Add [`TrustedTypes`](https://web.dev/trusted-types) members.
4+
- Include MDN API documentation as class and member dartdoc comments. Docs
5+
sourced from the [MDN Web Docs][] project; attributions and copyright
6+
licensing by Mozilla Contributors is licensed under [CC-BY-SA 2.5][].
7+
8+
[MDN Web Docs]: https://developer.mozilla.org/en-US/docs/Web
9+
[CC-BY-SA 2.5]: https://creativecommons.org/licenses/by-sa/2.5/
410

511
## 0.5.0
612

analysis_options.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ analyzer:
1010
- test_fixes/**
1111

1212
errors:
13-
# Ideally we'd fix all of these - or ignore them at the line-level where
14-
# necessary
13+
# 43 instances in generated code.
1514
camel_case_types: ignore
15+
# 420 instances in the MDN docs.
16+
comment_references: ignore
17+
# 14 instances in the MDN docs.
18+
lines_longer_than_80_chars: ignore
19+
# 1,333 instances in generated code.
1620
non_constant_identifier_names: ignore
1721
# Consider removing from dart_flutter_team_lints.
1822
unreachable_from_main: ignore

lib/src/dom/angle_instanced_arrays.dart

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4+
//
5+
// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web).
6+
// Attributions and copyright licensing by Mozilla Contributors is licensed
7+
// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/.
48

59
// Generated from Web IDL definitions.
610

@@ -11,21 +15,70 @@ import 'dart:js_interop';
1115

1216
import 'webgl1.dart';
1317

18+
/// The **`ANGLE_instanced_arrays`** extension is part of the
19+
/// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and
20+
/// allows to draw the same object, or groups of similar objects multiple times,
21+
/// if they share the same vertex data, primitive count and type.
22+
///
23+
/// WebGL extensions are available using the
24+
/// [WebGLRenderingContext.getExtension] method. For more information, see also
25+
/// [Using Extensions](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Using_Extensions)
26+
/// in the
27+
/// [WebGL tutorial](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial).
28+
///
29+
/// > **Note:** This extension is only available to [WebGLRenderingContext]
30+
/// > contexts. In [WebGL2RenderingContext], the functionality of this extension
31+
/// > is available on the WebGL2 context by default and the constants and
32+
/// > methods are available without the "`ANGLE`" suffix.
33+
/// >
34+
/// > Despite the name "ANGLE", this extension works on any device if the
35+
/// > hardware supports it and not just on Windows when using the ANGLE library.
36+
/// > "ANGLE" just indicates that this extension has been written by the ANGLE
37+
/// > library authors.
1438
extension type ANGLE_instanced_arrays._(JSObject _) implements JSObject {
1539
external static GLenum get VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE;
40+
41+
/// The **`ANGLE_instanced_arrays.drawArraysInstancedANGLE()`** method of the
42+
/// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)
43+
/// renders primitives from array data like the
44+
/// [WebGLRenderingContext.drawArrays] method. In addition, it can execute
45+
/// multiple instances of the range of elements.
46+
///
47+
/// > **Note:** When using [WebGL2RenderingContext], this method is available
48+
/// > as [WebGL2RenderingContext.drawArraysInstanced] by default.
1649
external void drawArraysInstancedANGLE(
1750
GLenum mode,
1851
GLint first,
1952
GLsizei count,
2053
GLsizei primcount,
2154
);
55+
56+
/// The **`ANGLE_instanced_arrays.drawElementsInstancedANGLE()`** method of
57+
/// the
58+
/// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)
59+
/// renders primitives from array data like the
60+
/// [WebGLRenderingContext.drawElements] method. In addition, it can execute
61+
/// multiple instances of a set of elements.
62+
///
63+
/// > **Note:** When using [WebGL2RenderingContext], this method is available
64+
/// > as [WebGL2RenderingContext.drawElementsInstanced] by default.
2265
external void drawElementsInstancedANGLE(
2366
GLenum mode,
2467
GLsizei count,
2568
GLenum type,
2669
GLintptr offset,
2770
GLsizei primcount,
2871
);
72+
73+
/// The **ANGLE_instanced_arrays.vertexAttribDivisorANGLE()** method of the
74+
/// [WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)
75+
/// modifies the rate at which generic vertex attributes advance when
76+
/// rendering multiple instances of primitives with
77+
/// [ANGLE_instanced_arrays.drawArraysInstancedANGLE] and
78+
/// [ANGLE_instanced_arrays.drawElementsInstancedANGLE].
79+
///
80+
/// > **Note:** When using [WebGL2RenderingContext], this method is available
81+
/// > as [WebGL2RenderingContext.vertexAttribDivisor] by default.
2982
external void vertexAttribDivisorANGLE(
3083
GLuint index,
3184
GLuint divisor,

lib/src/dom/clipboard_apis.dart

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4+
//
5+
// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web).
6+
// Attributions and copyright licensing by Mozilla Contributors is licensed
7+
// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/.
48

59
// Generated from Web IDL definitions.
610

@@ -23,6 +27,12 @@ extension type ClipboardEventInit._(JSObject _) implements EventInit, JSObject {
2327
external set clipboardData(DataTransfer? value);
2428
external DataTransfer? get clipboardData;
2529
}
30+
31+
/// The **`ClipboardEvent`** interface of the
32+
/// [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)
33+
/// represents events providing information related to modification of the
34+
/// clipboard, that is [Element/cut_event], [Element/copy_event], and
35+
/// [Element/paste_event] events.
2636
extension type ClipboardEvent._(JSObject _) implements Event, JSObject {
2737
external factory ClipboardEvent(
2838
String type, [
@@ -31,13 +41,29 @@ extension type ClipboardEvent._(JSObject _) implements Event, JSObject {
3141

3242
external DataTransfer? get clipboardData;
3343
}
44+
45+
/// The **`ClipboardItem`** interface of the
46+
/// [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)
47+
/// represents a single item format, used when reading or writing clipboard data
48+
/// using [clipboard.read] and [clipboard.write] respectively.
49+
///
50+
/// The benefit of having the **`ClipboardItem`** interface to represent data,
51+
/// is that it enables developers to cope with the varying scope of file types
52+
/// and data.
53+
///
54+
/// > **Note:** To work with text see the [Clipboard.readText] and
55+
/// > [Clipboard.writeText] methods of the [Clipboard] interface.
3456
extension type ClipboardItem._(JSObject _) implements JSObject {
3557
external factory ClipboardItem(
3658
JSObject items, [
3759
ClipboardItemOptions options,
3860
]);
3961

4062
external static bool supports(String type);
63+
64+
/// The **`getType()`** method of the [ClipboardItem] interface returns a
65+
/// `Promise` that resolves with a [Blob] of the requested or an error if the
66+
/// MIME type is not found.
4167
external JSPromise<Blob> getType(String type);
4268
external PresentationStyle get presentationStyle;
4369
external JSArray<JSString> get types;
@@ -48,11 +74,58 @@ extension type ClipboardItemOptions._(JSObject _) implements JSObject {
4874
external set presentationStyle(PresentationStyle value);
4975
external PresentationStyle get presentationStyle;
5076
}
77+
78+
/// The **`Clipboard`** interface of the
79+
/// [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)
80+
/// provides read and write access to the contents of the system clipboard.
81+
/// This allows a web application to implement cut, copy, and paste features.
82+
///
83+
/// The system clipboard is exposed through the global [Navigator.clipboard]
84+
/// property.
85+
///
86+
/// All of the Clipboard API methods operate asynchronously; they return a
87+
/// `Promise` which is resolved once the clipboard access has been completed.
88+
/// The promise is rejected if clipboard access is denied.
89+
///
90+
/// All the methods require a
91+
/// [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
92+
/// Additional requirements for using the API are discussed in the
93+
/// [Security consideration](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API#security_considerations)
94+
/// section of the API overview topic.
5195
extension type Clipboard._(JSObject _) implements EventTarget, JSObject {
96+
/// The **`read()`** method of the [Clipboard] interface requests a copy of
97+
/// the clipboard's contents, fulfilling the returned `Promise` with the data.
98+
///
99+
/// The method can in theory return arbitrary data (unlike
100+
/// [Clipboard.readText], which can only return text).
101+
/// Browsers commonly support reading text, HTML, and PNG image data — see
102+
/// [browser compatibility](#browser_compatibility) for more information.
52103
external JSPromise<ClipboardItems> read(
53104
[ClipboardUnsanitizedFormats formats]);
105+
106+
/// The **`readText()`** method of the [Clipboard] interface returns a
107+
/// `Promise` which fulfils with a copy of the textual contents of the system
108+
/// clipboard.
109+
///
110+
/// > **Note:** To read non-text contents from the clipboard, use the
111+
/// > [Clipboard.read] method instead.
112+
/// > You can write text to the clipboard using [Clipboard.writeText].
54113
external JSPromise<JSString> readText();
114+
115+
/// The **`write()`** method of the [Clipboard] interface writes arbitrary
116+
/// data to the clipboard, such as images, fulfilling the returned `Promise`
117+
/// on completion.
118+
/// This can be used to implement cut and copy functionality.
119+
///
120+
/// The method can in theory write arbitrary data (unlike
121+
/// [Clipboard.writeText], which can only write text).
122+
/// Browsers commonly support writing text, HTML, and PNG image data — see
123+
/// [browser compatibility](#browser_compatibility) for more information.
55124
external JSPromise<JSAny?> write(ClipboardItems data);
125+
126+
/// The **`writeText()`** method of the [Clipboard] interface writes the
127+
/// specified text to the system clipboard, returning a `Promise` that is
128+
/// resolved once the system clipboard has been updated.
56129
external JSPromise<JSAny?> writeText(String data);
57130
}
58131
extension type ClipboardUnsanitizedFormats._(JSObject _) implements JSObject {

lib/src/dom/compression.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4+
//
5+
// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web).
6+
// Attributions and copyright licensing by Mozilla Contributors is licensed
7+
// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/.
48

59
// Generated from Web IDL definitions.
610

@@ -12,12 +16,18 @@ import 'dart:js_interop';
1216
import 'streams.dart';
1317

1418
typedef CompressionFormat = String;
19+
20+
/// The **`CompressionStream`** interface of the [Compression Streams API] is an
21+
/// API for compressing a stream of data.
1522
extension type CompressionStream._(JSObject _) implements JSObject {
1623
external factory CompressionStream(CompressionFormat format);
1724

1825
external ReadableStream get readable;
1926
external WritableStream get writable;
2027
}
28+
29+
/// The **`DecompressionStream`** interface of the [Compression Streams API] is
30+
/// an API for decompressing a stream of data.
2131
extension type DecompressionStream._(JSObject _) implements JSObject {
2232
external factory DecompressionStream(CompressionFormat format);
2333

lib/src/dom/console.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4+
//
5+
// API docs from [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web).
6+
// Attributions and copyright licensing by Mozilla Contributors is licensed
7+
// under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/.
48

59
// Generated from Web IDL definitions.
610

@@ -11,6 +15,30 @@ import 'dart:js_interop';
1115

1216
@JS()
1317
external $Console get console;
18+
19+
/// The **`console`** object provides access to the debugging console (e.g., the
20+
/// [Web console](https://firefox-source-docs.mozilla.org/devtools-user/web_console/index.html)
21+
/// in Firefox). The specifics of how it works vary from browser to browser or
22+
/// server runtimes (Node.js, for example), but there is a _de facto_ set of
23+
/// features that are typically provided.
24+
///
25+
/// The `console` object can be accessed from any global object. [Window] on
26+
/// browsing scopes and [WorkerGlobalScope] as specific variants in workers via
27+
/// the property console. It's exposed as [Window.console], and can be
28+
/// referenced as `console`. For example:
29+
///
30+
/// ```js
31+
/// console.log("Failed to open the specified link");
32+
/// ```
33+
///
34+
/// This page documents the [Methods](#methods) available on the `console`
35+
/// object and gives a few [Usage](#usage) examples.
36+
///
37+
/// > **Note:** Certain online IDEs and editors may implement the console API
38+
/// > differently than the browsers. As a result, certain functionality of the
39+
/// > console API, such as the timer methods, may not be outputted in the
40+
/// > console of online IDEs or editors. Always open your browser's DevTools
41+
/// > console to see the logs as shown in this documentation.
1442
@JS('console')
1543
extension type $Console._(JSObject _) implements JSObject {
1644
@JS('assert')

0 commit comments

Comments
 (0)