Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update APIs and docs #345

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,263 changes: 2,613 additions & 1,650 deletions third_party/mdn/mdn.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions web/lib/src/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export 'dom/css_contain.dart';
export 'dom/css_counter_styles.dart';
export 'dom/css_font_loading.dart';
export 'dom/css_fonts.dart';
export 'dom/css_fonts_5.dart';
export 'dom/css_highlight_api.dart';
export 'dom/css_masking.dart';
export 'dom/css_nesting.dart';
export 'dom/css_paint_api.dart';
export 'dom/css_properties_values_api.dart';
export 'dom/css_transitions.dart';
Expand All @@ -34,7 +36,7 @@ export 'dom/css_view_transitions.dart';
export 'dom/css_view_transitions_2.dart';
export 'dom/cssom.dart';
export 'dom/cssom_view.dart';
export 'dom/digital_identities.dart';
export 'dom/digital_credentials.dart';
export 'dom/dom.dart';
export 'dom/dom_parsing.dart';
export 'dom/encoding.dart';
Expand Down Expand Up @@ -114,11 +116,11 @@ export 'dom/requestidlecallback.dart';
export 'dom/resize_observer.dart';
export 'dom/resource_timing.dart';
export 'dom/saa_non_cookie_storage.dart';
export 'dom/sanitizer_api.dart';
export 'dom/scheduling_apis.dart';
export 'dom/screen_capture.dart';
export 'dom/screen_orientation.dart';
export 'dom/screen_wake_lock.dart';
export 'dom/scroll_to_text_fragment.dart';
export 'dom/secure_payment_confirmation.dart';
export 'dom/selection_api.dart';
export 'dom/server_timing.dart';
Expand Down Expand Up @@ -146,9 +148,12 @@ export 'dom/web_share.dart';
export 'dom/webaudio.dart';
export 'dom/webauthn.dart';
export 'dom/webcodecs.dart';
export 'dom/webcodecs_aac_codec_registration.dart';
export 'dom/webcodecs_av1_codec_registration.dart';
export 'dom/webcodecs_avc_codec_registration.dart';
export 'dom/webcodecs_flac_codec_registration.dart';
export 'dom/webcodecs_hevc_codec_registration.dart';
export 'dom/webcodecs_opus_codec_registration.dart';
export 'dom/webcodecs_vp9_codec_registration.dart';
export 'dom/webcryptoapi.dart';
export 'dom/webgl1.dart';
Expand Down
24 changes: 14 additions & 10 deletions web/lib/src/dom/angle_instanced_arrays.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ import 'webgl1.dart';
/// in the
/// [WebGL tutorial](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial).
///
/// > **Note:** This extension is only available to [WebGLRenderingContext]
/// > contexts. In [WebGL2RenderingContext], the functionality of this extension
/// > is available on the WebGL2 context by default and the constants and
/// > methods are available without the "`ANGLE`" suffix.
/// > [!NOTE]
/// > This extension is only available to [WebGLRenderingContext] contexts. In
/// > [WebGL2RenderingContext], the functionality of this extension is available
/// > on the WebGL2 context by default and the constants and methods are
/// > available without the `ANGLE_` suffix.
/// >
/// > Despite the name "ANGLE", this extension works on any device if the
/// > hardware supports it and not just on Windows when using the ANGLE library.
Expand All @@ -51,8 +52,9 @@ extension type ANGLE_instanced_arrays._(JSObject _) implements JSObject {
/// [WebGLRenderingContext.drawArrays] method. In addition, it can execute
/// multiple instances of the range of elements.
///
/// > **Note:** When using [WebGL2RenderingContext], this method is available
/// > as [WebGL2RenderingContext.drawArraysInstanced] by default.
/// > [!NOTE]
/// > When using [WebGL2RenderingContext], this method is available as
/// > [WebGL2RenderingContext.drawArraysInstanced] by default.
external void drawArraysInstancedANGLE(
GLenum mode,
GLint first,
Expand All @@ -67,8 +69,9 @@ extension type ANGLE_instanced_arrays._(JSObject _) implements JSObject {
/// [WebGLRenderingContext.drawElements] method. In addition, it can execute
/// multiple instances of a set of elements.
///
/// > **Note:** When using [WebGL2RenderingContext], this method is available
/// > as [WebGL2RenderingContext.drawElementsInstanced] by default.
/// > [!NOTE]
/// > When using [WebGL2RenderingContext], this method is available as
/// > [WebGL2RenderingContext.drawElementsInstanced] by default.
external void drawElementsInstancedANGLE(
GLenum mode,
GLsizei count,
Expand All @@ -84,8 +87,9 @@ extension type ANGLE_instanced_arrays._(JSObject _) implements JSObject {
/// [ANGLE_instanced_arrays.drawArraysInstancedANGLE] and
/// [ANGLE_instanced_arrays.drawElementsInstancedANGLE].
///
/// > **Note:** When using [WebGL2RenderingContext], this method is available
/// > as [WebGL2RenderingContext.vertexAttribDivisor] by default.
/// > [!NOTE]
/// > When using [WebGL2RenderingContext], this method is available as
/// > [WebGL2RenderingContext.vertexAttribDivisor] by default.
external void vertexAttribDivisorANGLE(
GLuint index,
GLuint divisor,
Expand Down
8 changes: 5 additions & 3 deletions web/lib/src/dom/battery_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ extension type BatteryManager._(JSObject _) implements EventTarget, JSObject {
/// When its value changes, the [BatteryManager.chargingtimechange_event]
/// event is fired.
///
/// > **Note:** Even if the time returned is precise to the second,
/// > [!NOTE]
/// > Even if the time returned is precise to the second,
/// > browsers round them to a higher interval
/// > (typically to the closest 15 minutes) for privacy reasons.
external double get chargingTime;
Expand All @@ -62,8 +63,9 @@ extension type BatteryManager._(JSObject _) implements EventTarget, JSObject {
/// When its value changes, the [BatteryManager.dischargingtimechange_event]
/// event is fired.
///
/// > **Note:** Even if the time returned is precise to the second, browsers
/// > round them to a higher
/// > [!NOTE]
/// > Even if the time returned is precise to the second, browsers round them
/// > to a higher
/// > interval (typically to the closest 15 minutes) for privacy reasons.
external double get dischargingTime;

Expand Down
35 changes: 18 additions & 17 deletions web/lib/src/dom/clipboard_apis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ extension type ClipboardEvent._(JSObject _) implements Event, JSObject {
/// The **`ClipboardItem`** interface of the
/// [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)
/// represents a single item format, used when reading or writing clipboard data
/// using [clipboard.read] and [clipboard.write] respectively.
/// using [Clipboard.read] and [Clipboard.write] respectively.
///
/// The benefit of having the **`ClipboardItem`** interface to represent data,
/// is that it enables developers to cope with the varying scope of file types
/// and data.
/// The **`ClipboardItem`** interface enables developers to use a single type to
/// represent a range of different data formats.
///
/// > **Note:** To work with text see the [Clipboard.readText] and
/// > [Clipboard.writeText] methods of the [Clipboard] interface.
/// > [!NOTE]
/// > The `read()` and `write()` methods can be used to work with text strings
/// > and arbitrary data items represented by [Blob] instances. However, if you
/// > are solely working with text, it is more convenient to use the
/// > [Clipboard.readText] and [Clipboard.writeText] methods.
///
/// ---
///
Expand All @@ -93,7 +95,7 @@ extension type ClipboardItem._(JSObject _) implements JSObject {
/// [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)
/// mandates support for plain text, HTML and PNG files.
/// The `supports()` method will always return `true` for these MIME types, so
/// testing them is unnecessary .
/// testing them is unnecessary.
external static bool supports(String type);

/// The **`getType()`** method of the [ClipboardItem] interface returns a
Expand All @@ -109,7 +111,7 @@ extension type ClipboardItem._(JSObject _) implements JSObject {
external PresentationStyle get presentationStyle;

/// The read-only **`types`** property of the [ClipboardItem] interface
/// returns an `Array` of available within the [ClipboardItem]
/// returns an `Array` of available within the [ClipboardItem].
external JSArray<JSString> get types;
}
extension type ClipboardItemOptions._(JSObject _) implements JSObject {
Expand Down Expand Up @@ -147,29 +149,28 @@ extension type Clipboard._(JSObject _) implements EventTarget, JSObject {
///
/// The method can in theory return arbitrary data (unlike
/// [Clipboard.readText], which can only return text).
/// Browsers commonly support reading text, HTML, and PNG image data — see
/// [browser compatibility](#browser_compatibility) for more information.
/// Browsers commonly support reading text, HTML, and PNG image data.
external JSPromise<ClipboardItems> read(
[ClipboardUnsanitizedFormats formats]);

/// The **`readText()`** method of the [Clipboard] interface returns a
/// `Promise` which fulfils with a copy of the textual contents of the system
/// `Promise` which fulfills with a copy of the textual contents of the system
/// clipboard.
///
/// > **Note:** To read non-text contents from the clipboard, use the
/// > [Clipboard.read] method instead.
/// > [!NOTE]
/// > To read non-text contents from the clipboard, use the [Clipboard.read]
/// > method instead.
/// > You can write text to the clipboard using [Clipboard.writeText].
external JSPromise<JSString> readText();

/// The **`write()`** method of the [Clipboard] interface writes arbitrary
/// data to the clipboard, such as images, fulfilling the returned `Promise`
/// on completion.
/// [ClipboardItem] data such as images and text to the clipboard, fulfilling
/// the returned `Promise` on completion.
/// This can be used to implement cut and copy functionality.
///
/// The method can in theory write arbitrary data (unlike
/// [Clipboard.writeText], which can only write text).
/// Browsers commonly support writing text, HTML, and PNG image data — see
/// [browser compatibility](#browser_compatibility) for more information.
/// Browsers commonly support writing text, HTML, and PNG image data.
external JSPromise<JSAny?> write(ClipboardItems data);

/// The **`writeText()`** method of the [Clipboard] interface writes the
Expand Down
8 changes: 1 addition & 7 deletions web/lib/src/dom/console.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,12 @@ external $Console get console;
/// documentation, try the methods in your browser's developer tools, although
/// even here, there are some differences between browsers.
///
/// The `console` object can be accessed from any global object. [Window] on
/// browsing scopes and [WorkerGlobalScope] as specific variants in workers via
/// the property console. It's exposed as [Window.console], and can be
/// referenced as `console`. For example:
/// The `console` object is available in any global scope. For example:
///
/// ```js
/// console.log("Failed to open the specified link");
/// ```
///
/// This page documents the [Methods](#methods) available on the `console`
/// object and gives a few [Usage](#usage) examples.
///
/// ---
///
/// API documentation sourced from
Expand Down
31 changes: 15 additions & 16 deletions web/lib/src/dom/cookie_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,12 @@ extension type CookieStoreManager._(JSObject _) implements JSObject {

/// The **`CookieChangeEvent`** interface of the [Cookie Store API] is the event
/// type of the [CookieStore.change_event] event fired at a [CookieStore] when
/// any cookie changes occur. A cookie change consists of a cookie and a type
/// (either "changed" or "deleted").
/// any cookies are created or deleted.
///
/// Cookie changes that will cause the `CookieChangeEvent` to be dispatched are:
///
/// - A cookie is newly created and not immediately removed. In this case `type`
/// is "changed".
/// - A cookie is newly created and immediately removed. In this case `type` is
/// "deleted".
/// - A cookie is removed. In this case `type` is "deleted".
///
/// > **Note:** A cookie that is replaced due to the insertion of another cookie
/// > with the same name, domain, and path, is ignored and does not trigger a
/// > change event.
/// > [!NOTE]
/// > A cookie that is replaced due to the insertion of another cookie with the
/// > same name, domain, and path, is ignored and does not trigger a change
/// > event.
///
/// ---
///
Expand All @@ -226,11 +218,17 @@ extension type CookieChangeEvent._(JSObject _) implements Event, JSObject {

/// The **`changed`** read-only property of the [CookieChangeEvent] interface
/// returns an array of the cookies that have been changed.
///
/// Note that this will exclude cookies which were created with an expiry date
/// in the past, as these cookies are immediately deleted.
external JSArray<CookieListItem> get changed;

/// The **`deleted`** read-only property of the [CookieChangeEvent] interface
/// returns an array of the cookies that have been deleted by the given
/// `CookieChangeEvent` instance.
///
/// Note that this will include cookies which were created with an expiry date
/// in the past, as these cookies are immediately deleted.
external JSArray<CookieListItem> get deleted;
}
extension type CookieChangeEventInit._(JSObject _)
Expand Down Expand Up @@ -266,9 +264,10 @@ extension type CookieChangeEventInit._(JSObject _)
/// "deleted"
/// - A cookie is removed. In this case `type` is "deleted".
///
/// > **Note:** A cookie that is replaced due to the insertion of another cookie
/// > with the same name, domain, and path, is ignored and does not trigger a
/// > change event.
/// > [!NOTE]
/// > A cookie that is replaced due to the insertion of another cookie with the
/// > same name, domain, and path, is ignored and does not trigger a change
/// > event.
///
/// ---
///
Expand Down
Loading